PageSourceSearch

https://enchanted-forest-v2.vercel.app/assets/index-CkvKTgYU.js

js enchanted-forest-v2.vercel.app collected 2026-10-03 06:53:11 UTC 1,801,965 bytes, 15,745 lines download raw bytes

vendor: 17,882 bytes, lines 1-33
1function HF(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Rs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function EC(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function qF(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var kC={exports:{}},dp={},$C={exports:{}},Re={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Zc=Symbol.for("react.element"),KF=Symbol.for("react.portal"),XF=Symbol.for("react.fragment"),YF=Symbol.for("react.strict_mode"),QF=Symbol.for("react.profiler"),ZF=Symbol.for("react.provider"),JF=Symbol.for("react.context"),eL=Symbol.for("react.forward_ref"),tL=Symbol.for("react.suspense"),nL=Symbol.for("react.memo"),rL=Symbol.for("react.lazy"),ub=Symbol.iterator;function sL(t){return t===null||typeof t!="object"?null:(t=ub&&t[ub]||t["@@iterator"],typeof t=="function"?t:null)}var IC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},AC=Object.assign,RC={};function rl(t,e,n){this.props=t,this.context=e,this.refs=RC,this.updater=n||IC}rl.prototype.isReactComponent={};rl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};rl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function OC(){}OC.prototype=rl.prototype;function uv(t,e,n){this.props=t,this.context=e,this.refs=RC,this.updater=n||IC}var lv=uv.prototype=new OC;lv.constructor=uv;AC(lv,rl.prototype);lv.isPureReactComponent=!0;var lb=Array.isArray,DC=Object.prototype.hasOwnProperty,cv={current:null},PC={key:!0,ref:!0,__self:!0,__source:!0};function FC(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)DC.call(e,r)&&!PC.hasOwnProperty(r)&&(s[r]=e[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var u=Array(a),l=0;l<a;l++)u[l]=arguments[l+2];s.children=u}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:Zc,type:t,key:i,ref:o,props:s,_owner:cv.current}}function iL(t,e){return{$$typeof:Zc,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function hv(t){return typeof t=="object"&&t!==null&&t.$$typeof===Zc}function oL(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var cb=/\/+/g;function Hm(t,e){return typeof t=="object"&&t!==null&&t.key!=null?oL(""+t.key):e.toString(36)}function Ed(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Zc:case KF:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+Hm(o,0):r,lb(s)?(n="",t!=null&&(n=t.replace(cb,"$&/")+"/"),Ed(s,e,n,"",function(l){return l})):s!=null&&(hv(s)&&(s=iL(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(cb,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",lb(t))for(var a=0;a<t.length;a++){i=t[a];var u=r+Hm(i,a);o+=Ed(i,e,n,u,s)}else if(u=sL(t),typeof u=="function")for(t=u.call(t),a=0;!(i=t.next()).done;)i=i.value,u=r+Hm(i,a++),o+=Ed(i,e,n,u,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Uh(t,e,n){if(t==null)return t;var r=[],s=0;return Ed(t,r,"","",function(i){return e.call(n,i,s++)}),r}function aL(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Dn={current:null},kd={transition:null},uL={ReactCurrentDispatcher:Dn,ReactCurrentBatchConfig:kd,ReactCurrentOwner:cv};function LC(){throw Error("act(...) is not supported in production builds of React.")}Re.Children={map:Uh,forEach:function(t,e,n){Uh(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Uh(t,function(){e++}),e},toArray:function(t){return Uh(t,function(e){return e})||[]},only:function(t){if(!hv(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Re.Component=rl;Re.Fragment=XF;Re.Profiler=QF;Re.PureComponent=uv;Re.StrictMode=YF;Re.Suspense=tL;Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uL;Re.act=LC;Re.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=AC({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=cv.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(u in e)DC.call(e,u)&&!PC.hasOwnProperty(u)&&(r[u]=e[u]===void 0&&a!==void 0?a[u]:e[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){a=Array(u);for(var l=0;l<u;l++)a[l]=arguments[l+2];r.children=a}return{$$typeof:Zc,type:t.type,key:s,ref:i,props:r,_owner:o}};Re.createContext=function(t){return t={$$typeof:JF,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:ZF,_context:t},t.Consumer=t};Re.createElement=FC;Re.createFactory=function(t){var e=FC.bind(null,t);return e.type=t,e};Re.createRef=function(){return{current:null}};Re.forwardRef=function(t){return{$$typeof:eL,render:t}};Re.isValidElement=hv;Re.lazy=function(t){return{$$typeof:rL,_payload:{_status:-1,_result:t},_init:aL}};Re.memo=function(t,e){return{$$typeof:nL,type:t,compare:e===void 0?null:e}};Re.startTransition=function(t){var e=kd.transition;kd.transition={};try{t()}finally{kd.transition=e}};Re.unstable_act=LC;Re.useCallback=function(t,e){return Dn.current.useCallback(t,e)};Re.useContext=function(t){return Dn.current.useContext(t)};Re.useDebugValue=function(){};Re.useDeferredValue=function(t){return Dn.current.useDeferredValue(t)};Re.useEffect=function(t,e){return Dn.current.useEffect(t,e)};Re.useId=function(){return Dn.current.useId()};Re.useImperativeHandle=function(t,e,n){return Dn.current.useImperativeHandle(t,e,n)};Re.useInsertionEffect=function(t,e){return Dn.current.useInsertionEffect(t,e)};Re.useLayoutEffect=function(t,e){return Dn.current.useLayoutEffect(t,e)};Re.useMemo=function(t,e){return Dn.current.useMemo(t,e)};Re.useReducer=function(t,e,n){return Dn.current.useReducer(t,e,n)};Re.useRef=function(t){return Dn.current.useRef(t)};Re.useState=function(t){return Dn.current.useState(t)};Re.useSyncExternalStore=function(t,e,n){return Dn.current.useSyncExternalStore(t,e,n)};Re.useTransition=function(){return Dn.current.useTransition()};Re.version="18.3.1";$C.exports=Re;var ee=$C.exports;const Yo=EC(ee);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var lL=ee,cL=Symbol.for("react.element"),hL=Symbol.for("react.fragment"),dL=Object.prototype.hasOwnProperty,fL=lL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pL={key:!0,ref:!0,__self:!0,__source:!0};function MC(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)dL.call(e,r)&&!pL.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:cL,type:t,key:i,ref:o,props:s,_owner:fL.current}}dp.Fragment=hL;dp.jsx=MC;dp.jsxs=MC;kC.exports=dp;var Ce=kC.exports,VC={exports:{}},fr={},BC={exports:{}},WC={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(j,q){var Z=j.length;j.push(q);e:for(;0<Z;){var ae=Z-1>>>1,fe=j[ae];if(0<s(fe,q))j[ae]=q,j[Z]=fe,Z=ae;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var q=j[0],Z=j.pop();if(Z!==q){j[0]=Z;e:for(var ae=0,fe=j.length,We=fe>>>1;ae<We;){var Ue=2*(ae+1)-1,we=j[Ue],Ie=Ue+1,Ct=j[Ie];if(0>s(we,Z))Ie<fe&&0>s(Ct,we)?(j[ae]=Ct,j[Ie]=Z,ae=Ie):(j[ae]=we,j[Ue]=Z,ae=Ue);else if(Ie<fe&&0>s(Ct,Z))j[ae]=Ct,j[Ie]=Z,ae=Ie;else break e}}return q}function s(j,q){var Z=j.sortIndex-q.sortIndex;return Z!==0?Z:j.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var u=[],l=[],c=1,h=null,d=3,f=!1,p=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(j){for(var q=n(l);q!==null;){if(q.callback===null)r(l);else if(q.startTime<=j)r(l),q.sortIndex=q.expirationTime,e(u,q);else break;q=n(l)}}function _(j){if(y=!1,w(j),!p)if(n(u)!==null)p=!0,Q(T);else{var q=n(l);q!==null&&Y(_,q.startTime-j)}}function T(j,q){p=!1,y&&(y=!1,g(N),N=-1),f=!0;var Z=d;try{for(w(q),h=n(u);h!==null&&(!(h.expirationTime>q)||j&&!L());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,d=h.priorityLevel;var fe=ae(h.expirationTime<=q);q=t.unstable_now(),typeof fe=="function"?h.callback=fe:h===n(u)&&r(u),w(q)}else r(u);h=n(u)}if(h!==null)var We=!0;else{var Ue=n(l);Ue!==null&&Y(_,Ue.startTime-q),We=!1}return We}finally{h=null,d=Z,f=!1}}var E=!1,k=null,N=-1,O=5,R=-1;function L(){return!(t.unstable_now()-R<O)}function W(){if(k!==null){var j=t.unstable_now();R=j;var q=!0;try{q=k(!0,j)}finally{q?G():(E=!1,k=null)}}else E=!1}var G;if(typeof x=="function")G=function(){x(W)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,X=H.port2;H.port1.onmessage=W,G=function(){X.postMessage(null)}}else G=function(){v(W,0)};function Q(j){k=j,E||(E=!0,G())}function Y(j,q){N=v(function(){j(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_continueExecution=function(){p||f||(p=!0,Q(T))},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(j){switch(d){case 1:case 2:case 3:var q=3;break;default:q=d}var Z=d;d=q;try{return j()}finally{d=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(j,q){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var Z=d;d=j;try{return q()}finally{d=Z}},t.unstable_scheduleCallback=function(j,q,Z){var ae=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ae+Z:ae):Z=ae,j){case 1:var fe=-1;break;case 2:fe=250;break;case 5:fe=1073741823;break;case 4:fe=1e4;break;default:fe=5e3}return fe=Z+fe,j={id:c++,callback:q,priorityLevel:j,startTime:Z,expirationTime:fe,sortIndex:-1},Z>ae?(j.sortIndex=Z,e(l,j),n(u)===null&&j===n(l)&&(y?(g(N),N=-1):y=!0,Y(_,Z-ae))):(j.sortIndex=fe,e(u,j),p||f||(p=!0,Q(T))),j},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(j){var q=d;return function(){var Z=d;d=q;try{return j.apply(this,arguments)}finally{d=Z}}}})(WC);BC.exports=WC;var mL=BC.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var gL=ee,hr=mL;function te(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var UC=new Set,yc={};function Ea(t,e){Ru(t,e),Ru(t+"Capture",e)}function Ru(t,e){for(yc[t]=e,t=0;t<e.length;t++)UC.add(e[t])}var li=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ey=Object.prototype.hasOwnProperty,yL=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,hb={},db={};function vL(t){return ey.call(db,t)?!0:ey.call(hb,t)?!1:yL.test(t)?db[t]=!0:(hb[t]=!0,!1)}function xL(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function wL(t,e,n,r){if(e===null||typeof e>"u"||xL(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Pn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){cn[t]=new Pn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];cn[e]=new Pn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){cn[t]=new Pn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){cn[t]=new Pn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){cn[t]=new Pn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){cn[t]=new Pn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){cn[t]=new Pn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){cn[t]=new Pn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){cn[t]=new Pn(t,5,!1,t.toLowerCase(),null,!1,!1)});var dv=/[\-:]([a-z])/g;function fv(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode
33-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(dv,fv);cn[e]=new Pn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(dv,fv);cn[e]=new Pn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(dv,fv);cn[e]=new Pn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){cn[t]=new Pn(t,1,!1,t.toLowerCase(),null,!1,!1)});cn.xlinkHref=new Pn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){cn[t]=new Pn(t,1,!1,t.toLowerCase(),null,!0,!0)});function pv(t,e,n,r){var s=cn.hasOwnProperty(e)?cn[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(wL(e,n,s,r)&&(n=null),r||s===null?vL(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var bi=gL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zh=Symbol.for("react.element"),Ja=Symbol.for("react.portal"),eu=Symbol.for("react.fragment"),mv=Symbol.for("react.strict_mode"),ty=Symbol.for("react.profiler"),zC=Symbol.for("react.provider"),jC=Symbol.for("react.context"),gv=Symbol.for("react.forward_ref"),ny=Symbol.for("react.suspense"),ry=Symbol.for("react.suspense_list"),yv=Symbol.for("react.memo"),Pi=Symbol.for("react.lazy"),GC=Symbol.for("react.offscreen"),fb=Symbol.iterator;function Ol(t){return t===null||typeof t!="object"?null:(t=fb&&t[fb]||t["@@iterator"],typeof t=="function"?t:null)}var St=Object.assign,qm;function Hl(t){if(qm===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);qm=e&&e[1]||""}return`
34`+qm+t}var Km=!1;function Xm(t,e){if(!t||Km)return"";Km=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var r=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){r=l}t.call(e.prototype)}else{try{throw Error()}catch(l){r=l}t()}}catch(l){if(l&&r&&typeof l.stack=="string"){for(var s=l.stack.split(`
35`),i=r.stack.split(`
36`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var u=`
37`+s[o].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=o&&0<=a);break}}}finally{Km=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Hl(t):""}function bL(t){switch(t.tag){case 5:return Hl(t.type);case 16:return Hl("Lazy");case 13:return Hl("Suspense");case 19:return Hl("SuspenseList");case 0:case 2:case 15:return t=Xm(t.type,!1),t;case 11:return t=Xm(t.type.render,!1),t;case 1:return t=Xm(t.type,!0),t;default:return""}}function sy(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case eu:return"Fragment";case Ja:return"Portal";case ty:return"Profiler";case mv:return"StrictMode";case ny:return"Suspense";case ry:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case jC:return(t.displayName||"Context")+".Consumer";case zC:return(t._context.displayName||"Context")+".Provider";case gv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case yv:return e=t.displayName||null,e!==null?e:sy(t.type)||"Memo";case Pi:e=t._payload,t=t._init;try{return sy(t(e))}catch{}}return null}function _L(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return sy(e);case 8:return e===mv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function so(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function HC(t){var e=t.type;
vendor: 11,674 bytes, line 37
37return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function SL(t){var e=HC(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function jh(t){t._valueTracker||(t._valueTracker=SL(t))}function qC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=HC(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Xd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function iy(t,e){var n=e.checked;return St({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function pb(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=so(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function KC(t,e){e=e.checked,e!=null&&pv(t,"checked",e,!1)}function oy(t,e){KC(t,e);var n=so(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?ay(t,e.type,n):e.hasOwnProperty("defaultValue")&&ay(t,e.type,so(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function mb(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function ay(t,e,n){(e!=="number"||Xd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ql=Array.isArray;function bu(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+so(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function uy(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(te(91));return St({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function gb(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(te(92));if(ql(n)){if(1<n.length)throw Error(te(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:so(n)}}function XC(t,e){var n=so(e.value),r=so(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function yb(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function YC(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ly(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?YC(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Gh,QC=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Gh=Gh||document.createElement("div"),Gh.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Gh.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function vc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var nc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},TL=["Webkit","ms","Moz","O"];Object.keys(nc).forEach(function(t){TL.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),nc[e]=nc[t]})});function ZC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||nc.hasOwnProperty(t)&&nc[t]?(""+e).trim():e+"px"}function JC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=ZC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var CL=St({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cy(t,e){if(e){if(CL[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(te(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(te(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(te(61))}if(e.style!=null&&typeof e.style!="object")throw Error(te(62))}}function hy(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dy=null;function vv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fy=null,_u=null,Su=null;function vb(t){if(t=th(t)){if(typeof fy!="function")throw Error(te(280));var e=t.stateNode;e&&(e=yp(e),fy(t.stateNode,t.type,e))}}function eN(t){_u?Su?Su.push(t):Su=[t]:_u=t}function tN(){if(_u){var t=_u,e=Su;if(Su=_u=null,vb(t),e)for(t=0;t<e.length;t++)vb(e[t])}}function nN(t,e){return t(e)}function rN(){}var Ym=!1;function sN(t,e,n){if(Ym)return t(e,n);Ym=!0;try{return nN(t,e,n)}finally{Ym=!1,(_u!==null||Su!==null)&&(rN(),tN())}}function xc(t,e){var n=t.stateNode;if(n===null)return null;var r=yp(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(te(231,e,typeof n));return n}var py=!1;if(li)try{var Dl={};Object.defineProperty(Dl,"passive",{get:function(){py=!0}}),window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{py=!1}function NL(t,e,n,r,s,i,o,a,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(n,l)}catch(c){this.onError(c)}}var rc=!1,Yd=null,Qd=!1,my=null,EL={onError:function(t){rc=!0,Yd=t}};function kL(t,e,n,r,s,i,o,a,u){rc=!1,Yd=null,NL.apply(EL,arguments)}function $L(t,e,n,r,s,i,o,a,u){if(kL.apply(this,arguments),rc){if(rc){var l=Yd;rc=!1,Yd=null}else throw Error(te(198));Qd||(Qd=!0,my=l)}}function ka(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function iN(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function xb(t){if(ka(t)!==t)throw Error(te(188))}function IL(t){var e=t.alternate;if(!e){if(e=ka(t),e===null)throw Error(te(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return xb(s),t;if(i===r)return xb(s),e;i=i.sibling}throw Error(te(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?t:e}function oN(t){return t=IL(t),t!==null?aN(t):null}function aN(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=aN(t);if(e!==null)return e;t=t.sibling}return null}var uN=hr.unstable_scheduleCallback,wb=hr.unstable_cancelCallback,AL=hr.unstable_shouldYield,RL=hr.unstable_requestPaint,Rt=hr.unstable_now,OL=hr.unstable_getCurrentPriorityLevel,xv=hr.unstable_ImmediatePriority,lN=hr.unstable_UserBlockingPriority,Zd=hr.unstable_NormalPriority,DL=hr.unstable_LowPriority,cN=hr.unstable_IdlePriority,fp=null,Os=null;function PL(t){if(Os&&typeof Os.onCommitFiberRoot=="function")try{Os.onCommitFiberRoot(fp,t,void 0,(t.current.flags&128)===128)}catch{}}var os=Math.clz32?Math.clz32:ML,FL=Math.log,LL=Math.LN2;function ML(t){return t>>>=0,t===0?32:31-(FL(t)/LL|0)|0}var Hh=64,qh=4194304;function Kl(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Jd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Kl(a):(i&=o,i!==0&&(r=Kl(i)))}else o=n&~s,o!==0?r=Kl(o):i!==0&&(r=Kl(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-os(e),s=1<<n,r|=t[n],e&=~s;return r}function VL(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function BL(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-os(i),a=1<<o,u=s[o];u===-1?(!(a&n)||a&r)&&(s[o]=VL(a,e)):u<=e&&(t.expiredLanes|=a),i&=~a}}function gy(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function hN(){var t=Hh;return Hh<<=1,!(Hh&4194240)&&(Hh=64),t}function Qm(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}
vendor: 4,087 bytes, line 37
37function Jc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-os(e),t[e]=n}function WL(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-os(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function wv(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-os(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var He=0;function dN(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var fN,bv,pN,mN,gN,yy=!1,Kh=[],Hi=null,qi=null,Ki=null,wc=new Map,bc=new Map,Bi=[],UL="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function bb(t,e){switch(t){case"focusin":case"focusout":Hi=null;break;case"dragenter":case"dragleave":qi=null;break;case"mouseover":case"mouseout":Ki=null;break;case"pointerover":case"pointerout":wc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":bc.delete(e.pointerId)}}function Pl(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=th(e),e!==null&&bv(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function zL(t,e,n,r,s){switch(e){case"focusin":return Hi=Pl(Hi,t,e,n,r,s),!0;case"dragenter":return qi=Pl(qi,t,e,n,r,s),!0;case"mouseover":return Ki=Pl(Ki,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return wc.set(i,Pl(wc.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,bc.set(i,Pl(bc.get(i)||null,t,e,n,r,s)),!0}return!1}function yN(t){var e=Wo(t.target);if(e!==null){var n=ka(e);if(n!==null){if(e=n.tag,e===13){if(e=iN(n),e!==null){t.blockedOn=e,gN(t.priority,function(){pN(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function $d(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=vy(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);dy=r,n.target.dispatchEvent(r),dy=null}else return e=th(n),e!==null&&bv(e),t.blockedOn=n,!1;e.shift()}return!0}function _b(t,e,n){$d(t)&&n.delete(e)}function jL(){yy=!1,Hi!==null&&$d(Hi)&&(Hi=null),qi!==null&&$d(qi)&&(qi=null),Ki!==null&&$d(Ki)&&(Ki=null),wc.forEach(_b),bc.forEach(_b)}function Fl(t,e){t.blockedOn===e&&(t.blockedOn=null,yy||(yy=!0,hr.unstable_scheduleCallback(hr.unstable_NormalPriority,jL)))}function _c(t){function e(s){return Fl(s,t)}if(0<Kh.length){Fl(Kh[0],t);for(var n=1;n<Kh.length;n++){var r=Kh[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Hi!==null&&Fl(Hi,t),qi!==null&&Fl(qi,t),Ki!==null&&Fl(Ki,t),wc.forEach(e),bc.forEach(e),n=0;n<Bi.length;n++)r=Bi[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Bi.length&&(n=Bi[0],n.blockedOn===null);)yN(n),n.blockedOn===null&&Bi.shift()}var Tu=bi.ReactCurrentBatchConfig,ef=!0;function GL(t,e,n,r){var s=He,i=Tu.transition;Tu.transition=null;try{He=1,_v(t,e,n,r)}finally{He=s,Tu.transition=i}}function HL(t,e,n,r){var s=He,i=Tu.transition;Tu.transition=null;try{He=4,_v(t,e,n,r)}finally{He=s,Tu.transition=i}}function _v(t,e,n,r){if(ef){var s=vy(t,e,n,r);if(s===null)ag(t,e,r,tf,n),bb(t,r);else if(zL(s,t,e,n,r))r.stopPropagation();else if(bb(t,r),e&4&&-1<UL.indexOf(t)){for(;s!==null;){var i=th(s);if(i!==null&&fN(i),i=vy(t,e,n,r),i===null&&ag(t,e,r,tf,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else ag(t,e,r,null,n)}}var tf=null;function vy(t,e,n,r){if(tf=null,t=vv(r),t=Wo(t),t!==null)if(e=ka(t),e===null)t=null;else if(n=e.tag,n===13){if(t=iN(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return tf=t,null}
vendor: 10,401 bytes, line 37
37function vN(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(OL()){case xv:return 1;case lN:return 4;case Zd:case DL:return 16;case cN:return 536870912;default:return 16}default:return 16}}var Ui=null,Sv=null,Id=null;function xN(){if(Id)return Id;var t,e=Sv,n=e.length,r,s="value"in Ui?Ui.value:Ui.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return Id=s.slice(t,1<r?1-r:void 0)}function Ad(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Xh(){return!0}function Sb(){return!1}function pr(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Xh:Sb,this.isPropagationStopped=Sb,this}return St(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Xh)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Xh)},persist:function(){},isPersistent:Xh}),e}var sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tv=pr(sl),eh=St({},sl,{view:0,detail:0}),qL=pr(eh),Zm,Jm,Ll,pp=St({},eh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cv,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ll&&(Ll&&t.type==="mousemove"?(Zm=t.screenX-Ll.screenX,Jm=t.screenY-Ll.screenY):Jm=Zm=0,Ll=t),Zm)},movementY:function(t){return"movementY"in t?t.movementY:Jm}}),Tb=pr(pp),KL=St({},pp,{dataTransfer:0}),XL=pr(KL),YL=St({},eh,{relatedTarget:0}),eg=pr(YL),QL=St({},sl,{animationName:0,elapsedTime:0,pseudoElement:0}),ZL=pr(QL),JL=St({},sl,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),eM=pr(JL),tM=St({},sl,{data:0}),Cb=pr(tM),nM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},sM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iM(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=sM[t])?!!e[t]:!1}function Cv(){return iM}var oM=St({},eh,{key:function(t){if(t.key){var e=nM[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ad(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rM[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cv,charCode:function(t){return t.type==="keypress"?Ad(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ad(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),aM=pr(oM),uM=St({},pp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nb=pr(uM),lM=St({},eh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cv}),cM=pr(lM),hM=St({},sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),dM=pr(hM),fM=St({},pp,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),pM=pr(fM),mM=[9,13,27,32],Nv=li&&"CompositionEvent"in window,sc=null;li&&"documentMode"in document&&(sc=document.documentMode);var gM=li&&"TextEvent"in window&&!sc,wN=li&&(!Nv||sc&&8<sc&&11>=sc),Eb=" ",kb=!1;function bN(t,e){switch(t){case"keyup":return mM.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _N(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var tu=!1;function yM(t,e){switch(t){case"compositionend":return _N(e);case"keypress":return e.which!==32?null:(kb=!0,Eb);case"textInput":return t=e.data,t===Eb&&kb?null:t;default:return null}}function vM(t,e){if(tu)return t==="compositionend"||!Nv&&bN(t,e)?(t=xN(),Id=Sv=Ui=null,tu=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return wN&&e.locale!=="ko"?null:e.data;default:return null}}var xM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $b(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!xM[t.type]:e==="textarea"}function SN(t,e,n,r){eN(r),e=nf(e,"onChange"),0<e.length&&(n=new Tv("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ic=null,Sc=null;function wM(t){DN(t,0)}function mp(t){var e=su(t);if(qC(e))return t}function bM(t,e){if(t==="change")return e}var TN=!1;if(li){var tg;if(li){var ng="oninput"in document;if(!ng){var Ib=document.createElement("div");Ib.setAttribute("oninput","return;"),ng=typeof Ib.oninput=="function"}tg=ng}else tg=!1;TN=tg&&(!document.documentMode||9<document.documentMode)}function Ab(){ic&&(ic.detachEvent("onpropertychange",CN),Sc=ic=null)}function CN(t){if(t.propertyName==="value"&&mp(Sc)){var e=[];SN(e,Sc,t,vv(t)),sN(wM,e)}}function _M(t,e,n){t==="focusin"?(Ab(),ic=e,Sc=n,ic.attachEvent("onpropertychange",CN)):t==="focusout"&&Ab()}function SM(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return mp(Sc)}function TM(t,e){if(t==="click")return mp(e)}function CM(t,e){if(t==="input"||t==="change")return mp(e)}function NM(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var hs=typeof Object.is=="function"?Object.is:NM;function Tc(t,e){if(hs(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!ey.call(e,s)||!hs(t[s],e[s]))return!1}return!0}function Rb(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ob(t,e){var n=Rb(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Rb(n)}}function NN(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?NN(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function EN(){for(var t=window,e=Xd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Xd(t.document)}return e}function Ev(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function EM(t){var e=EN(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&NN(n.ownerDocument.documentElement,n)){if(r!==null&&Ev(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Ob(n,i);var o=Ob(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var kM=li&&"documentMode"in document&&11>=document.documentMode,nu=null,xy=null,oc=null,wy=!1;function Db(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wy||nu==null||nu!==Xd(r)||(r=nu,"selectionStart"in r&&Ev(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,501 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),oc&&Tc(oc,r)||(oc=r,r=nf(xy,"onSelect"),0<r.length&&(e=new Tv("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=nu)))}function Yh(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ru={animationend:Yh("Animation","AnimationEnd"),animationiteration:Yh("Animation","AnimationIteration"),animationstart:Yh("Animation","AnimationStart"),transitionend:Yh("Transition","TransitionEnd")},rg={},kN={};li&&(kN=document.createElement("div").style,"AnimationEvent"in window||(delete ru.animationend.animation,delete ru.animationiteration.animation,delete ru.animationstart.animation),"TransitionEvent"in window||delete ru.transitionend.transition);function gp(t){if(rg[t])return rg[t];if(!ru[t])return t;var e=ru[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in kN)return rg[t]=e[n];return t}var $N=gp("animationend"),IN=gp("animationiteration"),AN=gp("animationstart"),RN=gp("transitionend"),ON=new Map,Pb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function go(t,e){ON.set(t,e),Ea(e,[t])}for(var sg=0;sg<Pb.length;sg++){var ig=Pb[sg],$M=ig.toLowerCase(),IM=ig[0].toUpperCase()+ig.slice(1);go($M,"on"+IM)}go($N,"onAnimationEnd");go(IN,"onAnimationIteration");go(AN,"onAnimationStart");go("dblclick","onDoubleClick");go("focusin","onFocus");go("focusout","onBlur");go(RN,"onTransitionEnd");Ru("onMouseEnter",["mouseout","mouseover"]);Ru("onMouseLeave",["mouseout","mouseover"]);Ru("onPointerEnter",["pointerout","pointerover"]);Ru("onPointerLeave",["pointerout","pointerover"]);Ea("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ea("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ea("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ea("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ea("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ea("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),AM=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xl));function Fb(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,$L(r,e,void 0,t),t.currentTarget=null}function DN(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],u=a.instance,l=a.currentTarget;if(a=a.listener,u!==i&&s.isPropagationStopped())break e;Fb(s,a,l),i=u}else for(o=0;o<r.length;o++){if(a=r[o],u=a.instance,l=a.currentTarget,a=a.listener,u!==i&&s.isPropagationStopped())break e;Fb(s,a,l),i=u}}}if(Qd)throw t=my,Qd=!1,my=null,t}function lt(t,e){var n=e[Cy];n===void 0&&(n=e[Cy]=new Set);var r=t+"__bubble";n.has(r)||(PN(e,t,2,!1),n.add(r))}function og(t,e,n){var r=0;e&&(r|=4),PN(n,t,r,e)}var Qh="_reactListening"+Math.random().toString(36).slice(2);function Cc(t){if(!t[Qh]){t[Qh]=!0,UC.forEach(function(n){n!=="selectionchange"&&(AM.has(n)||og(n,!1,t),og(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Qh]||(e[Qh]=!0,og("selectionchange",!1,e))}}function PN(t,e,n,r){switch(vN(e)){case 1:var s=GL;break;case 4:s=HL;break;default:s=_v}n=s.bind(null,e,n,t),s=void 0,!py||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function ag(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;
vendor: 3,426 bytes, line 37
37if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var u=o.tag;if((u===3||u===4)&&(u=o.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Wo(a),o===null)return;if(u=o.tag,u===5||u===6){r=i=o;continue e}a=a.parentNode}}r=r.return}sN(function(){var l=i,c=vv(n),h=[];e:{var d=ON.get(t);if(d!==void 0){var f=Tv,p=t;switch(t){case"keypress":if(Ad(n)===0)break e;case"keydown":case"keyup":f=aM;break;case"focusin":p="focus",f=eg;break;case"focusout":p="blur",f=eg;break;case"beforeblur":case"afterblur":f=eg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Tb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=XL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=cM;break;case $N:case IN:case AN:f=ZL;break;case RN:f=dM;break;case"scroll":f=qL;break;case"wheel":f=pM;break;case"copy":case"cut":case"paste":f=eM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Nb}var y=(e&4)!==0,v=!y&&t==="scroll",g=y?d!==null?d+"Capture":null:d;y=[];for(var x=l,w;x!==null;){w=x;var _=w.stateNode;if(w.tag===5&&_!==null&&(w=_,g!==null&&(_=xc(x,g),_!=null&&y.push(Nc(x,_,w)))),v)break;x=x.return}0<y.length&&(d=new f(d,p,null,n,c),h.push({event:d,listeners:y}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",d&&n!==dy&&(p=n.relatedTarget||n.fromElement)&&(Wo(p)||p[ci]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(p=n.relatedTarget||n.toElement,f=l,p=p?Wo(p):null,p!==null&&(v=ka(p),p!==v||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=l),f!==p)){if(y=Tb,_="onMouseLeave",g="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(y=Nb,_="onPointerLeave",g="onPointerEnter",x="pointer"),v=f==null?d:su(f),w=p==null?d:su(p),d=new y(_,x+"leave",f,n,c),d.target=v,d.relatedTarget=w,_=null,Wo(c)===l&&(y=new y(g,x+"enter",p,n,c),y.target=w,y.relatedTarget=v,_=y),v=_,f&&p)t:{for(y=f,g=p,x=0,w=y;w;w=Ha(w))x++;for(w=0,_=g;_;_=Ha(_))w++;for(;0<x-w;)y=Ha(y),x--;for(;0<w-x;)g=Ha(g),w--;for(;x--;){if(y===g||g!==null&&y===g.alternate)break t;y=Ha(y),g=Ha(g)}y=null}else y=null;f!==null&&Lb(h,d,f,y,!1),p!==null&&v!==null&&Lb(h,v,p,y,!0)}}e:{if(d=l?su(l):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var T=bM;else if($b(d))if(TN)T=CM;else{T=SM;var E=_M}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(T=TM);if(T&&(T=T(t,l))){SN(h,T,n,c);break e}E&&E(t,d,l),t==="focusout"&&(E=d._wrapperState)&&E.controlled&&d.type==="number"&&ay(d,"number",d.value)}switch(E=l?su(l):window,t){case"focusin":($b(E)||E.contentEditable==="true")&&(nu=E,xy=l,oc=null);break;case"focusout":oc=xy=nu=null;break;case"mousedown":wy=!0;break;case"contextmenu":case"mouseup":case"dragend":wy=!1,Db(h,n,c);break;case"selectionchange":if(kM)break;case"keydown":case"keyup":Db(h,n,c)}var k;if(Nv)e:{switch(t){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}
vendor: 4,251 bytes, lines 37-38
37else tu?bN(t,n)&&(N="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(wN&&n.locale!=="ko"&&(tu||N!=="onCompositionStart"?N==="onCompositionEnd"&&tu&&(k=xN()):(Ui=c,Sv="value"in Ui?Ui.value:Ui.textContent,tu=!0)),E=nf(l,N),0<E.length&&(N=new Cb(N,t,null,n,c),h.push({event:N,listeners:E}),k?N.data=k:(k=_N(n),k!==null&&(N.data=k)))),(k=gM?yM(t,n):vM(t,n))&&(l=nf(l,"onBeforeInput"),0<l.length&&(c=new Cb("onBeforeInput","beforeinput",null,n,c),h.push({event:c,listeners:l}),c.data=k))}DN(h,e)})}function Nc(t,e,n){return{instance:t,listener:e,currentTarget:n}}function nf(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=xc(t,n),i!=null&&r.unshift(Nc(t,i,s)),i=xc(t,e),i!=null&&r.push(Nc(t,i,s))),t=t.return}return r}function Ha(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Lb(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var a=n,u=a.alternate,l=a.stateNode;if(u!==null&&u===r)break;a.tag===5&&l!==null&&(a=l,s?(u=xc(n,i),u!=null&&o.unshift(Nc(n,u,a))):s||(u=xc(n,i),u!=null&&o.push(Nc(n,u,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var RM=/\r\n?/g,OM=/\u0000|\uFFFD/g;function Mb(t){return(typeof t=="string"?t:""+t).replace(RM,`
38`).replace(OM,"")}function Zh(t,e,n){if(e=Mb(e),Mb(t)!==e&&n)throw Error(te(425))}function rf(){}var by=null,_y=null;function Sy(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ty=typeof setTimeout=="function"?setTimeout:void 0,DM=typeof clearTimeout=="function"?clearTimeout:void 0,Vb=typeof Promise=="function"?Promise:void 0,PM=typeof queueMicrotask=="function"?queueMicrotask:typeof Vb<"u"?function(t){return Vb.resolve(null).then(t).catch(FM)}:Ty;function FM(t){setTimeout(function(){throw t})}function ug(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),_c(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);_c(e)}function Xi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Bb(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var il=Math.random().toString(36).slice(2),$s="__reactFiber$"+il,Ec="__reactProps$"+il,ci="__reactContainer$"+il,Cy="__reactEvents$"+il,LM="__reactListeners$"+il,MM="__reactHandles$"+il;function Wo(t){var e=t[$s];if(e)return e;for(var n=t.parentNode;n;){if(e=n[ci]||n[$s]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Bb(t);t!==null;){if(n=t[$s])return n;t=Bb(t)}return e}t=n,n=t.parentNode}return null}function th(t){return t=t[$s]||t[ci],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function su(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(te(33))}function yp(t){return t[Ec]||null}var Ny=[],iu=-1;function yo(t){return{current:t}}function ct(t){0>iu||(t.current=Ny[iu],Ny[iu]=null,iu--)}function tt(t,e){iu++,Ny[iu]=t.current,t.current=e}var io={},Sn=yo(io),Kn=yo(!1),ia=io;function Ou(t,e){var n=t.type.contextTypes;if(!n)return io;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Xn(t){return t=t.childContextTypes,t!=null}function sf(){ct(Kn),ct(Sn)}function Wb(t,e,n){if(Sn.current!==io)throw Error(te(168));tt(Sn,e),tt(Kn,n)}function FN(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(te(108,_L(t)||"Unknown",s));return St({},n,r)}function of(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||io,ia=Sn.current,tt(Sn,t),tt(Kn,Kn.current),!0}function Ub(t,e,n){var r=t.stateNode;if(!r)throw Error(te(169));
vendor: 28,087 bytes, lines 38-40
38n?(t=FN(t,e,ia),r.__reactInternalMemoizedMergedChildContext=t,ct(Kn),ct(Sn),tt(Sn,t)):ct(Kn),tt(Kn,n)}var Zs=null,vp=!1,lg=!1;function LN(t){Zs===null?Zs=[t]:Zs.push(t)}function VM(t){vp=!0,LN(t)}function vo(){if(!lg&&Zs!==null){lg=!0;var t=0,e=He;try{var n=Zs;for(He=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Zs=null,vp=!1}catch(s){throw Zs!==null&&(Zs=Zs.slice(t+1)),uN(xv,vo),s}finally{He=e,lg=!1}}return null}var ou=[],au=0,af=null,uf=0,Er=[],kr=0,oa=null,ni=1,ri="";function Ro(t,e){ou[au++]=uf,ou[au++]=af,af=t,uf=e}function MN(t,e,n){Er[kr++]=ni,Er[kr++]=ri,Er[kr++]=oa,oa=t;var r=ni;t=ri;var s=32-os(r)-1;r&=~(1<<s),n+=1;var i=32-os(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ni=1<<32-os(e)+s|n<<s|r,ri=i+t}else ni=1<<i|n<<s|r,ri=t}function kv(t){t.return!==null&&(Ro(t,1),MN(t,1,0))}function $v(t){for(;t===af;)af=ou[--au],ou[au]=null,uf=ou[--au],ou[au]=null;for(;t===oa;)oa=Er[--kr],Er[kr]=null,ri=Er[--kr],Er[kr]=null,ni=Er[--kr],Er[kr]=null}var ur=null,ir=null,gt=!1,Jr=null;function VN(t,e){var n=$r(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function zb(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,ur=t,ir=Xi(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,ur=t,ir=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=oa!==null?{id:ni,overflow:ri}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=$r(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,ur=t,ir=null,!0):!1;default:return!1}}function Ey(t){return(t.mode&1)!==0&&(t.flags&128)===0}function ky(t){if(gt){var e=ir;if(e){var n=e;if(!zb(t,e)){if(Ey(t))throw Error(te(418));e=Xi(n.nextSibling);var r=ur;e&&zb(t,e)?VN(r,n):(t.flags=t.flags&-4097|2,gt=!1,ur=t)}}else{if(Ey(t))throw Error(te(418));t.flags=t.flags&-4097|2,gt=!1,ur=t}}}function jb(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;ur=t}function Jh(t){if(t!==ur)return!1;if(!gt)return jb(t),gt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Sy(t.type,t.memoizedProps)),e&&(e=ir)){if(Ey(t))throw BN(),Error(te(418));for(;e;)VN(t,e),e=Xi(e.nextSibling)}if(jb(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(te(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){ir=Xi(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}ir=null}}else ir=ur?Xi(t.stateNode.nextSibling):null;return!0}function BN(){for(var t=ir;t;)t=Xi(t.nextSibling)}function Du(){ir=ur=null,gt=!1}function Iv(t){Jr===null?Jr=[t]:Jr.push(t)}var BM=bi.ReactCurrentBatchConfig;function Ml(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(te(309));var r=n.stateNode}if(!r)throw Error(te(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,t))}return t}function ed(t,e){throw t=Object.prototype.toString.call(e),Error(te(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Gb(t){var e=t._init;return e(t._payload)}function WN(t){function e(g,x){if(t){var w=g.deletions;w===null?(g.deletions=[x],g.flags|=16):w.push(x)}}function n(g,x){if(!t)return null;for(;x!==null;)e(g,x),x=x.sibling;return null}function r(g,x){for(g=new Map;x!==null;)x.key!==null?g.set(x.key,x):g.set(x.index,x),x=x.sibling;return g}function s(g,x){return g=Ji(g,x),g.index=0,g.sibling=null,g}function i(g,x,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<x?(g.flags|=2,x):w):(g.flags|=2,x)):(g.flags|=1048576,x)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function a(g,x,w,_){return x===null||x.tag!==6?(x=gg(w,g.mode,_),x.return=g,x):(x=s(x,w),x.return=g,x)}function u(g,x,w,_){var T=w.type;return T===eu?c(g,x,w.props.children,_,w.key):x!==null&&(x.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Pi&&Gb(T)===x.type)?(_=s(x,w.props),_.ref=Ml(g,x,w),_.return=g,_):(_=Md(w.type,w.key,w.props,null,g.mode,_),_.ref=Ml(g,x,w),_.return=g,_)}function l(g,x,w,_){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=yg(w,g.mode,_),x.return=g,x):(x=s(x,w.children||[]),x.return=g,x)}function c(g,x,w,_,T){return x===null||x.tag!==7?(x=Zo(w,g.mode,_,T),x.return=g,x):(x=s(x,w),x.return=g,x)}function h(g,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=gg(""+x,g.mode,w),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case zh:return w=Md(x.type,x.key,x.props,null,g.mode,w),w.ref=Ml(g,null,x),w.return=g,w;case Ja:return x=yg(x,g.mode,w),x.return=g,x;case Pi:var _=x._init;return h(g,_(x._payload),w)}if(ql(x)||Ol(x))return x=Zo(x,g.mode,w,null),x.return=g,x;ed(g,x)}return null}function d(g,x,w,_){var T=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return T!==null?null:a(g,x,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case zh:return w.key===T?u(g,x,w,_):null;case Ja:return w.key===T?l(g,x,w,_):null;case Pi:return T=w._init,d(g,x,T(w._payload),_)}if(ql(w)||Ol(w))return T!==null?null:c(g,x,w,_,null);ed(g,w)}return null}function f(g,x,w,_,T){if(typeof _=="string"&&_!==""||typeof _=="number")return g=g.get(w)||null,a(x,g,""+_,T);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case zh:return g=g.get(_.key===null?w:_.key)||null,u(x,g,_,T);case Ja:return g=g.get(_.key===null?w:_.key)||null,l(x,g,_,T);case Pi:var E=_._init;return f(g,x,w,E(_._payload),T)}if(ql(_)||Ol(_))return g=g.get(w)||null,c(x,g,_,T,null);ed(x,_)}return null}function p(g,x,w,_){for(var T=null,E=null,k=x,N=x=0,O=null;k!==null&&N<w.length;N++){k.index>N?(O=k,k=null):O=k.sibling;var R=d(g,k,w[N],_);if(R===null){k===null&&(k=O);break}t&&k&&R.alternate===null&&e(g,k),x=i(R,x,N),E===null?T=R:E.sibling=R,E=R,k=O}if(N===w.length)return n(g,k),gt&&Ro(g,N),T;if(k===null){for(;N<w.length;N++)k=h(g,w[N],_),k!==null&&(x=i(k,x,N),E===null?T=k:E.sibling=k,E=k);return gt&&Ro(g,N),T}for(k=r(g,k);N<w.length;N++)O=f(k,g,N,w[N],_),O!==null&&(t&&O.alternate!==null&&k.delete(O.key===null?N:O.key),x=i(O,x,N),E===null?T=O:E.sibling=O,E=O);return t&&k.forEach(function(L){return e(g,L)}),gt&&Ro(g,N),T}function y(g,x,w,_){var T=Ol(w);if(typeof T!="function")throw Error(te(150));if(w=T.call(w),w==null)throw Error(te(151));for(var E=T=null,k=x,N=x=0,O=null,R=w.next();k!==null&&!R.done;N++,R=w.next()){k.index>N?(O=k,k=null):O=k.sibling;var L=d(g,k,R.value,_);if(L===null){k===null&&(k=O);break}t&&k&&L.alternate===null&&e(g,k),x=i(L,x,N),E===null?T=L:E.sibling=L,E=L,k=O}if(R.done)return n(g,k),gt&&Ro(g,N),T;if(k===null){for(;!R.done;N++,R=w.next())R=h(g,R.value,_),R!==null&&(x=i(R,x,N),E===null?T=R:E.sibling=R,E=R);return gt&&Ro(g,N),T}for(k=r(g,k);!R.done;N++,R=w.next())R=f(k,g,N,R.value,_),R!==null&&(t&&R.alternate!==null&&k.delete(R.key===null?N:R.key),x=i(R,x,N),E===null?T=R:E.sibling=R,E=R);return t&&k.forEach(function(W){return e(g,W)}),gt&&Ro(g,N),T}function v(g,x,w,_){if(typeof w=="object"&&w!==null&&w.type===eu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zh:e:{for(var T=w.key,E=x;E!==null;){if(E.key===T){if(T=w.type,T===eu){if(E.tag===7){n(g,E.sibling),x=s(E,w.props.children),x.return=g,g=x;break e}}else if(E.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Pi&&Gb(T)===E.type){n(g,E.sibling),x=s(E,w.props),x.ref=Ml(g,E,w),x.return=g,g=x;break e}n(g,E);break}else e(g,E);E=E.sibling}w.type===eu?(x=Zo(w.props.children,g.mode,_,w.key),x.return=g,g=x):(_=Md(w.type,w.key,w.props,null,g.mode,_),_.ref=Ml(g,x,w),_.return=g,g=_)}return o(g);case Ja:e:{for(E=w.key;x!==null;){if(x.key===E)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(g,x.sibling),x=s(x,w.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else e(g,x);x=x.sibling}x=yg(w,g.mode,_),x.return=g,g=x}return o(g);case Pi:return E=w._init,v(g,x,E(w._payload),_)}if(ql(w))return p(g,x,w,_);if(Ol(w))return y(g,x,w,_);ed(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(g,x.sibling),x=s(x,w),x.return=g,g=x):(n(g,x),x=gg(w,g.mode,_),x.return=g,g=x),o(g)):n(g,x)}return v}var Pu=WN(!0),UN=WN(!1),lf=yo(null),cf=null,uu=null,Av=null;function Rv(){Av=uu=cf=null}function Ov(t){var e=lf.current;ct(lf),t._currentValue=e}function $y(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Cu(t,e){cf=t,Av=uu=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Gn=!0),t.firstContext=null)}function Mr(t){var e=t._currentValue;if(Av!==t)if(t={context:t,memoizedValue:e,next:null},uu===null){if(cf===null)throw Error(te(308));uu=t,cf.dependencies={lanes:0,firstContext:t}}else uu=uu.next=t;return e}var Uo=null;function Dv(t){Uo===null?Uo=[t]:Uo.push(t)}function zN(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Dv(e)):(n.next=s.next,s.next=n),e.interleaved=n,hi(t,r)}function hi(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Fi=!1;function Pv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jN(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ii(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Yi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ve&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,hi(t,n)}return s=r.interleaved,s===null?(e.next=e,Dv(r)):(e.next=s.next,s.next=e),r.interleaved=e,hi(t,n)}function Rd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,wv(t,n)}}function Hb(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function hf(t,e,n,r){var s=t.updateQueue;Fi=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var u=a,l=u.next;u.next=null,o===null?i=l:o.next=l,o=u;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;o=0,c=l=u=null,a=i;do{var d=a.lane,f=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=t,y=a;switch(d=e,f=n,y.tag){case 1:if(p=y.payload,typeof p=="function"){h=p.call(f,h,d);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,d=typeof p=="function"?p.call(f,h,d):p,d==null)break e;h=St({},h,d);break e;case 2:Fi=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=s.effects,d===null?s.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=f,u=h):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;d=a,a=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(c===null&&(u=h),s.baseState=u,s.firstBaseUpdate=l,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);ua|=o,t.lanes=o,t.memoizedState=h}}function qb(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(te(191,s));s.call(r)}}}var nh={},Ds=yo(nh),kc=yo(nh),$c=yo(nh);function zo(t){if(t===nh)throw Error(te(174));return t}function Fv(t,e){switch(tt($c,e),tt(kc,t),tt(Ds,nh),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ly(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=ly(e,t)}ct(Ds),tt(Ds,e)}function Fu(){ct(Ds),ct(kc),ct($c)}function GN(t){zo($c.current);var e=zo(Ds.current),n=ly(e,t.type);e!==n&&(tt(kc,t),tt(Ds,n))}function Lv(t){kc.current===t&&(ct(Ds),ct(kc))}var bt=yo(0);function df(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var cg=[];function Mv(){for(var t=0;t<cg.length;t++)cg[t]._workInProgressVersionPrimary=null;cg.length=0}var Od=bi.ReactCurrentDispatcher,hg=bi.ReactCurrentBatchConfig,aa=0,_t=null,Bt=null,qt=null,ff=!1,ac=!1,Ic=0,WM=0;function pn(){throw Error(te(321))}function Vv(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!hs(t[n],e[n]))return!1;return!0}function Bv(t,e,n,r,s,i){if(aa=i,_t=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Od.current=t===null||t.memoizedState===null?GM:HM,t=n(r,s),ac){i=0;do{if(ac=!1,Ic=0,25<=i)throw Error(te(301));i+=1,qt=Bt=null,e.updateQueue=null,Od.current=qM,t=n(r,s)}while(ac)}if(Od.current=pf,e=Bt!==null&&Bt.next!==null,aa=0,qt=Bt=_t=null,ff=!1,e)throw Error(te(300));return t}function Wv(){var t=Ic!==0;return Ic=0,t}function Es(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?_t.memoizedState=qt=t:qt=qt.next=t,qt}function Vr(){if(Bt===null){var t=_t.alternate;t=t!==null?t.memoizedState:null}else t=Bt.next;var e=qt===null?_t.memoizedState:qt.next;if(e!==null)qt=e,Bt=t;else{if(t===null)throw Error(te(310));Bt=t,t={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},qt===null?_t.memoizedState=qt=t:qt=qt.next=t}return qt}function Ac(t,e){return typeof e=="function"?e(t):e}function dg(t){var e=Vr(),n=e.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=t;var r=Bt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,u=null,l=i;do{var c=l.lane;if((aa&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var h={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(a=u=h,o=r):u=u.next=h,_t.lanes|=c,ua|=c}l=l.next}while(l!==null&&l!==i);u===null?o=r:u.next=a,hs(r,e.memoizedState)||(Gn=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=u,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,_t.lanes|=i,ua|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function fg(t){var e=Vr(),n=e.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);hs(i,e.memoizedState)||(Gn=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function HN(){}function qN(t,e){var n=_t,r=Vr(),s=e(),i=!hs(r.memoizedState,s);if(i&&(r.memoizedState=s,Gn=!0),r=r.queue,Uv(YN.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||qt!==null&&qt.memoizedState.tag&1){if(n.flags|=2048,Rc(9,XN.bind(null,n,r,s,e),void 0,null),Yt===null)throw Error(te(349));aa&30||KN(n,e,s)}return s}function KN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=_t.updateQueue,e===null?(e={lastEffect:null,stores:null},_t.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function XN(t,e,n,r){e.value=n,e.getSnapshot=r,QN(e)&&ZN(t)}function YN(t,e,n){return n(function(){QN(e)&&ZN(t)})}function QN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!hs(t,n)}catch{return!0}}function ZN(t){var e=hi(t,1);e!==null&&as(e,t,1,-1)}function Kb(t){var e=Es();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ac,lastRenderedState:t},e.queue=t,t=t.dispatch=jM.bind(null,_t,t),[e.memoizedState,t]}function Rc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=_t.updateQueue,e===null?(e={lastEffect:null,stores:null},_t.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function JN(){return Vr().memoizedState}function Dd(t,e,n,r){var s=Es();_t.flags|=t,s.memoizedState=Rc(1|e,n,void 0,r===void 0?null:r)}function xp(t,e,n,r){var s=Vr();r=r===void 0?null:r;var i=void 0;if(Bt!==null){var o=Bt.memoizedState;if(i=o.destroy,r!==null&&Vv(r,o.deps)){s.memoizedState=Rc(e,n,i,r);return}}_t.flags|=t,s.memoizedState=Rc(1|e,n,i,r)}function Xb(t,e){return Dd(8390656,8,t,e)}function Uv(t,e){return xp(2048,8,t,e)}function e2(t,e){return xp(4,2,t,e)}function t2(t,e){return xp(4,4,t,e)}function n2(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function r2(t,e,n){return n=n!=null?n.concat([t]):null,xp(4,4,n2.bind(null,e,t),n)}function zv(){}function s2(t,e){var n=Vr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Vv(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function i2(t,e){var n=Vr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Vv(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function o2(t,e,n){return aa&21?(hs(n,e)||(n=hN(),_t.lanes|=n,ua|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Gn=!0),t.memoizedState=n)}function UM(t,e){var n=He;He=n!==0&&4>n?n:4,t(!0);var r=hg.transition;hg.transition={};try{t(!1),e()}finally{He=n,hg.transition=r}}function a2(){return Vr().memoizedState}function zM(t,e,n){var r=Zi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},u2(t))l2(e,n);else if(n=zN(t,e,n,r),n!==null){var s=Rn();as(n,t,r,s),c2(n,e,r)}}function jM(t,e,n){var r=Zi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(u2(t))l2(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,hs(a,o)){var u=e.interleaved;u===null?(s.next=s,Dv(e)):(s.next=u.next,u.next=s),e.interleaved=s;return}}catch{}finally{}n=zN(t,e,s,r),n!==null&&(s=Rn(),as(n,t,r,s),c2(n,e,r))}}function u2(t){var e=t.alternate;return t===_t||e!==null&&e===_t}function l2(t,e){ac=ff=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function c2(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,wv(t,n)}}var pf={readContext:Mr,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},GM={readContext:Mr,useCallback:function(t,e){return Es().memoizedState=[t,e===void 0?null:e],t},useContext:Mr,useEffect:Xb,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Dd(4194308,4,n2.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Dd(4194308,4,t,e)},useInsertionEffect:function(t,e){return Dd(4,2,t,e)},useMemo:function(t,e){var n=Es();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Es();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=zM.bind(null,_t,t),[r.memoizedState,t]},useRef:function(t){var e=Es();return t={current:t},e.memoizedState=t},useState:Kb,useDebugValue:zv,useDeferredValue:function(t){return Es().memoizedState=t},useTransition:function(){var t=Kb(!1),e=t[0];return t=UM.bind(null,t[1]),Es().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=_t,s=Es();if(gt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=e(),Yt===null)throw Error(te(349));aa&30||KN(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,Xb(YN.bind(null,r,i,t),[t]),r.flags|=2048,Rc(9,XN.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Es(),e=Yt.identifierPrefix;if(gt){var n=ri,r=ni;n=(r&~(1<<32-os(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ic++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=WM++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},HM={readContext:Mr,useCallback:s2,useContext:Mr,useEffect:Uv,useImperativeHandle:r2,useInsertionEffect:e2,useLayoutEffect:t2,useMemo:i2,useReducer:dg,useRef:JN,useState:function(){return dg(Ac)},useDebugValue:zv,useDeferredValue:function(t){var e=Vr();return o2(e,Bt.memoizedState,t)},useTransition:function(){var t=dg(Ac)[0],e=Vr().memoizedState;return[t,e]},useMutableSource:HN,useSyncExternalStore:qN,useId:a2,unstable_isNewReconciler:!1},qM={readContext:Mr,useCallback:s2,useContext:Mr,useEffect:Uv,useImperativeHandle:r2,useInsertionEffect:e2,useLayoutEffect:t2,useMemo:i2,useReducer:fg,useRef:JN,useState:function(){return fg(Ac)},useDebugValue:zv,useDeferredValue:function(t){var e=Vr();return Bt===null?e.memoizedState=t:o2(e,Bt.memoizedState,t)},useTransition:function(){var t=fg(Ac)[0],e=Vr().memoizedState;return[t,e]},useMutableSource:HN,useSyncExternalStore:qN,useId:a2,unstable_isNewReconciler:!1};function Yr(t,e){if(t&&t.defaultProps){e=St({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Iy(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:St({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wp={isMounted:function(t){return(t=t._reactInternals)?ka(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Rn(),s=Zi(t),i=ii(r,s);i.payload=e,n!=null&&(i.callback=n),e=Yi(t,i,s),e!==null&&(as(e,t,s,r),Rd(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Rn(),s=Zi(t),i=ii(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=Yi(t,i,s),e!==null&&(as(e,t,s,r),Rd(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Rn(),r=Zi(t),s=ii(n,r);s.tag=2,e!=null&&(s.callback=e),e=Yi(t,s,r),e!==null&&(as(e,t,r,n),Rd(e,t,r))}};function Yb(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Tc(n,r)||!Tc(s,i):!0}function h2(t,e,n){var r=!1,s=io,i=e.contextType;return typeof i=="object"&&i!==null?i=Mr(i):(s=Xn(e)?ia:Sn.current,r=e.contextTypes,i=(r=r!=null)?Ou(t,s):io),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wp,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function Qb(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&wp.enqueueReplaceState(e,e.state,null)}function Ay(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Pv(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Mr(i):(i=Xn(e)?ia:Sn.current,s.context=Ou(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Iy(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&wp.enqueueReplaceState(s,s.state,null),hf(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Lu(t,e){try{var n="",r=e;do n+=bL(r),r=r.return;while(r);var s=n}catch(i){s=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:t,source:e,stack:s,digest:null}}function pg(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Ry(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var KM=typeof WeakMap=="function"?WeakMap:Map;function d2(t,e,n){n=ii(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){gf||(gf=!0,Uy=r),Ry(t,e)},n}function f2(t,e,n){n=ii(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){Ry(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ry(t,e),typeof r!="function"&&(Qi===null?Qi=new Set([this]):Qi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Zb(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new KM;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=u3.bind(null,t,e,n),e.then(t,t))}function Jb(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function e_(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=ii(-1,1),e.tag=2,Yi(n,e,1))),n.lanes|=1),t)}var XM=bi.ReactCurrentOwner,Gn=!1;function kn(t,e,n,r){e.child=t===null?UN(e,null,n,r):Pu(e,t.child,n,r)}function t_(t,e,n,r,s){n=n.render;var i=e.ref;return Cu(e,s),r=Bv(t,e,n,r,i,s),n=Wv(),t!==null&&!Gn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,di(t,e,s)):(gt&&n&&kv(e),e.flags|=1,kn(t,e,r,s),e.child)}function n_(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!Qv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,p2(t,e,i,r,s)):(t=Md(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Tc,n(o,r)&&t.ref===e.ref)return di(t,e,s)}return e.flags|=1,t=Ji(i,r),t.ref=e.ref,t.return=e,e.child=t}function p2(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Tc(i,r)&&t.ref===e.ref)if(Gn=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(Gn=!0);else return e.lanes=t.lanes,di(t,e,s)}return Oy(t,e,n,r,s)}function m2(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(cu,nr),nr|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,tt(cu,nr),nr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,tt(cu,nr),nr|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,tt(cu,nr),nr|=r;return kn(t,e,s,n),e.child}function g2(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 5,244 bytes, line 40
40function Oy(t,e,n,r,s){var i=Xn(n)?ia:Sn.current;return i=Ou(e,i),Cu(e,s),n=Bv(t,e,n,r,i,s),r=Wv(),t!==null&&!Gn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,di(t,e,s)):(gt&&r&&kv(e),e.flags|=1,kn(t,e,n,s),e.child)}function r_(t,e,n,r,s){if(Xn(n)){var i=!0;of(e)}else i=!1;if(Cu(e,s),e.stateNode===null)Pd(t,e),h2(e,n,r),Ay(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var u=o.context,l=n.contextType;typeof l=="object"&&l!==null?l=Mr(l):(l=Xn(n)?ia:Sn.current,l=Ou(e,l));var c=n.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||u!==l)&&Qb(e,o,r,l),Fi=!1;var d=e.memoizedState;o.state=d,hf(e,r,o,s),u=e.memoizedState,a!==r||d!==u||Kn.current||Fi?(typeof c=="function"&&(Iy(e,n,c,r),u=e.memoizedState),(a=Fi||Yb(e,n,a,r,d,u,l))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=u),o.props=r,o.state=u,o.context=l,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,jN(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:Yr(e.type,a),o.props=l,h=e.pendingProps,d=o.context,u=n.contextType,typeof u=="object"&&u!==null?u=Mr(u):(u=Xn(n)?ia:Sn.current,u=Ou(e,u));var f=n.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==u)&&Qb(e,o,r,u),Fi=!1,d=e.memoizedState,o.state=d,hf(e,r,o,s);var p=e.memoizedState;a!==h||d!==p||Kn.current||Fi?(typeof f=="function"&&(Iy(e,n,f,r),p=e.memoizedState),(l=Fi||Yb(e,n,l,r,d,p,u)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,u)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=u,r=l):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return Dy(t,e,n,r,i,s)}function Dy(t,e,n,r,s,i){g2(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&Ub(e,n,!1),di(t,e,i);r=e.stateNode,XM.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Pu(e,t.child,null,i),e.child=Pu(e,null,a,i)):kn(t,e,a,i),e.memoizedState=r.state,s&&Ub(e,n,!0),e.child}function y2(t){var e=t.stateNode;e.pendingContext?Wb(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Wb(t,e.context,!1),Fv(t,e.containerInfo)}function s_(t,e,n,r,s){return Du(),Iv(s),e.flags|=256,kn(t,e,n,r),e.child}var Py={dehydrated:null,treeContext:null,retryLane:0};function Fy(t){return{baseLanes:t,cachePool:null,transitions:null}}function v2(t,e,n){var r=e.pendingProps,s=bt.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),tt(bt,s&1),t===null)return ky(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Sp(o,r,0,null),t=Zo(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Fy(n),e.memoizedState=Py,t):jv(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return YM(t,e,o,r,a,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,a=s.sibling;var u={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=u,e.deletions=null):(r=Ji(s,u),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=Ji(a,i):(i=Zo(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?Fy(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Py,r}return i=t.child,t=i.sibling,r=Ji(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function jv(t,e){return e=Sp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function td(t,e,n,r){return r!==null&&Iv(r),Pu(e,t.child,null,n),t=jv(e,e.pen
vendor: 5,156 bytes, line 40
40dingProps.children),t.flags|=2,e.memoizedState=null,t}function YM(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=pg(Error(te(422))),td(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=Sp({mode:"visible",children:r.children},s,0,null),i=Zo(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Pu(e,t.child,null,o),e.child.memoizedState=Fy(o),e.memoizedState=Py,i);if(!(e.mode&1))return td(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(te(419)),r=pg(i,r,void 0),td(t,e,o,r)}if(a=(o&t.childLanes)!==0,Gn||a){if(r=Yt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,hi(t,s),as(r,t,s,-1))}return Yv(),r=pg(Error(te(421))),td(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=l3.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,ir=Xi(s.nextSibling),ur=e,gt=!0,Jr=null,t!==null&&(Er[kr++]=ni,Er[kr++]=ri,Er[kr++]=oa,ni=t.id,ri=t.overflow,oa=e),e=jv(e,r.children),e.flags|=4096,e)}function i_(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),$y(t.return,e,n)}function mg(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function x2(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(kn(t,e,r.children,n),r=bt.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&i_(t,n,e);else if(t.tag===19)i_(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(tt(bt,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&df(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),mg(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&df(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}mg(e,!0,n,null,i);break;case"together":mg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Pd(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function di(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ua|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(te(153));if(e.child!==null){for(t=e.child,n=Ji(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Ji(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function QM(t,e,n){switch(e.tag){case 3:y2(e),Du();break;case 5:GN(e);break;case 1:Xn(e.type)&&of(e);break;case 4:Fv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;tt(lf,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(tt(bt,bt.current&1),e.flags|=128,null):n&e.child.childLanes?v2(t,e,n):(tt(bt,bt.current&1),t=di(t,e,n),t!==null?t.sibling:null);tt(bt,bt.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return x2(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),tt(bt,bt.current),r)break;return null;case 22:case 23:return e.lanes=0,m2(t,e,n)}return di(t,e,n)}var w2,Ly,b2,_2;w2=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Ly=function(){};b2=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,zo(Ds.current);var i=null;switch(n){case"input":s=iy(t,s),r=iy(t,r),i=[];break;case"select":s=St({},s,{value:void 0}),r=St({},r,{value:void 0}),i=[];break;case"textarea":s=uy(t,s),r=uy(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=rf)}cy(n,r);var o;n=null;for(l in s)if(!r.hasOwnProperty(l)&&s.hasOwnProperty(l)&&s[l]!=null)if(l==="style"){var a=s[l];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(yc.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in r){var u=r[l];if(a=s!=null?s[l]:void 0,r.hasOwnProperty(l)&&u!==a&&(u!=null||a!=null))if(l==="style")if(a){for(o in a)!a.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&a[o]!==u[o]&&(n||(n={}),n[o]=u[o])}
vendor: 5,030 bytes, line 40
40else n||(i||(i=[]),i.push(l,n)),n=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(yc.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&lt("scroll",t),i||a===u||(i=[])):(i=i||[]).push(l,u))}n&&(i=i||[]).push("style",n);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};_2=function(t,e,n,r){n!==r&&(e.flags|=4)};function Vl(t,e){if(!gt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function mn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function ZM(t,e,n){var r=e.pendingProps;switch($v(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(e),null;case 1:return Xn(e.type)&&sf(),mn(e),null;case 3:return r=e.stateNode,Fu(),ct(Kn),ct(Sn),Mv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Jh(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Jr!==null&&(Gy(Jr),Jr=null))),Ly(t,e),mn(e),null;case 5:Lv(e);var s=zo($c.current);if(n=e.type,t!==null&&e.stateNode!=null)b2(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(te(166));return mn(e),null}if(t=zo(Ds.current),Jh(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[$s]=e,r[Ec]=i,t=(e.mode&1)!==0,n){case"dialog":lt("cancel",r),lt("close",r);break;case"iframe":case"object":case"embed":lt("load",r);break;case"video":case"audio":for(s=0;s<Xl.length;s++)lt(Xl[s],r);break;case"source":lt("error",r);break;case"img":case"image":case"link":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"input":pb(r,i),lt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},lt("invalid",r);break;case"textarea":gb(r,i),lt("invalid",r)}cy(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Zh(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Zh(r.textContent,a,t),s=["children",""+a]):yc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&lt("scroll",r)}switch(n){case"input":jh(r),mb(r,i,!0);break;case"textarea":jh(r),yb(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=rf)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=YC(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[$s]=e,t[Ec]=r,w2(t,e,!1,!1),e.stateNode=t;e:{switch(o=hy(n,r),n){case"dialog":lt("cancel",t),lt("close",t),s=r;break;case"iframe":case"object":case"embed":lt("load",t),s=r;break;case"video":case"audio":for(s=0;s<Xl.length;s++)lt(Xl[s],t);s=r;break;case"source":lt("error",t),s=r;break;case"img":case"image":case"link":lt("error",t),lt("load",t),s=r;break;case"details":lt("toggle",t),s=r;break;case"input":pb(t,r),s=iy(t,r),lt("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=St({},r,{value:void 0}),lt("invalid",t);break;case"textarea":gb(t,r),s=uy(t,r),lt("invalid",t);break;default:s=r}cy(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var u=a[i];i==="style"?JC(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&QC(t,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&vc(t,u):typeof u=="number"&&vc(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(yc.hasOwnProperty(i)?u!=null&&i==="onScroll"&&lt("scroll",t):u!=null&&pv(t,i,u,o))}switch(n){case"input":jh(t),mb(t,r,!1);break;case"textarea":jh(t),yb(t);break;case"option":r.value!=null&&t.setAttribute("value",""+so(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?bu(t,!!r.multiple,i,!1):r.defaultValue!=null&&bu(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=rf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}
vendor: 28,872 bytes, line 40
40return mn(e),null;case 6:if(t&&e.stateNode!=null)_2(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(te(166));if(n=zo($c.current),zo(Ds.current),Jh(e)){if(r=e.stateNode,n=e.memoizedProps,r[$s]=e,(i=r.nodeValue!==n)&&(t=ur,t!==null))switch(t.tag){case 3:Zh(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Zh(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$s]=e,e.stateNode=r}return mn(e),null;case 13:if(ct(bt),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(gt&&ir!==null&&e.mode&1&&!(e.flags&128))BN(),Du(),e.flags|=98560,i=!1;else if(i=Jh(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(te(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[$s]=e}else Du(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;mn(e),i=!1}else Jr!==null&&(Gy(Jr),Jr=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||bt.current&1?Ut===0&&(Ut=3):Yv())),e.updateQueue!==null&&(e.flags|=4),mn(e),null);case 4:return Fu(),Ly(t,e),t===null&&Cc(e.stateNode.containerInfo),mn(e),null;case 10:return Ov(e.type._context),mn(e),null;case 17:return Xn(e.type)&&sf(),mn(e),null;case 19:if(ct(bt),i=e.memoizedState,i===null)return mn(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)Vl(i,!1);else{if(Ut!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=df(t),o!==null){for(e.flags|=128,Vl(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return tt(bt,bt.current&1|2),e.child}t=t.sibling}i.tail!==null&&Rt()>Mu&&(e.flags|=128,r=!0,Vl(i,!1),e.lanes=4194304)}else{if(!r)if(t=df(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Vl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!gt)return mn(e),null}else 2*Rt()-i.renderingStartTime>Mu&&n!==1073741824&&(e.flags|=128,r=!0,Vl(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Rt(),e.sibling=null,n=bt.current,tt(bt,r?n&1|2:n&1),e):(mn(e),null);case 22:case 23:return Xv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?nr&1073741824&&(mn(e),e.subtreeFlags&6&&(e.flags|=8192)):mn(e),null;case 24:return null;case 25:return null}throw Error(te(156,e.tag))}function JM(t,e){switch($v(e),e.tag){case 1:return Xn(e.type)&&sf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Fu(),ct(Kn),ct(Sn),Mv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Lv(e),null;case 13:if(ct(bt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(te(340));Du()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ct(bt),null;case 4:return Fu(),null;case 10:return Ov(e.type._context),null;case 22:case 23:return Xv(),null;case 24:return null;default:return null}}var nd=!1,vn=!1,e3=typeof WeakSet=="function"?WeakSet:Set,he=null;function lu(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){kt(t,e,r)}else n.current=null}function My(t,e,n){try{n()}catch(r){kt(t,e,r)}}var o_=!1;function t3(t,e){if(by=ef,t=EN(),Ev(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,l=0,c=0,h=t,d=null;t:for(;;){for(var f;h!==n||s!==0&&h.nodeType!==3||(a=o+s),h!==i||r!==0&&h.nodeType!==3||(u=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===t)break t;if(d===n&&++l===s&&(a=o),d===i&&++c===r&&(u=o),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(_y={focusedElem:t,selectionRange:n},ef=!1,he=e;he!==null;)if(e=he,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,he=t;else for(;he!==null;){e=he;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,v=p.memoizedState,g=e.stateNode,x=g.getSnapshotBeforeUpdate(e.elementType===e.type?y:Yr(e.type,y),v);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(_){kt(e,e.return,_)}if(t=e.sibling,t!==null){t.return=e.return,he=t;break}he=e.return}return p=o_,o_=!1,p}function uc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&My(e,n,i)}s=s.next}while(s!==r)}}function bp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Vy(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function S2(t){var e=t.alternate;e!==null&&(t.alternate=null,S2(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[$s],delete e[Ec],delete e[Cy],delete e[LM],delete e[MM])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function T2(t){return t.tag===5||t.tag===3||t.tag===4}function a_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||T2(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function By(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=rf));else if(r!==4&&(t=t.child,t!==null))for(By(t,e,n),t=t.sibling;t!==null;)By(t,e,n),t=t.sibling}function Wy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Wy(t,e,n),t=t.sibling;t!==null;)Wy(t,e,n),t=t.sibling}var on=null,Qr=!1;function Ai(t,e,n){for(n=n.child;n!==null;)C2(t,e,n),n=n.sibling}function C2(t,e,n){if(Os&&typeof Os.onCommitFiberUnmount=="function")try{Os.onCommitFiberUnmount(fp,n)}catch{}switch(n.tag){case 5:vn||lu(n,e);case 6:var r=on,s=Qr;on=null,Ai(t,e,n),on=r,Qr=s,on!==null&&(Qr?(t=on,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):on.removeChild(n.stateNode));break;case 18:on!==null&&(Qr?(t=on,n=n.stateNode,t.nodeType===8?ug(t.parentNode,n):t.nodeType===1&&ug(t,n),_c(t)):ug(on,n.stateNode));break;case 4:r=on,s=Qr,on=n.stateNode.containerInfo,Qr=!0,Ai(t,e,n),on=r,Qr=s;break;case 0:case 11:case 14:case 15:if(!vn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&My(n,e,o),s=s.next}while(s!==r)}Ai(t,e,n);break;case 1:if(!vn&&(lu(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){kt(n,e,a)}Ai(t,e,n);break;case 21:Ai(t,e,n);break;case 22:n.mode&1?(vn=(r=vn)||n.memoizedState!==null,Ai(t,e,n),vn=r):Ai(t,e,n);break;default:Ai(t,e,n)}}function u_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new e3),e.forEach(function(r){var s=c3.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Xr(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:on=a.stateNode,Qr=!1;break e;case 3:on=a.stateNode.containerInfo,Qr=!0;break e;case 4:on=a.stateNode.containerInfo,Qr=!0;break e}a=a.return}if(on===null)throw Error(te(160));C2(i,o,s),on=null,Qr=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(l){kt(s,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)N2(e,t),e=e.sibling}function N2(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xr(e,t),Ns(t),r&4){try{uc(3,t,t.return),bp(3,t)}catch(y){kt(t,t.return,y)}try{uc(5,t,t.return)}catch(y){kt(t,t.return,y)}}break;case 1:Xr(e,t),Ns(t),r&512&&n!==null&&lu(n,n.return);break;case 5:if(Xr(e,t),Ns(t),r&512&&n!==null&&lu(n,n.return),t.flags&32){var s=t.stateNode;try{vc(s,"")}catch(y){kt(t,t.return,y)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&KC(s,i),hy(a,o);var l=hy(a,i);for(o=0;o<u.length;o+=2){var c=u[o],h=u[o+1];c==="style"?JC(s,h):c==="dangerouslySetInnerHTML"?QC(s,h):c==="children"?vc(s,h):pv(s,c,h,l)}switch(a){case"input":oy(s,i);break;case"textarea":XC(s,i);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?bu(s,!!i.multiple,f,!1):d!==!!i.multiple&&(i.defaultValue!=null?bu(s,!!i.multiple,i.defaultValue,!0):bu(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ec]=i}catch(y){kt(t,t.return,y)}}break;case 6:if(Xr(e,t),Ns(t),r&4){if(t.stateNode===null)throw Error(te(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(y){kt(t,t.return,y)}}break;case 3:if(Xr(e,t),Ns(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{_c(e.containerInfo)}catch(y){kt(t,t.return,y)}break;case 4:Xr(e,t),Ns(t);break;case 13:Xr(e,t),Ns(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(qv=Rt())),r&4&&u_(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(vn=(l=vn)||c,Xr(e,t),vn=l):Xr(e,t),Ns(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(he=t,c=t.child;c!==null;){for(h=he=c;he!==null;){switch(d=he,f=d.child,d.tag){case 0:case 11:case 14:case 15:uc(4,d,d.return);break;case 1:lu(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){r=d,n=d.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(y){kt(r,n,y)}}break;case 5:lu(d,d.return);break;case 22:if(d.memoizedState!==null){c_(h);continue}}f!==null?(f.return=d,he=f):c_(h)}c=c.sibling}e:for(c=null,h=t;;){if(h.tag===5){if(c===null){c=h;try{s=h.stateNode,l?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=h.stateNode,u=h.memoizedProps.style,o=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=ZC("display",o))}catch(y){kt(t,t.return,y)}}}else if(h.tag===6){if(c===null)try{h.stateNode.nodeValue=l?"":h.memoizedProps}catch(y){kt(t,t.return,y)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;c===h&&(c=null),h=h.return}c===h&&(c=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Xr(e,t),Ns(t),r&4&&u_(t);break;case 21:break;default:Xr(e,t),Ns(t)}}function Ns(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(T2(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(vc(s,""),r.flags&=-33);var i=a_(t);Wy(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=a_(t);By(t,a,o);break;default:throw Error(te(161))}}catch(u){kt(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function n3(t,e,n){he=t,E2(t)}function E2(t,e,n){for(var r=(t.mode&1)!==0;he!==null;){var s=he,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||nd;if(!o){var a=s.alternate,u=a!==null&&a.memoizedState!==null||vn;a=nd;var l=vn;if(nd=o,(vn=u)&&!l)for(he=s;he!==null;)o=he,u=o.child,o.tag===22&&o.memoizedState!==null?h_(s):u!==null?(u.return=o,he=u):h_(s);for(;i!==null;)he=i,E2(i),i=i.sibling;he=s,nd=a,vn=l}l_(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,he=i):l_(t)}}function l_(t){for(;he!==null;){var e=he;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:vn||bp(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!vn)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:Yr(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&qb(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}qb(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var h=c.dehydrated;h!==null&&_c(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}vn||e.flags&512&&Vy(e)}catch(d){kt(e,e.return,d)}}if(e===t){he=null;break}if(n=e.sibling,n!==null){n.return=e.return,he=n;break}he=e.return}}function c_(t){for(;he!==null;){var e=he;if(e===t){he=null;break}var n=e.sibling;if(n!==null){n.return=e.return,he=n;break}he=e.return}}function h_(t){for(;he!==null;){var e=he;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{bp(4,e)}catch(u){kt(e,n,u)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(u){kt(e,s,u)}}var i=e.return;try{Vy(e)}catch(u){kt(e,i,u)}break;case 5:var o=e.return;try{Vy(e)}catch(u){kt(e,o,u)}}}catch(u){kt(e,e.return,u)}if(e===t){he=null;break}var a=e.sibling;if(a!==null){a.return=e.return,he=a;break}he=e.return}}var r3=Math.ceil,mf=bi.ReactCurrentDispatcher,Gv=bi.ReactCurrentOwner,Pr=bi.ReactCurrentBatchConfig,Ve=0,Yt=null,Mt=null,ln=0,nr=0,cu=yo(0),Ut=0,Oc=null,ua=0,_p=0,Hv=0,lc=null,zn=null,qv=0,Mu=1/0,Ys=null,gf=!1,Uy=null,Qi=null,rd=!1,zi=null,yf=0,cc=0,zy=null,Fd=-1,Ld=0;function Rn(){return Ve&6?Rt():Fd!==-1?Fd:Fd=Rt()}function Zi(t){return t.mode&1?Ve&2&&ln!==0?ln&-ln:BM.transition!==null?(Ld===0&&(Ld=hN()),Ld):(t=He,t!==0||(t=window.event,t=t===void 0?16:vN(t.type)),t):1}function as(t,e,n,r){if(50<cc)throw cc=0,zy=null,Error(te(185));Jc(t,n,r),(!(Ve&2)||t!==Yt)&&(t===Yt&&(!(Ve&2)&&(_p|=n),Ut===4&&Wi(t,ln)),Yn(t,r),n===1&&Ve===0&&!(e.mode&1)&&(Mu=Rt()+500,vp&&vo()))}function Yn(t,e){var n=t.callbackNode;BL(t,e);var r=Jd(t,t===Yt?ln:0);if(r===0)n!==null&&wb(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&wb(n),e===1)t.tag===0?VM(d_.bind(null,t)):LN(d_.bind(null,t)),PM(function(){!(Ve&6)&&vo()}),n=null;else{switch(dN(r)){case 1:n=xv;break;case 4:n=lN;break;case 16:n=Zd;break;case 536870912:n=cN;break;default:n=Zd}n=P2(n,k2.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function k2(t,e){if(Fd=-1,Ld=0,Ve&6)throw Error(te(327));var n=t.callbackNode;if(Nu()&&t.callbackNode!==n)return null;var r=Jd(t,t===Yt?ln:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=vf(t,r);else{e=r;var s=Ve;Ve|=2;var i=I2();(Yt!==t||ln!==e)&&(Ys=null,Mu=Rt()+500,Qo(t,e));do try{o3();break}catch(a){$2(t,a)}while(!0);Rv(),mf.current=i,Ve=s,Mt!==null?e=0:(Yt=null,ln=0,e=Ut)}if(e!==0){if(e===2&&(s=gy(t),s!==0&&(r=s,e=jy(t,s))),e===1)throw n=Oc,Qo(t,0),Wi(t,r),Yn(t,Rt()),n;if(e===6)Wi(t,r);else{if(s=t.current.alternate,!(r&30)&&!s3(s)&&(e=vf(t,r),e===2&&(i=gy(t),i!==0&&(r=i,e=jy(t,i))),e===1))throw n=Oc,Qo(t,0),Wi(t,r),Yn(t,Rt()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(te(345));case 2:Oo(t,zn,Ys);break;case 3:if(Wi(t,r),(r&130023424)===r&&(e=qv+500-Rt(),10<e)){if(Jd(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){Rn(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Ty(Oo.bind(null,t,zn,Ys),e);break}Oo(t,zn,Ys);break;case 4:if(Wi(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-os(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=Rt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*r3(r/1960))-r,10<r){t.timeoutHandle=Ty(Oo.bind(null,t,zn,Ys),r);break}Oo(t,zn,Ys);break;case 5:Oo(t,zn,Ys);break;default:throw Error(te(329))}}}return Yn(t,Rt()),t.callbackNode===n?k2.bind(null,t):null}function jy(t,e){var n=lc;return t.current.memoizedState.isDehydrated&&(Qo(t,e).flags|=256),t=vf(t,e),t!==2&&(e=zn,zn=n,e!==null&&Gy(e)),t}function Gy(t){zn===null?zn=t:zn.push.apply(zn,t)}function s3(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!hs(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Wi(t,e){for(e&=~Hv,e&=~_p,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-os(e),r=1<<n;t[n]=-1,e&=~r}}function d_(t){if(Ve&6)throw Error(te(327));Nu();var e=Jd(t,0);if(!(e&1))return Yn(t,Rt()),null;var n=vf(t,e);if(t.tag!==0&&n===2){var r=gy(t);r!==0&&(e=r,n=jy(t,r))}if(n===1)throw n=Oc,Qo(t,0),Wi(t,e),Yn(t,Rt()),n;if(n===6)throw Error(te(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Oo(t,zn,Ys),Yn(t,Rt()),null}function Kv(t,e){var n=Ve;Ve|=1;try{return t(e)}finally{Ve=n,Ve===0&&(Mu=Rt()+500,vp&&vo())}}function la(t){zi!==null&&zi.tag===0&&!(Ve&6)&&Nu();var e=Ve;Ve|=1;var n=Pr.transition,r=He;try{if(Pr.transition=null,He=1,t)return t()}finally{He=r,Pr.transition=n,Ve=e,!(Ve&6)&&vo()}}function Xv(){nr=cu.current,ct(cu)}function Qo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,DM(n)),Mt!==null)for(n=Mt.return;n!==null;){var r=n;switch($v(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&sf();break;case 3:Fu(),ct(Kn),ct(Sn),Mv();break;case 5:Lv(r);break;case 4:Fu();break;case 13:ct(bt);break;case 19:ct(bt);break;case 10:Ov(r.type._context);break;case 22:case 23:Xv()}n=n.return}if(Yt=t,Mt=t=Ji(t.current,null),ln=nr=e,Ut=0,Oc=null,Hv=_p=ua=0,zn=lc=null,Uo!==null){for(e=0;e<Uo.length;e++)if(n=Uo[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Uo=null}return t}function $2(t,e){do{var n=Mt;try{if(Rv(),Od.current=pf,ff){for(var r=_t.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ff=!1}if(aa=0,qt=Bt=_t=null,ac=!1,Ic=0,Gv.current=null,n===null||n.return===null){Ut=1,Oc=e,Mt=null;break}e:{var i=t,o=n.return,a=n,u=e;if(e=ln,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=a,h=c.tag;if(!(c.mode&1)&&(h===0||h===11||h===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=Jb(o);if(f!==null){f.flags&=-257,e_(f,o,a,i,e),f.mode&1&&Zb(i,l,e),e=f,u=l;var p=e.updateQueue;if(p===null){var y=new Set;y.add(u),e.updateQueue=y}else p.add(u);break e}else{if(!(e&1)){Zb(i,l,e),Yv();break e}u=Error(te(426))}}else if(gt&&a.mode&1){var v=Jb(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),e_(v,o,a,i,e),Iv(Lu(u,a));break e}}i=u=Lu(u,a),Ut!==4&&(Ut=2),lc===null?lc=[i]:lc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=d2(i,u,e);Hb(i,g);break e;case 1:a=u;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Qi===null||!Qi.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var _=f2(i,a,e);Hb(i,_);break e}}i=i.return}while(i!==null)}R2(n)}catch(T){e=T,Mt===n&&n!==null&&(Mt=n=n.return);continue}break}while(!0)}function I2(){var t=mf.current;return mf.current=pf,t===null?pf:t}function Yv(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Yt===null||!(ua&268435455)&&!(_p&268435455)||Wi(Yt,ln)}function vf(t,e){var n=Ve;Ve|=2;var r=I2();(Yt!==t||ln!==e)&&(Ys=null,Qo(t,e));do try{i3();break}catch(s){$2(t,s)}while(!0);if(Rv(),Ve=n,mf.current=r,Mt!==null)throw Error(te(261));return Yt=null,ln=0,Ut}function i3(){for(;Mt!==null;)A2(Mt)}function o3(){for(;Mt!==null&&!AL();)A2(Mt)}function A2(t){var e=D2(t.alternate,t,nr);t.memoizedProps=t.pendingProps,e===null?R2(t):Mt=e,Gv.current=null}function R2(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=JM(n,e),n!==null){n.flags&=32767,Mt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ut=6,Mt=null;return}}else if(n=ZM(n,e,nr),n!==null){Mt=n;return}if(e=e.sibling,e!==null){Mt=e;return}Mt=e=t}while(e!==null);Ut===0&&(Ut=5)}function Oo(t,e,n){var r=He,s=Pr.transition;try{Pr.transition=null,He=1,a3(t,e,n,r)}finally{Pr.transition=s,He=r}return null}function a3(t,e,n,r){do Nu();while(zi!==null);if(Ve&6)throw Error(te(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(te(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(WL(t,i),t===Yt&&(Mt=Yt=null,ln=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||rd||(rd=!0,P2(Zd,function(){return Nu(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Pr.transition,Pr.transition=null;var o=He;He=1;var a=Ve;Ve|=4,Gv.current=null,t3(t,n),N2(n,t),EM(_y),ef=!!by,_y=by=null,t.current=n,n3(n),RL(),Ve=a,He=o,Pr.transition=i}else t.current=n;if(rd&&(rd=!1,zi=t,yf=s),i=t.pendingLanes,i===0&&(Qi=null),PL(n.stateNode),Yn(t,Rt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(gf)throw gf=!1,t=Uy,Uy=null,t;return yf&1&&t.tag!==0&&Nu(),i=t.pendingLanes,i&1?t===zy?cc++:(cc=0,zy=t):cc=0,vo(),null}function Nu(){if(zi!==null){var t=dN(yf),e=Pr.transition,n=He;try{if(Pr.transition=null,He=16>t?16:t,zi===null)var r=!1;else{if(t=zi,zi=null,yf=0,Ve&6)throw Error(te(331));var s=Ve;for(Ve|=4,he=t.current;he!==null;){var i=he,o=i.child;if(he.flags&16){var a=i.deletions;if(a!==null){for(var u=0;u<a.length;u++){var l=a[u];for(he=l;he!==null;){var c=he;switch(c.tag){case 0:case 11:case 15:uc(8,c,i)}var h=c.child;if(h!==null)h.return=c,he=h;else for(;he!==null;){c=he;var d=c.sibling,f=c.return;if(S2(c),c===l){he=null;break}if(d!==null){d.return=f,he=d;break}he=f}}}var p=i.alternate;if(p!==null){var y=p.child;if(y!==null){p.child=null;do{var v=y.sibling;y.sibling=null,y=v}while(y!==null)}}he=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,he=o;else e:for(;he!==null;){if(i=he,i.flags&2048)switch(i.tag){case 0:case 11:case 15:uc(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,he=g;break e}he=i.return}}var x=t.current;for(he=x;he!==null;){o=he;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,he=w;else e:for(o=x;he!==null;){if(a=he,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:bp(9,a)}}catch(T){kt(a,a.return,T)}if(a===o){he=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,he=_;break e}he=a.return}}if(Ve=s,vo(),Os&&typeof Os.onPostCommitFiberRoot=="function")try{Os.onPostCommitFiberRoot(fp,t)}catch{}r=!0}return r}finally{He=n,Pr.transition=e}}return!1}function f_(t,e,n){e=Lu(n,e),e=d2(t,e,1),t=Yi(t,e,1),e=Rn(),t!==null&&(Jc(t,1,e),Yn(t,e))}function kt(t,e,n){if(t.tag===3)f_(t,t,n);else for(;e!==null;){if(e.tag===3){f_(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qi===null||!Qi.has(r))){t=Lu(n,t),t=f2(e,t,1),e=Yi(e,t,1),t=Rn(),e!==null&&(Jc(e,1,t),Yn(e,t));break}}e=e.return}}function u3(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Rn(),t.pingedLanes|=t.suspendedLanes&n,Yt===t&&(ln&n)===n&&(Ut===4||Ut===3&&(ln&130023424)===ln&&500>Rt()-qv?Qo(t,0):Hv|=n),Yn(t,e)}function O2(t,e){e===0&&(t.mode&1?(e=qh,qh<<=1,!(qh&130023424)&&(qh=4194304)):e=1);var n=Rn();t=hi(t,e),t!==null&&(Jc(t,e,n),Yn(t,n))}function l3(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),O2(t,n)}function c3(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(e),O2(t,n)}var D2;D2=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Kn.current)Gn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Gn=!1,QM(t,e,n);Gn=!!(t.flags&131072)}else Gn=!1,gt&&e.flags&1048576&&MN(e,uf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Pd(t,e),t=e.pendingProps;var s=Ou(e,Sn.current);Cu(e,n),s=Bv(null,e,r,t,s,n);var i=Wv();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Xn(r)?(i=!0,of(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Pv(e),s.updater=wp,e.stateNode=s,s._reactInternals=e,Ay(e,r,t,n),e=Dy(null,e,r,!0,i,n)):(e.tag=0,gt&&i&&kv(e),kn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Pd(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=d3(r),t=Yr(r,t),s){case 0:e=Oy(null,e,r,t,n);break e;case 1:e=r_(null,e,r,t,n);break e;case 11:e=t_(null,e,r,t,n);break e;case 14:e=n_(null,e,r,Yr(r.type,t),n);break e}throw Error(te(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yr(r,s),Oy(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yr(r,s),r_(t,e,r,s,n);case 3:e:{if(y2(e),t===null)throw Error(te(387));r=e.pendingProps,i=e.memoizedState,s=i.element,jN(t,e),hf(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Lu(Error(te(423)),e),e=s_(t,e,r,n,s);break e}else if(r!==s){s=Lu(Error(te(424)),e),e=s_(t,e,r,n,s);break e}else for(ir=Xi(e.stateNode.containerInfo.firstChild),ur=e,gt=!0,Jr=null,n=UN(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Du(),r===s){e=di(t,e,n);break e}kn(t,e,r,n)}e=e.child}return e;case 5:return GN(e),t===null&&ky(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Sy(r,s)?o=null:i!==null&&Sy(r,i)&&(e.flags|=32),g2(t,e),kn(t,e,o,n),e.child;case 6:return t===null&&ky(e),null;case 13:return v2(t,e,n);case 4:return Fv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Pu(e,null,r,n):kn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yr(r,s),t_(t,e,r,s,n);case 7:return kn(t,e,e.pendingProps,n),e.child;case 8:return kn(t,e,e.pendingProps.children,n),e.child;case 12:return kn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,tt(lf,r._currentValue),r._currentValue=o,i!==null)if(hs(i.value,o)){if(i.children===s.children&&!Kn.current){e=di(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=ii(-1,n&-n),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),$y(i.return,n,e),a.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(te(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),$y(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}kn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Cu(e,n),s=Mr(s),r=r(s),e.flags|=1,kn(t,e,r,n),e.child;case 14:return r=e.type,s=Yr(r,e.pendingProps),s=Yr(r.type,s),n_(t,e,r,s,n);
vendor: 5,129 bytes, line 40
40case 15:return p2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yr(r,s),Pd(t,e),e.tag=1,Xn(r)?(t=!0,of(e)):t=!1,Cu(e,n),h2(e,r,s),Ay(e,r,s,n),Dy(null,e,r,!0,t,n);case 19:return x2(t,e,n);case 22:return m2(t,e,n)}throw Error(te(156,e.tag))};function P2(t,e){return uN(t,e)}function h3(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $r(t,e,n,r){return new h3(t,e,n,r)}function Qv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function d3(t){if(typeof t=="function")return Qv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===gv)return 11;if(t===yv)return 14}return 2}function Ji(t,e){var n=t.alternate;return n===null?(n=$r(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Md(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Qv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case eu:return Zo(n.children,s,i,e);case mv:o=8,s|=8;break;case ty:return t=$r(12,n,e,s|2),t.elementType=ty,t.lanes=i,t;case ny:return t=$r(13,n,e,s),t.elementType=ny,t.lanes=i,t;case ry:return t=$r(19,n,e,s),t.elementType=ry,t.lanes=i,t;case GC:return Sp(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case zC:o=10;break e;case jC:o=9;break e;case gv:o=11;break e;case yv:o=14;break e;case Pi:o=16,r=null;break e}throw Error(te(130,t==null?t:typeof t,""))}return e=$r(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Zo(t,e,n,r){return t=$r(7,t,r,e),t.lanes=n,t}function Sp(t,e,n,r){return t=$r(22,t,r,e),t.elementType=GC,t.lanes=n,t.stateNode={isHidden:!1},t}function gg(t,e,n){return t=$r(6,t,null,e),t.lanes=n,t}function yg(t,e,n){return e=$r(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function f3(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qm(0),this.expirationTimes=Qm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qm(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Zv(t,e,n,r,s,i,o,a,u){return t=new f3(t,e,n,a,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=$r(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pv(i),t}function p3(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ja,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function F2(t){if(!t)return io;t=t._reactInternals;e:{if(ka(t)!==t||t.tag!==1)throw Error(te(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Xn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(te(171))}if(t.tag===1){var n=t.type;if(Xn(n))return FN(t,n,e)}return e}function L2(t,e,n,r,s,i,o,a,u){return t=Zv(n,r,!0,t,s,i,o,a,u),t.context=F2(null),n=t.current,r=Rn(),s=Zi(n),i=ii(r,s),i.callback=e??null,Yi(n,i,s),t.current.lanes=s,Jc(t,s,r),Yn(t,r),t}function Tp(t,e,n,r){var s=e.current,i=Rn(),o=Zi(s);return n=F2(n),e.context===null?e.context=n:e.pendingContext=n,e=ii(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Yi(s,e,o),t!==null&&(as(t,s,o,i),Rd(t,s,o)),o}function xf(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function p_(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Jv(t,e){p_(t,e),(t=t.alternate)&&p_(t,e)}function m3(){return null}var M2=typeof reportError=="function"?reportError:function(t){console.error(t)};function ex(t){this._internalRoot=t}Cp.prototype.render=ex.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(te(409));Tp(t,e,null,null)};Cp.prototype.unmount=ex.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;la(function(){Tp(null,t,null,null)}),e[ci]=null}};function Cp(t){this._internalRoot=t}Cp.prototype.unstable_scheduleHydration=function(t){if(t){var e=mN();
vendor: 5,762 bytes, line 40
40t={blockedOn:null,target:t,priority:e};for(var n=0;n<Bi.length&&e!==0&&e<Bi[n].priority;n++);Bi.splice(n,0,t),n===0&&yN(t)}};function tx(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Np(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function m_(){}function g3(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var l=xf(o);i.call(l)}}var o=L2(e,r,t,0,null,!1,!1,"",m_);return t._reactRootContainer=o,t[ci]=o.current,Cc(t.nodeType===8?t.parentNode:t),la(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var l=xf(u);a.call(l)}}var u=Zv(t,0,!1,null,null,!1,!1,"",m_);return t._reactRootContainer=u,t[ci]=u.current,Cc(t.nodeType===8?t.parentNode:t),la(function(){Tp(e,u,n,r)}),u}function Ep(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var u=xf(o);a.call(u)}}Tp(e,o,t,s)}else o=g3(n,e,t,s,r);return xf(o)}fN=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Kl(e.pendingLanes);n!==0&&(wv(e,n|1),Yn(e,Rt()),!(Ve&6)&&(Mu=Rt()+500,vo()))}break;case 13:la(function(){var r=hi(t,1);if(r!==null){var s=Rn();as(r,t,1,s)}}),Jv(t,1)}};bv=function(t){if(t.tag===13){var e=hi(t,134217728);if(e!==null){var n=Rn();as(e,t,134217728,n)}Jv(t,134217728)}};pN=function(t){if(t.tag===13){var e=Zi(t),n=hi(t,e);if(n!==null){var r=Rn();as(n,t,e,r)}Jv(t,e)}};mN=function(){return He};gN=function(t,e){var n=He;try{return He=t,e()}finally{He=n}};fy=function(t,e,n){switch(e){case"input":if(oy(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=yp(r);if(!s)throw Error(te(90));qC(r),oy(r,s)}}}break;case"textarea":XC(t,n);break;case"select":e=n.value,e!=null&&bu(t,!!n.multiple,e,!1)}};nN=Kv;rN=la;var y3={usingClientEntryPoint:!1,Events:[th,su,yp,eN,tN,Kv]},Bl={findFiberByHostInstance:Wo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},v3={bundleType:Bl.bundleType,version:Bl.version,rendererPackageName:Bl.rendererPackageName,rendererConfig:Bl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:bi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=oN(t),t===null?null:t.stateNode},findFiberByHostInstance:Bl.findFiberByHostInstance||m3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sd.isDisabled&&sd.supportsFiber)try{fp=sd.inject(v3),Os=sd}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=y3;fr.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tx(e))throw Error(te(200));return p3(t,e,null,n)};fr.createRoot=function(t,e){if(!tx(t))throw Error(te(299));var n=!1,r="",s=M2;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Zv(t,1,!1,null,null,n,!1,r,s),t[ci]=e.current,Cc(t.nodeType===8?t.parentNode:t),new ex(e)};fr.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(te(188)):(t=Object.keys(t).join(","),Error(te(268,t)));return t=oN(e),t=t===null?null:t.stateNode,t};fr.flushSync=function(t){return la(t)};fr.hydrate=function(t,e,n){if(!Np(e))throw Error(te(200));return Ep(null,t,e,!0,n)};fr.hydrateRoot=function(t,e,n){if(!tx(t))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=M2;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=L2(e,null,t,1,n??null,s,!1,i,o),t[ci]=e.current,Cc(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new Cp(e)};fr.render=function(t,e,n){if(!Np(e))throw Error(te(200));return Ep(null,t,e,!1,n)};fr.unmountComponentAtNode=function(t){if(!Np(t))throw Error(te(40));return t._reactRootContainer?(la(function(){Ep(null,null,t,!1,function(){t._reactRootContainer=null,t[ci]=null})}),!0):!1};fr.unstable_batchedUpdates=Kv;fr.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Np(n))throw Error(te(200));if(t==null||t._reactInternals===void 0)throw Error(te(38));return Ep(t,e,n,!1,r)};fr.version="18.3.1-next-f1338f8080-20240426";function V2(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(V2)}catch(t){console.error(t)}}V2(),VC.exports=fr;var x3=VC.exports,B2,g_=x3;B2=g_.createRoot,g_.hydrateRoot;function w3(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}function kp(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Hy=t=>Array.isArray(t);function W2(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Dc(t){return typeof t=="string"||Array.isArray(t)}function y_(t){const e=[{},{}];
vendor: 5,519 bytes, line 40
40return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function nx(t,e,n,r){if(typeof e=="function"){const[s,i]=y_(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=y_(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function $p(t,e,n){const r=t.getProps();return nx(r,e,n!==void 0?n:r.custom,t)}const rx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sx=["initial",...rx],rh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],$a=new Set(rh),Ps=t=>t*1e3,Fs=t=>t/1e3,b3={type:"spring",stiffness:500,damping:25,restSpeed:10},_3=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),S3={type:"keyframes",duration:.8},T3={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},C3=(t,{keyframes:e})=>e.length>2?S3:$a.has(t)?t.startsWith("scale")?_3(e[1]):b3:T3;function ix(t,e){return t?t[e]||t.default||t:void 0}const N3={skipAnimations:!1,useManualTiming:!1},E3=t=>t!==null;function Ip(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(E3),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const _n=t=>t;function k3(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){i.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,c=!1,h=!1)=>{const f=h&&r?e:n;return c&&i.add(l),f.has(l)||f.add(l),l},cancel:l=>{n.delete(l),i.delete(l)},process:l=>{if(o=l,r){s=!0;return}r=!0,[e,n]=[n,e],n.clear(),e.forEach(a),r=!1,s&&(s=!1,u.process(l))}};return u}const id=["read","resolveKeyframes","update","preRender","render","postRender"],$3=40;function U2(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=id.reduce((g,x)=>(g[x]=k3(i),g),{}),{read:a,resolveKeyframes:u,update:l,preRender:c,render:h,postRender:d}=o,f=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,$3),1),s.timestamp=g,s.isProcessing=!0,a.process(s),u.process(s),l.process(s),c.process(s),h.process(s),d.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(f))},p=()=>{n=!0,r=!0,s.isProcessing||t(f)};return{schedule:id.reduce((g,x)=>{const w=o[x];return g[x]=(_,T=!1,E=!1)=>(n||p(),w.schedule(_,T,E)),g},{}),cancel:g=>{for(let x=0;x<id.length;x++)o[id[x]].cancel(g)},state:s,steps:o}}const{schedule:Ge,cancel:fi,state:an,steps:vg}=U2(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0),z2=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,I3=1e-7,A3=12;function R3(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=z2(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>I3&&++a<A3);return o}function sh(t,e,n,r){if(t===e&&n===r)return _n;const s=i=>R3(i,0,1,t,n);return i=>i===0||i===1?i:z2(s(i),e,r)}const j2=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,G2=t=>e=>1-t(1-e),H2=sh(.33,1.53,.69,.99),ox=G2(H2),q2=j2(ox),K2=t=>(t*=2)<1?.5*ox(t):.5*(2-Math.pow(2,-10*(t-1))),ax=t=>1-Math.sin(Math.acos(t)),X2=G2(ax),Y2=j2(ax),Q2=t=>/^0[^.\s]+$/u.test(t);function O3(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Q2(t):!0}let qy=_n;const Z2=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),J2=t=>e=>typeof e=="string"&&e.startsWith(t),eE=J2("--"),D3=J2("var(--"),ux=t=>D3(t)?P3.test(t.split("/*")[0].trim()):!1,P3=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,F3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function L3(t){const e=F3.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function tE(t,e,n=1){const[r,s]=L3(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return Z2(o)?parseFloat(o):o}return ux(s)?tE(s,e,n+1):s}const oo=(t,e,n)=>n>e?e:n<t?t:n,ol={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Pc={...ol,transform:t=>oo(0,1,t)},od={...ol,default:1},ih=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Di=ih("deg"),Ls=ih("%"),ye=ih("px"),M3=ih("vh"),V3=ih("vw"),v_={...Ls,parse:t=>Ls.parse(t)/100,transform:t=>Ls.transform(t*100)},B3=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),x_=t=>t===ol||t===ye,w_=(t,e)=>parseFloat(t.split(", ")[e]),b_=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return w_(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?w_(i[1],t):0}},W3=new Set(["x","y","z"]),U3=rh.filter(t=>!W3.has(t));function z3(t){const e=[];return U3.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Vu={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:b_(4,13),y:b_(5,14)};Vu.translateX=Vu.x;Vu.translateY=Vu.y;const nE=t=>e=>e.test(t),j3={test:t=>t==="auto",parse:t=>t},rE=[ol,ye,Ls,Di,V3,M3,j3],__=t=>rE.find(nE(t)),Jo=new Set;let Ky=!1,Xy=!1;function sE(){if(Xy){const t=Array.from(Jo).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=z3(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);
vendor: 4,748 bytes, line 40
40s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Xy=!1,Ky=!1,Jo.forEach(t=>t.complete()),Jo.clear()}function iE(){Jo.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Xy=!0)})}function G3(){iE(),sE()}class lx{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Jo.add(this),Ky||(Ky=!0,Ge.read(iE),Ge.resolveKeyframes(sE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const u=r.readValue(n,a);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Jo.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Jo.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const hc=t=>Math.round(t*1e5)/1e5,cx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function H3(t){return t==null}const q3=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,hx=(t,e)=>n=>!!(typeof n=="string"&&q3.test(n)&&n.startsWith(t)||e&&!H3(n)&&Object.prototype.hasOwnProperty.call(n,e)),oE=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(cx);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},K3=t=>oo(0,255,t),xg={...ol,transform:t=>Math.round(K3(t))},jo={test:hx("rgb","red"),parse:oE("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+xg.transform(t)+", "+xg.transform(e)+", "+xg.transform(n)+", "+hc(Pc.transform(r))+")"};function X3(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Yy={test:hx("#"),parse:X3,transform:jo.transform},hu={test:hx("hsl","hue"),parse:oE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ls.transform(hc(e))+", "+Ls.transform(hc(n))+", "+hc(Pc.transform(r))+")"},gn={test:t=>jo.test(t)||Yy.test(t)||hu.test(t),parse:t=>jo.test(t)?jo.parse(t):hu.test(t)?hu.parse(t):Yy.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?jo.transform(t):hu.transform(t)},Y3=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Q3(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(cx))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Y3))===null||n===void 0?void 0:n.length)||0)>0}const aE="number",uE="color",Z3="var",J3="var(",S_="${}",eV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fc(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(eV,u=>(gn.test(u)?(r.color.push(i),s.push(uE),n.push(gn.parse(u))):u.startsWith(J3)?(r.var.push(i),s.push(Z3),n.push(u)):(r.number.push(i),s.push(aE),n.push(parseFloat(u))),++i,S_)).split(S_);return{values:n,split:a,indexes:r,types:s}}function lE(t){return Fc(t).values}function cE(t){const{split:e,types:n}=Fc(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=n[o];a===aE?i+=hc(s[o]):a===uE?i+=gn.transform(s[o]):i+=s[o]}return i}}const tV=t=>typeof t=="number"?0:t;function nV(t){const e=lE(t);return cE(t)(e.map(tV))}const ao={test:Q3,parse:lE,createTransformer:cE,getAnimatableNone:nV},rV=new Set(["brightness","contrast","saturate","opacity"]);function sV(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(cx)||[];if(!r)return t;const s=n.replace(r,"");let i=rV.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const iV=/\b([a-z-]*)\(.*?\)/gu,Qy={...ao,getAnimatableNone:t=>{const e=t.match(iV);return e?e.map(sV).join(" "):t}},oV={borderWidth:ye,borderTopWidth:ye,borderRightWidth:ye,borderBottomWidth:ye,borderLeftWidth:ye,borderRadius:ye,radiu
vendor: 7,363 bytes, line 40
40s:ye,borderTopLeftRadius:ye,borderTopRightRadius:ye,borderBottomRightRadius:ye,borderBottomLeftRadius:ye,width:ye,maxWidth:ye,height:ye,maxHeight:ye,top:ye,right:ye,bottom:ye,left:ye,padding:ye,paddingTop:ye,paddingRight:ye,paddingBottom:ye,paddingLeft:ye,margin:ye,marginTop:ye,marginRight:ye,marginBottom:ye,marginLeft:ye,backgroundPositionX:ye,backgroundPositionY:ye},aV={rotate:Di,rotateX:Di,rotateY:Di,rotateZ:Di,scale:od,scaleX:od,scaleY:od,scaleZ:od,skew:Di,skewX:Di,skewY:Di,distance:ye,translateX:ye,translateY:ye,translateZ:ye,x:ye,y:ye,z:ye,perspective:ye,transformPerspective:ye,opacity:Pc,originX:v_,originY:v_,originZ:ye},T_={...ol,transform:Math.round},dx={...oV,...aV,zIndex:T_,size:ye,fillOpacity:Pc,strokeOpacity:Pc,numOctaves:T_},uV={...dx,color:gn,backgroundColor:gn,outlineColor:gn,fill:gn,stroke:gn,borderColor:gn,borderTopColor:gn,borderRightColor:gn,borderBottomColor:gn,borderLeftColor:gn,filter:Qy,WebkitFilter:Qy},fx=t=>uV[t];function hE(t,e){let n=fx(t);return n!==Qy&&(n=ao),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const lV=new Set(["auto","none","0"]);function cV(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!lV.has(i)&&Fc(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=hE(n,s)}class dE extends lx{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let l=e[u];if(typeof l=="string"&&(l=l.trim(),ux(l))){const c=tE(l,n.current);c!==void 0&&(e[u]=c),u===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!B3.has(r)||e.length!==2)return;const[s,i]=e,o=__(s),a=__(i);if(o!==a)if(x_(o)&&x_(a))for(let u=0;u<e.length;u++){const l=e[u];typeof l=="string"&&(e[u]=parseFloat(l))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)O3(e[s])&&r.push(s);r.length&&cV(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Vu[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Vu[r](n.measureViewportBox(),window.getComputedStyle(n.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([u,l])=>{n.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Ap(t){return typeof t=="function"}let Vd;function hV(){Vd=void 0}const Ms={now:()=>(Vd===void 0&&Ms.set(an.isProcessing||N3.useManualTiming?an.timestamp:performance.now()),Vd),set:t=>{Vd=t,queueMicrotask(hV)}},C_=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ao.test(t)||t==="0")&&!t.startsWith("url("));function dV(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function fV(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=C_(s,e),a=C_(i,e);return!o||!a?!1:dV(t)||(n==="spring"||Ap(n))&&r}const pV=40;class fE{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ms.now(),this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>pV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&G3(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=Ms.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!fV(e,r,s,i))if(o)this.options.duration=0;else{u==null||u(Ip(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function pE(t,e){return e?t*(1e3/e):0}const mV=5;function mE(t,e,n){const r=Math.max(e-mV,0);return pE(n-t(r),e-r)}const wg=.001,gV=.01,yV=10,vV=.05,xV=1;function wV({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let s,i,o=1-e;o=oo(vV,xV,o),t=oo(gV,yV,Fs(t)),o<1?(s=l=>{const c=l*o,h=c*t,d=c-n,f=Zy(l,o),p=Math.exp(-h);return wg-d/f*p},i=l=>{const h=l*o*t,d=h*n+n,f=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-h),y=Zy(Math.pow(l,2),o);return(-s(l)+wg>0?-1:1)*((d-f)*p)/y}):(s=l=>{const c=Math.exp(-l*t),h=(l-n)*t+1;return-wg+c*h},i=l=>{const c=Math.exp(-l*t),h=(n-l)*(t*t);return c*h});const a=5/t,u=_V(s,i,a);if(t=Ps(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*r;return{stiffness:l,damping:o*2*Math.sqrt(r*l),duration:t}}}const bV=12;function _V(t,e,n){let r=n;for(let s=1;s<bV;s++)r=r-t(r)/e(r);return r}function Zy(t,e){return t*Math.sqrt(1-e*e)}const SV=["duration","bounce"],TV=["stiffness","damping","mass"];function N_(t,e){return e.some(n=>t[n]!==void 0)}function CV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!N_(t,TV)&&N_(t,SV)){const n=wV(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function px({keyframes:t,restDelta:e,restSpeed:n,...r}){const s=t[0],i=t[t.length-1],o={done:!1,value:s},{stiffness:a,damping:u,mass:l,duration:c,velocity:h,isResolvedFromDuration:d}=CV({...r,velocity:-Fs(r.velocity||0)}),f=h||0,p=u/(2*Math.sqrt(a*l)),y=i-s,v=Fs(Math.sqrt(a/l)),g=Math.abs(y)<5;n||(n=g?.01:2),e||(e=g?.005:.5);let x;if(p<1){const w=Zy(v,p);x=_=>{const T=Math.exp(-p*v*_);return i-T*((f+p*v*y)/w*Math.sin(w*_)+y*Math.cos(w*_))}}else if(p===1)x=w=>i-Math.exp(-v*w)*(y+(f+v*y)*w);else{const w=v*Math.sqrt(p*p-1);x=_=>{const T=Math.exp(-p*v*_),E=Math.min(w*_,300);return i-T*((f+p*v*y)*Math.sinh(E)+w*y*Math.cosh(E))/w}}return{calculatedDuration:d&&c||null,next:w=>{const _=x(w);if(d)o.done=w>=c;else{let T=0;p<1&&(T=w===0?Ps(f):mE(x,w,_));const E=Math.abs(T)<=n,k=Math.abs(i-_)<=e;o.done=E&&k}return o.value=o.done?i:_,o}}}function E_({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},f=N=>a!==void 0&&N<a||u!==void 0&&N>u,p=N=>a===void 0?u:u===void 0||Math.abs(a-N)<Math.abs(u-N)?a:u;let y=n*e;const v=h+y,g=o===void 0?v:o(v);g!==v&&(y=g-h);const x=N=>-y*Math.exp(-N/r),w=N=>g+x(N),_=N=>{const O=x(N),R=w(N);d.done=Math.abs(O)<=l,d.value=d.done?g:R};let T,E;const k=N=>{f(d.value)&&(T=N,E=px({keyframes:[d.value,p(d.value)],velocity:mE(w,N,d.value),damping:s,stiffness:i,restDelta:l,restSpeed:c}))};return k(0),{calculatedDuration:null,next:N=>{let O=!1;return!E&&T===void 0&&(O=!0,_(N),k(N)),T!==void 0&&N>=T?E.next(N-T):(!O&&_(N),d)}}}
vendor: 4,140 bytes, line 40
40const NV=sh(.42,0,1,1),EV=sh(0,0,.58,1),gE=sh(.42,0,.58,1),yE=t=>Array.isArray(t)&&typeof t[0]!="number",mx=t=>Array.isArray(t)&&typeof t[0]=="number",k_={linear:_n,easeIn:NV,easeInOut:gE,easeOut:EV,circIn:ax,circInOut:Y2,circOut:X2,backIn:ox,backInOut:q2,backOut:H2,anticipate:K2},$_=t=>{if(mx(t)){qy(t.length===4);const[e,n,r,s]=t;return sh(e,n,r,s)}else if(typeof t=="string")return qy(k_[t]!==void 0),k_[t];return t},kV=(t,e)=>n=>e(t(n)),oi=(...t)=>t.reduce(kV),ca=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},yt=(t,e,n)=>t+(e-t)*n;function bg(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function $V({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,u=2*n-a;s=bg(u,a,t+1/3),i=bg(u,a,t),o=bg(u,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function wf(t,e){return n=>n>0?e:t}const _g=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},IV=[Yy,jo,hu],AV=t=>IV.find(e=>e.test(t));function I_(t){const e=AV(t);if(!e)return!1;let n=e.parse(t);return e===hu&&(n=$V(n)),n}const A_=(t,e)=>{const n=I_(t),r=I_(e);if(!n||!r)return wf(t,e);const s={...n};return i=>(s.red=_g(n.red,r.red,i),s.green=_g(n.green,r.green,i),s.blue=_g(n.blue,r.blue,i),s.alpha=yt(n.alpha,r.alpha,i),jo.transform(s))},Jy=new Set(["none","hidden"]);function RV(t,e){return Jy.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function OV(t,e){return n=>yt(t,e,n)}function gx(t){return typeof t=="number"?OV:typeof t=="string"?ux(t)?wf:gn.test(t)?A_:FV:Array.isArray(t)?vE:typeof t=="object"?gn.test(t)?A_:DV:wf}function vE(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>gx(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function DV(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=gx(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function PV(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=t.indexes[o][s[o]],u=(n=t.values[a])!==null&&n!==void 0?n:0;r[i]=u,s[o]++}return r}const FV=(t,e)=>{const n=ao.createTransformer(e),r=Fc(t),s=Fc(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Jy.has(t)&&!s.values.length||Jy.has(e)&&!r.values.length?RV(t,e):oi(vE(PV(r,s),s.values),n):wf(t,e)};function xE(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?yt(t,e,n):gx(t)(t,e)}function LV(t,e,n){const r=[],s=n||xE,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const u=Array.isArray(e)?e[o]||_n:e;a=oi(u,a)}r.push(a)}return r}function MV(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(qy(i===e.length),i===1)return()=>e[0];if(i===2&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=LV(e,r,s),a=o.length,u=l=>{let c=0;if(a>1)for(;c<t.length-2&&!(l<t[c+1]);c++);const h=ca(t[c],t[c+1],l);return o[c](h)};return n?l=>u(oo(t[0],t[i-1],l)):u}function wE(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ca(0,e,r);t.push(yt(n,1,s))}}function bE(t){const e=[0];return wE(e,t.length-1),e}function VV(t,e){return t.map(n=>n*e)}function BV(t,e){return t.map(()=>e||gE).splice(0,t.length-1)}function bf({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=yE(r)?r.map($_):$_(r),i={done:!1,value:e[0]},o=VV(n&&n.length===e.length?n:bE(e),t),a=MV(o,e,{ease:Array.isArray(s)?s:BV(e,s)});return{calculatedDuration:t,next:u=>(i.value=a(u),i.done=u>=t,i)}}const e0=2e4;function _E(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<e0;)e+=n,r=t.next(e);return e>=e0?1/0:e}const WV=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Ge.update(e,!0),stop:()=>fi(e),now:()=>an.isProcessing?an.timestamp:Ms.now()}},UV={decay:E_,inertia:E_,tween:bf,keyframes:bf,spring:px},zV=t=>t/100;class yx extends fE{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>
vendor: 63,016 bytes, line 40
40{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||lx,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(i,a,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=Ap(n)?n:UV[n]||bf;let u,l;a!==bf&&typeof e[0]!="number"&&(u=oi(zV,xE(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});i==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=_E(c));const{calculatedDuration:h}=c,d=h+s,f=d*(r+1)-s;return{generator:c,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:h,resolvedDuration:d,totalDuration:f}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:c,resolvedDuration:h}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:f,repeatType:p,repeatDelay:y,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),x=this.speed>=0?g<0:g>c;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let w=this.currentTime,_=i;if(f){const N=Math.min(this.currentTime,c)/h;let O=Math.floor(N),R=N%1;!R&&N>=1&&(R=1),R===1&&O--,O=Math.min(O,f+1),!!(O%2)&&(p==="reverse"?(R=1-R,y&&(R-=y/h)):p==="mirror"&&(_=o)),w=oo(0,1,R)*h}const T=x?{done:!1,value:u[0]}:_.next(w);a&&(T.value=a(T.value));let{done:E}=T;!x&&l!==null&&(E=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return k&&s!==void 0&&(T.value=Ip(u,this.options,s)),v&&v(T.value),k&&this.finish(),T}get duration(){const{resolved:e}=this;return e?Fs(e.calculatedDuration):0}get time(){return Fs(this.currentTime)}set time(e){e=Ps(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Fs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=WV,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const jV=new Set(["opacity","clipPath","filter","transform"]),GV=10,HV=(t,e)=>{let n="";const r=Math.max(Math.round(e/GV),2);for(let s=0;s<r;s++)n+=t(ca(0,r-1,s))+", ";return`linear(${n.substring(0,n.length-2)})`};function vx(t){let e;return()=>(e===void 0&&(e=t()),e)}const qV={linearEasing:void 0};function KV(t,e){const n=vx(t);return()=>{var r;return(r=qV[e])!==null&&r!==void 0?r:n()}}const _f=KV(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function SE(t){return!!(typeof t=="function"&&_f()||!t||typeof t=="string"&&(t in t0||_f())||mx(t)||Array.isArray(t)&&t.every(SE))}const Yl=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,t0={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yl([0,.65,.55,1]),circOut:Yl([.55,0,1,.45]),backIn:Yl([.31,.01,.66,-.59]),backOut:Yl([.33,1.53,.69,.99])};function TE(t,e){if(t)return typeof t=="function"&&_f()?HV(t,e):mx(t)?Yl(t):Array.isArray(t)?t.map(n=>TE(n,e)||t0.easeOut):t0[t]}function XV(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:n};u&&(l.offset=u);const c=TE(a,s);return Array.isArray(c)&&(l.easing=c),t.animate(l,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}function R_(t,e){t.timeline=e,t.onfinish=null}const YV=vx(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Sf=10,QV=2e4;function ZV(t){return Ap(t.type)||t.type==="spring"||!SE(t.ease)}function JV(t,e){const n=new yx({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<QV;)r=n.sample(i),s.push(r.value),i+=Sf;return{times:void 0,keyframes:s,duration:i-Sf,ease:"linear"}}const CE={anticipate:K2,backInOut:q2,circInOut:Y2};function eB(t){return t in CE}class O_ extends fE{constructor(e){super(e);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new dE(i,(o,a)=>this.onKeyframesResolved(o,a),n,r,s),this.resolver.scheduleResolve()}initPlayback(e,n){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:u,name:l,startTime:c}=this.options;if(!(!((r=u.owner)===null||r===void 0)&&r.current))return!1;if(typeof o=="string"&&_f()&&eB(o)&&(o=CE[o]),ZV(this.options)){const{onComplete:d,onUpdate:f,motionValue:p,element:y,...v}=this.options,g=JV(e,v);e=g.keyframes,e.length===1&&(e[1]=e[0]),s=g.duration,i=g.times,o=g.ease,a="keyframes"}const h=XV(u.owner.current,l,e,{...this.options,duration:s,times:i,ease:o});return h.startTime=c??this.calcStartTime(),this.pendingTimeline?(R_(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:d}=this.options;u.set(Ip(e,this.options,n)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return Fs(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return Fs(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Ps(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return _n;const{animation:r}=n;R_(r,e)}return _n}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:c,onComplete:h,element:d,...f}=this.options,p=new yx({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),y=Ps(this.time);l.setWithVelocity(p.sample(y-Sf).value,p.sample(y).value,Sf)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return YV()&&r&&jV.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}const tB=vx(()=>window.ScrollTimeline!==void 0);class NE{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e,n){const r=this.animations.map(s=>tB()&&s.attachTimeline?s.attachTimeline(e):n(s));return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function nB({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:u,elapsed:l,...c}){return!!Object.keys(c).length}const xx=(t,e,n,r={},s,i)=>o=>{const a=ix(r,t)||{},u=a.delay||r.delay||0;let{elapsed:l=0}=r;l=l-Ps(u);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};nB(a)||(c={...c,...C3(t,c)}),c.duration&&(c.duration=Ps(c.duration)),c.repeatDelay&&(c.repeatDelay=Ps(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let h=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(h=!0)),h&&!i&&e.get()!==void 0){const d=Ip(c.keyframes,a);if(d!==void 0)return Ge.update(()=>{c.onUpdate(d),c.onComplete()}),new NE([])}return!i&&O_.supports(c)?new O_(c):new yx(c)},rB=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),sB=t=>Hy(t)?t[t.length-1]||0:t;function wx(t,e){t.indexOf(e)===-1&&t.push(e)}function Rp(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class bx{constructor(){this.subscriptions=[]}add(e){return wx(this.subscriptions,e),()=>Rp(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const D_=30,iB=t=>!isNaN(parseFloat(t));class oB{constructor(e,n={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Ms.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Ms.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=iB(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new bx);const r=this.events[e].add(n);return e==="change"?()=>{r(),Ge.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ms.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>D_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,D_);return pE(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Bu(t,e){return new oB(t,e)}function aB(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Bu(n))}function uB(t,e){const n=$p(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=sB(i[o]);aB(t,o,a)}}const _x=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lB="framerAppearId",EE="data-"+_x(lB);function kE(t){return t.props[EE]}const Vt=t=>!!(t&&t.getVelocity);function cB(t){return!!(Vt(t)&&t.add)}function n0(t,e){const n=t.getValue("willChange");if(cB(n))return n.add(e)}function hB({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function Sx(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;r&&(o=r);const l=[],c=s&&t.animationState&&t.animationState.getState()[s];for(const h in u){const d=t.getValue(h,(i=t.latestValues[h])!==null&&i!==void 0?i:null),f=u[h];if(f===void 0||c&&hB(c,h))continue;const p={delay:n,...ix(o||{},h)};let y=!1;if(window.MotionHandoffAnimation){const g=kE(t);if(g){const x=window.MotionHandoffAnimation(g,h,Ge);x!==null&&(p.startTime=x,y=!0)}}n0(t,h),d.start(xx(h,d,f,t.shouldReduceMotion&&$a.has(h)?{type:!1}:p,t,y));const v=d.animation;v&&l.push(v)}return a&&Promise.all(l).then(()=>{Ge.update(()=>{a&&uB(t,a)})}),l}function r0(t,e,n={}){var r;const s=$p(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(Sx(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:h,staggerDirection:d}=i;return dB(t,e,c+l,h,d,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[l,c]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function dB(t,e,n=0,r=0,s=1,i){const o=[],a=(t.variantChildren.size-1)*r,u=s===1?(l=0)=>l*r:(l=0)=>a-l*r;return Array.from(t.variantChildren).sort(fB).forEach((l,c)=>{l.notify("AnimationStart",e),o.push(r0(l,e,{...i,delay:n+u(c)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function fB(t,e){return t.sortNodePosition(e)}function pB(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>r0(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=r0(t,e,n);else{const s=typeof e=="function"?$p(t,e,n.custom):e;r=Promise.all(Sx(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const mB=sx.length;function $E(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?$E(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<mB;n++){const r=sx[n],s=t.props[r];(Dc(s)||s===!1)&&(e[r]=s)}return e}const gB=[...rx].reverse(),yB=rx.length;function vB(t){return e=>Promise.all(e.map(({animation:n,options:r})=>pB(t,n,r)))}function xB(t){let e=vB(t),n=P_(),r=!0;const s=u=>(l,c)=>{var h;const d=$p(t,c,u==="exit"?(h=t.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(d){const{transition:f,transitionEnd:p,...y}=d;l={...l,...y,...p}}return l};function i(u){e=u(t)}function o(u){const{props:l}=t,c=$E(t.parent)||{},h=[],d=new Set;let f={},p=1/0;for(let v=0;v<yB;v++){const g=gB[v],x=n[g],w=l[g]!==void 0?l[g]:c[g],_=Dc(w),T=g===u?x.isActive:null;T===!1&&(p=v);let E=w===c[g]&&w!==l[g]&&_;if(E&&r&&t.manuallyAnimateOnMount&&(E=!1),x.protectedKeys={...f},!x.isActive&&T===null||!w&&!x.prevProp||kp(w)||typeof w=="boolean")continue;const k=wB(x.prevProp,w);let N=k||g===u&&x.isActive&&!E&&_||v>p&&_,O=!1;const R=Array.isArray(w)?w:[w];let L=R.reduce(s(g),{});T===!1&&(L={});const{prevResolvedValues:W={}}=x,G={...W,...L},H=Y=>{N=!0,d.has(Y)&&(O=!0,d.delete(Y)),x.needsAnimating[Y]=!0;const j=t.getValue(Y);j&&(j.liveStyle=!1)};for(const Y in G){const j=L[Y],q=W[Y];if(f.hasOwnProperty(Y))continue;let Z=!1;Hy(j)&&Hy(q)?Z=!W2(j,q):Z=j!==q,Z?j!=null?H(Y):d.add(Y):j!==void 0&&d.has(Y)?H(Y):x.protectedKeys[Y]=!0}x.prevProp=w,x.prevResolvedValues=L,x.isActive&&(f={...f,...L}),r&&t.blockInitialAnimation&&(N=!1),N&&(!(E&&k)||O)&&h.push(...R.map(Y=>({animation:Y,options:{type:g}})))}if(d.size){const v={};d.forEach(g=>{const x=t.getBaseTarget(g),w=t.getValue(g);w&&(w.liveStyle=!0),v[g]=x??null}),h.push({animation:v})}let y=!!h.length;return r&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(y=!1),r=!1,y?e(h):Promise.resolve()}function a(u,l){var c;if(n[u].isActive===l)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var f;return(f=d.animationState)===null||f===void 0?void 0:f.setActive(u,l)}),n[u].isActive=l;const h=o(u);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=P_(),r=!0}}}function wB(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!W2(e,t):!1}function $o(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function P_(){return{animate:$o(!0),whileInView:$o(),whileHover:$o(),whileTap:$o(),whileDrag:$o(),whileFocus:$o(),exit:$o()}}class xo{constructor(e){this.isMounted=!1,this.node=e}update(){}}class bB extends xo{constructor(e){super(e),e.animationState||(e.animationState=xB(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();kp(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _B=0;class SB extends xo{constructor(){super(...arguments),this.id=_B++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const TB={animation:{Feature:bB},exit:{Feature:SB}},IE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Op(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const CB=t=>e=>IE(e)&&t(e,Op(e));function si(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function ai(t,e,n,r){return si(t,e,CB(n),r)}const F_=(t,e)=>Math.abs(t-e);function NB(t,e){const n=F_(t.x,e.x),r=F_(t.y,e.y);return Math.sqrt(n**2+r**2)}class AE{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Tg(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,f=NB(h.offset,{x:0,y:0})>=3;if(!d&&!f)return;const{point:p}=h,{timestamp:y}=an;this.history.push({...p,timestamp:y});const{onStart:v,onMove:g}=this.handlers;d||(v&&v(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,h)},this.handlePointerMove=(h,d)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Sg(d,this.transformPagePoint),Ge.update(this.updatePoint,!0)},this.handlePointerUp=(h,d)=>{this.end();const{onEnd:f,onSessionEnd:p,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Tg(h.type==="pointercancel"?this.lastMoveEventInfo:Sg(d,this.transformPagePoint),this.history);this.startEvent&&f&&f(h,v),p&&p(h,v)},!IE(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Op(e),a=Sg(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=an;this.history=[{...u,timestamp:l}];const{onSessionStart:c}=n;c&&c(e,Tg(a,this.history)),this.removeListeners=oi(ai(this.contextWindow,"pointermove",this.handlePointerMove),ai(this.contextWindow,"pointerup",this.handlePointerUp),ai(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),fi(this.updatePoint)}}function Sg(t,e){return e?{point:e(t.point)}:t}function L_(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Tg({point:t},e){return{point:t,delta:L_(t,RE(e)),offset:L_(t,EB(e)),velocity:kB(e,.1)}}function EB(t){return t[0]}function RE(t){return t[t.length-1]}function kB(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=RE(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Ps(e)));)n--;if(!r)return{x:0,y:0};const i=Fs(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function OE(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const M_=OE("dragHorizontal"),V_=OE("dragVertical");function DE(t){let e=!1;if(t==="y")e=V_();else if(t==="x")e=M_();else{const n=M_(),r=V_();n&&r?e=()=>{n(),r()}:(n&&n(),r&&r())}return e}function PE(){const t=DE(!0);return t?(t(),!1):!0}function du(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const FE=1e-4,$B=1-FE,IB=1+FE,LE=.01,AB=0-LE,RB=0+LE;function dr(t){return t.max-t.min}function OB(t,e,n){return Math.abs(t-e)<=n}function B_(t,e,n,r=.5){t.origin=r,t.originPoint=yt(e.min,e.max,t.origin),t.scale=dr(n)/dr(e),t.translate=yt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=$B&&t.scale<=IB||isNaN(t.scale))&&(t.scale=1),(t.translate>=AB&&t.translate<=RB||isNaN(t.translate))&&(t.translate=0)}function dc(t,e,n,r){B_(t.x,e.x,n.x,r?r.originX:void 0),B_(t.y,e.y,n.y,r?r.originY:void 0)}function W_(t,e,n){t.min=n.min+e.min,t.max=t.min+dr(e)}function DB(t,e,n){W_(t.x,e.x,n.x),W_(t.y,e.y,n.y)}function U_(t,e,n){t.min=e.min-n.min,t.max=t.min+dr(e)}function fc(t,e,n){U_(t.x,e.x,n.x),U_(t.y,e.y,n.y)}function PB(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?yt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?yt(n,t,r.max):Math.min(t,n)),t}function z_(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function FB(t,{top:e,left:n,bottom:r,right:s}){return{x:z_(t.x,n,s),y:z_(t.y,e,r)}}function j_(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function LB(t,e){return{x:j_(t.x,e.x),y:j_(t.y,e.y)}}function MB(t,e){let n=.5;const r=dr(t),s=dr(e);return s>r?n=ca(e.min,e.max-r,t.min):r>s&&(n=ca(t.min,t.max-s,e.min)),oo(0,1,n)}function VB(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const s0=.35;function BB(t=s0){return t===!1?t=0:t===!0&&(t=s0),{x:G_(t,"left","right"),y:G_(t,"top","bottom")}}function G_(t,e,n){return{min:H_(t,e),max:H_(t,n)}}function H_(t,e){return typeof t=="number"?t:t[e]||0}const q_=()=>({translate:0,scale:1,origin:0,originPoint:0}),fu=()=>({x:q_(),y:q_()}),K_=()=>({min:0,max:0}),Et=()=>({x:K_(),y:K_()});function Tr(t){return[t("x"),t("y")]}function ME({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function WB({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function UB(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Cg(t){return t===void 0||t===1}function i0({scale:t,scaleX:e,scaleY:n}){return!Cg(t)||!Cg(e)||!Cg(n)}function Do(t){return i0(t)||VE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function VE(t){return X_(t.x)||X_(t.y)}function X_(t){return t&&t!=="0%"}function Tf(t,e,n){const r=t-n,s=e*r;return n+s}function Y_(t,e,n,r,s){return s!==void 0&&(t=Tf(t,s,r)),Tf(t,n,r)+e}function o0(t,e=0,n=1,r,s){t.min=Y_(t.min,e,n,r,s),t.max=Y_(t.max,e,n,r,s)}function BE(t,{x:e,y:n}){o0(t.x,e.translate,e.scale,e.originPoint),o0(t.y,n.translate,n.scale,n.originPoint)}const Q_=.999999999999,Z_=1.0000000000001;function zB(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=n[a],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&mu(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,BE(t,o)),r&&Do(i.latestValues)&&mu(t,i.latestValues))}e.x<Z_&&e.x>Q_&&(e.x=1),e.y<Z_&&e.y>Q_&&(e.y=1)}function pu(t,e){t.min=t.min+e,t.max=t.max+e}function J_(t,e,n,r,s=.5){const i=yt(t.min,t.max,s);o0(t,e,n,i,r)}function mu(t,e){J_(t.x,e.x,e.scaleX,e.scale,e.originX),J_(t.y,e.y,e.scaleY,e.scale,e.originY)}function WE(t,e){return ME(UB(t.getBoundingClientRect(),e))}function jB(t,e,n){const r=WE(t,n),{scroll:s}=e;return s&&(pu(r.x,s.offset.x),pu(r.y,s.offset.y)),r}const UE=({current:t})=>t?t.ownerDocument.defaultView:null,GB=new WeakMap;class HB{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Et(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Op(c,"page").point)},i=(c,h)=>{const{drag:d,dragPropagation:f,onDragStart:p}=this.getProps();if(d&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=DE(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Tr(v=>{let g=this.getAxisMotionValue(v).get()||0;if(Ls.test(g)){const{projection:x}=this.visualElement;if(x&&x.layout){const w=x.layout.layoutBox[v];w&&(g=dr(w)*(parseFloat(g)/100))}}this.originPoint[v]=g}),p&&Ge.postRender(()=>p(c,h)),n0(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},o=(c,h)=>{const{dragPropagation:d,dragDirectionLock:f,onDirectionLock:p,onDrag:y}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:v}=h;if(f&&this.currentDirection===null){this.currentDirection=qB(v),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",h.point,v),this.updateAxis("y",h.point,v),this.visualElement.render(),y&&y(c,h)},a=(c,h)=>this.stop(c,h),u=()=>Tr(c=>{var h;return this.getAnimationState(c)==="paused"&&((h=this.getAxisMotionValue(c).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new AE(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:UE(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Ge.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!ad(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=PB(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&du(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=FB(s.layoutBox,n):this.constraints=!1,this.elastic=BB(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Tr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=VB(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!du(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=jB(r,s.root,this.visualElement.getTransformPagePoint());let o=LB(s.layout.layoutBox,i);if(n){const a=n(WB(o));this.hasMutatedConstraints=!!a,a&&(o=ME(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=Tr(c=>{if(!ad(c,n,this.currentDirection))return;let h=u&&u[c]||{};o&&(h={min:0,max:0});const d=s?200:1e6,f=s?40:1e7,p={type:"inertia",velocity:r?e[c]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(c,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return n0(this.visualElement,e),r.start(xx(e,r,0,n,this.visualElement,!1))}stopAnimation(){Tr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Tr(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Tr(n=>{const{drag:r}=this.getProps();if(!ad(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(e[n]-yt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!du(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Tr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();s[o]=MB({min:u,max:u},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Tr(o=>{if(!ad(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(yt(u,l,s[o]))})}addListeners(){if(!this.visualElement.current)return;GB.set(this.visualElement,this);const e=this.visualElement.current,n=ai(e,"pointerdown",u=>{const{drag:l,dragListener:c=!0}=this.getProps();l&&c&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();du(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ge.read(r);const o=si(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(Tr(c=>{const h=this.getAxisMotionValue(c);h&&(this.originPoint[c]+=u[c].translate,h.set(h.get()+u[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=s0,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function ad(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function qB(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class KB extends xo{constructor(e){super(e),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new HB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_n}unmount(){this.removeGroupControls(),this.removeListeners()}}const eS=t=>(e,n)=>{t&&Ge.postRender(()=>t(e,n))};class XB extends xo{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(e){this.session=new AE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:UE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:eS(e),onStart:eS(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&Ge.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=ai(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Dp=ee.createContext(null);function YB(){const t=ee.useContext(Dp);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,s=ee.useId();ee.useEffect(()=>r(s),[]);const i=ee.useCallback(()=>n&&n(s),[s,n]);return!e&&n?[!1,i]:[!0]}const Tx=ee.createContext({}),zE=ee.createContext({}),Bd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function tS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Wl={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ye.test(t))t=parseFloat(t);else return t;const n=tS(t,e.target.x),r=tS(t,e.target.y);return`${n}% ${r}%`}},QB={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=ao.parse(t);if(s.length>5)return r;const i=ao.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,u=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=u;const l=yt(a,u,.5);return typeof s[2+o]=="number"&&(s[2+o]/=l),typeof s[3+o]=="number"&&(s[3+o]/=l),i(s)}},Cf={};function ZB(t){Object.assign(Cf,t)}const{schedule:Cx,cancel:Cme}=U2(queueMicrotask,!1);class JB extends ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;ZB(e4),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Bd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Ge.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Cx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function jE(t){const[e,n]=YB(),r=ee.useContext(Tx);return Ce.jsx(JB,{...t,layoutGroup:r,switchLayoutGroup:ee.useContext(zE),isPresent:e,safeToRemove:n})}const e4={borderRadius:{...Wl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Wl,borderTopRightRadius:Wl,borderBottomLeftRadius:Wl,borderBottomRightRadius:Wl,boxShadow:QB},GE=["TopLeft","TopRight","BottomLeft","BottomRight"],t4=GE.length,nS=t=>typeof t=="string"?parseFloat(t):t,rS=t=>typeof t=="number"||ye.test(t);function n4(t,e,n,r,s,i){s?(t.opacity=yt(0,n.opacity!==void 0?n.opacity:1,r4(r)),t.opacityExit=yt(e.opacity!==void 0?e.opacity:1,0,s4(r))):i&&(t.opacity=yt(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<t4;o++){const a=`border${GE[o]}Radius`;let u=sS(e,a),l=sS(n,a);if(u===void 0&&l===void 0)continue;u||(u=0),l||(l=0),u===0||l===0||rS(u)===rS(l)?(t[a]=Math.max(yt(nS(u),nS(l),r),0),(Ls.test(l)||Ls.test(u))&&(t[a]+="%")):t[a]=l}(e.rotate||n.rotate)&&(t.rotate=yt(e.rotate||0,n.rotate||0,r))}function sS(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const r4=HE(0,.5,X2),s4=HE(.5,.95,_n);function HE(t,e,n){return r=>r<t?0:r>e?1:n(ca(t,e,r))}function iS(t,e){t.min=e.min,t.max=e.max}function _r(t,e){iS(t.x,e.x),iS(t.y,e.y)}function oS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function aS(t,e,n,r,s){return t-=e,t=Tf(t,1/n,r),s!==void 0&&(t=Tf(t,1/s,r)),t}function i4(t,e=0,n=1,r=.5,s,i=t,o=t){if(Ls.test(e)&&(e=parseFloat(e),e=yt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=yt(i.min,i.max,r);t===i&&(a-=e),t.min=aS(t.min,e,n,a,s),t.max=aS(t.max,e,n,a,s)}function uS(t,e,[n,r,s],i,o){i4(t,e[n],e[r],e[s],e.scale,i,o)}const o4=["x","scaleX","originX"],a4=["y","scaleY","originY"];function lS(t,e,n,r){uS(t.x,e,o4,n?n.x:void 0,r?r.x:void 0),uS(t.y,e,a4,n?n.y:void 0,r?r.y:void 0)}function cS(t){return t.translate===0&&t.scale===1}function qE(t){return cS(t.x)&&cS(t.y)}function hS(t,e){return t.min===e.min&&t.max===e.max}function u4(t,e){return hS(t.x,e.x)&&hS(t.y,e.y)}function dS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function KE(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function fS(t){return dr(t.x)/dr(t.y)}function pS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class l4{constructor(){this.members=[]}add(e){wx(this.members,e),e.scheduleRender()}remove(e){if(Rp(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function c4(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:l,rotate:c,rotateX:h,rotateY:d,skewX:f,skewY:p}=n;l&&(r=`perspective(${l}px) ${r}`),c&&(r+=`rotate(${c}deg) `),h&&(r+=`rotateX(${h}deg) `),d&&(r+=`rotateY(${d}deg) `),f&&(r+=`skewX(${f}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(r+=`scale(${a}, ${u})`),r||"none"}const h4=(t,e)=>t.depth-e.depth;class d4{constructor(){this.children=[],this.isDirty=!1}add(e){wx(this.children,e),this.isDirty=!0}remove(e){Rp(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h4),this.isDirty=!1,this.children.forEach(e)}}function Wd(t){const e=Vt(t)?t.get():t;return rB(e)?e.toValue():e}function f4(t,e){const n=Ms.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(fi(r),t(i-e))};return Ge.read(r,!0),()=>fi(r)}function XE(t){return t instanceof SVGElement&&t.tagName!=="svg"}function YE(t,e,n){const r=Vt(t)?t:Bu(t);return r.start(xx("",r,e,n)),r.animation}const Po={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ql=typeof window<"u"&&window.MotionDebug!==void 0,Ng=["","X","Y","Z"],p4={visibility:"hidden"},mS=1e3;let m4=0;function Eg(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function QE(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=kE(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ge,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&QE(r)}function ZE({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=m4++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ql&&(Po.totalNodes=Po.resolvedTargetDeltas=Po.recalculatedProjection=0),this.nodes.forEach(v4),this.nodes.forEach(S4),this.nodes.forEach(T4),this.nodes.forEach(x4),Ql&&window.MotionDebug.record(Po)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new d4)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new bx),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const u=this.eventHandlers.get(o);u&&u.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=XE(o),this.instance=o;const{layoutId:u,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(l||u)&&(this.isLayoutDirty=!0),t){let h;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=f4(d,250),Bd.hasAnimatedSinceResize&&(Bd.hasAnimatedSinceResize=!1,this.nodes.forEach(yS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&c&&(u||l)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:d,hasRelativeTargetChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||$4,{onLayoutAnimationStart:v,onLayoutAnimationComplete:g}=c.getProps(),x=!this.targetLayout||!KE(this.targetLayout,p)||f,w=!d&&f;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||d&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,w);const _={...ix(y,"layout"),onPlay:v,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else d||yS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,fi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(C4),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&QE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const h=this.path[c];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:u}=this.options;if(a===void 0&&!u)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(gS);return}this.isUpdating||this.nodes.forEach(b4),this.isUpdating=!1,this.nodes.forEach(_4),this.nodes.forEach(g4),this.nodes.forEach(y4),this.clearAllSnapshots();const a=Ms.now();an.delta=oo(0,1e3/60,a-an.timestamp),an.timestamp=a,an.isProcessing=!0,vg.update.process(an),vg.preRender.process(an),vg.render.process(an),an.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(w4),this.sharedNodes.forEach(N4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ge.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ge.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Et(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!qE(this.projectionDelta),u=this.getTransformTemplate(),l=u?u(this.latestValues,""):void 0,c=l!==this.prevTransformTemplateValue;o&&(a||Do(this.latestValues)||c)&&(s(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let u=this.removeElementScroll(a);return o&&(u=this.removeTransform(u)),I4(u),{animationId:this.root.animationId,measuredBox:a,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:a}=this.options;if(!a)return Et();const u=a.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(A4))){const{scroll:c}=this.root;c&&(pu(u.x,c.offset.x),pu(u.y,c.offset.y))}return u}removeElementScroll(o){var a;const u=Et();if(_r(u,o),!((a=this.scroll)===null||a===void 0)&&a.wasRoot)return u;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:h,options:d}=c;c!==this.root&&h&&d.layoutScroll&&(h.wasRoot&&_r(u,o),pu(u.x,h.offset.x),pu(u.y,h.offset.y))}return u}applyTransform(o,a=!1){const u=Et();_r(u,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&mu(u,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Do(c.latestValues)&&mu(u,c.latestValues)}return Do(this.latestValues)&&mu(u,this.latestValues),u}removeTransform(o){const a=Et();_r(a,o);for(let u=0;u<this.path.length;u++){const l=this.path[u];if(!l.instance||!Do(l.latestValues))continue;i0(l.latestValues)&&l.updateSnapshot();const c=Et(),h=l.measurePageBox();_r(c,h),lS(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,c)}return Do(this.latestValues)&&lS(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==an.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==u;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:d}=this.options;if(!(!this.layout||!(h||d))){if(this.resolvedRelativeTargetAt=an.timestamp,!this.targetDelta&&!this.relativeTarget){const f=this.getClosestProjectingParent();f&&f.layout&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Et(),this.relativeTargetOrigin=Et(),fc(this.relativeTargetOrigin,this.layout.layoutBox,f.layout.layoutBox),_r(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Et(),this.targetWithTransforms=Et()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),DB(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):_r(this.target,this.layout.layoutBox),BE(this.target,this.targetDelta)):_r(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const f=this.getClosestProjectingParent();f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Et(),this.relativeTargetOrigin=Et(),fc(this.relativeTargetOrigin,this.target,f.target),_r(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ql&&Po.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||i0(this.parent.latestValues)||VE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),u=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(l=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===an.timestamp&&(l=!1),l)return;const{layout:c,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||h))return;_r(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,f=this.treeScale.y;zB(this.layoutCorrected,this.treeScale,this.path,u),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Et());const{target:p}=a;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(oS(this.prevProjectionDelta.x,this.projectionDelta.x),oS(this.prevProjectionDelta.y,this.projectionDelta.y)),dc(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==f||!pS(this.projectionDelta.x,this.prevProjectionDelta.x)||!pS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Ql&&Po.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)===null||a===void 0||a.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=fu(),this.projectionDelta=fu(),this.projectionDeltaWithTransform=fu()}setAnimationOrigin(o,a=!1){const u=this.snapshot,l=u?u.latestValues:{},c={...this.latestValues},h=fu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=Et(),f=u?u.source:void 0,p=this.layout?this.layout.source:void 0,y=f!==p,v=this.getStack(),g=!v||v.members.length<=1,x=!!(y&&!g&&this.options.crossfade===!0&&!this.path.some(k4));this.animationProgress=0;let w;this.mixTargetDelta=_=>{const T=_/1e3;vS(h.x,o.x,T),vS(h.y,o.y,T),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fc(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),E4(this.relativeTarget,this.relativeTargetOrigin,d,T),w&&u4(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Et()),_r(w,this.relativeTarget)),y&&(this.animationValues=c,n4(c,l,this.latestValues,T,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(fi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ge.update(()=>{Bd.hasAnimatedSinceResize=!0,this.currentAnimation=YE(0,mS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(mS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:c}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&JE(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||Et();const h=dr(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const d=dr(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+d}_r(a,u),mu(a,c),dc(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new l4),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&Eg("z",o,l,this.animationValues);for(let c=0;c<Ng.length;c++)Eg(`rotate${Ng[c]}`,o,l,this.animationValues),Eg(`skew${Ng[c]}`,o,l,this.animationValues);o.render();for(const c in l)o.setStaticValue(c,l[c]),this.animationValues&&(this.animationValues[c]=l[c]);o.scheduleRender()}getProjectionStyles(o){var a,u;if(!this.instance||this.isSVG)return;if(!this.isVisible)return p4;const l={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,l.opacity="",l.pointerEvents=Wd(o==null?void 0:o.pointerEvents)||"",l.transform=c?c(this.latestValues,""):"none",l;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const y={};return this.options.layoutId&&(y.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,y.pointerEvents=Wd(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Do(this.latestValues)&&(y.transform=c?c({},""):"none",this.hasProjected=!1),y}const d=h.animationValues||h.latestValues;this.applyTransformsToTarget(),l.transform=c4(this.projectionDeltaWithTransform,this.treeScale,d),c&&(l.transform=c(d,l.transform));const{x:f,y:p}=this.projectionDelta;l.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,h.animationValues?l.opacity=h===this?(u=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&u!==void 0?u:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:l.opacity=h===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const y in Cf){if(d[y]===void 0)continue;const{correct:v,applyTo:g}=Cf[y],x=l.transform==="none"?d[y]:v(d[y],h);if(g){const w=g.length;for(let _=0;_<w;_++)l[g[_]]=x}else l[y]=x}return this.options.layoutId&&(l.pointerEvents=h===this?Wd(o==null?void 0:o.pointerEvents)||"":"none"),l}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(gS),this.root.sharedNodes.clear()}}}function g4(t){t.updateLayout()}function y4(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?Tr(h=>{const d=o?n.measuredBox[h]:n.layoutBox[h],f=dr(d);d.min=r[h].min,d.max=d.min+f}):JE(i,n.layoutBox,r)&&Tr(h=>{const d=o?n.measuredBox[h]:n.layoutBox[h],f=dr(r[h]);d.max=d.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+f)});const a=fu();dc(a,r,n.layoutBox);const u=fu();o?dc(u,t.applyTransform(s,!0),n.measuredBox):dc(u,r,n.layoutBox);const l=!qE(a);let c=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:d,layout:f}=h;if(d&&f){const p=Et();fc(p,n.layoutBox,d.layoutBox);const y=Et();fc(y,r,f.layoutBox),KE(p,y)||(c=!0),h.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=p,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function v4(t){Ql&&Po.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function x4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function w4(t){t.clearSnapshot()}function gS(t){t.clearMeasurements()}function b4(t){t.isLayoutDirty=!1}function _4(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function yS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function S4(t){t.resolveTargetDelta()}function T4(t){t.calcProjection()}
40function C4(t){t.resetSkewAndRotation()}function N4(t){t.removeLeadSnapshot()}function vS(t,e,n){t.translate=yt(e.translate,0,n),t.scale=yt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function xS(t,e,n,r){t.min=yt(e.min,n.min,r),t.max=yt(e.max,n.max,r)}function E4(t,e,n,r){xS(t.x,e.x,n.x,r),xS(t.y,e.y,n.y,r)}function k4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const $4={duration:.45,ease:[.4,0,.1,1]},wS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),bS=wS("applewebkit/")&&!wS("chrome/")?Math.round:_n;function _S(t){t.min=bS(t.min),t.max=bS(t.max)}function I4(t){_S(t.x),_S(t.y)}function JE(t,e,n){return t==="position"||t==="preserve-aspect"&&!OB(fS(e),fS(n),.2)}function A4(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const R4=ZE({attachResizeListener:(t,e)=>si(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),kg={current:void 0},ek=ZE({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!kg.current){const t=new R4({});t.mount(window),t.setOptions({layoutScroll:!0}),kg.current=t}return kg.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),O4={pan:{Feature:XB},drag:{Feature:KB,ProjectionNode:ek,MeasureLayout:jE}};function SS(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||PE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[r];u&&Ge.postRender(()=>u(i,o))};return ai(t.current,n,s,{passive:!t.getProps()[r]})}class D4 extends xo{mount(){this.unmount=oi(SS(this.node,!0),SS(this.node,!1))}unmount(){}}class P4 extends xo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=oi(si(this.node.current,"focus",()=>this.onFocus()),si(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const tk=(t,e)=>e?t===e?!0:tk(t,e.parentElement):!1;function $g(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Op(n))}class F4 extends xo{constructor(){super(...arguments),this.removeStartListeners=_n,this.removeEndListeners=_n,this.removeAccessibleListeners=_n,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=ai(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:c,globalTapTarget:h}=this.node.getProps(),d=!h&&!tk(this.node.current,a.target)?c:l;d&&Ge.update(()=>d(a,u))},{passive:!(r.onTap||r.onPointerUp)}),o=ai(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=oi(i,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||$g("up",(u,l)=>{const{onTap:c}=this.node.getProps();c&&Ge.postRender(()=>c(u,l))})};this.removeEndListeners(),this.removeEndListeners=si(this.node.current,"keyup",o),$g("down",(a,u)=>{this.startPress(a,u)})},n=si(this.node.current,"keydown",e),r=()=>{this.isPressing&&$g("cancel",(i,o)=>this.cancelPress(i,o))},s=si(this.node.current,"blur",r);this.removeAccessibleListeners=oi(n,s)}}startPress(e,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Ge.postRender(()=>r(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!PE()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Ge.postRender(()=>r(e,n))}mount(){const e=this.node.getProps(),n=ai(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=si(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=oi(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const a0=new WeakMap,Ig=new WeakMap,L4=t=>{const e=a0.get(t.target);e&&e(t)}
vendor: 20,225 bytes, line 40
40,M4=t=>{t.forEach(L4)};function V4({root:t,...e}){const n=t||document;Ig.has(n)||Ig.set(n,{});const r=Ig.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(M4,{root:t,...e})),r[s]}function B4(t,e,n){const r=V4(e);return a0.set(t,n),r.observe(t),()=>{a0.delete(t),r.unobserve(t)}}const W4={some:0,all:1};class U4 extends xo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:W4[s]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,i&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:c,onViewportLeave:h}=this.node.getProps(),d=l?c:h;d&&d(u)};return B4(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(z4(e,n))&&this.startObserver()}unmount(){}}function z4({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const j4={inView:{Feature:U4},tap:{Feature:F4},focus:{Feature:P4},hover:{Feature:D4}},G4={layout:{ProjectionNode:ek,MeasureLayout:jE}},Pp=ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Fp=ee.createContext({}),Nx=typeof window<"u",Ex=Nx?ee.useLayoutEffect:ee.useEffect,nk=ee.createContext({strict:!1});function H4(t,e,n,r,s){var i,o;const{visualElement:a}=ee.useContext(Fp),u=ee.useContext(nk),l=ee.useContext(Dp),c=ee.useContext(Pp).reducedMotion,h=ee.useRef();r=r||u.renderer,!h.current&&r&&(h.current=r(t,{visualState:e,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=h.current,f=ee.useContext(zE);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&q4(h.current,n,s,f);const p=ee.useRef(!1);ee.useInsertionEffect(()=>{d&&p.current&&d.update(n,l)});const y=n[EE],v=ee.useRef(!!y&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,y))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,y)));return Ex(()=>{d&&(p.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),Cx.render(d.render),v.current&&d.animationState&&d.animationState.animateChanges())}),ee.useEffect(()=>{d&&(!v.current&&d.animationState&&d.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,y)}),v.current=!1))}),d}function q4(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:rk(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&du(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:l})}function rk(t){if(t)return t.options.allowProjection!==!1?t.projection:rk(t.parent)}function K4(t,e,n){return ee.useCallback(r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):du(n)&&(n.current=r))},[e])}function Lp(t){return kp(t.animate)||sx.some(e=>Dc(t[e]))}function sk(t){return!!(Lp(t)||t.variants)}function X4(t,e){if(Lp(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Dc(n)?n:void 0,animate:Dc(r)?r:void 0}}return t.inherit!==!1?e:{}}function Y4(t){const{initial:e,animate:n}=X4(t,ee.useContext(Fp));return ee.useMemo(()=>({initial:e,animate:n}),[TS(e),TS(n)])}function TS(t){return Array.isArray(t)?t.join(" "):t}const CS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in CS)Wu[t]={isEnabled:e=>CS[t].some(n=>!!e[n])};function Q4(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const Z4=Symbol.for("motionComponentSymbol");function J4({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){t&&Q4(t);function i(a,u){let l;const c={...ee.useContext(Pp),...a,layoutId:eW(a)},{isStatic:h}=c,d=Y4(a),f=r(a,h);if(!h&&Nx){tW();const p=nW(c);l=p.MeasureLayout,d.visualElement=H4(s,f,c,e,p.ProjectionNode)}return Ce.jsxs(Fp.Provider,{value:d,children:[l&&d.visualElement?Ce.jsx(l,{visualElement:d.visualElement,...c}):null,n(s,a,K4(f,d.visualElement,u),f,h,d.visualElement)]})}const o=ee.forwardRef(i);return o[Z4]=s,o}function eW({layoutId:t}){const e=ee.useContext(Tx).id;return e&&t!==void 0?e+"-"+t:t}function tW(t,e){ee.useContext(nk).strict}function nW(t){const{drag:e,layout:n}=Wu;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const rW=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function kx(t){return typeof t!="string"||t.includes("-")?!1:!!(rW.indexOf(t)>-1||/[A-Z]/u.test(t))}function ik(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const ok=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ak(t,e,n,r){ik(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(ok.has(s)?s:_x(s),e.attrs[s])}function uk(t,{layout:e,layoutId:n}){return $a.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Cf[t]||t==="opacity")}function $x(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(Vt(s[o])||e.style&&Vt(e.style[o])||uk(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function lk(t,e,n){const r=$x(t,e,n);for(const s in t)if(Vt(t[s])||Vt(e[s])){const i=rh.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function Mp(t){const e=ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function sW({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,s,i){const o={latestValues:iW(r,s,i,t),renderState:e()};return n&&(o.mount=a=>n(r,a,o)),o}const ck=t=>(e,n)=>{const r=ee.useContext(Fp),s=ee.useContext(Dp),i=()=>sW(t,e,r,s);return n?i():Mp(i)};function iW(t,e,n,r){const s={},i=r(t,{});for(const d in i)s[d]=Wd(i[d]);let{initial:o,animate:a}=t;const u=Lp(t),l=sk(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const h=c?a:o;if(h&&typeof h!="boolean"&&!kp(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const p=nx(t,d[f]);if(p){const{transitionEnd:y,transition:v,...g}=p;for(const x in g){let w=g[x];if(Array.isArray(w)){const _=c?w.length-1:0;w=w[_]}w!==null&&(s[x]=w)}for(const x in y)s[x]=y[x]}}}return s}const Ix=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),hk=()=>({...Ix(),attrs:{}}),dk=(t,e)=>e&&typeof t=="number"?e.transform(t):t,oW={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aW=rh.length;function uW(t,e,n){let r="",s=!0;for(let i=0;i<aW;i++){const o=rh[i],a=t[o];if(a===void 0)continue;let u=!0;if(typeof a=="number"?u=a===(o.startsWith("scale")?1:0):u=parseFloat(a)===0,!u||n){const l=dk(a,dx[o]);if(!u){s=!1;const c=oW[o]||o;r+=`${c}(${l}) `}n&&(e[o]=l)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Ax(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,a=!1;for(const u in e){const l=e[u];if($a.has(u)){o=!0;continue}else if(eE(u)){s[u]=l;continue}else{const c=dk(l,dx[u]);u.startsWith("origin")?(a=!0,i[u]=c):r[u]=c}}if(e.transform||(o||n?r.transform=uW(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:u="50%",originY:l="50%",originZ:c=0}=i;r.transformOrigin=`${u} ${l} ${c}`}}function NS(t,e,n){return typeof t=="string"?t:ye.transform(e+n*t)}function lW(t,e,n){const r=NS(e,t.x,t.width),s=NS(n,t.y,t.height);return`${r} ${s}`}const cW={offset:"stroke-dashoffset",array:"stroke-dasharray"},hW={offset:"strokeDashoffset",array:"strokeDasharray"};function dW(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?cW:hW;t[i.offset]=ye.transform(-r);const o=ye.transform(e),a=ye.transform(n);t[i.array]=`${o} ${a}`}function Rx(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:u=0,...l},c,h){if(Ax(t,l,h),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:p}=t;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(s!==void 0||i!==void 0||f.transform)&&(f.transformOrigin=lW(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(d.x=e),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),o!==void 0&&dW(d,o,a,u,!1)}const Ox=t=>typeof t=="string"&&t.toLowerCase()==="svg",fW={useVisualState:ck({scrapeMotionValuesFromProps:lk,createRenderState:hk,onMount:(t,e,{renderState:n,latestValues:r})=>{Ge.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Ge.render(()=>{Rx(n,r,Ox(e.tagName),t.transformTemplate),ak(e,n)})}})},pW={useVisualState:ck({scrapeMotionValuesFromProps:$x,createRenderState:Ix})};function fk(t,e,n){for(const r in e)!Vt(e[r])&&!uk(r,n)&&(t[r]=e[r])}function mW({transformTemplate:t},e){return ee.useMemo(()=>{const n=Ix();return Ax(n,e,t),Object.assign({},n.vars,n.style)},[e])}function gW(t,e){const n=t.style||{},r={};return fk(r,n,t),Object.assign(r,mW(t,e)),r}function yW(t,e){const n={},r=gW(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const vW=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Nf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||vW.has(t)}let pk=t=>!Nf(t);function xW(t){t&&(pk=e=>e.startsWith("on")?!Nf(e):t(e))}try{xW(require("@emotion/is-prop-valid").default)}catch{}function wW(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(pk(s)||n===!0&&Nf(s)||!e&&!Nf(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function bW(t,e,n,r){const s=ee.useMemo(()=>{const i=hk();return Rx(i,e,Ox(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};fk(i,t.style,t),s.style={...i,...s.style}}return s}function _W(t=!1){return(n,r,s,{latestValues:i},o)=>{const u=(kx(n)?bW:yW)(r,i,o,n),l=wW(r,typeof n=="string",t),c=n!==ee.Fragment?{...l,...u,ref:s}:{},{children:h}=r,d=ee.useMemo(()=>Vt(h)?h.get():h,[h]);return ee.createElement(n,{...c,children:d})}}function SW(t,e){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...kx(r)?fW:pW,preloadedFeatures:t,useRender:_W(s),createVisualElement:e,Component:r};return J4(o)}}const u0={current:null},mk={current:!1};function TW(){if(mk.current=!0,!!Nx)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>u0.current=t.matches;t.addListener(e),e()}else u0.current=!1}function CW(t,e,n){for(const r in e){const s=e[r],i=n[r];if(Vt(s))t.addValue(r,s);else if(Vt(i))t.addValue(r,Bu(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,Bu(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Uu=new WeakMap,NW=[...rE,gn,ao],EW=t=>NW.find(nE(t)),ES=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class gk{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=lx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=Ms.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,Ge.render(this.render,!1,!0))};const{latestValues:u,renderState:l}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=l,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Lp(n),this.isVariantNode=sk(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in h){const f=h[d];u[d]!==void 0&&Vt(f)&&f.set(u[d],!1)}}mount(e){this.current=e,Uu.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),mk.current||TW(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:u0.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uu.delete(this.current),this.projection&&this.projection.unmount(),fi(this.notifyUpdate),fi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=$a.has(e),s=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Ge.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const n=Wu[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Et()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<ES.length;r++){const s=ES[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=CW(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Bu(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(Z2(s)||Q2(s))?s=parseFloat(s):!EW(s)&&ao.test(n)&&(s=hE(e,n)),this.setBaseTarget(e,Vt(s)?s.get():s)),Vt(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=nx(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Vt(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new bx),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class yk extends gk{constructor(){super(...arguments),this.KeyframeResolver=dE}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}}function kW(t){return window.getComputedStyle(t)}class vk extends yk{constructor(){super(...arguments),this.type="html",this.renderInstance=ik}readValueFromInstance(e,n){if($a.has(n)){const r=fx(n);return r&&r.default||0}else{const r=kW(e),s=(eE(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return WE(e,n)}build(e,n,r){Ax(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return $x(e,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Vt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class xk extends yk{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Et}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if($a.has(n)){const r=fx(n);return r&&r.default||0}return n=ok.has(n)?n:_x(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return lk(e,n,r)}build(e,n,r){Rx(e,n,this.isSVGTag,r.transformTemplate)}
40renderInstance(e,n,r,s){ak(e,n,r,s)}mount(e){this.isSVGTag=Ox(e.tagName),super.mount(e)}}const $W=(t,e)=>kx(t)?new xk(e):new vk(e,{allowProjection:t!==ee.Fragment}),IW=SW({...TB,...j4,...O4,...G4},$W),rs=w3(IW);class AW extends ee.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function RW({children:t,isPresent:e}){const n=ee.useId(),r=ee.useRef(null),s=ee.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=ee.useContext(Pp);return ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
41          [data-motion-pop-id="${n}"] {
42            position: absolute !important;
43            width: ${o}px !important;
44            height: ${a}px !important;
45            top: ${u}px !important;
46            left: ${l}px !important;
47          }
48        `),()=>{document.head.removeChild(c)}},[e]),Ce.jsx(AW,{isPresent:e,childRef:r,sizeRef:s,children:ee.cloneElement(t,{ref:r})})}const OW=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=Mp(DW),u=ee.useId(),l=ee.useCallback(h=>{a.set(h,!0);for(const d of a.values())if(!d)return;r&&r()},[a,r]),c=ee.useMemo(()=>({id:u,initial:e,isPresent:n,custom:s,onExitComplete:l,register:h=>(a.set(h,!1),()=>a.delete(h))}),i?[Math.random(),l]:[n,l]);return ee.useMemo(()=>{a.forEach((h,d)=>a.set(d,!1))},[n]),ee.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(t=Ce.jsx(RW,{isPresent:n,children:t})),Ce.jsx(Dp.Provider,{value:c,children:t})};function DW(){return new Map}const ud=t=>t.key||"";function kS(t){const e=[];return ee.Children.forEach(t,n=>{ee.isValidElement(n)&&e.push(n)}),e}const $S=({children:t,exitBeforeEnter:e,custom:n,initial:r=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:o="sync"})=>{const a=ee.useMemo(()=>kS(t),[t]),u=a.map(ud),l=ee.useRef(!0),c=ee.useRef(a),h=Mp(()=>new Map),[d,f]=ee.useState(a),[p,y]=ee.useState(a);Ex(()=>{l.current=!1,c.current=a;for(let x=0;x<p.length;x++){const w=ud(p[x]);u.includes(w)?h.delete(w):h.get(w)!==!0&&h.set(w,!1)}},[p,u.length,u.join("-")]);const v=[];if(a!==d){let x=[...a];for(let w=0;w<p.length;w++){const _=p[w],T=ud(_);u.includes(T)||(x.splice(w,0,_),v.push(_))}o==="wait"&&v.length&&(x=v),y(kS(x)),f(a);return}const{forceRender:g}=ee.useContext(Tx);return Ce.jsx(Ce.Fragment,{children:p.map(x=>{const w=ud(x),_=a===p||u.includes(w),T=()=>{if(h.has(w))h.set(w,!0);else return;let E=!0;h.forEach(k=>{k||(E=!1)}),E&&(g==null||g(),y(c.current),s&&s())};return Ce.jsx(OW,{isPresent:_,initial:!l.current||r?void 0:!1,custom:_?void 0:n,presenceAffectsLayout:i,mode:o,onExitComplete:_?void 0:T,children:x},w)})})};function wk(t){const e=Mp(()=>Bu(t)),{isStatic:n}=ee.useContext(Pp);if(n){const[,r]=ee.useState(t);ee.useEffect(()=>e.on("change",r),[])}return e}function PW(t,e){const n=wk(e()),r=()=>n.set(e());return r(),Ex(()=>{const s=()=>Ge.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),fi(r)}}),n}function FW(t,...e){const n=t.length;function r(){let s="";for(let i=0;i<n;i++){s+=t[i];const o=e[i];o&&(s+=Vt(o)?o.get():o)}return s}return PW(e.filter(Vt),r)}function LW(t,e,n){var r;if(typeof t=="string"){let s=document;n?((r=n[t])!==null&&r!==void 0||(n[t]=s.querySelectorAll(t)),t=n[t]):t=s.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}function MW(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(_E(r),e0);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Fs(s)}}function Dx(t){return typeof t=="object"&&!Array.isArray(t)}function bk(t,e,n,r){return typeof t=="string"&&Dx(e)?LW(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function IS(t,e,n,r){var s;return typeof e=="number"?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):e==="<"?n:(s=r.get(e))!==null&&s!==void 0?s:t}const VW=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function BW(t,e){return yE(t)?t[VW(0,t.length,e)]:t}function WW(t,e,n){for(let r=0;r<t.length;r++){const s=t[r];s.at>
48e&&s.at<n&&(Rp(t,s),r--)}}function UW(t,e,n,r,s,i){WW(t,s,i);for(let o=0;o<e.length;o++)t.push({value:e[o],at:yt(s,i,r[o]),easing:BW(n,o)})}function zW(t,e){return t.at===e.at?t.value===null?1:e.value===null?-1:0:t.at-e.at}const jW="easeInOut";function GW(t,{defaultTransition:e={},...n}={},r,s){const i=e.duration||.3,o=new Map,a=new Map,u={},l=new Map;let c=0,h=0,d=0;for(let f=0;f<t.length;f++){const p=t[f];if(typeof p=="string"){l.set(p,h);continue}else if(!Array.isArray(p)){l.set(p.name,IS(h,p.at,c,l));continue}let[y,v,g={}]=p;g.at!==void 0&&(h=IS(h,g.at,c,l));let x=0;const w=(_,T,E,k=0,N=0)=>{const O=HW(_),{delay:R=0,times:L=bE(O),type:W="keyframes",...G}=T;let{ease:H=e.ease||"easeOut",duration:X}=T;const Q=typeof R=="function"?R(k,N):R,Y=O.length,j=Ap(W)?W:s==null?void 0:s[W];if(Y<=2&&j){let fe=100;if(Y===2&&XW(O)){const we=O[1]-O[0];fe=Math.abs(we)}const We={...G};X!==void 0&&(We.duration=Ps(X));const Ue=MW(We,fe,j);H=Ue.ease,X=Ue.duration}X??(X=i);const q=h+Q,Z=q+X;L.length===1&&L[0]===0&&(L[1]=1);const ae=L.length-O.length;ae>0&&wE(L,ae),O.length===1&&O.unshift(null),UW(E,O,H,L,q,Z),x=Math.max(Q+X,x),d=Math.max(Z,d)};if(Vt(y)){const _=AS(y,a);w(v,g,RS("default",_))}else{const _=bk(y,v,r,u),T=_.length;for(let E=0;E<T;E++){v=v,g=g;const k=_[E],N=AS(k,a);for(const O in v)w(v[O],qW(g,O),RS(O,N),E,T)}}c=h,h+=x}return a.forEach((f,p)=>{for(const y in f){const v=f[y];v.sort(zW);const g=[],x=[],w=[];for(let T=0;T<v.length;T++){const{at:E,value:k,easing:N}=v[T];g.push(k),x.push(ca(0,d,E)),w.push(N||"easeOut")}x[0]!==0&&(x.unshift(0),g.unshift(g[0]),w.unshift(jW)),x[x.length-1]!==1&&(x.push(1),g.push(null)),o.has(p)||o.set(p,{keyframes:{},transition:{}});const _=o.get(p);_.keyframes[y]=g,_.transition[y]={...e,duration:d,ease:w,times:x,...n}}}),o}function AS(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function RS(t,e){return e[t]||(e[t]=[]),e[t]}function HW(t){return Array.isArray(t)?t:[t]}function qW(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const KW=t=>typeof t=="number",XW=t=>t.every(KW);function YW(t,e){return t in e}class QW extends gk{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(YW(n,e)){const r=e[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return Et()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}function ZW(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=XE(t)?new xk(e):new vk(e);n.mount(t),Uu.set(t,n)}function JW(t){const e={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new QW(e);n.mount(t),Uu.set(t,n)}function eU(t,e){return Vt(t)||typeof t=="number"||typeof t=="string"&&!Dx(e)}function _k(t,e,n,r){const s=[];if(eU(t,e))s.push(YE(t,Dx(e)&&e.default||e,n&&(n.default||n)));else{const i=bk(t,e,r),o=i.length;for(let a=0;a<o;a++){const u=i[a],l=u instanceof Element?ZW:JW;Uu.has(u)||l(u);const c=Uu.get(u),h={...n};"delay"in h&&typeof h.delay=="function"&&(h.delay=h.delay(a,o)),s.push(...Sx(c,{...e,transition:h},{}))}}return s}function tU(t,e,n){const r=[];return GW(t,e,n,{spring:px}).forEach(({keyframes:i,transition:o},a)=>{r.push(..._k(a,i,o))}),r}function nU(t){return Array.isArray(t)&&Array.isArray(t[0])}function rU(t){function e(n,r,s){let i=[];return nU(n)?i=tU(n,r,t):i=_k(n,r,s,t),new NE(i)}return e}const OS=rU(),Sk="15.1.22",DS=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}),PS=(t,e,n)=>({endTime:e,insertTime:n,type:"linearRampToValue",value:t}),l0=(t,e)=>({startTime:e,type:"setValue",value:t}),Tk=(t,e,n)=>({duration:n,startTime:e,type:"setValueCurve",values:t}),Ck=(t,e,{startTime:n,target:r,timeConstant:s})=>r+(e-r)*Math.exp((n-t)/s),gu=t=>t.type==="exponentialRampToValue",Ef=t=>t.type==="linearRampToValue",Li=t=>gu(t)||Ef(t),Px=t=>t.type==="setValue",Qs=t=>t.type==="setValueCurve",kf=(t,e,n,r)=>{const s=t[e];return s===void 0?r:Li(s)||Px(s)?s.value:Qs(s)?s.values[s.values.length-1]:Ck(n,kf(t,e-1,s.startTime,r),s)},FS=(t,e,n,r,s)=>n===void 0?[r.insertTime,s]:Li(n)?[n.endTime,n.value]:Px(n)?[n.startTime,n.value]:Qs(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,kf(t,e-1,n.startTime,s)],c0=t=>t.type==="cancelAndHold",h0=t=>t.type==="cancelScheduledValues",Ri=t=>c0(t)||h0(t)?t.cancelTime:gu(t)||Ef(t)?t.endTime:t.startTime,LS=(t,e,n,{endTime:r,value:s})=>n===s?s:0<n&&0<s||n<0&&s<0?n*(s/n)**((t-e)/(r-e)):0,MS=(t,e,n,{endTime:r,value:s})=>n+(t-e)/(r-e)*(s-n),sU=(t,e)=>{const n=Math.floor(e),r=Math.ceil(e);return n===r?t[n]:(1-(e-n))*t[n]+(1-(r-e))*t[r]},iU=(t,{duration:e,startTime:n,values:r})=>{const s=(t-n)/e*(r.length-1);return sU(r,s)},ld=t=>t.type==="setTarget";class oU{constructor(e){this._automationEvents=[],this._currenTime=0,this._defaultValue=e}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}
vendor: 5,608 bytes, lines 48-50
48add(e){const n=Ri(e);if(c0(e)||h0(e)){const r=this._automationEvents.findIndex(i=>h0(e)&&Qs(i)?i.startTime+i.duration>=n:Ri(i)>=n),s=this._automationEvents[r];if(r!==-1&&(this._automationEvents=this._automationEvents.slice(0,r)),c0(e)){const i=this._automationEvents[this._automationEvents.length-1];if(s!==void 0&&Li(s)){if(i!==void 0&&ld(i))throw new Error("The internal list is malformed.");const o=i===void 0?s.insertTime:Qs(i)?i.startTime+i.duration:Ri(i),a=i===void 0?this._defaultValue:Qs(i)?i.values[i.values.length-1]:i.value,u=gu(s)?LS(n,o,a,s):MS(n,o,a,s),l=gu(s)?DS(u,n,this._currenTime):PS(u,n,this._currenTime);this._automationEvents.push(l)}if(i!==void 0&&ld(i)&&this._automationEvents.push(l0(this.getValue(n),n)),i!==void 0&&Qs(i)&&i.startTime+i.duration>n){const o=n-i.startTime,a=(i.values.length-1)/i.duration,u=Math.max(2,1+Math.ceil(o*a)),l=o/(u-1)*a,c=i.values.slice(0,u);if(l<1)for(let h=1;h<u;h+=1){const d=l*h%1;c[h]=i.values[h-1]*(1-d)+i.values[h]*d}this._automationEvents[this._automationEvents.length-1]=Tk(c,i.startTime,o)}}}else{const r=this._automationEvents.findIndex(o=>Ri(o)>n),s=r===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[r-1];if(s!==void 0&&Qs(s)&&Ri(s)+s.duration>n)return!1;const i=gu(e)?DS(e.value,e.endTime,this._currenTime):Ef(e)?PS(e.value,n,this._currenTime):e;if(r===-1)this._automationEvents.push(i);else{if(Qs(e)&&n+e.duration>Ri(this._automationEvents[r]))return!1;this._automationEvents.splice(r,0,i)}}return!0}flush(e){const n=this._automationEvents.findIndex(r=>Ri(r)>e);if(n>1){const r=this._automationEvents.slice(n-1),s=r[0];ld(s)&&r.unshift(l0(kf(this._automationEvents,n-2,s.startTime,this._defaultValue),s.startTime)),this._automationEvents=r}}getValue(e){if(this._automationEvents.length===0)return this._defaultValue;const n=this._automationEvents.findIndex(o=>Ri(o)>e),r=this._automationEvents[n],s=(n===-1?this._automationEvents.length:n)-1,i=this._automationEvents[s];if(i!==void 0&&ld(i)&&(r===void 0||!Li(r)||r.insertTime>e))return Ck(e,kf(this._automationEvents,s-1,i.startTime,this._defaultValue),i);if(i!==void 0&&Px(i)&&(r===void 0||!Li(r)))return i.value;if(i!==void 0&&Qs(i)&&(r===void 0||!Li(r)||i.startTime+i.duration>e))return e<i.startTime+i.duration?iU(e,i):i.values[i.values.length-1];if(i!==void 0&&Li(i)&&(r===void 0||!Li(r)))return i.value;if(r!==void 0&&gu(r)){const[o,a]=FS(this._automationEvents,s,i,r,this._defaultValue);return LS(e,o,a,r)}if(r!==void 0&&Ef(r)){const[o,a]=FS(this._automationEvents,s,i,r,this._defaultValue);return MS(e,o,a,r)}return this._defaultValue}}const aU=t=>({cancelTime:t,type:"cancelAndHold"}),uU=t=>({cancelTime:t,type:"cancelScheduledValues"}),lU=(t,e)=>({endTime:e,type:"exponentialRampToValue",value:t}),cU=(t,e)=>({endTime:e,type:"linearRampToValue",value:t}),hU=(t,e,n)=>({startTime:e,target:t,timeConstant:n,type:"setTarget"}),dU=()=>new DOMException("","AbortError"),fU=t=>(e,n,[r,s,i],o)=>{t(e[s],[n,r,i],a=>a[0]===n&&a[1]===r,o)},pU=t=>(e,n,r)=>{const s=[];for(let i=0;i<r.numberOfInputs;i+=1)s.push(new Set);t.set(e,{activeInputs:s,outputs:new Set,passiveInputs:new WeakMap,renderer:n})},mU=t=>(e,n)=>{t.set(e,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:n})},zu=new WeakSet,Nk=new WeakMap,Fx=new WeakMap,Ek=new WeakMap,Lx=new WeakMap,Vp=new WeakMap,kk=new WeakMap,d0=new WeakMap,f0=new WeakMap,p0=new WeakMap,$k={construct(){return $k}},gU=t=>{try{const e=new Proxy(t,$k);new e}catch{return!1}return!0},VS=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,BS=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),s=r.match(VS);for(;s!==null;){const i=s[1].slice(1,-1),o=s[0].replace(/([\s]+)?;?$/,"").replace(i,new URL(i,e).toString());n.push(o),r=r.slice(s[0].length).replace(/^[\s]+/,""),s=r.match(VS)}return[n.join(";"),r]},WS=t=>{if(t!==void 0&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},US=t=>{if(!gU(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(t.prototype===null||typeof t.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},yU=(t,e,n,r,s,i,o,a,u,l,c,h,d)=>{let f=0;return(p,y,v={credentials:"omit"})=>{const g=c.get(p);if(g!==void 0&&g.has(y))return Promise.resolve();const x=l.get(p);if(x!==void 0){const T=x.get(y);if(T!==void 0)return T}const w=i(p),_=w.audioWorklet===void 0?s(y).then(([T,E])=>{const[k,N]=BS(T,E),O=`${k};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${N}
49})})(window,'_AWGS')`;return n(O)}).then(()=>{const T=d._AWGS.pop();if(T===void 0)throw new SyntaxError;r(w.currentTime,w.sampleRate,()=>T(class{},void 0,(E,k)=>{if(E.trim()==="")throw e();const N=f0.get(w);if(N!==void 0){if(N.has(E))throw e();US(k),WS(k.parameterDescriptors),N.set(E,k)}else US(k),WS(k.parameterDescriptors),f0.set(w,new Map([[E,k]]))},w.sampleRate,void 0,void 0))}):Promise.all([s(y),Promise.resolve(t(h,h))]).then(([[T,E],k])=>{const N=f+1;f=N;const[O,R]=BS(T,E),H=`${O};((AudioWorkletProcessor,registerProcessor)=>{${R}
50})(${k?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${k?"":"__c = (a) =>
50 a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${k?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${N}',class extends AudioWorkletProcessor{process(){return !1}})`,X=new Blob([H],{type:"application/javascript; charset=utf-8"}),Q=URL.createObjectURL(X);return w.audioWorklet.addModule(Q,v).then(()=>{if(a(w))return w;const Y=o(w);return Y.audioWorklet.addModule(Q,v).then(()=>Y)}).then(Y=>{if(u===null)throw new SyntaxError;try{new u(Y,`__sac${N}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(Q))});return x===void 0?l.set(p,new Map([[y,_]])):x.set(y,_),_.then(()=>{const T=c.get(p);T===void 0?c.set(p,new Set([y])):T.add(y)}).finally(()=>{const T=l.get(p);T!==void 0&&T.delete(y)}),_}},ds=(t,e)=>{const n=t.get(e);if(n===void 0)throw new Error("A value with the given key could not be found.");return n},Bp=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(n.length===0)throw Error("No element was found.");const[r]=n;return t.delete(r),r},Ik=(t,e,n,r)=>{const s=ds(t,e),i=Bp(s,o=>o[0]===n&&o[1]===r);return s.size===0&&t.delete(e),i},oh=t=>ds(kk,t),ju=t=>
vendor: 28,173 bytes, line 50
50{if(zu.has(t))throw new Error("The AudioNode is already stored.");zu.add(t),oh(t).forEach(e=>e(!0))},Ak=t=>"port"in t,ah=t=>{if(!zu.has(t))throw new Error("The AudioNode is not stored.");zu.delete(t),oh(t).forEach(e=>e(!1))},m0=(t,e)=>{!Ak(t)&&e.every(n=>n.size===0)&&ah(t)},vU=(t,e,n,r,s,i,o,a,u,l,c,h,d)=>{const f=new WeakMap;return(p,y,v,g,x)=>{const{activeInputs:w,passiveInputs:_}=i(y),{outputs:T}=i(p),E=a(p),k=N=>{const O=u(y),R=u(p);if(N){const L=Ik(_,p,v,g);t(w,p,L,!1),!x&&!h(p)&&n(R,O,v,g),d(y)&&ju(y)}else{const L=r(w,p,v,g);e(_,g,L,!1),!x&&!h(p)&&s(R,O,v,g);const W=o(y);if(W===0)c(y)&&m0(y,w);else{const G=f.get(y);G!==void 0&&clearTimeout(G),f.set(y,setTimeout(()=>{c(y)&&m0(y,w)},W*1e3))}}};return l(T,[y,v,g],N=>N[0]===y&&N[1]===v&&N[2]===g,!0)?(E.add(k),c(p)?t(w,p,[v,g,k],!0):e(_,g,[p,v,k],!0),!0):!1}},xU=t=>(e,n,[r,s,i],o)=>{const a=e.get(r);a===void 0?e.set(r,new Set([[s,n,i]])):t(a,[s,n,i],u=>u[0]===s&&u[1]===n,o)},wU=t=>(e,n)=>{const r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(r).connect(e.destination);const s=()=>{n.removeEventListener("ended",s),n.disconnect(r),r.disconnect()};n.addEventListener("ended",s)},bU=t=>(e,n)=>{t(e).add(n)},_U={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},SU=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=s(a),c={..._U,...u},h=r(l,c),d=i(l)?e():null;super(a,!1,h,d),this._nativeAnalyserNode=h}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(a){this._nativeAnalyserNode.fftSize=a}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(a){const u=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=a,!(a>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=u,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(a){const u=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=a,!(this._nativeAnalyserNode.maxDecibels>a))throw this._nativeAnalyserNode.minDecibels=u,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(a){this._nativeAnalyserNode.smoothingTimeConstant=a}getByteFrequencyData(a){this._nativeAnalyserNode.getByteFrequencyData(a)}getByteTimeDomainData(a){this._nativeAnalyserNode.getByteTimeDomainData(a)}getFloatFrequencyData(a){this._nativeAnalyserNode.getFloatFrequencyData(a)}getFloatTimeDomainData(a){this._nativeAnalyserNode.getFloatTimeDomainData(a)}},Cn=(t,e)=>t.context===e,TU=(t,e,n)=>()=>{const r=new WeakMap,s=async(i,o)=>{let a=e(i);if(!Cn(a,o)){const l={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,fftSize:a.fftSize,maxDecibels:a.maxDecibels,minDecibels:a.minDecibels,smoothingTimeConstant:a.smoothingTimeConstant};a=t(o,l)}return r.set(o,a),await n(i,o,a),a};return{render(i,o){const a=r.get(o);return a!==void 0?Promise.resolve(a):s(i,o)}}},$f=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},js=()=>new DOMException("","IndexSizeError"),Mx=t=>{t.getChannelData=(e=>n=>{try{return e.call(t,n)}catch(r){throw r.code===12?js():r}})(t.getChannelData)},CU={numberOfChannels:1},NU=(t,e,n,r,s,i,o,a)=>{let u=null;return class Rk{constructor(c){if(s===null)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:h,numberOfChannels:d,sampleRate:f}={...CU,...c};u===null&&(u=new s(1,1,44100));const p=r!==null&&e(i,i)?new r({length:h,numberOfChannels:d,sampleRate:f}):u.createBuffer(d,h,f);if(p.numberOfChannels===0)throw n();return typeof p.copyFromChannel!="function"?(o(p),Mx(p)):e($f,()=>$f(p))||a(p),t.add(p),p}static[Symbol.hasInstance](c){return c!==null&&typeof c=="object"&&Object.getPrototypeOf(c)===Rk.prototype||t.has(c)}}},jn=-34028234663852886e22,$n=-jn,ui=t=>zu.has(t),EU={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},kU=(t,e,n,r,s,i,o,a)=>class extends t{constructor(l,c){const h=i(l),d={...EU,...c},f=s(h,d),p=o(h),y=p?e():null;super(l,!1,f,y),this._audioBufferSourceNodeRenderer=y,this._isBufferNullified=!1,this._isBufferSet=d.buffer!==null,this._nativeAudioBufferSourceNode=f,this._onended=null,this._playbackRate=n(this,p,f.playbackRate,$n,jn)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(l){if(this._nativeAudioBufferSourceNode.buffer=l,l!==null){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(l){this._nativeAudioBufferSourceNode.loop=l}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(l){this._nativeAudioBufferSourceNode.loopEnd=l}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(l){this._nativeAudioBufferSourceNode.loopStart=l}get onended(){return this._onended}set onended(l){const c=typeof l=="function"?a(this,l):null;this._nativeAudioBufferSourceNode.onended=c;const h=this._nativeAudioBufferSourceNode.onended;this._onended=h!==null&&h===c?l:h}get playbackRate(){return this._playbackRate}start(l=0,c=0,h){if(this._nativeAudioBufferSourceNode.start(l,c,h),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=h===void 0?[l,c]:[l,c,h]),this.context.state!=="closed"){ju(this);const d=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",d),ui(this)&&ah(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",d)}}stop(l=0){this._nativeAudioBufferSourceNode.stop(l),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=l)}},$U=(t,e,n,r,s)=>()=>{const i=new WeakMap;let o=null,a=null;const u=async(l,c)=>{let h=n(l);const d=Cn(h,c);if(!d){const f={buffer:h.buffer,channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,loop:h.loop,loopEnd:h.loopEnd,loopStart:h.loopStart,playbackRate:h.playbackRate.value};h=e(c,f),o!==null&&h.start(...o),a!==null&&h.stop(a)}return i.set(c,h),d?await t(c,l.playbackRate,h.playbackRate):await r(c,l.playbackRate,h.playbackRate),await s(l,c,h),h};return{set start(l){o=l},set stop(l){a=l},render(l,c){const h=i.get(c);return h!==void 0?Promise.resolve(h):u(l,c)}}},IU=t=>"playbackRate"in t,AU=t=>"frequency"in t&&"gain"in t,RU=t=>"offset"in t,OU=t=>!("frequency"in t)&&"gain"in t,DU=t=>"detune"in t&&"frequency"in t&&!("gain"in t),PU=t=>"pan"in t,An=t=>ds(Nk,t),uh=t=>ds(Ek,t),g0=(t,e)=>{const{activeInputs:n}=An(t);n.forEach(s=>s.forEach(([i])=>{e.includes(t)||g0(i,[...e,t])}));const r=IU(t)?[t.playbackRate]:Ak(t)?Array.from(t.parameters.values()):AU(t)?[t.Q,t.detune,t.frequency,t.gain]:RU(t)?[t.offset]:OU(t)?[t.gain]:DU(t)?[t.detune,t.frequency]:PU(t)?[t.pan]:[];for(const s of r){const i=uh(s);i!==void 0&&i.activeInputs.forEach(([o])=>g0(o,e))}ui(t)&&ah(t)},Ok=t=>{g0(t.destination,[])},FU=t=>t===void 0||typeof t=="number"||typeof t=="string"&&(t==="balanced"||t==="interactive"||t==="playback"),LU=(t,e,n,r,s,i,o,a,u)=>class extends t{constructor(c={}){if(u===null)throw new Error("Missing the native AudioContext constructor.");let h;try{h=new u(c)}catch(p){throw p.code===12&&p.message==="sampleRate is not in range"?n():p}if(h===null)throw r();if(!FU(c.latencyHint))throw new TypeError(`The provided value '${c.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(c.sampleRate!==void 0&&h.sampleRate!==c.sampleRate)throw n();super(h,2);const{latencyHint:d}=c,{sampleRate:f}=h;if(this._baseLatency=typeof h.baseLatency=="number"?h.baseLatency:d==="balanced"?512/f:d==="interactive"||d===void 0?256/f:d==="playback"?1024/f:Math.max(2,Math.min(128,Math.round(d*f/128)))*128/f,this._nativeAudioContext=h,u.name==="webkitAudioContext"?(this._nativeGainNode=h.createGain(),this._nativeOscillatorNode=h.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(h.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,h.state==="running"){this._state="suspended";const p=()=>{this._state==="suspended"&&(this._state=null),h.removeEventListener("statechange",p)};h.addEventListener("statechange",p)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw e()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),Ok(this)}))}createMediaElementSource(c){return new s(this,{mediaElement:c})}createMediaStreamDestination(){return new i(this)}createMediaStreamSource(c){return new o(this,{mediaStream:c})}createMediaStreamTrackSource(c){return new a(this,{mediaStreamTrack:c})}resume(){return this._state==="suspended"?new Promise((c,h)=>{const d=()=>{this._nativeAudioContext.removeEventListener("statechange",d),this._nativeAudioContext.state==="running"?c():this.resume().then(c,h)};this._nativeAudioContext.addEventListener("statechange",d)}):this._nativeAudioContext.resume().catch(c=>{throw c===void 0||c.code===15?e():c})}suspend(){return this._nativeAudioContext.suspend().catch(c=>{throw c===void 0?e():c})}},MU=(t,e,n,r,s,i,o,a)=>class extends t{constructor(l,c){const h=i(l),d=o(h),f=s(h,c,d),p=d?e(a):null;super(l,!1,f,p),this._isNodeOfNativeOfflineAudioContext=d,this._nativeAudioDestinationNode=f}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(l){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(l>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=l}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(l){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=l}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},VU=t=>{const e=new WeakMap,n=async(r,s)=>{const i=s.destination;return e.set(s,i),await t(r,s,i),i};return{render(r,s){const i=e.get(s);return i!==void 0?Promise.resolve(i):n(r,s)}}},BU=(t,e,n,r,s,i,o,a)=>(u,l)=>{const c=l.listener,h=()=>{const T=new Float32Array(1),E=e(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),k=o(l);let N=!1,O=[0,0,-1,0,1,0],R=[0,0,0];const L=()=>{if(N)return;N=!0;const X=r(l,256,9,0);X.onaudioprocess=({inputBuffer:Q})=>{const Y=[i(Q,T,0),i(Q,T,1),i(Q,T,2),i(Q,T,3),i(Q,T,4),i(Q,T,5)];Y.some((q,Z)=>q!==O[Z])&&(c.setOrientation(...Y),O=Y);const j=[i(Q,T,6),i(Q,T,7),i(Q,T,8)];j.some((q,Z)=>q!==R[Z])&&(c.setPosition(...j),R=j)},E.connect(X)},W=X=>Q=>{Q!==O[X]&&(O[X]=Q,c.setOrientation(...O))},G=X=>Q=>{Q!==R[X]&&(R[X]=Q,c.setPosition(...R))},H=(X,Q,Y)=>{const j=n(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:Q});j.connect(E,0,X),j.start(),Object.defineProperty(j.offset,"defaultValue",{get(){return Q}});const q=t({context:u},k,j.offset,$n,jn);return a(q,"value",Z=>()=>Z.call(q),Z=>ae=>{try{Z.call(q,ae)}catch(fe){if(fe.code!==9)throw fe}L(),k&&Y(ae)}),q.cancelAndHoldAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.cancelAndHoldAtTime),q.cancelScheduledValues=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.cancelScheduledValues),q.exponentialRampToValueAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.exponentialRampToValueAtTime),q.linearRampToValueAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.linearRampToValueAtTime),q.setTargetAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.setTargetAtTime),q.setValueAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.setValueAtTime),q.setValueCurveAtTime=(Z=>k?()=>{throw s()}:(...ae)=>{const fe=Z.apply(q,ae);return L(),fe})(q.setValueCurveAtTime),q};return{forwardX:H(0,0,W(0)),forwardY:H(1,0,W(1)),forwardZ:H(2,-1,W(2)),positionX:H(6,0,G(0)),positionY:H(7,0,G(1)),positionZ:H(8,0,G(2)),upX:H(3,0,W(3)),upY:H(4,1,W(4)),upZ:H(5,0,W(5))}},{forwardX:d,forwardY:f,forwardZ:p,positionX:y,positionY:v,positionZ:g,upX:x,upY:w,upZ:_}=c.forwardX===void 0?h():c;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return p},get positionX(){return y},get positionY(){return v},get positionZ(){return g},get upX(){return x},get upY(){return w},get upZ(){return _}}},If=t=>"context"in t,lh=t=>If(t[0]),Ia=(t,e,n,r)=>{for(const s of t)if(n(s)){if(r)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},zS=(t,e,[n,r],s)=>{Ia(t,[e,n,r],i=>i[0]===e&&i[1]===n,s)},jS=(t,[e,n,r],s)=>{const i=t.get(e);i===void 0?t.set(e,new Set([[n,r]])):Ia(i,[n,r],o=>o[0]===n,s)},al=t=>"inputs"in t,Af=(t,e,n,r)=>{if(al(e)){const s=e.inputs[r];return t.connect(s,n,0),[s,n,0]}return t.connect(e,n,r),[e,n,r]},Dk=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},WU=(t,e,n)=>Bp(t,r=>r[0]===e&&r[1]===n),Pk=(t,e)=>{if(!oh(t).delete(e))throw new Error("Missing the expected event listener.")},Fk=(t,e,n)=>{const r=ds(t,e),s=Bp(r,i=>i[0]===n);return r.size===0&&t.delete(e),s},Rf=(t,e,n,r)=>{al(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},dt=t=>ds(Fx,t),Lc=t=>ds(Lx,t),ha=t=>d0.has(t),Ud=t=>!zu.has(t),GS=(t,e)=>new Promise(n=>{if(e!==null)n(!0);else{const r=t.createScriptProcessor(256,1,1),s=t.createGain(),i=t.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const a=t.createBufferSource();a.buffer=i,a.loop=!0,a.connect(r).connect(t.destination),a.connect(s),a.disconnect(s),r.onaudioprocess=u=>{const l=u.inputBuffer.getChannelData(0);Array.prototype.some.call(l,c=>c===1)?n(!0):n(!1),a.stop(),r.onaudioprocess=null,a.disconnect(r),r.disconnect(t.destination)},a.start()}}),Ag=(t,e)=>{const n=new Map;for(const r of t)for(const s of r){const i=n.get(s);n.set(s,i===void 0?1:i+1)}n.forEach((r,s)=>e(s,r))},Of=t=>"context"in t,UU=t=>{const e=new Map;t.connect=(n=>(r,s=0,i=0)=>{const o=Of(r)?n(r,s,i):n(r,s),a=e.get(r);return a===void 0?e.set(r,[{input:i,output:s}]):a.every(u=>u.input!==i||u.output!==s)&&a.push({input:i,output:s}),o})(t.connect.bind(t)),t.disconnect=(n=>(r,s,i)=>{if(n.apply(t),r===void 0)e.clear();else if(typeof r=="number")for(const[o,a]of e){const u=a.filter(l=>l.output!==r);u.length===0?e.delete(o):e.set(o,u)}else if(e.has(r))if(s===void 0)e.delete(r);else{const o=e.get(r);if(o!==void 0){const a=o.filter(u=>u.output!==s&&(u.input!==i||i===void 0));a.length===0?e.delete(r):e.set(r,a)}}for(const[o,a]of e)a.forEach(u=>{Of(o)?t.connect(o,u.output,u.input):t.connect(o,u.output)})})(t.disconnect)},zU=(t,e,n,r)=>{const{activeInputs:s,passiveInputs:i}=uh(e),{outputs:o}=An(t),a=oh(t),u=l=>{const c=dt(t),h=Lc(e);if(l){const d=Fk(i,t,n);zS(s,t,d,!1),!r&&!ha(t)&&c.connect(h,n)}else{const d=WU(s,t,n);jS(i,d,!1),!r&&!ha(t)&&c.disconnect(h,n)}};return Ia(o,[e,n],l=>l[0]===e&&l[1]===n,!0)?(a.add(u),ui(t)?zS(s,t,[n,u],!0):jS(i,[t,n,u],!0),!0):!1},jU=(t,e,n,r)=>{const{activeInputs:s,passiveInputs:i}=An(e),o=Dk(s[r],t,n);return o===null?[Ik(i,t,n,r)[2],!1]:[o[2],!0]},GU=(t,e,n)=>{const{activeInputs:r,passiveInputs:s}=uh(e),i=Dk(r,t,n);return i===null?[Fk(s,t,n)[1],!1]:[i[2],!0]},Vx=(t,e,n,r,s)=>{const[i,o]=jU(t,n,r,s);if(i!==null&&(Pk(t,i),o&&!e&&!ha(t)&&Rf(dt(t),dt(n),r,s)),ui(n)){const{activeInputs:a}=An(n);m0(n,a)}},Bx=(t,e,n,r)=>{const[s,i]=GU(t,n,r);s!==null&&(Pk(t,s),i&&!e&&!ha(t)&&dt(t).disconnect(Lc(n),r))},HU=(t,e)=>{const n=An(t),r=[];for(const s of n.outputs)lh(s)?Vx(t,e,...s):Bx(t,e,...s),r.push(s[0]);return n.outputs.clear(),r},qU=(t,e,n)=>{const r=An(t),s=[];for(const i of r.outputs)i[1]===n&&(lh(i)?Vx(t,e,...i):Bx(t,e,...i),s.push(i[0]),r.outputs.delete(i));return s},KU=(t,e,n,r,s)=>{const i=An(t);return Array.from(i.outputs).filter(o=>o[0]===n&&(r===void 0||o[1]===r)&&(s===void 0||o[2]===s)).map(o=>(lh(o)?Vx(t,e,...o):Bx(t,e,...o),i.outputs.delete(o),o[0]))},XU=(t,e,n,r,s,i,o,a,u,l,c,h,d,f,p,y)=>class extends l{constructor(g,x,w,_){super(w),this._context=g,this._nativeAudioNode=w;const T=c(g);h(T)&&n(GS,()=>GS(T,y))!==!0&&UU(w),Fx.set(this,w),kk.set(this,new Set),g.state!=="closed"&&x&&ju(this),t(this,_,w)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(g){this._nativeAudioNode.channelCount=g}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(g){this._nativeAudioNode.channelCountMode=g}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(g){this._nativeAudioNode.channelInterpretation=g}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(g,x=0,w=0){if(x<0||x>=this._nativeAudioNode.numberOfOutputs)throw s();const _=c(this._context),T=p(_);if(d(g)||f(g))throw i();if(If(g)){const N=dt(g);try{const R=Af(this._nativeAudioNode,N,x,w),L=Ud(this);(T||L)&&this._nativeAudioNode.disconnect(...R),this.context.state!=="closed"&&!L&&Ud(g)&&ju(g)}catch(R){throw R.code===12?i():R}if(e(this,g,x,w,T)){const R=u([this],g);Ag(R,r(T))}return g}const E=Lc(g);if(E.name==="playbackRate"&&E.maxValue===1024)throw o();try{this._nativeAudioNode.connect(E,x),(T||Ud(this))&&this._nativeAudioNode.disconnect(E,x)}catch(N){throw N.code===12?i():N}if(zU(this,g,x,T)){const N=u([this],g);Ag(N,r(T))}}disconnect(g,x,w){let _;const T=c(this._context),E=p(T);if(g===void 0)_=HU(this,E);else if(typeof g=="number"){if(g<0||g>=this.numberOfOutputs)throw s();_=qU(this,E,g)}else{if(x!==void 0&&(x<0||x>=this.numberOfOutputs)||If(g)&&w!==void 0&&(w<0||w>=g.numberOfInputs))throw s();if(_=KU(this,E,g,x,w),_.length===0)throw i()}for(const k of _){const N=u([this],k);Ag(N,a)}}},YU=(t,e,n,r,s,i,o,a,u,l,c,h,d)=>(f,p,y,v=null,g=null)=>{const x=y.value,w=new oU(x),_=p?r(w):null,T={get defaultValue(){return x},get maxValue(){return v===null?y.maxValue:v},get minValue(){return g===null?y.minValue:g},get value(){return y.value},set value(E){y.value=E,T.setValueAtTime(E,f.context.currentTime)},cancelAndHoldAtTime(E){if(typeof y.cancelAndHoldAtTime=="function")_===null&&w.flush(f.context.currentTime),w.add(s(E)),y.cancelAndHoldAtTime(E);else{const k=Array.from(w).pop();_===null&&w.flush(f.context.currentTime),w.add(s(E));const N=Array.from(w).pop();y.cancelScheduledValues(E),k!==N&&N!==void 0&&(N.type==="exponentialRampToValue"?y.exponentialRampToValueAtTime(N.value,N.endTime):N.type==="linearRampToValue"?y.linearRampToValueAtTime(N.value,N.endTime):N.type==="setValue"?y.setValueAtTime(N.value,N.startTime):N.type==="setValueCurve"&&y.setValueCurveAtTime(N.values,N.startTime,N.duration))}return T},cancelScheduledValues(E){return _===null&&w.flush(f.context.currentTime),w.add(i(E)),y.cancelScheduledValues(E),T},exponentialRampToValueAtTime(E,k){if(E===0)throw new RangeError;if(!Number.isFinite(k)||k<0)throw new RangeError;const N=f.context.currentTime;return _===null&&w.flush(N),Array.from(w).length===0&&(w.add(l(x,N)),y.setValueAtTime(x,N)),w.add(o(E,k)),y.exponentialRampToValueAtTime(E,k),T},linearRampToValueAtTime(E,k){const N=f.context.currentTime;return _===null&&w.flush(N),Array.from(w).length===0&&(w.add(l(x,N)),y.setValueAtTime(x,N)),w.add(a(E,k)),y.linearRampToValueAtTime(E,k),T},setTargetAtTime(E,k,N){return _===null&&w.flush(f.context.currentTime),w.add(u(E,k,N)),y.setTargetAtTime(E,k,N),T},setValueAtTime(E,k){return _===null&&w.flush(f.context.currentTime),w.add(l(E,k)),y.setValueAtTime(E,k),T},setValueCurveAtTime(E,k,N){const O=E instanceof Float32Array?E:new Float32Array(E);if(h!==null&&h.name==="webkitAudioContext"){const R=k+N,L=f.context.sampleRate,W=Math.ceil(k*L),G=Math.floor(R*L),H=G-W,X=new Float32Array(H);for(let Y=0;Y<H;Y+=1){const j=(O.length-1)/N*((W+Y)/L-k),q=Math.floor(j),Z=Math.ceil(j);X[Y]=q===Z?O[q]:(1-(j-q))*O[q]+(1-(Z-j))*O[Z]}_===null&&w.flush(f.context.currentTime),w.add(c(X,k,N)),y.setValueCurveAtTime(X,k,N);const Q=G/L;Q<R&&d(T,X[X.length-1],Q),d(T,O[O.length-1],R)}else _===null&&w.flush(f.context.currentTime),w.add(c(O,k,N)),y.setValueCurveAtTime(O,k,N);return T}};return n.set(T,y),e.set(T,f),t(T,_),T},QU=t=>({replay(e){for(const n of t)if(n.type==="exponentialRampToValue"){const{endTime:r,value:s}=n;e.exponentialRampToValueAtTime(s,r)}else if(n.type==="linearRampToValue"){const{endTime:r,value:s}=n;e.linearRampToValueAtTime(s,r)}else if(n.type==="setTarget"){const{startTime:r,target:s,timeConstant:i}=n;e.setTargetAtTime(s,r,i)}else if(n.type==="setValue"){const{startTime:r,value:s}=n;e.setValueAtTime(s,r)}else if(n.type==="setValueCurve"){const{duration:r,startTime:s,values:i}=n;e.setValueCurveAtTime(i,s,r)}else throw new Error("Can't apply an unknown automation.")}});class Lk{constructor(e){this._map=new Map(e)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(e,n=null){return this._map.forEach((r,s)=>e.call(n,r,s,this))}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){return this._map.keys()}values(){return this._map.values()}}const ZU={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},JU=(t,e,n,r,s,i,o,a,u,l,c,h,d,f)=>class extends e{constructor(y,v,g){var x;const w=a(y),_=u(w),T=c({...ZU,...g});d(T);const E=f0.get(w),k=E==null?void 0:E.get(v),N=_||w.state!=="closed"?w:(x=o(w))!==null&&x!==void 0?x:w,O=s(N,_?null:y.baseLatency,l,v,k,T),R=_?r(v,T,k):null;super(y,!0,O,R);const L=[];O.parameters.forEach((G,H)=>{const X=n(this,_,G);L.push([H,X])}),this._nativeAudioWorkletNode=O,this._onprocessorerror=null,this._parameters=new Lk(L),_&&t(w,this);const{activeInputs:W}=i(this);h(O,W)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(y){const v=typeof y=="function"?f(this,y):null;this._nativeAudioWorkletNode.onprocessorerror=v;const g=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=g!==null&&g===v?y:g}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function Df(t,e,n,r,s){if(typeof t.copyFromChannel=="function")e[n].byteLength===0&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],r,s);else{const i=t.getChannelData(r);if(e[n].byteLength===0)e[n]=i.slice(s,s+128);else{const o=new Float32Array(i.buffer,s*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(o)}}}const Mk=(t,e,n,r,s)=>{typeof t.copyToChannel=="function"?e[n].byteLength!==0&&t.copyToChannel(e[n],r,s):e[n].byteLength!==0&&t.getChannelData(r).set(e[n],s)},Pf=(t,e)=>{const n=[];for(let r=0;r<t;r+=1){const s=[],i=typeof e=="number"?e:e[r];for(let o=0;o<i;o+=1)s.push(new Float32Array(128));n.push(s)}return n},ez=(t,e)=>{const n=ds(p0,t),r=dt(e);return ds(n,r)},tz=async(t,e,n,r,s,i,o)=>{const a=e===null?Math.ceil(t.context.length/128)*128:e.length,u=r.channelCount*r.numberOfInputs,l=s.reduce((v,g)=>v+g,0),c=l===0?null:n.createBuffer(l,a,n.sampleRate);if(i===void 0)throw new Error("Missing the processor constructor.");const h=An(t),d=await ez(n,t),f=Pf(r.numberOfInputs,r.channelCount),p=Pf(r.numberOfOutputs,s),y=Array.from(t.parameters.keys()).reduce((v,g)=>({...v,[g]:new Float32Array(128)}),{});for(let v=0;v<a;v+=128){if(r.numberOfInputs>0&&e!==null)for(let g=0;g<r.numberOfInputs;g+=1)for(let x=0;x<r.channelCount;x+=1)Df(e,f[g],x,x,v);i.parameterDescriptors!==void 0&&e!==null&&i.parameterDescriptors.forEach(({name:g},x)=>{Df(e,y,g,u+x,v)});for(let g=0;g<r.numberOfInputs;g+=1)for(let x=0;x<s[g];x+=1)p[g][x].byteLength===0&&(p[g][x]=new Float32Array(128));try{const g=f.map((w,_)=>h.activeInputs[_].size===0?[]:w),x=o(v/n.sampleRate,n.sampleRate,()=>d.process(g,p,y));if(c!==null)for(let w=0,_=0;w<r.numberOfOutputs;w+=1){for(let T=0;T<s[w];T+=1)Mk(c,p[w],T,_+T,v);_+=s[w]}if(!x)break}catch(g){t.dispatchEvent(new ErrorEvent("processorerror",{colno:g.colno,filename:g.filename,lineno:g.lineno,message:g.message}));break}}return c},nz=(t,e,n,r,s,i,o,a,u,l,c,h,d,f,p,y)=>(v,g,x)=>{const w=new WeakMap;let _=null;const T=async(E,k)=>{let N=c(E),O=null;const R=Cn(N,k),L=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(h===null){const W=L.reduce((Q,Y)=>Q+Y,0),G=s(k,{channelCount:Math.max(1,W),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,W)}),H=[];for(let Q=0;Q<E.numberOfOutputs;Q+=1)H.push(r(k,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:L[Q]}));const X=o(k,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1});X.connect=e.bind(null,H),X.disconnect=u.bind(null,H),O=[G,H,X]}else R||(N=new h(k,v));if(w.set(k,O===null?N:O[2]),O!==null){if(_===null){if(x===void 0)throw new Error("Missing the processor constructor.");if(d===null)throw new Error("Missing the native OfflineAudioContext constructor.");const Y=E.channelCount*E.numberOfInputs,j=x.parameterDescriptors===void 0?0:x.parameterDescriptors.length,q=Y+j;_=tz(E,q===0?null:await(async()=>{const ae=new d(q,Math.ceil(E.context.length/128)*128,k.sampleRate),fe=[],We=[];for(let Ie=0;Ie<g.numberOfInputs;Ie+=1)fe.push(o(ae,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),We.push(s(ae,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const Ue=await Promise.all(Array.from(E.parameters.values()).map(async Ie=>{const Ct=i(ae,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:Ie.value});return await f(ae,Ie,Ct.offset),Ct})),we=r(ae,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,Y+j)});for(let Ie=0;Ie<g.numberOfInputs;Ie+=1){fe[Ie].connect(We[Ie]);for(let Ct=0;Ct<g.channelCount;Ct+=1)We[Ie].connect(we,Ct,Ie*g.channelCount+Ct)}for(const[Ie,Ct]of Ue.entries())Ct.connect(we,0,Y+Ie),Ct.start(0);return we.connect(ae.destination),await Promise.all(fe.map(Ie=>p(E,ae,Ie))),y(ae)})(),k,g,L,x,l)}const W=await _,G=n(k,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[H,X,Q]=O;W!==null&&(G.buffer=W,G.start(0)),G.connect(H);for(let Y=0,j=0;Y<E.numberOfOutputs;Y+=1){const q=X[Y];for(let Z=0;Z<L[Y];Z+=1)H.connect(q,j+Z,Z);j+=L[Y]}return Q}if(R)for(const[W,G]of E.parameters.entries())await t(k,G,N.parameters.get(W));else for(const[W,G]of E.parameters.entries())await f(k,G,N.parameters.get(W));return await p(E,k,N),N};return{render(E,k){a(k,E);const N=w.get(k);return N!==void 0?Promise.resolve(N):T(E,k)}}},rz=(t,e,n,r,s,i,o,a,u,l,c,h,d,f,p,y,v,g,x,w)=>class extends p{constructor(T,E){super(T,E),this._nativeContext=T,this._audioWorklet=t===void 0?void 0:{addModule:(k,N)=>t(this,k,N)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new s(this)}createBuffer(T,E,k){return new n({length:E,numberOfChannels:T,sampleRate:k})}createBufferSource(){return new r(this)}createChannelMerger(T=6){return new i(this,{numberOfInputs:T})}createChannelSplitter(T=6){return new o(this,{numberOfOutputs:T})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(T=1){return new c(this,{maxDelayTime:T})}createDynamicsCompressor(){return new h(this)}createGain(){return new d(this)}createIIRFilter(T,E){return new f(this,{feedback:E,feedforward:T})}createOscillator(){return new y(this)}createPanner(){return new v(this)}
50createPeriodicWave(T,E,k={disableNormalization:!1}){return new g(this,{...k,imag:E,real:T})}createStereoPanner(){return new x(this)}createWaveShaper(){return new w(this)}decodeAudioData(T,E,k){return l(this._nativeContext,T).then(N=>(typeof E=="function"&&E(N),N),N=>{throw typeof k=="function"&&k(N),N})}},sz={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},iz=(t,e,n,r,s,i,o,a)=>class extends t{constructor(l,c){const h=i(l),d={...sz,...c},f=s(h,d),p=o(h),y=p?n():null;super(l,!1,f,y),this._Q=e(this,p,f.Q,$n,jn),this._detune=e(this,p,f.detune,1200*Math.log2($n),-1200*Math.log2($n)),this._frequency=e(this,p,f.frequency,l.sampleRate/2,0),this._gain=e(this,p,f.gain,40*Math.log10($n),jn),this._nativeBiquadFilterNode=f,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(l){this._nativeBiquadFilterNode.type=l}getFrequencyResponse(l,c,h){try{this._nativeBiquadFilterNode.getFrequencyResponse(l,c,h)}catch(d){throw d.code===11?r():d}if(l.length!==c.length||c.length!==h.length)throw r()}},oz=(t,e,n,r,s)=>()=>{const i=new WeakMap,o=async(a,u)=>{let l=n(a);const c=Cn(l,u);if(!c){const h={Q:l.Q.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,detune:l.detune.value,frequency:l.frequency.value,gain:l.gain.value,type:l.type};l=e(u,h)}return i.set(u,l),c?(await t(u,a.Q,l.Q),await t(u,a.detune,l.detune),await t(u,a.frequency,l.frequency),await t(u,a.gain,l.gain)):(await r(u,a.Q,l.Q),await r(u,a.detune,l.detune),await r(u,a.frequency,l.frequency),await r(u,a.gain,l.gain)),await s(a,u,l),l};return{render(a,u){const l=i.get(u);return l!==void 0?Promise.resolve(l):o(a,u)}}},az=(t,e)=>(n,r)=>{const s=e.get(n);if(s!==void 0)return s;const i=t.get(n);if(i!==void 0)return i;try{const o=r();return o instanceof Promise?(t.set(n,o),o.catch(()=>!1).then(a=>(t.delete(n),e.set(n,a),a))):(e.set(n,o),o)}catch{return e.set(n,!1),!1}},uz={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},lz=(t,e,n,r,s)=>class extends t{constructor(o,a){const u=r(o),l={...uz,...a},c=n(u,l),h=s(u)?e():null;super(o,!1,c,h)}},cz=(t,e,n)=>()=>{const r=new WeakMap,s=async(i,o)=>{let a=e(i);if(!Cn(a,o)){const l={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs};a=t(o,l)}return r.set(o,a),await n(i,o,a),a};return{render(i,o){const a=r.get(o);return a!==void 0?Promise.resolve(a):s(i,o)}}},hz={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},dz=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=r(a),c=i({...hz,...u}),h=n(l,c),d=s(l)?e():null;super(a,!1,h,d)}},fz=(t,e,n)=>()=>{const r=new WeakMap,s=async(i,o)=>{let a=e(i);if(!Cn(a,o)){const l={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs};a=t(o,l)}return r.set(o,a),await n(i,o,a),a};return{render(i,o){const a=r.get(o);return a!==void 0?Promise.resolve(a):s(i,o)}}},pz=t=>(e,n,r)=>t(n,e,r),mz=t=>(e,n,r=0,s=0)=>{const i=e[r];if(i===void 0)throw t();return Of(n)?i.connect(n,0,s):i.connect(n,0)},gz=t=>(e,n)=>{const r=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),s=e.createBuffer(1,2,44100);return r.buffer=s,r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}},yz={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},vz=(t,e,n,r,s,i,o)=>class extends t{constructor(u,l){const c=s(u),h={...yz,...l},d=r(c,h),f=i(c),p=f?n():null;super(u,!1,d,p),this._constantSourceNodeRenderer=p,this._nativeConstantSourceNode=d,this._offset=e(this,f,d.offset,$n,jn),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(u){const l=typeof u=="function"?o(this,u):null;this._nativeConstantSourceNode.onended=l;const c=this._nativeConstantSourceNode.onended;this._onended=c!==null&&c===l?u:c}start(u=0){if(this._nativeConstantSourceNode.start(u),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=u),this.context.state!=="closed"){ju(this);const l=()=>{this._nativeConstantSourceNode.removeEventListener("ended",l),ui(this)&&ah(this)};this._nativeConstantSourceNode.addEventListener("ended",l)}}stop(u=0){this._nativeConstantSourceNode.stop(u),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=u)}},xz=(t,e,n,r,s)=>()=>{const i=new WeakMap;let o=null,a=null;const u=async(l,c)=>{let h=n(l);const d=Cn(h,c);if(!d){const f={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,offset:h.offset.value};h=e(c,f),o!==null&&h.start(o),a!==null&&h.stop(a)}return i.set(c,h),d?await t(c,l.offset,h.offset):await r(c,l.offset,h.offset),await s(l,c,h),h};return{set start(l){o=l},set stop(l){a=l},render(l,c){const h=i.get(c);return h!==void 0?Promise.resolve(h):u(l,c)}}},wz=t=>e=>(t[0]=e,t[0]),bz={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},_z=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=r(a),c={...bz,...u},h=n(l,c),f=s(l)?e():null;super(a,!1,h,f),this._isBufferNullified=!1,this._nativeConvolverNode=h,c.buffer!==null&&i(this,c.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(a){if(this._nativeConvolverNode.buffer=a,a===null&&this._nativeConvolverNode.buffer!==null){const u=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=u.createBuffer(1,1,u.sampleRate),this._isBufferNullified=!0,i(this,0)}else this._isBufferNullified=!1,i(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(a){this._nativeConvolverNode.normalize=a}},Sz=(t,e,n)=>()=>{const r=new WeakMap,s=async(i,o)=>{let a=e(i);if(!Cn(a,o)){const l={buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize};a=t(o,l)}return r.set(o,a),al(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a};return{render(i,o){const a=r.get(o);return a!==void 0?Promise.resolve(a):s(i,o)}}},Tz=(t,e)=>(n,r,s)=>{if(e===null)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,r,s)}catch(i){throw i.name==="SyntaxError"?t():i}},Cz=()=>new DOMException("","DataCloneError"),HS=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise(r=>{const s=()=>{n.onmessage=null,e.close(),n.close(),r()};n.onmessage=()=>s();try{e.postMessage(t,[t])}catch{}finally{s()}})},Nz=(t,e,n,r,s,i,o,a,u,l,c)=>(h,d)=>{const f=o(h)?h:i(h);if(s.has(d)){const p=n();return Promise.reject(p)}try{s.add(d)}catch{}return e(u,()=>u(f))?f.decodeAudioData(d).then(p=>(HS(d).catch(()=>{}),e(a,()=>a(p))||c(p),t.add(p),p)):new Promise((p,y)=>{const v=async()=>{try{await HS(d)}catch{}},g=x=>{y(x),v()};try{f.decodeAudioData(d,x=>{typeof x.copyFromChannel!="function"&&(l(x),Mx(x)),t.add(x),v().then(()=>p(x))},x=>{g(x===null?r():x)})}catch(x){g(x)}})},Ez=(t,e,n,r,s,i,o,a)=>(u,l)=>{const c=e.get(u);if(c===void 0)throw new Error("Missing the expected cycle count.");const h=i(u.context),d=a(h);if(c===l){if(e.delete(u),!d&&o(u)){const f=r(u),{outputs:p}=n(u);for(const y of p)if(lh(y)){const v=r(y[0]);t(f,v,y[1],y[2])}else{const v=s(y[0]);f.connect(v,y[1])}}}else e.set(u,c-l)},kz={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},$z=(t,e,n,r,s,i,o)=>class extends t{constructor(u,l){const c=s(u),h={...kz,...l},d=r(c,h),f=i(c),p=f?n(h.maxDelayTime):null;super(u,!1,d,p),this._delayTime=e(this,f,d.delayTime),o(this,h.maxDelayTime)}get delayTime(){return this._delayTime}},Iz=(t,e,n,r,s)=>i=>{const o=new WeakMap,a=async(u,l)=>{let c=n(u);const h=Cn(c,l);
50if(!h){const d={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:i};c=e(l,d)}return o.set(l,c),h?await t(l,u.delayTime,c.delayTime):await r(l,u.delayTime,c.delayTime),await s(u,l,c),c};return{render(u,l){const c=o.get(l);return c!==void 0?Promise.resolve(c):a(u,l)}}},Az=t=>(e,n,r,s)=>t(e[s],i=>i[0]===n&&i[1]===r),Rz=t=>(e,n)=>{t(e).delete(n)},Oz=t=>"delayTime"in t,Dz=(t,e,n)=>function r(s,i){const o=If(i)?i:n(t,i);if(Oz(o))return[];if(s[0]===o)return[s];if(s.includes(o))return[];const{outputs:a}=e(o);return Array.from(a).map(u=>r([...s,o],u[0])).reduce((u,l)=>u.concat(l),[])},cd=(t,e,n)=>{const r=e[n];if(r===void 0)throw t();return r},Pz=t=>(e,n=void 0,r=void 0,s=0)=>n===void 0?e.forEach(i=>i.disconnect()):typeof n=="number"?cd(t,e,n).disconnect():Of(n)?r===void 0?e.forEach(i=>i.disconnect(n)):s===void 0?cd(t,e,r).disconnect(n,0):cd(t,e,r).disconnect(n,0,s):r===void 0?e.forEach(i=>i.disconnect(n)):cd(t,e,r).disconnect(n,0),Fz={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},Lz=(t,e,n,r,s,i,o,a)=>class extends t{constructor(l,c){const h=i(l),d={...Fz,...c},f=r(h,d),p=o(h),y=p?n():null;super(l,!1,f,y),this._attack=e(this,p,f.attack),this._knee=e(this,p,f.knee),this._nativeDynamicsCompressorNode=f,this._ratio=e(this,p,f.ratio),this._release=e(this,p,f.release),this._threshold=e(this,p,f.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(l){const c=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=l,l>2)throw this._nativeDynamicsCompressorNode.channelCount=c,s()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(l){const c=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=l,l==="max")throw this._nativeDynamicsCompressorNode.channelCountMode=c,s()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value=="number"?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}},Mz=(t,e,n,r,s)=>()=>{const i=new WeakMap,o=async(a,u)=>{let l=n(a);const c=Cn(l,u);if(!c){const h={attack:l.attack.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,knee:l.knee.value,ratio:l.ratio.value,release:l.release.value,threshold:l.threshold.value};l=e(u,h)}return i.set(u,l),c?(await t(u,a.attack,l.attack),await t(u,a.knee,l.knee),await t(u,a.ratio,l.ratio),await t(u,a.release,l.release),await t(u,a.threshold,l.threshold)):(await r(u,a.attack,l.attack),await r(u,a.knee,l.knee),await r(u,a.ratio,l.ratio),await r(u,a.release,l.release),await r(u,a.threshold,l.threshold)),await s(a,u,l),l};return{render(a,u){const l=i.get(u);return l!==void 0?Promise.resolve(l):o(a,u)}}},Vz=()=>new DOMException("","EncodingError"),Bz=t=>e=>new Promise((n,r)=>{if(t===null){r(new SyntaxError);return}const s=t.document.head;if(s===null)r(new SyntaxError);else{const i=t.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),u=t.onerror,l=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(c,h,d,f,p)=>{if(h===a||h===t.location.href&&d===1&&f===1)return l(),r(p),!1;if(u!==null)return u(c,h,d,f,p)},i.onerror=()=>{l(),r(new SyntaxError)},i.onload=()=>{l(),n()},i.src=a,i.type="module",s.appendChild(i)}}),Wz=t=>class{constructor(n){this._nativeEventTarget=n,this._listeners=new WeakMap}addEventListener(n,r,s){if(r!==null){let i=this._listeners.get(r);i===void 0&&(i=t(this,r),typeof r=="function"&&this._listeners.set(r,i)),this._nativeEventTarget.addEventListener(n,i,s)}}dispatchEvent(n){return this._nativeEventTarget.dispatchEvent(n)}removeEventListener(n,r,s){const i=r===null?void 0:this._listeners.get(r);this._nativeEventTarget.removeEventListener(n,i===void 0?null:i,s)}},Uz=t=>(e,n,r)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get(){return Math.round(e*n)}},currentTime:{configurable:!0,get(){return e}}});try{return r()}finally{t!==null&&(delete t.currentFrame,delete t.currentTime)}},zz=t=>async e=>{try{const n=await fetch(e);if(n.ok)return[await n.text(),n.url]}catch{}throw t()},jz={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},Gz=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=s(a),c={...jz,...u},h=r(l,c),d=i(l),f=d?n():null;super(a,!1,h,f),this._gain=e(this,d,h.gain,$n,jn)}get gain(){return this._gain}},Hz=(t,e,n,r,s)=>()=>{const i=new WeakMap,o=async(a,u)=>{let l=n(a);const c=Cn(l,u);if(!c){const h={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,gain:l.gain.value};l=e(u,h)}return i.set(u,l),c?await t(u,a.gain,l.gain):await r(u,a.gain,l.gain),await s(a,u,l),l};return{render(a,u){const l=i.get(u);return l!==void 0?Promise.resolve(l):o(a,u)}}},qz=(t,e)=>n=>e(t,n),Kz=t=>e=>{const n=t(e);if(n.renderer===null)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer},Xz=t=>e=>{var n;return(n=t.get(e))!==null&&n!==void 0?n:0},Yz=t=>e=>{const n=t(e);if(n.renderer===null)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer},Qz=t=>e=>t.get(e),Qt=()=>new DOMException("","InvalidStateError"),Zz=t=>e=>{const n=t.get(e);if(n===void 0)throw Qt();return n},Jz=(t,e)=>n=>{let r=t.get(n);if(r!==void 0)return r;if(e===null)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new e(1,1,44100),t.set(n,r),r},ej=t=>e=>{const n=t.get(e);if(n===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return n},Wp=()=>new DOMException("","InvalidAccessError"),tj=t=>{t.getFrequencyResponse=(e=>(n,r,s)=>{if(n.length!==r.length||r.length!==s.length)throw Wp();return e.call(t,n,r,s)})(t.getFrequencyResponse)},nj={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},rj=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=r(a),c=s(l),h={...nj,...u},d=e(l,c?null:a.baseLatency,h),f=c?n(h.feedback,h.feedforward):null;super(a,!1,d,f),tj(d),this._nativeIIRFilterNode=d,i(this,1)}getFrequencyResponse(a,u,l){return this._nativeIIRFilterNode.getFrequencyResponse(a,u,l)}},Vk=(t,e,n,r,s,i,o,a,u,l,c)=>{const h=l.length;let d=a;for(let f=0;f<h;f+=1){let p=n[0]*l[f];for(let y=1;y<s;y+=1){const v=d-y&u-1;p+=n[y]*i[v],p-=t[y]*o[v]}for(let y=s;y<r;y+=1)p+=n[y]*i[d-y&u-1];for(let y=s;y<e;y+=1)p-=t[y]*o[d-y&u-1];i[d]=l[f],o[d]=p,d=d+1&u-1,c[f]=p}return d},sj=(t,e,n,r)=>{const s=n instanceof Float64Array?n:new Float64Array(n),i=r instanceof Float64Array?r:new Float64Array(r),o=s.length,a=i.length,u=Math.min(o,a);if(s[0]!==1){for(let p=0;p<o;p+=1)i[p]/=s[0];for(let p=1;p<a;p+=1)s[p]/=s[0]}const l=32,c=new Float32Array(l),h=new Float32Array(l),d=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),f=t.numberOfChannels;for(let p=0;p<f;p+=1){const y=t.getChannelData(p),v=d.getChannelData(p);c.fill(0),h.fill(0),Vk(s,o,i,a,u,c,h,0,l,y,v)}return d},ij=(t,e,n,r,s)=>(i,o)=>{const a=new WeakMap;let u=null;const l=async(c,h)=>{let d=null,f=e(c);const p=Cn(f,h);if(h.createIIRFilter===void 0?d=t(h,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(f=h.createIIRFilter(o,i)),a.set(h,d===null?f:d),d!==null){if(u===null){if(n===null)throw new Error("Missing the native OfflineAudioContext constructor.");const v=new n(c.context.destination.channelCount,c.context.length,h.sampleRate);u=(async()=>{await r(c,v,v.destination);const g=await s(v);return sj(g,h,i,o)})()}const y=await u;return d.buffer=y,d.start(0),d}return await r(c,h,f),f};return{render(c,h){const d=a.get(h);return d!==void 0?Promise.resolve(d):l(c,h)}}},oj=(t,e,n,r,s,i)=>o=>(a,u)=>{const l=t.get(a);if(l===void 0){if(!o&&i(a)){const c=r(a),{outputs:h}=n(a);for(const d of h)if(lh(d)){const f=r(d[0]);e(c,f,d[1],d[2])}else{const f=s(d[0]);c.disconnect(f,d[1])}}t.set(a,u)}else t.set(a,l+u)},aj=(t,e)=>n=>{const r=t.get(n);return e(r)||e(n)},uj=(t,e)=>n=>t.has(n)||e(n),lj=(t,e)=>n=>t.has(n)||e(n),cj=(t,e)=>n=>{const r=t.get(n);return e(r)||e(n)},hj=t=>e=>t!==null&&e instanceof t,dj=t=>e=>t!==null&&typeof t.AudioNode=="function"&&e instanceof t.AudioNode,fj=t=>e=>t!==null&&typeof t.AudioParam=="function"&&e instanceof t.AudioParam,pj=(t,e)=>n=>t(n)||e(n),mj=t=>e=>t!==null&&e instanceof t,gj=t=>t!==null&&t.isSecureContext,yj=(t,e,n,r)=>class extends t{constructor(i,o){const a=n(i),u=e(a,o);if(r(a))throw TypeError();super(i,!0,u,null),this._nativeMediaElementAudioSourceNode=u}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},vj={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},xj=(t,e,n,r)=>class extends t{constructor(i,o){const a=n(i);if(r(a))throw new TypeError;const u={...vj,...o},l=e(a,u);super(i,!1,l,null),this._nativeMediaStreamAudioDestinationNode=l}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},wj=(t,e,n,r)=>class extends t{constructor(i,o){const a=n(i),u=e(a,o);if(r(a))throw new TypeError;super(i,!0,u,null),this._nativeMediaStreamAudioSourceNode=u}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},bj=(t,e,n)=>class extends t{constructor(s,i){const o=n(s),a=e(o,i);super(s,!0,a,null)}},_j=(t,e,n,r,s,i)=>class extends n{constructor(a,u){super(a),this._nativeContext=a,Vp.set(this,a),r(a)&&s.set(a,new Set),this._destination=new t(this,u),this._listener=e(this,a),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(a){const u=typeof a=="function"?i(this,a):null;this._nativeContext.onstatechange=u;const l=this._nativeContext.onstatechange;this._onstatechange=l!==null&&l===u?a:l}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},Mc=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,()=>{});return n===void 0?!1:(n.catch(()=>{}),!0)}catch{}return!1},Sj=(t,e)=>(n,r,s)=>{const i=new Set;return n.connect=(o=>(a,u=0,l=0)=>{const c=i.size===0;if(e(a))return o.call(n,a,u,l),t(i,[a,u,l],h=>h[0]===a&&h[1]===u&&h[2]===l,!0),c&&r(),a;o.call(n,a,u),t(i,[a,u],h=>h[0]===a&&h[1]===u,!0),c&&r()})(n.connect),n.disconnect=(o=>(a,u,l)=>{const c=i.size>0;
vendor: 9,235 bytes, line 50
50if(a===void 0)o.apply(n),i.clear();else if(typeof a=="number"){o.call(n,a);for(const d of i)d[1]===a&&i.delete(d)}else{e(a)?o.call(n,a,u,l):o.call(n,a,u);for(const d of i)d[0]===a&&(u===void 0||d[1]===u)&&(l===void 0||d[2]===l)&&i.delete(d)}const h=i.size===0;c&&h&&s()})(n.disconnect),n},pt=(t,e,n)=>{const r=e[n];r!==void 0&&r!==t[n]&&(t[n]=r)},jt=(t,e)=>{pt(t,e,"channelCount"),pt(t,e,"channelCountMode"),pt(t,e,"channelInterpretation")},qS=t=>typeof t.getFloatTimeDomainData=="function",Tj=t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const r=Math.max(n.length,t.fftSize);for(let s=0;s<r;s+=1)e[s]=(n[s]-128)*.0078125;return e}},Cj=(t,e)=>(n,r)=>{const s=n.createAnalyser();if(jt(s,r),!(r.maxDecibels>r.minDecibels))throw e();return pt(s,r,"fftSize"),pt(s,r,"maxDecibels"),pt(s,r,"minDecibels"),pt(s,r,"smoothingTimeConstant"),t(qS,()=>qS(s))||Tj(s),s},Nj=t=>t===null?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null,$t=(t,e,n)=>{const r=e[n];r!==void 0&&r!==t[n].value&&(t[n].value=r)},Ej=t=>{t.start=(e=>{let n=!1;return(r=0,s=0,i)=>{if(n)throw Qt();e.call(t,r,s,i),n=!0}})(t.start)},Wx=t=>{t.start=(e=>(n=0,r=0,s)=>{if(typeof s=="number"&&s<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,r,s)})(t.start)},Ux=t=>{t.stop=(e=>(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})(t.stop)},kj=(t,e,n,r,s,i,o,a,u,l,c)=>(h,d)=>{const f=h.createBufferSource();return jt(f,d),$t(f,d,"playbackRate"),pt(f,d,"buffer"),pt(f,d,"loop"),pt(f,d,"loopEnd"),pt(f,d,"loopStart"),e(n,()=>n(h))||Ej(f),e(r,()=>r(h))||u(f),e(s,()=>s(h))||l(f,h),e(i,()=>i(h))||Wx(f),e(o,()=>o(h))||c(f,h),e(a,()=>a(h))||Ux(f),t(h,f),f},$j=t=>t===null?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null,Ij=(t,e)=>(n,r,s)=>{const i=n.destination;if(i.channelCount!==r)try{i.channelCount=r}catch{}s&&i.channelCountMode!=="explicit"&&(i.channelCountMode="explicit"),i.maxChannelCount===0&&Object.defineProperty(i,"maxChannelCount",{value:r});const o=t(n,{channelCount:r,channelCountMode:i.channelCountMode,channelInterpretation:i.channelInterpretation,gain:1});return e(o,"channelCount",a=>()=>a.call(o),a=>u=>{a.call(o,u);try{i.channelCount=u}catch(l){if(u>i.maxChannelCount)throw l}}),e(o,"channelCountMode",a=>()=>a.call(o),a=>u=>{a.call(o,u),i.channelCountMode=u}),e(o,"channelInterpretation",a=>()=>a.call(o),a=>u=>{a.call(o,u),i.channelInterpretation=u}),Object.defineProperty(o,"maxChannelCount",{get:()=>i.maxChannelCount}),o.connect(i),o},Aj=t=>t===null?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null,Rj=t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}},Oj=(t,e,n,r,s)=>(i,o,a,u,l,c)=>{if(a!==null)try{const h=new a(i,u,c),d=new Map;let f=null;if(Object.defineProperties(h,{channelCount:{get:()=>c.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>f,set:p=>{typeof f=="function"&&h.removeEventListener("processorerror",f),f=typeof p=="function"?p:null,typeof f=="function"&&h.addEventListener("processorerror",f)}}}),h.addEventListener=(p=>(...y)=>{if(y[0]==="processorerror"){const v=typeof y[1]=="function"?y[1]:typeof y[1]=="object"&&y[1]!==null&&typeof y[1].handleEvent=="function"?y[1].handleEvent:null;if(v!==null){const g=d.get(y[1]);g!==void 0?y[1]=g:(y[1]=x=>{x.type==="error"?(Object.defineProperties(x,{type:{value:"processorerror"}}),v(x)):v(new ErrorEvent(y[0],{...x}))},d.set(v,y[1]))}}return p.call(h,"error",y[1],y[2]),p.call(h,...y)})(h.addEventListener),h.removeEventListener=(p=>(...y)=>{if(y[0]==="processorerror"){const v=d.get(y[1]);v!==void 0&&(d.delete(y[1]),y[1]=v)}return p.call(h,"error",y[1],y[2]),p.call(h,y[0],y[1],y[2])})(h.removeEventListener),c.numberOfOutputs!==0){const p=n(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return h.connect(p).connect(i.destination),s(h,()=>p.disconnect(),()=>p.connect(i.destination))}return h}catch(h){throw h.code===11?r():h}if(l===void 0)throw r();return Rj(c),e(i,o,l,c)},Bk=(t,e)=>t===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),Dj=t=>new Promise((e,n)=>{const{port1:r,port2:s}=new MessageChannel;r.onmessage=({data:i})=>{r.close(),s.close(),e(i)},r.onmessageerror=({data:i})=>{r.close(),s.close(),n(i)},s.postMessage(t)}),Pj=async(t,e)=>{const n=await Dj(e);return new t(n)},Fj=(t,e,n,r)=>{let s=p0.get(t);s===void 0&&(s=new WeakMap,p0.set(t,s));const i=Pj(n,r);return s.set(e,i),i},Lj=(t,e,n,r,s,i,o,a,u,l,c,h,d)=>(f,p,y,v)=>{if(v.numberOfInputs===0&&v.numberOfOutputs===0)throw u();const g=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(g.some(ce=>ce<1))throw u();if(g.length!==v.numberOfOutputs)throw e();if(v.channelCountMode!=="explicit")throw u();const x=v.channelCount*v.numberOfInputs,w=g.reduce((ce,be)=>ce+be,0),_=y.parameterDescriptors===void 0?0:y.parameterDescriptors.length;if(x+_>6||w>6)throw u();const T=new MessageChannel,E=[],k=[];for(let ce=0;ce<v.numberOfInputs;ce+=1)E.push(o(f,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),k.push(s(f,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const N=[];if(y.parameterDescriptors!==void 0)for(const{defaultValue:ce,maxValue:be,minValue:Nt,name:Ze}of y.parameterDescriptors){const Fe=i(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:v.parameterData[Ze]!==void 0?v.parameterData[Ze]:ce===void 0?0:ce});Object.defineProperties(Fe.offset,{defaultValue:{get:()=>ce===void 0?0:ce},maxValue:{get:()=>be===void 0?$n:be},minValue:{get:()=>Nt===void 0?jn:Nt}}),N.push(Fe)}const O=r(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,x+_)}),R=Bk(p,f.sampleRate),L=a(f,R,x+_,Math.max(1,w)),W=s(f,{channelCount:Math.max(1,w),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,w)}),G=[];for(let ce=0;ce<v.numberOfOutputs;ce+=1)G.push(r(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:g[ce]}));for(let ce=0;ce<v.numberOfInputs;ce+=1){E[ce].connect(k[ce]);for(let be=0;be<v.channelCount;be+=1)k[ce].connect(O,be,ce*v.channelCount+be)}const H=new Lk(y.parameterDescriptors===void 0?[]:y.parameterDescriptors.map(({name:ce},be)=>{const Nt=N[be];return Nt.connect(O,0,x+be),Nt.start(0),[ce,Nt.offset]}));O.connect(L);let X=v.channelInterpretation,Q=null;const Y=v.numberOfOutputs===0?[L]:G,j={get bufferSize(){return R},get channelCount(){return v.channelCount},set channelCount(ce){throw n()},get channelCountMode(){return v.channelCountMode},set channelCountMode(ce){throw n()},get channelInterpretation(){return X},set channelInterpretation(ce){for(const be of E)be.channelInterpretation=ce;X=ce},get context(){return L.context},get inputs(){return E},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},get onprocessorerror(){return Q},set onprocessorerror(ce){typeof Q=="function"&&j.removeEventListener("processorerror",Q),Q=typeof ce=="function"?ce:null,typeof Q=="function"&&j.addEventListener("processorerror",Q)},get parameters(){return H},get port(){return T.port2},addEventListener(...ce){return L.addEventListener(ce[0],ce[1],ce[2])},connect:t.bind(null,Y),disconnect:l.bind(null,Y),dispatchEvent(...ce){return L.dispatchEvent(ce[0])},removeEventListener(...ce){return L.removeEventListener(ce[0],ce[1],ce[2])}},q=new Map;T.port1.addEventListener=(ce=>(...be)=>{if(be[0]==="message"){const Nt=typeof be[1]=="function"?be[1]:typeof be[1]=="object"&&be[1]!==null&&typeof be[1].handleEvent=="function"?be[1].handleEvent:null;if(Nt!==null){const Ze=q.get(be[1]);Ze!==void 0?be[1]=Ze:(be[1]=Fe=>{c(f.currentTime,f.sampleRate,()=>Nt(Fe))},q.set(Nt,be[1]))}}return ce.call(T.port1,be[0],be[1],be[2])})(T.port1.addEventListener),T.port1.removeEventListener=(ce=>(...be)=>{if(be[0]==="message"){const Nt=q.get(be[1]);Nt!==void 0&&(q.delete(be[1]),be[1]=Nt)}return ce.call(T.port1,be[0],be[1],be[2])})(T.port1.removeEventListener);let Z=null;Object.defineProperty(T.port1,"onmessage",{get:()=>Z,set:ce=>{typeof Z=="function"&&T.port1.removeEventListener("message",Z),Z=typeof ce=="function"?ce:null,typeof Z=="function"&&(T.port1.addEventListener("message",Z),T.port1.start())}}),y.prototype.port=T.port1;let ae=null;Fj(f,j,y,v).then(ce=>ae=ce);const We=Pf(v.numberOfInputs,v.channelCount),Ue=Pf(v.numberOfOutputs,g),we=y.parameterDescriptors===void 0?[]:y.parameterDescriptors.reduce((ce,{name:be})=>({...ce,[be]:new Float32Array(128)}),{});let Ie=!0;const Ct=()=>{v.numberOfOutputs>0&&L.disconnect(W);for(let ce=0,be=0;ce<v.numberOfOutputs;ce+=1){const Nt=G[ce];for(let Ze=0;Ze<g[ce];Ze+=1)W.disconnect(Nt,be+Ze,Ze);be+=g[ce]}},me=new Map;L.onaudioprocess=({inputBuffer:ce,outputBuffer:be})=>{if(ae!==null){const Nt=h(j);for(let Ze=0;Ze<R;Ze+=128){for(let Fe=0;Fe<v.numberOfInputs;Fe+=1)for(let at=0;at<v.channelCount;at+=1)Df(ce,We[Fe],at,at,Ze);
50y.parameterDescriptors!==void 0&&y.parameterDescriptors.forEach(({name:Fe},at)=>{Df(ce,we,Fe,x+at,Ze)});for(let Fe=0;Fe<v.numberOfInputs;Fe+=1)for(let at=0;at<g[Fe];at+=1)Ue[Fe][at].byteLength===0&&(Ue[Fe][at]=new Float32Array(128));try{const Fe=We.map((En,wr)=>{if(Nt[wr].size>0)return me.set(wr,R/128),En;const Hr=me.get(wr);return Hr===void 0?[]:(En.every($h=>$h.every(Ua=>Ua===0))&&(Hr===1?me.delete(wr):me.set(wr,Hr-1)),En)});Ie=c(f.currentTime+Ze/f.sampleRate,f.sampleRate,()=>ae.process(Fe,Ue,we));for(let En=0,wr=0;En<v.numberOfOutputs;En+=1){for(let $i=0;$i<g[En];$i+=1)Mk(be,Ue[En],$i,wr+$i,Ze);wr+=g[En]}}catch(Fe){Ie=!1,j.dispatchEvent(new ErrorEvent("processorerror",{colno:Fe.colno,filename:Fe.filename,lineno:Fe.lineno,message:Fe.message}))}if(!Ie){for(let Fe=0;Fe<v.numberOfInputs;Fe+=1){E[Fe].disconnect(k[Fe]);for(let at=0;at<v.channelCount;at+=1)k[Ze].disconnect(O,at,Fe*v.channelCount+at)}if(y.parameterDescriptors!==void 0){const Fe=y.parameterDescriptors.length;for(let at=0;at<Fe;at+=1){const En=N[at];En.disconnect(O,0,x+at),En.stop()}}O.disconnect(L),L.onaudioprocess=null,bs?Ct():ki();break}}}};let bs=!1;const Gr=o(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),xr=()=>L.connect(Gr).connect(f.destination),ki=()=>{L.disconnect(Gr),Gr.disconnect()},It=()=>{if(Ie){ki(),v.numberOfOutputs>0&&L.connect(W);for(let ce=0,be=0;ce<v.numberOfOutputs;ce+=1){const Nt=G[ce];for(let Ze=0;Ze<g[ce];Ze+=1)W.connect(Nt,be+Ze,Ze);be+=g[ce]}}bs=!0},nn=()=>{Ie&&(xr(),Ct()),bs=!1};return xr(),d(j,It,nn)},Wk=(t,e)=>{const n=t.createBiquadFilter();return jt(n,e),$t(n,e,"Q"),$t(n,e,"detune"),$t(n,e,"frequency"),$t(n,e,"gain"),pt(n,e,"type"),n},Mj=(t,e)=>(n,r)=>{const s=n.createChannelMerger(r.numberOfInputs);return t!==null&&t.name==="webkitAudioContext"&&e(n,s),jt(s,r),s},Vj=t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:n=>{if(n!==e)throw Qt()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:n=>{if(n!=="explicit")throw Qt()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:n=>{if(n!=="discrete")throw Qt()}})},ch=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return jt(n,e),Vj(n),n},Bj=(t,e,n,r,s)=>(i,o)=>{if(i.createConstantSource===void 0)return n(i,o);const a=i.createConstantSource();return jt(a,o),$t(a,o,"offset"),e(r,()=>r(i))||Wx(a),e(s,()=>s(i))||Ux(a),t(i,a),a},ul=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),Wj=(t,e,n,r)=>(s,{offset:i,...o})=>{const a=s.createBuffer(1,2,44100),u=e(s,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),l=n(s,{...o,gain:i}),c=a.getChannelData(0);c[0]=1,c[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(p){l.channelCount=p},get channelCountMode(){return l.channelCountMode},set channelCountMode(p){l.channelCountMode=p},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(p){l.channelInterpretation=p},get context(){return l.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get offset(){return l.gain},get onended(){return u.onended},set onended(p){u.onended=p},addEventListener(...p){return u.addEventListener(p[0],p[1],p[2])},dispatchEvent(...p){return u.dispatchEvent(p[0])},removeEventListener(...p){return u.removeEventListener(p[0],p[1],p[2])},start(p=0){u.start.call(u,p)},stop(p=0){u.stop.call(u,p)}},d=()=>u.connect(l),f=()=>u.disconnect(l);return t(s,u),r(ul(h,l),d,f)},Uj=(t,e)=>(n,r)=>{const s=n.createConvolver();if(jt(s,r),r.disableNormalization===s.normalize&&(s.normalize=!r.disableNormalization),pt(s,r,"buffer"),r.channelCount>2||(e(s,"channelCount",i=>()=>i.call(s),i=>o=>{if(o>2)throw t();return i.call(s,o)}),r.channelCountMode==="max"))throw t();return e(s,"channelCountMode",i=>()=>i.call(s),i=>o=>{if(o==="max")throw t();return i.call(s,o)}),s},Uk=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return jt(n,e),$t(n,e,"delayTime"),n},zj=t=>(e,n)=>{const r=e.createDynamicsCompressor();if(jt(r,n),n.channelCount>2||n.channelCountMode==="max")throw t();return $t(r,n,"attack"),$t(r,n,"knee"),$t(r,n,"ratio"),$t(r,n,"release"),$t(r,n,"threshold"),r},Zn=(t,e)=>{const n=t.createGain();return jt(n,e),$t(n,e,"gain"),n},jj=t=>(e,n,r)=>{if(e.createIIRFilter===void 0)return t(e,n,r);const s=e.createIIRFilter(r.feedforward,r.feedback);return jt(s,r),s};function Gj(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function Hj(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function KS(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=Hj(n,e),n[0]+=t[r];return n}const qj=(t,e,n,r)=>(s,i,{channelCount:o,channelCountMode:a,channelInterpretation:u,feedback:l,feedforward:c})=>{const h=Bk(i,s.sampleRate),d=l instanceof Float64Array?l:new Float64Array(l),f=c instanceof Float64Array?c:new Float64Array(c),p=d.length,y=f.length,v=Math.min(p,y);if(p===0||p>20)throw r();if(d[0]===0)throw e();if(y===0||y>20)throw r();if(f[0]===0)throw e();if(d[0]!==1){for(let N=0;N<y;N+=1)f[N]/=d[0];for(let N=1;N<p;N+=1)d[N]/=d[0]}const g=n(s,h,o,o);g.channelCount=o,g.channelCountMode=a,g.channelInterpretation=u;const x=32,w=[],_=[],T=[];for(let N=0;N<o;N+=1){w.push(0);const O=new Float32Array(x),R=new Float32Array(x);O.fill(0),R.fill(0),_.push(O),T.push(R)}g.onaudioprocess=N=>{const O=N.inputBuffer,R=N.outputBuffer,L=O.numberOfChannels;for(let W=0;W<L;W+=1){const G=O.getChannelData(W),H=R.getChannelData(W);
50w[W]=Vk(d,p,f,y,v,_[W],T[W],w[W],x,G,H)}};const E=s.sampleRate/2;return ul({get bufferSize(){return h},get channelCount(){return g.channelCount},set channelCount(N){g.channelCount=N},get channelCountMode(){return g.channelCountMode},set channelCountMode(N){g.channelCountMode=N},get channelInterpretation(){return g.channelInterpretation},set channelInterpretation(N){g.channelInterpretation=N},get context(){return g.context},get inputs(){return[g]},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},addEventListener(...N){return g.addEventListener(N[0],N[1],N[2])},dispatchEvent(...N){return g.dispatchEvent(N[0])},getFrequencyResponse(N,O,R){if(N.length!==O.length||O.length!==R.length)throw t();const L=N.length;for(let W=0;W<L;W+=1){const G=-Math.PI*(N[W]/E),H=[Math.cos(G),Math.sin(G)],X=KS(f,H),Q=KS(d,H),Y=Gj(X,Q);O[W]=Math.sqrt(Y[0]*Y[0]+Y[1]*Y[1]),R[W]=Math.atan2(Y[1],Y[0])}},removeEventListener(...N){return g.removeEventListener(N[0],N[1],N[2])}},g)},Kj=(t,e)=>t.createMediaElementSource(e.mediaElement),Xj=(t,e)=>{const n=t.createMediaStreamDestination();return jt(n,e),n.numberOfOutputs===1&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Yj=(t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort((i,o)=>i.id<o.id?-1:i.id>o.id?1:0);const r=n.slice(0,1),s=t.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(s,"mediaStream",{value:e}),s},Qj=(t,e)=>(n,{mediaStreamTrack:r})=>{if(typeof n.createMediaStreamTrackSource=="function")return n.createMediaStreamTrackSource(r);const s=new MediaStream([r]),i=n.createMediaStreamSource(s);if(r.kind!=="audio")throw t();if(e(n))throw new TypeError;return i},Zj=t=>t===null?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null,Jj=(t,e,n,r,s,i)=>(o,a)=>{const u=o.createOscillator();return jt(u,a),$t(u,a,"detune"),$t(u,a,"frequency"),a.periodicWave!==void 0?u.setPeriodicWave(a.periodicWave):pt(u,a,"type"),e(n,()=>n(o))||Wx(u),e(r,()=>r(o))||i(u,o),e(s,()=>s(o))||Ux(u),t(o,u),u},eG=t=>(e,n)=>{const r=e.createPanner();return r.orientationX===void 0?t(e,n):(jt(r,n),$t(r,n,"orientationX"),$t(r,n,"orientationY"),$t(r,n,"orientationZ"),$t(r,n,"positionX"),$t(r,n,"positionY"),$t(r,n,"positionZ"),pt(r,n,"coneInnerAngle"),pt(r,n,"coneOuterAngle"),pt(r,n,"coneOuterGain"),pt(r,n,"distanceModel"),pt(r,n,"maxDistance"),pt(r,n,"panningModel"),pt(r,n,"refDistance"),pt(r,n,"rolloffFactor"),r)},tG=(t,e,n,r,s,i,o,a,u,l)=>(c,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:f,distanceModel:p,maxDistance:y,orientationX:v,orientationY:g,orientationZ:x,panningModel:w,positionX:_,positionY:T,positionZ:E,refDistance:k,rolloffFactor:N,...O})=>{const R=c.createPanner();if(O.channelCount>2||O.channelCountMode==="max")throw o();jt(R,O);const L={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},W=n(c,{...L,channelInterpretation:"speakers",numberOfInputs:6}),G=r(c,{...O,gain:1}),H=r(c,{...L,gain:1}),X=r(c,{...L,gain:0}),Q=r(c,{...L,gain:0}),Y=r(c,{...L,gain:0}),j=r(c,{...L,gain:0}),q=r(c,{...L,gain:0}),Z=s(c,256,6,1),ae=i(c,{...L,curve:new Float32Array([1,1]),oversample:"none"});let fe=[v,g,x],We=[_,T,E];const Ue=new Float32Array(1);Z.onaudioprocess=({inputBuffer:me})=>{const bs=[u(me,Ue,0),u(me,Ue,1),u(me,Ue,2)];bs.some((xr,ki)=>xr!==fe[ki])&&(R.setOrientation(...bs),fe=bs);const Gr=[u(me,Ue,3),u(me,Ue,4),u(me,Ue,5)];Gr.some((xr,ki)=>xr!==We[ki])&&(R.setPosition(...Gr),We=Gr)},Object.defineProperty(X.gain,"defaultValue",{get:()=>0}),Object.defineProperty(Q.gain,"defaultValue",{get:()=>0}),Object.defineProperty(Y.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(q.gain,"defaultValue",{get:()=>0});const we={get bufferSize(){},get channelCount(){return R.channelCount},set channelCount(me){if(me>2)throw o();G.channelCount=me,R.channelCount=me},get channelCountMode(){return R.channelCountMode},set channelCountMode(me){if(me==="max")throw o();G.channelCountMode=me,R.channelCountMode=me},get channelInterpretation(){return R.channelInterpretation},set channelInterpretation(me){G.channelInterpretation=me,R.channelInterpretation=me},get coneInnerAngle(){return R.coneInnerAngle},set coneInnerAngle(me){R.coneInnerAngle=me},get coneOuterAngle(){return R.coneOuterAngle},set coneOuterAngle(me){R.coneOuterAngle=me},get coneOuterGain(){return R.coneOuterGain},set coneOuterGain(me){if(me<0||me>1)throw e();R.coneOuterGain=me},get context(){return R.context},get distanceModel(){return R.distanceModel},set distanceModel(me){R.distanceModel=me},get inputs(){return[G]},get maxDistance(){return R.maxDistance},set maxDistance(me){if(me<0)throw new RangeError;R.maxDistance=me},get numberOfInputs(){return R.numberOfInputs},get numberOfOutputs(){return R.numberOfOutputs},get orientationX(){return H.gain},get orientationY(){return X.gain},get orientationZ(){return Q.gain},get panningModel(){return R.panningModel},set panningModel(me){R.panningModel=me},get positionX(){return Y.gain},get positionY(){return j.gain},get positionZ(){return q.gain},get refDistance(){return R.refDistance},set refDistance(me){if(me<0)throw new RangeError;R.refDistance=me},get rolloffFactor(){return R.rolloffFactor},set rolloffFactor(me){if(me<0)throw new RangeError;R.rolloffFactor=me},addEventListener(...me){return G.addEventListener(me[0],me[1],me[2])},dispatchEvent(...me){return G.dispatchEvent(me[0])},removeEventListener(...me){return G.removeEventListener(me[0],me[1],me[2])}};h!==we.coneInnerAngle&&(we.coneInnerAngle=h),d!==we.coneOuterAngle&&(we.coneOuterAngle=d),f!==we.coneOuterGain&&(we.coneOuterGain=f),p!==we.distanceModel&&(we.distanceModel=p),y!==we.maxDistance&&(we.maxDistance=y),v!==we.orientationX.value&&(we.orientationX.value=v),g!==we.orientationY.value&&(we.orientationY.value=g),x!==we.orientationZ.value&&(we.orientationZ.value=x),w!==we.panningModel&&(we.panningModel=w),_!==we.positionX.value&&(we.positionX.value=_),T!==we.positionY.value&&(we.positionY.value=T),E!==we.positionZ.value&&(we.positionZ.value=E),k!==we.refDistance&&(we.refDistance=k),N!==we.rolloffFactor&&(we.rolloffFactor=N),(fe[0]!==1||fe[1]!==0||fe[2]!==0)&&R.setOrientation(...fe),(We[0]!==0||We[1]!==0||We[2]!==0)&&R.setPosition(...We);const Ie=()=>{G.connect(R),t(G,ae,0,0),ae.connect(H).connect(W,0,0),ae.connect(X).connect(W,0,1),ae.connect(Q).connect(W,0,2),ae.connect(Y).connect(W,0,3),ae.connect(j).connect(W,0,4),ae.connect(q).connect(W,0,5),W.connect(Z).connect(c.destination)},Ct=()=>{G.disconnect(R),a(G,ae,0,0),ae.disconnect(H),H.disconnect(W),ae.disconnect(X),X.disconnect(W),ae.disconnect(Q),Q.disconnect(W),ae.disconnect(Y),Y.disconnect(W),ae.disconnect(j),j.disconnect(W),ae.disconnect(q),q.disconnect(W),W.disconnect(Z),Z.disconnect(c.destination)};return l(ul(we,R),Ie,Ct)},nG=t=>(e,{disableNormalization:n,imag:r,real:s})=>{const i=r instanceof Float32Array?r:new Float32Array(r),o=s instanceof Float32Array?s:new Float32Array(s),a=e.createPerio
50dicWave(o,i,{disableNormalization:n});if(Array.from(r).length<2)throw t();return a},hh=(t,e,n,r)=>t.createScriptProcessor(e,n,r),rG=(t,e)=>(n,r)=>{const s=r.channelCountMode;if(s==="clamped-max")throw e();if(n.createStereoPanner===void 0)return t(n,r);const i=n.createStereoPanner();return jt(i,r),$t(i,r,"pan"),Object.defineProperty(i,"channelCountMode",{get:()=>s,set:o=>{if(o!==s)throw e()}}),i},sG=(t,e,n,r,s,i)=>{const a=new Float32Array([1,1]),u=Math.PI/2,l={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},c={...l,oversample:"none"},h=(p,y,v,g)=>{const x=new Float32Array(16385),w=new Float32Array(16385);for(let O=0;O<16385;O+=1){const R=O/16384*u;x[O]=Math.cos(R),w[O]=Math.sin(R)}const _=n(p,{...l,gain:0}),T=r(p,{...c,curve:x}),E=r(p,{...c,curve:a}),k=n(p,{...l,gain:0}),N=r(p,{...c,curve:w});return{connectGraph(){y.connect(_),y.connect(E.inputs===void 0?E:E.inputs[0]),y.connect(k),E.connect(v),v.connect(T.inputs===void 0?T:T.inputs[0]),v.connect(N.inputs===void 0?N:N.inputs[0]),T.connect(_.gain),N.connect(k.gain),_.connect(g,0,0),k.connect(g,0,1)},disconnectGraph(){y.disconnect(_),y.disconnect(E.inputs===void 0?E:E.inputs[0]),y.disconnect(k),E.disconnect(v),v.disconnect(T.inputs===void 0?T:T.inputs[0]),v.disconnect(N.inputs===void 0?N:N.inputs[0]),T.disconnect(_.gain),N.disconnect(k.gain),_.disconnect(g,0,0),k.disconnect(g,0,1)}}},d=(p,y,v,g)=>{const x=new Float32Array(16385),w=new Float32Array(16385),_=new Float32Array(16385),T=new Float32Array(16385),E=Math.floor(16385/2);for(let Y=0;Y<16385;Y+=1)if(Y>E){const j=(Y-E)/(16384-E)*u;x[Y]=Math.cos(j),w[Y]=Math.sin(j),_[Y]=0,T[Y]=1}else{const j=Y/(16384-E)*u;x[Y]=1,w[Y]=0,_[Y]=Math.cos(j),T[Y]=Math.sin(j)}const k=e(p,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),N=n(p,{...l,gain:0}),O=r(p,{...c,curve:x}),R=n(p,{...l,gain:0}),L=r(p,{...c,curve:w}),W=r(p,{...c,curve:a}),G=n(p,{...l,gain:0}),H=r(p,{...c,curve:_}),X=n(p,{...l,gain:0}),Q=r(p,{...c,curve:T});return{connectGraph(){y.connect(k),y.connect(W.inputs===void 0?W:W.inputs[0]),k.connect(N,0),k.connect(R,0),k.connect(G,1),k.connect(X,1),W.connect(v),v.connect(O.inputs===void 0?O:O.inputs[0]),v.connect(L.inputs===void 0?L:L.inputs[0]),v.connect(H.inputs===void 0?H:H.inputs[0]),v.connect(Q.inputs===void 0?Q:Q.inputs[0]),O.connect(N.gain),L.connect(R.gain),H.connect(G.gain),Q.connect(X.gain),N.connect(g,0,0),G.connect(g,0,0),R.connect(g,0,1),X.connect(g,0,1)},disconnectGraph(){y.disconnect(k),y.disconnect(W.inputs===void 0?W:W.inputs[0]),k.disconnect(N,0),k.disconnect(R,0),k.disconnect(G,1),k.disconnect(X,1),W.disconnect(v),v.disconnect(O.inputs===void 0?O:O.inputs[0]),v.disconnect(L.inputs===void 0?L:L.inputs[0]),v.disconnect(H.inputs===void 0?H:H.inputs[0]),v.disconnect(Q.inputs===void 0?Q:Q.inputs[0]),O.disconnect(N.gain),L.disconnect(R.gain),H.disconnect(G.gain),Q.disconnect(X.gain),N.disconnect(g,0,0),G.disconnect(g,0,0),R.disconnect(g,0,1),X.disconnect(g,0,1)}}},f=(p,y,v,g,x)=>{if(y===1)return h(p,v,g,x);if(y===2)return d(p,v,g,x);throw s()};return(p,{channelCount:y,channelCountMode:v,pan:g,...x})=>{if(v==="max")throw s();const w=t(p,{...x,channelCount:1,channelCountMode:v,numberOfInputs:2}),_=n(p,{...x,channelCount:y,channelCountMode:v,gain:1}),T=n(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:g});let{connectGraph:E,disconnectGraph:k}=f(p,y,_,T,w);Object.defineProperty(T.gain,"defaultValue",{get:()=>0}),Object.defineProperty(T.gain,"maxValue",{get:()=>1}),Object.defineProperty(T.gain,"minValue",{get:()=>-1});const N={get bufferSize(){},get channelCount(){return _.channelCount},set channelCount(W){_.channelCount!==W&&(O&&k(),{connectGraph:E,disconnectGraph:k}=f(p,W,_,T,w),O&&E()),_.channelCount=W},get channelCountMode(){return _.channelCountMode},set channelCountMode(W){if(W==="clamped-max"||W==="max")throw s();_.channelCountMode=W},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(W){_.channelInterpretation=W},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},get pan(){return T.gain},addEventListener(...W){return _.addEventListener(W[0],W[1],W[2])},dispatchEvent(...W){return _.dispatchEvent(W[0])},removeEventListener(...W){return _.removeEventListener(W[0],W[1],W[2])}};let O=!1;const R=()=>{E(),O=!0},L=()=>{k(),O=!1};return i(ul(N,w),R,L)}},iG=(t,e,n,r,s,i,o)=>(a,u)=>{const l=a.createWaveShaper();if(i!==null&&i.name==="webkitAudioContext"&&a.createGain().gain.automationRate===void 0)return n(a,u);jt(l,u);const c=u.curve===null||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(c!==null&&c.length<2)throw e();pt(l,{curve:c},"curve"),pt(l,u,"oversample");let h=null,d=!1;return o(l,"curve",y=>()=>y.call(l),y=>v=>(y.call(l,v),d&&(r(v)&&h===null?h=t(a,l):!r(v)&&h!==null&&(h(),h=null)),v)),s(l,()=>{d=!0,r(l.curve)&&(h=t(a,l))},()=>{d=!1,h!==null&&(h(),h=null)})},oG=(t,e,n,r,s)=>(i,{curve:o,oversample:a,...u})=>{const l=i.createWaveShaper(),c=i.createWaveShaper();jt(l,u),jt(c,u);const h=n(i,{...u,gain:1}),d=n(i,{...u,gain:-1}),f=n(i,{...u,gain:1}),p=n(i,{...u,gain:-1});let y=null,v=!1,g=null;const x={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(T){h.channelCount=T,d.channelCount=T,l.channelCount=T,f.channelCount=T,c.channelCount=T,p.channelCount=T},get channelCountMode(){return l.channelCountMode},set channelCountMode(T){h.channelCountMode=T,d.channelCountMode=T,l.channelCountMode=T,f.channelCountMode=T,c.channelCountMode=T,p.channelCountMode=T},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(T){h.channelInterpretation=T,d.channelInterpretation=T,l.channelInterpretation=T,f.channelInterpretation=T,c.channelInterpretation=T,p.channelInterpretation=T},get context(){return l.context},get curve(){return g},set curve(T){if(T!==null&&T.length<2)throw e();if(T===null)l.curve=T,c.curve=T;else{const E=T.length,k=new Float32Array(E+2-E%2),N=new Float32Array(E+2-E%2);k[0]=T[0],N[0]=-T[E-1];const O=Math.ceil((E+1)/2),R=(E+1)/2-1;for(let L=1;L<O;L+=1){const W=L/O*R,G=Math.floor(W),H=Math.ceil(W);k[L]=G===H?T[G]:(1-(W-G))*T[G]+(1-(H-W))*T[H],N[L]=G===H?-T[E-1-G]:-((1-(W-G))*T[E-1-G])-(1-(H-W))*T[E-1-H]}k[O]=E%2===1?T[O-1]:(T[O-2]+T[O-1])/2,l.curve=k,c.curve=N}g=T,v&&(r(g)&&y===null?y=t(i,h):y!==null&&(y(),y=null))},get inputs(){return[h]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get oversample(){return l.oversample},set oversample(T){l.oversample=T,c.oversample=T},addEventListener(...T){return h.addEventListener(T[0],T[1],T[2])},dispatchEvent(...T){return h.dispatchEvent(T[0])},removeEventListener(...T){return h.removeEventListener(T[0],T[1],T[2])}};o!==null&&(x.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==x.oversample&&(x.oversample=a);const w=()=>{h.connect(l).connect(f),h.connect(d).connect(c).connect(p).connect(f),v=!0,r(g)&&(y=t(i,h))},_=()=>{h.disconnect(l),l.disconnect(f),h.disconnect(d),d.disconnect(c),c.disconnect(p),p.disconnect(f),v=!1,y!==null&&(y(),y=null)};return s(ul(x,f),w,_)},Fn=()=>new DOMException("","NotSupportedError"),aG={numberOfChannels:1},uG=(t,e,n,r,s)=>class extends t{constructor(o,a,u){let l;if(typeof o=="number"&&a!==void 0&&u!==void 0)l={length:a,numberOfChannels:o,sampleRate:u};else if(typeof o=="object")l=o;else throw new Error("The given parameters are not valid.");const{length:c,numberOfChannels:h,sampleRate:d}={...aG,...l},f=r(h,c,d);e(Mc,()=>Mc(f))||f.addEventListener("statechange",(()=>{let p=0;const y=v=>{this._state==="running"&&(p>0?(f.removeEventListener("statechange",y),v.stopImmediatePropagation(),this._waitForThePromiseToSettle(v)):p+=1)};return y})()),super(f,h),this._length=c,this._nativeOfflineAudioContext=f,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(n()):(this._state="running",s(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,Ok(this)}))}_waitForThePromiseToSettle(o){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(o):setTimeout(()=>this._waitForThePromiseToSettle(o))}},lG={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},cG=(t,e,n,r,s,i,o)=>class extends t{constructor(u,l){const c=s(u),h={...lG,...l},d=n(c,h),f=i(c),p=f?r():null,y=u.sampleRate/2;super(u,!1,d,p),this._detune=e(this,f,d.detune,153600,-153600),this._frequency=e(this,f,d.frequency,y,-y),this._nativeOscillatorNode=d,this._onended=null,this._oscillatorNodeRenderer=p,this._oscillatorNodeRenderer!==null&&h.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=h.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(u){const l=typeof u=="function"?o(this,u):null;this._nativeOscillatorNode.onended=l;const c=this._nativeOscillatorNode.onended;this._onended=c!==null&&c===l?u:c}get type(){return this._nativeOscillatorNode.type}set type(u){this._nativeOscillatorNode.type=u,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(u){this._nativeOscillatorNode.setPeriodicWave(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=u)}start(u=0){if(this._nativeOscillatorNode.start(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=u),this.context.state!=="closed"){ju(this);const l=()=>{this._nativeOscillatorNode.removeEventListener("ended",l),ui(this)&&ah(this)};this._nativeOscillatorNode.addEventListener("ended",l)}}stop(u=0){this._nativeOscillatorNode.stop(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=u)}},hG=(t,e,n,r,s)=>()=>{const i=new WeakMap;let o=null,a=null,u=null;const l=async(c,h)=>{let d=n(c);const f=Cn(d,h);if(!f){const p={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:o===null?void 0:o,type:d.type};d=e(h,p),a!==null&&d.start(a),u!==null&&d.stop(u)}return i.set(h,d),f?(await t(h,c.detune,d.detune),await t(h,c.frequency,d.frequency)):(await r(h,c.detune,d.detune),await r(h,c.frequency,d.frequency)),await s(c,h,d),d};return{set periodicWave(c){o=c},set start(c){a=c},set stop(c){u=c},render(c,h){const d=i.get(h);return d!==void 0?Promise.resolve(d):l(c,h)}}},dG={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},fG=(t,e,n,r,s,i,o)=>class extends t{constructor(u,l){const c=s(u),h={...dG,...l},d=n(c,h),f=i(c),p=f?r():null;super(u,!1,d,p),this._nativePannerNode=d,this._orientationX=e(this,f,d.orientationX,$n,jn),this._orientationY=e(this,f,d.orientationY,$
50n,jn),this._orientationZ=e(this,f,d.orientationZ,$n,jn),this._positionX=e(this,f,d.positionX,$n,jn),this._positionY=e(this,f,d.positionY,$n,jn),this._positionZ=e(this,f,d.positionZ,$n,jn),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(u){this._nativePannerNode.coneInnerAngle=u}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(u){this._nativePannerNode.coneOuterAngle=u}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(u){this._nativePannerNode.coneOuterGain=u}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(u){this._nativePannerNode.distanceModel=u}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(u){this._nativePannerNode.maxDistance=u}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(u){this._nativePannerNode.panningModel=u}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(u){this._nativePannerNode.refDistance=u}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(u){this._nativePannerNode.rolloffFactor=u}},pG=(t,e,n,r,s,i,o,a,u,l)=>()=>{const c=new WeakMap;let h=null;const d=async(f,p)=>{let y=null,v=i(f);const g={channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation},x={...g,coneInnerAngle:v.coneInnerAngle,coneOuterAngle:v.coneOuterAngle,coneOuterGain:v.coneOuterGain,distanceModel:v.distanceModel,maxDistance:v.maxDistance,panningModel:v.panningModel,refDistance:v.refDistance,rolloffFactor:v.rolloffFactor},w=Cn(v,p);if("bufferSize"in v)y=r(p,{...g,gain:1});else if(!w){const _={...x,orientationX:v.orientationX.value,orientationY:v.orientationY.value,orientationZ:v.orientationZ.value,positionX:v.positionX.value,positionY:v.positionY.value,positionZ:v.positionZ.value};v=s(p,_)}if(c.set(p,y===null?v:y),y!==null){if(h===null){if(o===null)throw new Error("Missing the native OfflineAudioContext constructor.");const L=new o(6,f.context.length,p.sampleRate),W=e(L,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});W.connect(L.destination),h=(async()=>{const G=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map(async(H,X)=>{const Q=n(L,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:X===0?1:0});return await a(L,H,Q.offset),Q}));for(let H=0;H<6;H+=1)G[H].connect(W,0,H),G[H].start(0);return l(L)})()}const _=await h,T=r(p,{...g,gain:1});await u(f,p,T);const E=[];for(let L=0;L<_.numberOfChannels;L+=1)E.push(_.getChannelData(L));let k=[E[0][0],E[1][0],E[2][0]],N=[E[3][0],E[4][0],E[5][0]],O=r(p,{...g,gain:1}),R=s(p,{...x,orientationX:k[0],orientationY:k[1],orientationZ:k[2],positionX:N[0],positionY:N[1],positionZ:N[2]});T.connect(O).connect(R.inputs[0]),R.connect(y);for(let L=128;L<_.length;L+=128){const W=[E[0][L],E[1][L],E[2][L]],G=[E[3][L],E[4][L],E[5][L]];if(W.some((H,X)=>H!==k[X])||G.some((H,X)=>H!==N[X])){k=W,N=G;const H=L/p.sampleRate;O.gain.setValueAtTime(0,H),O=r(p,{...g,gain:0}),R=s(p,{...x,orientationX:k[0],orientationY:k[1],orientationZ:k[2],positionX:N[0],positionY:N[1],positionZ:N[2]}),O.gain.setValueAtTime(1,H),T.connect(O).connect(R.inputs[0]),R.connect(y)}}return y}return w?(await t(p,f.orientationX,v.orientationX),await t(p,f.orientationY,v.orientationY),await t(p,f.orientationZ,v.orientationZ),await t(p,f.positionX,v.positionX),await t(p,f.positionY,v.positionY),await t(p,f.positionZ,v.positionZ)):(await a(p,f.orientationX,v.orientationX),await a(p,f.orientationY,v.orientationY),await a(p,f.orientationZ,v.orientationZ),await a(p,f.positionX,v.positionX),await a(p,f.positionY,v.positionY),await a(p,f.positionZ,v.positionZ)),al(v)?await u(f,p,v.inputs[0]):await u(f,p,v),v};return{render(f,p){const y=c.get(p);return y!==void 0?Promise.resolve(y):d(f,p)}}},mG={disableNormalization:!1},gG=(t,e,n,r)=>class zk{constructor(i,o){const a=e(i),u=r({...mG,...o}),l=t(a,u);return n.add(l),l}static[Symbol.hasInstance](i){return i!==null&&typeof i=="object"&&Object.getPrototypeOf(i)===zk.prototype||n.has(i)}},yG=(t,e)=>(n,r,s)=>(t(r).replay(s),e(r,n,s)),vG=(t,e,n)=>async(r,s,i)=>{const o=t(r);await Promise.all(o.activeInputs.map((a,u)=>Array.from(a).map(async([l,c])=>{const d=await e(l).render(l,s),f=r.context.destination;!n(l)&&(r!==f||!n(r))&&d.connect(i,c,u)})).reduce((a,u)=>[...a,...u],[]))},xG=(t,e,n)=>async(r,s,i)=>{const o=e(r);await Promise.all(Array.from(o.activeInputs).map(async([a,u])=>{const c=await t(a).render(a,s);n(a)||c.connect(i,u)}))},wG=(t,e,n,r)=>s=>t(Mc,()=>Mc(s))?Promise.resolve(t(r,r)).then(i=>{if(!i){const o=n(s,512,0,1);s.oncomplete=()=>{o.onaudioprocess=null,o.disconnect()},o.onaudioprocess=()=>s.currentTime,o.connect(s.destination)}return s.startRendering()}):new Promise(i=>{const o=e(s,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});s.oncomplete=a=>{o.disconnect(),i(a.renderedBuffer)},o.connect(s.destination),s.startRendering()}),bG=t=>
50(e,n)=>{t.set(e,n)},_G=t=>(e,n)=>t.set(e,n),SG=(t,e,n,r,s,i,o,a)=>(u,l)=>n(u).render(u,l).then(()=>Promise.all(Array.from(r(l)).map(c=>n(c).render(c,l)))).then(()=>s(l)).then(c=>(typeof c.copyFromChannel!="function"?(o(c),Mx(c)):e(i,()=>i(c))||a(c),t.add(c),c)),TG={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},CG=(t,e,n,r,s,i)=>class extends t{constructor(a,u){const l=s(a),c={...TG,...u},h=n(l,c),d=i(l),f=d?r():null;super(a,!1,h,f),this._pan=e(this,d,h.pan)}get pan(){return this._pan}},NG=(t,e,n,r,s)=>()=>{const i=new WeakMap,o=async(a,u)=>{let l=n(a);const c=Cn(l,u);if(!c){const h={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,pan:l.pan.value};l=e(u,h)}return i.set(u,l),c?await t(u,a.pan,l.pan):await r(u,a.pan,l.pan),al(l)?await s(a,u,l.inputs[0]):await s(a,u,l),l};return{render(a,u){const l=i.get(u);return l!==void 0?Promise.resolve(l):o(a,u)}}},EG=t=>()=>{if(t===null)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0},kG=(t,e)=>async()=>{if(t===null)return!0;if(e===null)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new e(1,128,44100),s=URL.createObjectURL(n);let i=!1,o=!1;try{await r.audioWorklet.addModule(s);const a=new t(r,"a",{numberOfOutputs:0}),u=r.createOscillator();a.port.onmessage=()=>i=!0,a.onprocessorerror=()=>o=!0,u.connect(a),u.start(0),await r.startRendering(),await new Promise(l=>setTimeout(l))}catch{}finally{URL.revokeObjectURL(s)}return i&&!o},$G=(t,e)=>()=>{if(e===null)return Promise.resolve(!1);const n=new e(1,1,44100),r=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(s=>{n.oncomplete=()=>{r.disconnect(),s(n.currentTime!==0)},n.startRendering()})},IG=()=>new DOMException("","UnknownError"),AG={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},RG=(t,e,n,r,s,i,o)=>class extends t{constructor(u,l){const c=s(u),h={...AG,...l},d=n(c,h),p=i(c)?r():null;super(u,!0,d,p),this._isCurveNullified=!1,this._nativeWaveShaperNode=d,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(u){if(u===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(u.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=u}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(u){this._nativeWaveShaperNode.oversample=u}},OG=(t,e,n)=>()=>{const r=new WeakMap,s=async(i,o)=>{let a=e(i);if(!Cn(a,o)){const l={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample};a=t(o,l)}return r.set(o,a),al(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a};return{render(i,o){const a=r.get(o);return a!==void 0?Promise.resolve(a):s(i,o)}}},DG=()=>typeof window>"u"?null:window,PG=(t,e)=>n=>{n.copyFromChannel=(r,s,i=0)=>{const o=t(i),a=t(s);if(a>=n.numberOfChannels)throw e();const u=n.length,l=n.getChannelData(a),c=r.length;for(let h=o<0?-o:0;h+o<u&&h<c;h+=1)r[h]=l[h+o]},n.copyToChannel=(r,s,i=0)=>{const o=t(i),a=t(s);if(a>=n.numberOfChannels)throw e();const u=n.length,l=n.getChannelData(a),c=r.length;for(let h=o<0?-o:0;h+o<u&&h<c;h+=1)l[h+o]=r[h]}},FG=t=>e=>{e.copyFromChannel=(n=>(r,s,i=0)=>{const o=t(i),a=t(s);if(o<e.length)return n.call(e,r,a,o)})(e.copyFromChannel),e.copyToChannel=(n=>(r,s,i=0)=>{const o=t(i),a=t(s);if(o<e.length)return n.call(e,r,a,o)})(e.copyToChannel)},LG=t=>(e,n)=>{const r=n.createBuffer(1,1,44100);e.buffer===null&&(e.buffer=r),t(e,"buffer",s=>()=>{const i=s.call(e);return i===r?null:i},s=>i=>s.call(e,i===null?r:i))},MG=(t,e)=>(n,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const s=n.createBufferSource();e(r,()=>{const a=r.numberOfInputs;for(let u=0;u<a;u+=1)s.connect(r,0,u)},()=>s.disconnect(r))},jk=(t,e,n)=>t.copyFromChannel===void 0?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),Gk=t=>{if(t===null)return!1;const e=t.length;return e%2!==0?t[Math.floor(e/2)]!==0:t[e/2-1]+t[e/2]!==0},dh=(t,e,n,r)=>{let s=t;for(;!s.hasOwnProperty(e);)s=Object.getPrototypeOf(s);const{get:i,set:o}=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,{get:n(i),set:r(o)})},VG=t=>({...t,outputChannelCount:t.outputChannelCount!==void 0?t.outputChannelCount:t.numberOfInputs===1&&t.numberOfOutputs===1?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),BG=t=>({...t,channelCount:t.numberOfOutputs}),WG=t=>{const{imag:e,real:n}=t;
50return e===void 0?n===void 0?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,()=>0),real:n}:n===void 0?{...t,imag:e,real:Array.from(e,()=>0)}:{...t,imag:e,real:n}},Hk=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(r.code!==9)throw r;Hk(t,e,n+1e-7)}},UG=t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1},zG=t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0},jG=t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0},zx=t=>{const e=t.createOscillator();try{e.start(-1)}catch(n){return n instanceof RangeError}return!1},qk=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},jx=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(n){return n instanceof RangeError}return!1},GG=t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},HG=t=>{t.start=(e=>(n=0,r=0,s)=>{const i=t.buffer,o=i===null?r:Math.min(i.duration,r);i!==null&&o>i.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,o,s)})(t.start)},Kk=(t,e)=>{const n=e.createGain();t.connect(n);const r=(s=>()=>{s.call(t,n),t.removeEventListener("ended",r)})(t.disconnect);t.addEventListener("ended",r),ul(t,n),t.stop=(s=>{let i=!1;return(o=0)=>{if(i)try{s.call(t,o)}catch{n.gain.setValueAtTime(0,o)}else s.call(t,o),i=!0}})(t.stop)},ll=(t,e)=>n=>{const r={value:t};return Object.defineProperties(n,{currentTarget:r,target:r}),typeof e=="function"?e.call(t,n):e.handleEvent.call(t,n)},qG=fU(Ia),KG=xU(Ia),XG=Az(Bp),Xk=new WeakMap,YG=Xz(Xk),ms=az(new Map,new WeakMap),Ws=DG(),Yk=Cj(ms,js),Gx=Kz(An),dn=vG(An,Gx,ha),QG=TU(Yk,dt,dn),it=Zz(Vp),_i=Zj(Ws),Ke=mj(_i),Qk=new WeakMap,Zk=Wz(ll),fh=$j(Ws),Hx=hj(fh),qx=dj(Ws),Jk=fj(Ws),Vc=Aj(Ws),Dt=XU(pU(Nk),vU(qG,KG,Af,XG,Rf,An,YG,oh,dt,Ia,ui,ha,Ud),ms,oj(d0,Rf,An,dt,Lc,ui),js,Wp,Fn,Ez(Af,d0,An,dt,Lc,it,ui,Ke),Dz(Qk,An,ds),Zk,it,Hx,qx,Jk,Ke,Vc),ZG=SU(Dt,QG,js,Yk,it,Ke),Kx=new WeakSet,XS=Nj(Ws),e$=wz(new Uint32Array(1)),Xx=PG(e$,js),Yx=FG(e$),t$=NU(Kx,ms,Fn,XS,_i,EG(XS),Xx,Yx),Up=wU(Zn),n$=xG(Gx,uh,ha),Gs=pz(n$),cl=kj(Up,ms,UG,zG,jG,zx,qk,jx,HG,LG(dh),Kk),Hs=yG(Yz(uh),n$),JG=$U(Gs,cl,dt,Hs,dn),gs=YU(mU(Ek),Qk,Lx,QU,aU,uU,lU,cU,hU,l0,Tk,fh,Hk),e6=kU(Dt,JG,gs,Qt,cl,it,Ke,ll),t6=MU(Dt,VU,js,Qt,Ij(Zn,dh),it,Ke,dn),n6=oz(Gs,Wk,dt,Hs,dn),Aa=_G(Xk),r6=iz(Dt,gs,n6,Wp,Wk,it,Ke,Aa),wo=Sj(Ia,qx),s6=MG(Qt,wo),bo=Mj(fh,s6),i6=cz(bo,dt,dn),o6=lz(Dt,i6,bo,it,Ke),a6=fz(ch,dt,dn),u6=dz(Dt,a6,ch,it,Ke,BG),l6=Wj(Up,cl,Zn,wo),hl=Bj(Up,ms,l6,zx,jx),c6=xz(Gs,hl,dt,Hs,dn),h6=vz(Dt,gs,c6,hl,it,Ke,ll),r$=Uj(Fn,dh),d6=Sz(r$,dt,dn),f6=_z(Dt,d6,r$,it,Ke,Aa),p6=Iz(Gs,Uk,dt,Hs,dn),m6=$z(Dt,gs,p6,Uk,it,Ke,Aa),s$=zj(Fn),g6=Mz(Gs,s$,dt,Hs,dn),y6=Lz(Dt,gs,g6,s$,Fn,it,Ke,Aa),v6=Hz(Gs,Zn,dt,Hs,dn),x6=Gz(Dt,gs,v6,Zn,it,Ke),w6=qj(Wp,Qt,hh,Fn),zp=wG(ms,Zn,hh,$G(Zn,_i)),b6=ij(cl,dt,_i,dn,zp),_6=jj(w6),S6=rj(Dt,_6,b6,it,Ke,Aa),T6=BU(gs,bo,hl,hh,Fn,jk,Ke,dh),i$=new WeakMap,C6=_j(t6,T6,Zk,Ke,i$,ll),o$=Jj(Up,ms,zx,qk,jx,Kk),N6=hG(Gs,o$,dt,Hs,dn),E6=cG(Dt,gs,o$,N6,it,Ke,ll),a$=gz(cl),k6=oG(a$,Qt,Zn,Gk,wo),jp=iG(a$,Qt,k6,Gk,wo,fh,dh),$6=tG(Af,Qt,bo,Zn,hh,jp,Fn,Rf,jk,wo),u$=eG($6),I6=pG(Gs,bo,hl,Zn,u$,dt,_i,Hs,dn,zp),A6=fG(Dt,gs,u$,I6,it,Ke,Aa),R6=nG(js),O6=gG(R6,it,new WeakSet,WG),D6=sG(bo,ch,Zn,jp,Fn,wo),l$=rG(D6,Fn),P6=NG(Gs,l$,dt,Hs,dn),F6=CG(Dt,gs,l$,P6,it,Ke),L6=OG(jp,dt,dn),M6=RG(Dt,Qt,jp,L6,it,Ke,Aa),c$=gj(Ws),Qx=Uz(Ws),h$=new WeakMap,V6=Jz(h$,_i),B6=c$?yU(ms,Fn,Bz(Ws),Qx,zz(dU),it,V6,Ke,Vc,new WeakMap,new WeakMap,kG(Vc,_i),Ws):void 0,W6=pj(Hx,Ke),U6=Nz(Kx,ms,Cz,Vz,new WeakSet,it,W6,$f,Mc,Xx,Yx),d$=rz(B6,ZG,t$,e6,r6,o6,u6,h6,f6,U6,m6,y6,x6,S6,C6,E6,A6,O6,F6,M6),z6=yj(Dt,Kj,it,Ke),j6=xj(Dt,Xj,it,Ke),G6=wj(Dt,Yj,it,Ke),H6=Qj(Qt,Ke),q6=bj(Dt,H6,it),K6=LU(d$,Qt,Fn,IG,z6,j6,G6,q6,fh),Zx=ej(i$),X6=bU(Zx),f$=mz(js),Y6=Rz(Zx),p$=Pz(js),m$=new WeakMap,Q6=qz(m$,ds),Z6=Lj(f$,js,Qt,bo,ch,hl,Zn,hh,Fn,p$,Qx,Q6,wo),J6=Oj(Qt,Z6,Zn,Fn,wo),eH=nz(Gs,f$,cl,bo,ch,hl,Zn,Y6,p$,Qx,dt,Vc,_i,Hs,dn,zp),tH=Qz(h$),nH=bG(m$),YS=c$?JU(X6,Dt,gs,eH,J6,An,tH,it,Ke,Vc,VG,nH,GG,ll):void 0,rH=Tz(Fn,_i),sH=SG(Kx,ms,Gx,Zx,zp,$f,Xx,Yx),iH=uG(d$,ms,Qt,rH,sH),oH=aj(Vp,Hx),aH=uj(Fx,qx),uH=lj(Lx,Jk),lH=cj(Vp,Ke);function Fr(t){return t===void 0}function Oe(t){return t!==void 0}function cH(t){return typeof t=="function"}function pi(t){return typeof t=="number"}function ea(t){return Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object}function hH(t){return typeof t=="boolean"}function lr(t){return Array.isArray(t)}function mi(t){return typeof t=="string"}function hd(t){return mi(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function ve(t,e){if(!t)throw new Error(e)}function Ir(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function g$(t){!t.isOffline&&t.state!=="running"&&Gp('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let y$=!1,QS=!1;function ZS(t){y$=t}function dH(t){Fr(t)&&y$&&!QS&&(QS=!0,Gp("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}let v$=console;function fH(...t){v$.log(...t)}function Gp(...t){v$.warn(...t)}function pH(t){return new K6(t)}function mH(t,e,n){return new iH(t,e,n)}const sr=typeof self=="object"?self:null,gH=sr&&(sr.hasOwnProperty("AudioContext")||sr.hasOwnProperty("webkitAudioContext"));function yH(t,e,n){return ve(Oe(YS),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(sr==null?void 0:sr.BaseAudioContext)?sr==null?void 0:sr.AudioWorkletNode:YS)(t,e,n)}function ys(t,e,n,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;
50a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i}function Ot(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(c){try{l(r.next(c))}catch(h){o(h)}}function u(c){try{l(r.throw(c))}catch(h){o(h)}}function l(c){c.done?i(c.value):s(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})}class vH{constructor(e,n,r,s){this._callback=e,this._type=n,this._minimumUpdateInterval=Math.max(128/(s||44100),.001),this.updateInterval=r,this._createClock()}_createWorker(){const e=new Blob([`
51			// the initial timeout time
52			let timeoutTime =  ${(this._updateInterval*1e3).toFixed(1)};
53			// onmessage callback
54			self.onmessage = function(msg){
55				timeoutTime = parseInt(msg.data);
56			};
57			// the tick function which posts a message
58			// and schedules a new tick
59			function tick(){
60				setTimeout(tick, timeoutTime);
61				self.postMessage('tick');
62			}
63			// call tick initially
64			tick();
65			`],{type:"text/javascript"}),n=URL.createObjectURL(e),r=new Worker(n);r.onmessage=this._callback.bind(this),this._worker=r}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},this._updateInterval*1e3)}_createClock(){if(this._type==="worker")try{this._createWorker()}catch{this._type="timeout",this._createClock()}else this._type==="timeout"&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(e){var n;this._updateInterval=Math.max(e,this._minimumUpdateInterval),this._type==="worker"&&((n=this._worker)===null||n===void 0||n.postMessage(this._updateInterval*1e3))}get type(){return this._type}set type(e){this._disposeClock(),this._type=e,this._createClock()}dispose(){this._disposeClock()}}function da(t){return uH(t)}function eo(t){return aH(t)}function zd(t){return lH(t)}function Xa(t){return oH(t)}function xH(t){return t instanceof t$}function wH(t,e){return t==="value"||da(e)||eo(e)||xH(e)}function ta(t,...e){if(!e.length)return t;const n=e.shift();if(ea(t)&&ea(n))for(const r in n)wH(r,n[r])?t[r]=n[r]:ea(n[r])?(t[r]||Object.assign(t,{[r]:{}}),ta(t[r],n[r])):Object.assign(t,{[r]:n[r]});return ta(t,...e)}function bH(t,e){return t.length===e.length&&t.every((n,r)=>e[r]===n)}function xe(t,e,n=[],r){const s={},i=Array.from(e);if(ea(i[0])&&r&&!Reflect.has(i[0],r)&&(Object.keys(i[0]).some(a=>Reflect.has(t,a))||(ta(s,{[r]:i[0]}),n.splice(n.indexOf(r),1),i.shift())),i.length===1&&ea(i[0]))ta(s,i[0]);else for(let o=0;o<n.length;o++)Oe(i[o])&&(s[n[o]]=i[o]);return ta(t,s)}function _H(t){return t.constructor.getDefaults()}function Eu(t,e){return Fr(t)?e:t}function Go(t,e){return e.forEach(n=>{Reflect.has(t,n)&&delete t[n]}),t}/**
66 * Tone.js
67 * @author Yotam Mann
68 * @license http://opensource.org/licenses/MIT MIT License
69 * @copyright 2014-2024 Yotam Mann
70 */class Si{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...e){(this.debug||sr&&this.toString()===sr.TONE_DEBUG_CLASS)&&fH(this,...e)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}Si.version=Sk;const Jx=1e-6;function Gu(t,e){return t>e+Jx}function y0(t,e){return Gu(t,e)||es(t,e)}function Ff(t,e){return t+Jx<e}function es(t,e){return Math.abs(t-e)<Jx}function SH(t,e,n){return Math.max(Math.min(t,n),e)}class Lr extends Si{constructor(){super(),this.name="Timeline",this._timeline=[];const e=xe(Lr.getDefaults(),arguments,["memory"]);this.memory=e.memory,this.increasing=e.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(e){if(ve(Reflect.has(e,"time"),"Timeline: events must have a time attribute"),e.time=e.time.valueOf(),this.increasing&&this.length){const n=this._timeline[this.length-1];ve(y0(e.time,n.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(e)}else{const n=this._search(e.time);this._timeline.splice(n+1,0,e)}if(this.length>this.memory){const n=this.length-this.memory;this._timeline.splice(0,n)}return this}remove(e){const n=this._timeline.indexOf(e);return n!==-1&&this._timeline.splice(n,1),this}get(e,n="time"){const r=this._search(e,n);return r!==-1?this._timeline[r]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(e,n="time"){const r=this._search(e,n);return r+1<this._timeline.length?this._timeline[r+1]:null}getBefore(e){const n=this._timeline.length;if(n>0&&this._timeline[n-1].time<e)return this._timeline[n-1];const r=this._search(e);return r-1>=0?this._timeline[r-1]:null}cancel(e){if(this._timeline.length>1){let n=this._search(e);if(n>=0)if(es(this._timeline[n].time,e)){for(let r=n;r>=0&&es(this._timeline[r].time,e);r--)n=r;this._timeline=this._timeline.slice(0,n)}else this._timeline=this._timeline.slice(0,n+1);else this._timeline=[]}else this._timeline.length===1&&y0(this._timeline[0].time,e)&&(this._timeline=[]);return this}cancelBefore(e){const n=this._search(e);return n>=0&&(this._timeline=this._timeline.slice(n+1)),this}previousEvent(e){const n=this._timeline.indexOf(e);return n>0?this._timeline[n-1]:null}_search(e,n="time"){if(this._timeline.length===0)return-1;let r=0;const s=this._timeline.length;let i=s;if(s>0&&this._timeline[s-1][n]<=e)return s-1;for(;r<i;){let o=Math.floor(r+(i-r)/2);const a=this._timeline[o],u=this._timeline[o+1];if(es(a[n],e)){for(let l=o;l<this._timeline.length;l++){const c=this._timeline[l];
70if(es(c[n],e))o=l;else break}return o}else{if(Ff(a[n],e)&&Gu(u[n],e))return o;Gu(a[n],e)?i=o:r=o+1}}return-1}_iterate(e,n=0,r=this._timeline.length-1){this._timeline.slice(n,r+1).forEach(e)}forEach(e){return this._iterate(e),this}forEachBefore(e,n){const r=this._search(e);return r!==-1&&this._iterate(n,0,r),this}forEachAfter(e,n){const r=this._search(e);return this._iterate(n,r+1),this}forEachBetween(e,n,r){let s=this._search(e),i=this._search(n);return s!==-1&&i!==-1?(this._timeline[s].time!==e&&(s+=1),this._timeline[i].time===n&&(i-=1),this._iterate(r,s,i)):s===-1&&this._iterate(r,0,i),this}forEachFrom(e,n){let r=this._search(e);for(;r>=0&&this._timeline[r].time>=e;)r--;return this._iterate(n,r+1),this}forEachAtTime(e,n){const r=this._search(e);if(r!==-1&&es(this._timeline[r].time,e)){let s=r;for(let i=r;i>=0&&es(this._timeline[i].time,e);i--)s=i;this._iterate(i=>{n(i)},s,r)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const x$=[];function Hp(t){x$.push(t)}function TH(t){x$.forEach(e=>e(t))}const w$=[];function qp(t){w$.push(t)}function CH(t){w$.forEach(e=>e(t))}class ph extends Si{constructor(){super(...arguments),this.name="Emitter"}on(e,n){return e.split(/\W+/).forEach(s=>{Fr(this._events)&&(this._events={}),this._events.hasOwnProperty(s)||(this._events[s]=[]),this._events[s].push(n)}),this}once(e,n){const r=(...s)=>{n(...s),this.off(e,r)};return this.on(e,r),this}off(e,n){return e.split(/\W+/).forEach(s=>{if(Fr(this._events)&&(this._events={}),this._events.hasOwnProperty(s))if(Fr(n))this._events[s]=[];else{const i=this._events[s];for(let o=i.length-1;o>=0;o--)i[o]===n&&i.splice(o,1)}}),this}emit(e,...n){if(this._events&&this._events.hasOwnProperty(e)){const r=this._events[e].slice(0);for(let s=0,i=r.length;s<i;s++)r[s].apply(this,n)}return this}static mixin(e){["on","once","off","emit"].forEach(n=>{const r=Object.getOwnPropertyDescriptor(ph.prototype,n);Object.defineProperty(e.prototype,n,r)})}dispose(){return super.dispose(),this._events=void 0,this}}class b$ extends ph{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class mh extends b${constructor(){var e,n;super(),this.name="Context",this._constants=new Map,this._timeouts=new Lr,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const r=xe(mh.getDefaults(),arguments,["context"]);r.context?(this._context=r.context,this._latencyHint=((e=arguments[0])===null||e===void 0?void 0:e.latencyHint)||""):(this._context=pH({latencyHint:r.latencyHint}),this._latencyHint=r.latencyHint),this._ticker=new vH(this.emit.bind(this,"tick"),r.clockSource,r.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[!((n=arguments[0])===null||n===void 0)&&n.hasOwnProperty("updateInterval")?"_lookAhead":"lookAhead"]=r.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){return this._initialized||(TH(this),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(e,n,r){return this._context.createBuffer(e,n,r)}createChannelMerger(e){return this._context.createChannelMerger(e)}createChannelSplitter(e){return this._context.createChannelSplitter(e)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(e){return this._context.createDelay(e)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(e,n){return this._context.createIIRFilter(e,n)}createPanner(){return this._context.createPanner()}createPeriodicWave(e,n,r){return this._context.createPeriodicWave(e,n,r)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}
70createMediaStreamSource(e){return ve(Xa(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamSource(e)}createMediaElementSource(e){return ve(Xa(this._context),"Not available if OfflineAudioContext"),this._context.createMediaElementSource(e)}createMediaStreamDestination(){return ve(Xa(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamDestination()}decodeAudioData(e){return this._context.decodeAudioData(e)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(e){ve(!this._initialized,"The listener cannot be set after initialization."),this._listener=e}get transport(){return this.initialize(),this._transport}set transport(e){ve(!this._initialized,"The transport cannot be set after initialization."),this._transport=e}get draw(){return this.initialize(),this._draw}set draw(e){ve(!this._initialized,"Draw cannot be set after initialization."),this._draw=e}get destination(){return this.initialize(),this._destination}set destination(e){ve(!this._initialized,"The destination cannot be set after initialization."),this._destination=e}createAudioWorkletNode(e,n){return yH(this.rawContext,e,n)}addAudioWorkletModule(e){return Ot(this,void 0,void 0,function*(){ve(Oe(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(e)),yield this._workletPromise})}workletsAreReady(){return Ot(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(e){this._ticker.updateInterval=e}get clockSource(){return this._ticker.type}set clockSource(e){this._ticker.type=e}get lookAhead(){return this._lookAhead}set lookAhead(e){this._lookAhead=e,this.updateInterval=e?e/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return Xa(this._context)?this._context.resume():Promise.resolve()}close(){return Ot(this,void 0,void 0,function*(){Xa(this._context)&&this.state!=="closed"&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&CH(this)})}getConstant(e){if(this._constants.has(e))return this._constants.get(e);{const n=this._context.createBuffer(1,128,this._context.sampleRate),r=n.getChannelData(0);for(let i=0;i<r.length;i++)r[i]=e;const s=this._context.createBufferSource();return s.channelCount=1,s.channelCountMode="explicit",s.buffer=n,s.loop=!0,s.start(0),this._constants.set(e,s),s}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(e=>this._constants[e].disconnect()),this.close(),this}_timeoutLoop(){const e=this.now();this._timeouts.forEachBefore(e,n=>{n.callback(),this._timeouts.remove(n)})}setTimeout(e,n){this._timeoutIds++;const r=this.now();return this._timeouts.add({callback:e,id:this._timeoutIds,time:r+n}),this._timeoutIds}clearTimeout(e){return this._timeouts.forEach(n=>{n.id===e&&this._timeouts.remove(n)}),this}clearInterval(e){return this.clearTimeout(e)}setInterval(e,n){const r=++this._timeoutIds,s=()=>{const i=this.now();this._timeouts.add({callback:()=>{e(),s()},id:r,time:i+n})};return s(),r}}class NH extends b${constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(e,n,r){return{}}createChannelMerger(e){return{}}createChannelSplitter(e){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(e){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(e,n){return{}}createPanner(){return{}}createPeriodicWave(e,n,r){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(e){return{}}createMediaElementSource(e){return{}}createMediaStreamDestination(){return{}}decodeAudioData(e){return Promise.resolve({})}createAudioWorkletNode(e,n){return{}}get rawContext(){return{}}addAudioWorkletModule(e){return Ot(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(e,n){return 0}clearTimeout(e){return this}setInterval(e,n){return 0}clearInterval(e){return this}getConstant(e){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(e){}get destination(){return{}}set destination(e){}now(){return 0}immediate(){return 0}}function ot(t,e){lr(e)?e.forEach(n=>ot(t,n)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function e1(t,e){lr(e)?e.forEach(n=>e1(t,n)):Object.defineProperty(t,e,{writable:!0})}const je=()=>{};class Xe extends Si{constructor(){super(),this.name="ToneAudioBuffer",this.onload=je;const e=xe(Xe.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=e.reverse,this.onload=e.onload,mi(e.url)?this.load(e.url).catch(e.onerror):e.url&&this.set(e.url)}static getDefaults(){return{onerror:je,onload:je,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:or().sampleRate}set(e){return e instanceof Xe?e.loaded?this._buffer=e.get():e.onload=()=>{this.set(e),this.onload(this)}:this._buffer=e,this._reversed&&this._reverse(),this}get(){return this._buffer}load(e){return Ot(this,void 0,void 0,function*(){const n=Xe.load(e).then(r=>{this.set(r),this.onload(this)});Xe.downloads.push(n);try{yield n}finally{const r=Xe.downloads.indexOf(n);Xe.downloads.splice(r,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(e){const n=lr(e)&&e[0].length>0,r=n?e.length:1,s=n?e[0].length:e.length,i=or(),o=i.createBuffer(r,s,i.sampleRate),a=!n&&r===1?[e]:e;for(let u=0;u<r;
70u++)o.copyToChannel(a[u],u);return this._buffer=o,this}toMono(e){if(pi(e))this.fromArray(this.toArray(e));else{let n=new Float32Array(this.length);const r=this.numberOfChannels;for(let s=0;s<r;s++){const i=this.toArray(s);for(let o=0;o<i.length;o++)n[o]+=i[o]}n=n.map(s=>s/r),this.fromArray(n)}return this}toArray(e){if(pi(e))return this.getChannelData(e);if(this.numberOfChannels===1)return this.toArray(0);{const n=[];for(let r=0;r<this.numberOfChannels;r++)n[r]=this.getChannelData(r);return n}}getChannelData(e){return this._buffer?this._buffer.getChannelData(e):new Float32Array(0)}slice(e,n=this.duration){ve(this.loaded,"Buffer is not loaded");const r=Math.floor(e*this.sampleRate),s=Math.floor(n*this.sampleRate);ve(r<s,"The start time must be less than the end time");const i=s-r,o=or().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let a=0;a<this.numberOfChannels;a++)o.copyToChannel(this.getChannelData(a).subarray(r,s),a);return new Xe(o)}_reverse(){if(this.loaded)for(let e=0;e<this.numberOfChannels;e++)this.getChannelData(e).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(e){this._reversed!==e&&(this._reversed=e,this._reverse())}static fromArray(e){return new Xe().fromArray(e)}static fromUrl(e){return Ot(this,void 0,void 0,function*(){return yield new Xe().load(e)})}static load(e){return Ot(this,void 0,void 0,function*(){const n=Xe.baseUrl===""||Xe.baseUrl.endsWith("/")?Xe.baseUrl:Xe.baseUrl+"/",r=yield fetch(n+e);if(!r.ok)throw new Error(`could not load url: ${e}`);const s=yield r.arrayBuffer();return yield or().decodeAudioData(s)})}static supportsType(e){const n=e.split("."),r=n[n.length-1];return document.createElement("audio").canPlayType("audio/"+r)!==""}static loaded(){return Ot(this,void 0,void 0,function*(){for(yield Promise.resolve();Xe.downloads.length;)yield Xe.downloads[0]})}}Xe.baseUrl="";Xe.downloads=[];class Kp extends mh{constructor(){super({clockSource:"offline",context:zd(arguments[0])?arguments[0]:mH(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:zd(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=zd(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(e){return Ot(this,void 0,void 0,function*(){let n=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,n++;const r=Math.floor(this.sampleRate/128);e&&n%r===0&&(yield new Promise(s=>setTimeout(s,1)))}})}render(){return Ot(this,arguments,void 0,function*(e=!0){yield this.workletsAreReady(),yield this._renderClock(e);const n=yield this._context.startRendering();return new Xe(n)})}close(){return Promise.resolve()}}const _$=new NH;let yu=_$;function or(){return yu===_$&&gH&&EH(new mh),yu}function EH(t,e=!1){e&&yu.dispose(),Xa(t)?yu=new mh(t):zd(t)?yu=new Kp(t):yu=t}if(sr&&!sr.TONE_SILENCE_LOGGING){const e=` * Tone.js v${Sk} * `;console.log(`%c${e}`,"background: #000; color: #fff")}function kH(t){return Math.pow(10,t/20)}function $H(t){return 20*(Math.log(t)/Math.LN10)}function S$(t){return Math.pow(2,t/12)}let Xp=440;function IH(){return Xp}function AH(t){Xp=t}function Ho(t){return Math.round(T$(t))}function T$(t){return 69+12*Math.log2(t/Xp)}function C$(t){return Xp*Math.pow(2,(t-69)/12)}class t1 extends Si{constructor(e,n,r){super(),this.defaultUnits="s",this._val=n,this._units=r,this.context=e,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:e=>this._frequencyToUnits(parseFloat(e)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:e=>this._ticksToUnits(parseInt(e,10)),regexp:/^(\d+)i$/i},m:{method:e=>this._beatsToUnits(parseInt(e,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(e,n)=>{const r=parseInt(e,10),s=n==="."?1.5:1;return r===1?this._beatsToUnits(this._getTimeSignature())*s:this._beatsToUnits(4/r)*s},regexp:/^(\d+)n(\.?)$/i},number:{method:e=>this._expressions[this.defaultUnits].method.call(this,e),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:e=>this._secondsToUnits(parseFloat(e)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:e=>parseInt(e,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:e=>{const n=parseInt(e,10);return this._beatsToUnits(8/(Math.floor(n)*3))},regexp:/^(\d+)t$/i},tr:{method:(e,n,r)=>{let s=0;return e&&e!=="0"&&(s+=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),n&&n!=="0"&&(s+=this._beatsToUnits(parseFloat(n))),r&&r!=="0"&&(s+=this._beatsToUnits(parseFloat(r)/4)),s},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof t1&&this.fromType(this._val),Fr(this._val))return this._noArg();if(mi(this._val)&&Fr(this._units)){for(const e in this._expressions)if(this._expressions[e].regexp.test(this._val.trim())){this._units=e;break}}else if(ea(this._val)){let e=0;for(const n in this._val)if(Oe(this._val[n])){const r=this._val[n],s=new this.constructor(this.context,n).valueOf()*r;e+=s}return e}if(Oe(this._units)){const e=this._expressions[this._units],n=this._val.toString().trim().match(e.regexp);return n?e.method.apply(this,n.slice(1)):e.method.call(this,this._val)}else return mi(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(e){return 1/e}_beatsToUnits(e){return 60/this._getBpm()*e}_secondsToUnits(e){return e}_ticksToUnits(e){return e*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(e){switch(this._units=void 0,this.defaultUnits){case"s":this._val=e.toSeconds();break;case"i":this._val=e.toTicks();break;case"hz":this._val=e.toFrequency();break;case"midi":this._val=e.toMidi();break}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return this.toSeconds()*1e3}}class is extends t1{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:e=>this._now()+new this.constructor(this.context,e).valueOf(),regexp:/^\+(.+)/},quantize:{method:e=>{const n=new is(this.context,e).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(n))},regexp:/^@(.+)/}})}quantize(e,n=1){const r=new this.constructor(this.context,e).valueOf(),s=this.valueOf(),a=Math.round(s/r)*r-s;return s+a*n}toNotation(){const e=this.toSeconds(),n=["1m"];for(let i=1;i<9;i++){const o=Math.pow(2,i);n.push(o+"n."),n.push(o+"n"),n.push(o+"t")}n.push("0");let r=n[0],s=new is(this.context,n[0]).toSeconds();
70return n.forEach(i=>{const o=new is(this.context,i).toSeconds();Math.abs(o-e)<Math.abs(s-e)&&(r=i,s=o)}),r}toBarsBeatsSixteenths(){const e=this._beatsToUnits(1);let n=this.valueOf()/e;n=parseFloat(n.toFixed(4));const r=Math.floor(n/this._getTimeSignature());let s=n%1*4;n=Math.floor(n)%this._getTimeSignature();const i=s.toString();return i.length>3&&(s=parseFloat(parseFloat(i).toFixed(3))),[r,n,s].join(":")}toTicks(){const e=this._beatsToUnits(1);return this.valueOf()/e*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return Ho(this.toFrequency())}_now(){return this.context.now()}}class Hn extends is{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return IH()}static set A4(e){AH(e)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(e){return this.defaultUnits==="midi"?e:Hn.mtof(e)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(e,n){const s=RH[e.toLowerCase()]+(parseInt(n,10)+1)*12;return this.defaultUnits==="midi"?s:Hn.mtof(s)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(e,n,r){let s=1;return e&&e!=="0"&&(s*=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),n&&n!=="0"&&(s*=this._beatsToUnits(parseFloat(n))),r&&r!=="0"&&(s*=this._beatsToUnits(parseFloat(r)/4)),s}}})}transpose(e){return new Hn(this.context,this.valueOf()*S$(e))}harmonize(e){return e.map(n=>this.transpose(n))}toMidi(){return Ho(this.valueOf())}toNote(){const e=this.toFrequency(),n=Math.log2(e/Hn.A4);let r=Math.round(12*n)+57;const s=Math.floor(r/12);return s<0&&(r+=-12*s),OH[r%12]+s.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const e=this._beatsToUnits(1),n=this.valueOf()/e;return Math.floor(n*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(e){return e}_ticksToUnits(e){return 1/(e*60/(this._getBpm()*this._getPPQ()))}_beatsToUnits(e){return 1/super._beatsToUnits(e)}_secondsToUnits(e){return 1/e}static mtof(e){return C$(e)}static ftom(e){return Ho(e)}}const RH={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},OH=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function DH(t,e){return new Hn(or(),t,e)}class pc extends is{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Qn extends Si{constructor(){super();const e=xe(Qn.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=e.context}static getDefaults(){return{context:or()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(e){return dH(e),new is(this.context,e).toSeconds()}toFrequency(e){return new Hn(this.context,e).toFrequency()}toTicks(e){return new pc(this.context,e).toTicks()}_getPartialProperties(e){const n=this.get();return Object.keys(n).forEach(r=>{Fr(e[r])&&delete n[r]}),n}get(){const e=_H(this);return Object.keys(e).forEach(n=>{if(Reflect.has(this,n)){const r=this[n];Oe(r)&&Oe(r.value)&&Oe(r.setValueAtTime)?e[n]=r.value:r instanceof Qn?e[n]=r._getPartialProperties(e[n]):lr(r)||pi(r)||mi(r)||hH(r)?e[n]=r:delete e[n]}}),e}set(e){return Object.keys(e).forEach(n=>{Reflect.has(this,n)&&Oe(this[n])&&(this[n]&&Oe(this[n].value)&&Oe(this[n].setValueAtTime)?this[n].value!==e[n]&&(this[n].value=e[n]):this[n]instanceof Qn?this[n].set(e[n]):this[n]=e[n])}),this}}class n1 extends Lr{constructor(e="stopped"){super(),this.name="StateTimeline",this._initial=e,this.setStateAtTime(this._initial,0)}getValueAtTime(e){const n=this.get(e);return n!==null?n.state:this._initial}setStateAtTime(e,n,r){return Ir(n,0),this.add(Object.assign({},r,{state:e,time:n})),this}getLastState(e,n){const r=this._search(n);for(let s=r;s>=0;s--){const i=this._timeline[s];if(i.state===e)return i}}getNextState(e,n){const r=this._search(n);if(r!==-1)for(let s=r;s<this._timeline.length;s++){const i=this._timeline[s];if(i.state===e)return i}}}class Ye extends Qn{constructor(){const e=xe(Ye.getDefaults(),arguments,["param","units","convert"]);for(super(e),this.name="Param",this.overridden=!1,this._minOutput=1e-7,ve(Oe(e.param)&&(da(e.param)||e.param instanceof Ye),"param must be an AudioParam");!da(e.param);)e.param=e.param._param;
70this._swappable=Oe(e.swappable)?e.swappable:!1,this._swappable?(this.input=this.context.createGain(),this._param=e.param,this.input.connect(this._param)):this._param=this.input=e.param,this._events=new Lr(1e3),this._initialValue=this._param.defaultValue,this.units=e.units,this.convert=e.convert,this._minValue=e.minValue,this._maxValue=e.maxValue,Oe(e.value)&&e.value!==this._toType(this._initialValue)&&this.setValueAtTime(e.value,0)}static getDefaults(){return Object.assign(Qn.getDefaults(),{convert:!0,units:"number"})}get value(){const e=this.now();return this.getValueAtTime(e)}set value(e){this.cancelScheduledValues(this.now()),this.setValueAtTime(e,this.now())}get minValue(){return Oe(this._minValue)?this._minValue:this.units==="time"||this.units==="frequency"||this.units==="normalRange"||this.units==="positive"||this.units==="transportTime"||this.units==="ticks"||this.units==="bpm"||this.units==="hertz"||this.units==="samples"?0:this.units==="audioRange"?-1:this.units==="decibels"?-1/0:this._param.minValue}get maxValue(){return Oe(this._maxValue)?this._maxValue:this.units==="normalRange"||this.units==="audioRange"?1:this._param.maxValue}_is(e,n){return this.units===n}_assertRange(e){return Oe(this.maxValue)&&Oe(this.minValue)&&Ir(e,this._fromType(this.minValue),this._fromType(this.maxValue)),e}_fromType(e){return this.convert&&!this.overridden?this._is(e,"time")?this.toSeconds(e):this._is(e,"decibels")?kH(e):this._is(e,"frequency")?this.toFrequency(e):e:this.overridden?0:e}_toType(e){return this.convert&&this.units==="decibels"?$H(e):e}setValueAtTime(e,n){const r=this.toSeconds(n),s=this._fromType(e);return ve(isFinite(s)&&isFinite(r),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(n)}`),this._assertRange(s),this.log(this.units,"setValueAtTime",e,r),this._events.add({time:r,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,r),this}getValueAtTime(e){const n=Math.max(this.toSeconds(e),0),r=this._events.getAfter(n),s=this._events.get(n);let i=this._initialValue;if(s===null)i=this._initialValue;else if(s.type==="setTargetAtTime"&&(r===null||r.type==="setValueAtTime")){const o=this._events.getBefore(s.time);let a;o===null?a=this._initialValue:a=o.value,s.type==="setTargetAtTime"&&(i=this._exponentialApproach(s.time,a,s.value,s.constant,n))}else if(r===null)i=s.value;else if(r.type==="linearRampToValueAtTime"||r.type==="exponentialRampToValueAtTime"){let o=s.value;if(s.type==="setTargetAtTime"){const a=this._events.getBefore(s.time);a===null?o=this._initialValue:o=a.value}r.type==="linearRampToValueAtTime"?i=this._linearInterpolate(s.time,o,r.time,r.value,n):i=this._exponentialInterpolate(s.time,o,r.time,r.value,n)}else i=s.value;return this._toType(i)}setRampPoint(e){e=this.toSeconds(e);let n=this.getValueAtTime(e);return this.cancelAndHoldAtTime(e),this._fromType(n)===0&&(n=this._toType(this._minOutput)),this.setValueAtTime(n,e),this}linearRampToValueAtTime(e,n){const r=this._fromType(e),s=this.toSeconds(n);return ve(isFinite(r)&&isFinite(s),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(n)}`),this._assertRange(r),this._events.add({time:s,type:"linearRampToValueAtTime",value:r}),this.log(this.units,"linearRampToValueAtTime",e,s),this._param.linearRampToValueAtTime(r,s),this}exponentialRampToValueAtTime(e,n){let r=this._fromType(e);r=es(r,0)?this._minOutput:r,this._assertRange(r);const s=this.toSeconds(n);return ve(isFinite(r)&&isFinite(s),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(n)}`),this._events.add({time:s,type:"exponentialRampToValueAtTime",value:r}),this.log(this.units,"exponentialRampToValueAtTime",e,s),this._param.exponentialRampToValueAtTime(r,s),this}exponentialRampTo(e,n,r){return r=this.toSeconds(r),this.setRampPoint(r),this.exponentialRampToValueAtTime(e,r+this.toSeconds(n)),this}linearRampTo(e,n,r){return r=this.toSeconds(r),this.setRampPoint(r),this.linearRampToValueAtTime(e,r+this.toSeconds(n)),this}targetRampTo(e,n,r){return r=this.toSeconds(r),this.setRampPoint(r),this.exponentialApproachValueAtTime(e,r,n),this}exponentialApproachValueAtTime(e,n,r){n=this.toSeconds(n),r=this.toSeconds(r);const s=Math.log(r+1)/Math.log(200);return this.setTargetAtTime(e,n,s),this.cancelAndHoldAtTime(n+r*.9),this.linearRampToValueAtTime(e,n+r),this}setTargetAtTime(e,n,r){const s=this._fromType(e);ve(isFinite(r)&&r>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(n);return this._assertRange(s),ve(isFinite(s)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(e)}, ${JSON.stringify(n)}`),this._events.add({constant:r,time:i,type:"setTargetAtTime",value:s}),this.log(this.units,"setTargetAtTime",e,i,r),this._param.setTargetAtTime(s,i,r),this}setValueCurveAtTime(e,n,r,s=1){r=this.toSeconds(r),n=this.toSeconds(n);const i=this._fromType(e[0])*s;this.setValueAtTime(this._toType(i),n);const o=r/(e.length-1);for(let a=1;a<e.length;a++){const u=this._fromType(e[a])*s;this.linearRampToValueAtTime(this._toType(u),n+a*o)}return this}cancelScheduledValues(e){const n=this.toSeconds(e);return ve(isFinite(n),`Invalid argument to cancelScheduledValues: ${JSON.stringify(e)}`),this._events.cancel(n),this._param.cancelScheduledValues(n),this.log(this.units,"cancelScheduledValues",n),this}cancelAndHoldAtTime(e){const n=this.toSeconds(e),r=this._fromType(this.getValueAtTime(n));ve(isFinite(n),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(e)}`),this.log(this.units,"cancelAndHoldAtTime",n,"value="+r);const s=this._events.get(n),i=this._events.getAfter(n);return s&&es(s.time,n)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(n),this._events.cancel(n+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),i.type==="linearRampToValueAtTime"?this.linearRampToValueAtTime(this._toType(r),n):i.type==="exponentialRampToValueAtTime"&&this.exponentialRampToValueAtTime(this._toType(r),n)),this._events.add({time:n,type:"setValueAtTime",value:r}),this._param.setValueAtTime(r,n),this}rampTo(e,n=.1,r){return this.units==="frequency"||this.units==="bpm"||this.units==="decibels"?this.exponentialRampTo(e,n,r):this.linearRampTo(e,n,r),this}apply(e){const n=this.context.currentTime;e.setValueAtTime(this.getValueAtTime(n),n);const r=this._events.get(n);if(r&&r.type==="setTargetAtTime"){const s=this._events.getAfter(r.time),i=s?s.time:n+2,o=(i-n)/10;for(let a=n;a<i;a+=o)e.linearRampToValueAtTime(this.getValueAtTime(a),a)}
vendor: 4,197 bytes, line 70
70return this._events.forEachAfter(this.context.currentTime,s=>{s.type==="cancelScheduledValues"?e.cancelScheduledValues(s.time):s.type==="setTargetAtTime"?e.setTargetAtTime(s.value,s.time,s.constant):e[s.type](s.value,s.time)}),this}setParam(e){ve(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const n=this.input;return n.disconnect(this._param),this.apply(e),this._param=e,n.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(e,n,r,s,i){return r+(n-r)*Math.exp(-(i-e)/s)}_linearInterpolate(e,n,r,s,i){return n+(s-n)*((i-e)/(r-e))}_exponentialInterpolate(e,n,r,s,i){return n*Math.pow(s/n,(i-e)/(r-e))}}class _e extends Qn{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return Oe(this.input)?da(this.input)||this.input instanceof Ye?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Oe(this.output)?this.output.numberOfOutputs:0}_isAudioNode(e){return Oe(e)&&(e instanceof _e||eo(e))}_getInternalNodes(){const e=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&e.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&e.push(this.output),e}_setChannelProperties(e){this._getInternalNodes().forEach(r=>{r.channelCount=e.channelCount,r.channelCountMode=e.channelCountMode,r.channelInterpretation=e.channelInterpretation})}_getChannelProperties(){const e=this._getInternalNodes();ve(e.length>0,"ToneAudioNode does not have any internal nodes");const n=e[0];return{channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(e){const n=this._getChannelProperties();this._setChannelProperties(Object.assign(n,{channelCount:e}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(e){const n=this._getChannelProperties();this._setChannelProperties(Object.assign(n,{channelCountMode:e}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(e){const n=this._getChannelProperties();this._setChannelProperties(Object.assign(n,{channelInterpretation:e}))}connect(e,n=0,r=0){return uo(this,e,n,r),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Gp("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(e,n=0,r=0){return PH(this,e,n,r),this}chain(...e){return Lf(this,...e),this}fan(...e){return e.forEach(n=>this.connect(n)),this}dispose(){return super.dispose(),Oe(this.input)&&(this.input instanceof _e?this.input.dispose():eo(this.input)&&this.input.disconnect()),Oe(this.output)&&(this.output instanceof _e?this.output.dispose():eo(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function Lf(...t){const e=t.shift();t.reduce((n,r)=>(n instanceof _e?n.connect(r):eo(n)&&uo(n,r),r),e)}function uo(t,e,n=0,r=0){for(ve(Oe(t),"Cannot connect from undefined node"),ve(Oe(e),"Cannot connect to undefined node"),(e instanceof _e||eo(e))&&ve(e.numberOfInputs>0,"Cannot connect to node with no inputs"),ve(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof _e||e instanceof Ye;)Oe(e.input)&&(e=e.input);for(;t instanceof _e;)Oe(t.output)&&(t=t.output);da(e)?t.connect(e,n):t.connect(e,n,r)}function PH(t,e,n=0,r=0){if(Oe(e))for(;e instanceof _e;)e=e.input;for(;!eo(t);)Oe(t.output)&&(t=t.output);da(e)?t.disconnect(e,n):eo(e)?t.disconnect(e,n,r):t.disconnect()}class nt extends _e{constructor(){const e=xe(nt.getDefaults(),arguments,["gain","units"]);super(e),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Ye({context:this.context,convert:e.convert,param:this._gainNode.gain,units:e.units,value:e.gain,minValue:e.minValue,maxValue:e.maxValue}),ot(this,"gain")}static getDefaults(){return Object.assign(_e.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}
70class Hu extends _e{constructor(e){super(e),this.onended=je,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new nt({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(n){const r=this.toSeconds(n);return this._startTime!==-1&&r>=this._startTime&&(this._stopTime===-1||r<=this._stopTime)?"started":"stopped"},this._fadeIn=e.fadeIn,this._fadeOut=e.fadeOut,this._curve=e.curve,this.onended=e.onended}static getDefaults(){return Object.assign(_e.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:je})}_startGain(e,n=1){ve(this._startTime===-1,"Source cannot be started more than once");const r=this.toSeconds(this._fadeIn);return this._startTime=e+r,this._startTime=Math.max(this._startTime,this.context.currentTime),r>0?(this._gainNode.gain.setValueAtTime(0,e),this._curve==="linear"?this._gainNode.gain.linearRampToValueAtTime(n,e+r):this._gainNode.gain.exponentialApproachValueAtTime(n,e,r)):this._gainNode.gain.setValueAtTime(n,e),this}stop(e){return this.log("stop",e),this._stopGain(this.toSeconds(e)),this}_stopGain(e){ve(this._startTime!==-1,"'start' must be called before 'stop'"),this.cancelStop();const n=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(e)+n,this._stopTime=Math.max(this._stopTime,this.now()),n>0?this._curve==="linear"?this._gainNode.gain.linearRampTo(0,n,e):this._gainNode.gain.targetRampTo(0,n,e):(this._gainNode.gain.cancelAndHoldAtTime(e),this._gainNode.gain.setValueAtTime(0,e)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const r=this._curve==="exponential"?n*2:0;this._stopSource(this.now()+r),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==je&&(this.onended(this),this.onended=je,!this.context.isOffline)){const e=()=>this.dispose();typeof requestIdleCallback<"u"?requestIdleCallback(e):setTimeout(e,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),ve(this._startTime!==-1,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}
vendor: 4,610 bytes, line 70
70dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=je,this}}class r1 extends Hu{constructor(){const e=xe(r1.getDefaults(),arguments,["offset"]);super(e),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),uo(this._source,this._gainNode),this.offset=new Ye({context:this.context,convert:e.convert,param:this._source.offset,units:e.units,value:e.offset,minValue:e.minValue,maxValue:e.maxValue})}static getDefaults(){return Object.assign(Hu.getDefaults(),{convert:!0,offset:1,units:"number"})}start(e){const n=this.toSeconds(e);return this.log("start",n),this._startGain(n),this._source.start(n),this}_stopSource(e){this._source.stop(e)}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ht extends _e{constructor(){const e=xe(ht.getDefaults(),arguments,["value","units"]);super(e),this.name="Signal",this.override=!0,this.output=this._constantSource=new r1({context:this.context,convert:e.convert,offset:e.value,units:e.units,minValue:e.minValue,maxValue:e.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(_e.getDefaults(),{convert:!0,units:"number",value:0})}connect(e,n=0,r=0){return s1(this,e,n,r),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(e,n){return this._param.setValueAtTime(e,n),this}getValueAtTime(e){return this._param.getValueAtTime(e)}setRampPoint(e){return this._param.setRampPoint(e),this}linearRampToValueAtTime(e,n){return this._param.linearRampToValueAtTime(e,n),this}exponentialRampToValueAtTime(e,n){return this._param.exponentialRampToValueAtTime(e,n),this}exponentialRampTo(e,n,r){return this._param.exponentialRampTo(e,n,r),this}linearRampTo(e,n,r){return this._param.linearRampTo(e,n,r),this}targetRampTo(e,n,r){return this._param.targetRampTo(e,n,r),this}exponentialApproachValueAtTime(e,n,r){return this._param.exponentialApproachValueAtTime(e,n,r),this}setTargetAtTime(e,n,r){return this._param.setTargetAtTime(e,n,r),this}setValueCurveAtTime(e,n,r,s){return this._param.setValueCurveAtTime(e,n,r,s),this}cancelScheduledValues(e){return this._param.cancelScheduledValues(e),this}cancelAndHoldAtTime(e){return this._param.cancelAndHoldAtTime(e),this}rampTo(e,n,r){return this._param.rampTo(e,n,r),this}get value(){return this._param.value}set value(e){this._param.value=e}get convert(){return this._param.convert}set convert(e){this._param.convert=e}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(e){this._param.overridden=e}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(e){return this._param.apply(e),this}}function s1(t,e,n,r){(e instanceof Ye||da(e)||e instanceof ht&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ht&&(e.overridden=!0)),uo(t,e,n,r)}class i1 extends Ye{constructor(){const e=xe(i1.getDefaults(),arguments,["value"]);super(e),this.name="TickParam",this._events=new Lr(1/0),this._multiplier=1,this._multiplier=e.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(e.value)}),this.setValueAtTime(e.value,0)}static getDefaults(){return Object.assign(Ye.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(e,n,r){n=this.toSeconds(n),this.setRampPoint(n);const s=this._fromType(e),i=this._events.get(n),o=Math.round(Math.max(1/r,1));for(let a=0;a<=o;a++){const u=r*a+n,l=this._exponentialApproach(i.time,i.value,s,r,u);this.linearRampToValueAtTime(this._toType(l),u)}return this}setValueAtTime(e,n){const r=this.toSeconds(n);super.setValueAtTime(e,n);const s=this._events.get(r),i=this._events.previousEvent(s),o=this._getTicksUntilEvent(i,r);return s.ticks=Math.max(o,0),this}linearRampToValueAtTime(e,n){const r=this.toSeconds(n);super.linearRampToValueAtTime(e,n);const s=this._events.get(r),i=this._events.previousEvent(s),o=this._getTicksUntilEvent(i,r);return s.ticks=Math.max(o,0),this}exponentialRampToValueAtTime(e,n){n=this.toSeconds(n);const r=this._fromType(e),s=this._events.get(n),i=Math.round(Math.max((n-s.time)*10,1)),o=(n-s.time)/i;for(let a=0;a<=i;a++){const u=o*a+s.time,l=this._exponentialInterpolate(s.time,s.value,n,r,u);this.linearRampToValueAtTime(this._toType(l),u)}return this}_getTicksUntilEvent(e,n){if(e===null)e={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Fr(e.ticks)){const o=this._events.previousEvent(e);e.ticks=this._getTicksUntilEvent(o,e.time)}
70const r=this._fromType(this.getValueAtTime(e.time));let s=this._fromType(this.getValueAtTime(n));const i=this._events.get(n);return i&&i.time===n&&i.type==="setValueAtTime"&&(s=this._fromType(this.getValueAtTime(n-this.sampleTime))),.5*(n-e.time)*(r+s)+e.ticks}getTicksAtTime(e){const n=this.toSeconds(e),r=this._events.get(n);return Math.max(this._getTicksUntilEvent(r,n),0)}getDurationOfTicks(e,n){const r=this.toSeconds(n),s=this.getTicksAtTime(n);return this.getTimeOfTick(s+e)-r}getTimeOfTick(e){const n=this._events.get(e,"ticks"),r=this._events.getAfter(e,"ticks");if(n&&n.ticks===e)return n.time;if(n&&r&&r.type==="linearRampToValueAtTime"&&n.value!==r.value){const s=this._fromType(this.getValueAtTime(n.time)),o=(this._fromType(this.getValueAtTime(r.time))-s)/(r.time-n.time),a=Math.sqrt(Math.pow(s,2)-2*o*(n.ticks-e)),u=(-s+a)/o,l=(-s-a)/o;return(u>0?u:l)+n.time}else return n?n.value===0?1/0:n.time+(e-n.ticks)/n.value:e/this._initialValue}ticksToTime(e,n){return this.getDurationOfTicks(e,n)}timeToTicks(e,n){const r=this.toSeconds(n),s=this.toSeconds(e),i=this.getTicksAtTime(r);return this.getTicksAtTime(r+s)-i}_fromType(e){return this.units==="bpm"&&this.multiplier?1/(60/e/this.multiplier):super._fromType(e)}_toType(e){return this.units==="bpm"&&this.multiplier?e/this.multiplier*60:super._toType(e)}get multiplier(){return this._multiplier}set multiplier(e){const n=this.value;this._multiplier=e,this.cancelScheduledValues(0),this.setValueAtTime(n,0)}}class o1 extends ht{constructor(){const e=xe(o1.getDefaults(),arguments,["value"]);super(e),this.name="TickSignal",this.input=this._param=new i1({context:this.context,convert:e.convert,multiplier:e.multiplier,param:this._constantSource.offset,units:e.units,value:e.value})}static getDefaults(){return Object.assign(ht.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(e,n){return this._param.ticksToTime(e,n)}timeToTicks(e,n){return this._param.timeToTicks(e,n)}getTimeOfTick(e){return this._param.getTimeOfTick(e)}getDurationOfTicks(e,n){return this._param.getDurationOfTicks(e,n)}getTicksAtTime(e){return this._param.getTicksAtTime(e)}get multiplier(){return this._param.multiplier}set multiplier(e){this._param.multiplier=e}dispose(){return super.dispose(),this._param.dispose(),this}}class a1 extends Qn{constructor(){const e=xe(a1.getDefaults(),arguments,["frequency"]);super(e),this.name="TickSource",this._state=new n1,this._tickOffset=new Lr,this._ticksAtTime=new Lr,this._secondsAtTime=new Lr,this.frequency=new o1({context:this.context,units:e.units,value:e.frequency}),ot(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Qn.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(e,n){const r=this.toSeconds(e);return this._state.getValueAtTime(r)!=="started"&&(this._state.setStateAtTime("started",r),Oe(n)&&this.setTicksAtTime(n,r),this._ticksAtTime.cancel(r),this._secondsAtTime.cancel(r)),this}stop(e){const n=this.toSeconds(e);if(this._state.getValueAtTime(n)==="stopped"){const r=this._state.get(n);r&&r.time>0&&(this._tickOffset.cancel(r.time),this._state.cancel(r.time))}return this._state.cancel(n),this._state.setStateAtTime("stopped",n),this.setTicksAtTime(0,n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n),this}pause(e){const n=this.toSeconds(e);return this._state.getValueAtTime(n)==="started"&&(this._state.setStateAtTime("paused",n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n)),this}cancel(e){return e=this.toSeconds(e),this._state.cancel(e),this._tickOffset.cancel(e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getTicksAtTime(e){const n=this.toSeconds(e),r=this._state.getLastState("stopped",n),s=this._ticksAtTime.get(n),i={state:"paused",time:n};this._state.add(i);let o=s||r,a=s?s.ticks:0,u=null;return this._state.forEachBetween(o.time,n+this.sampleTime,l=>{let c=o.time;const h=this._tickOffset.get(l.time);h&&h.time>=o.time&&(a=h.ticks,c=h.time),o.state==="started"&&l.state!=="started"&&(a+=this.frequency.getTicksAtTime(l.time)-this.frequency.getTicksAtTime(c),l.time!==i.time&&(u={state:l.state,time:l.time,ticks:a})),o=l}),this._state.remove(i),u&&this._ticksAtTime.add(u),a}get ticks(){return this.getTicksAtTime(this.now())}set ticks(e){this.setTicksAtTime(e,this.now())}
70get seconds(){return this.getSecondsAtTime(this.now())}set seconds(e){const n=this.now(),r=this.frequency.timeToTicks(e,n);this.setTicksAtTime(r,n)}getSecondsAtTime(e){e=this.toSeconds(e);const n=this._state.getLastState("stopped",e),r={state:"paused",time:e};this._state.add(r);const s=this._secondsAtTime.get(e);let i=s||n,o=s?s.seconds:0,a=null;return this._state.forEachBetween(i.time,e+this.sampleTime,u=>{let l=i.time;const c=this._tickOffset.get(u.time);c&&c.time>=i.time&&(o=c.seconds,l=c.time),i.state==="started"&&u.state!=="started"&&(o+=u.time-l,u.time!==r.time&&(a={state:u.state,time:u.time,seconds:o})),i=u}),this._state.remove(r),a&&this._secondsAtTime.add(a),o}setTicksAtTime(e,n){return n=this.toSeconds(n),this._tickOffset.cancel(n),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(e,n),ticks:e,time:n}),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n),this}getStateAtTime(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)}getTimeOfTick(e,n=this.now()){const r=this._tickOffset.get(n),s=this._state.get(n),i=Math.max(r.time,s.time),o=this.frequency.getTicksAtTime(i)+e-r.ticks;return this.frequency.getTimeOfTick(o)}forEachTickBetween(e,n,r){let s=this._state.get(e);this._state.forEachBetween(e,n,o=>{s&&s.state==="started"&&o.state!=="started"&&this.forEachTickBetween(Math.max(s.time,e),o.time-this.sampleTime,r),s=o});let i=null;if(s&&s.state==="started"){const o=Math.max(s.time,e),a=this.frequency.getTicksAtTime(o),u=this.frequency.getTicksAtTime(s.time),l=a-u;let c=Math.ceil(l)-l;c=es(c,1)?0:c;let h=this.frequency.getTimeOfTick(a+c);for(;h<n;){try{r(h,Math.round(this.getTicksAtTime(h)))}catch(d){i=d;break}h+=this.frequency.getDurationOfTicks(1,h)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}}class Yp extends Qn{constructor(){const e=xe(Yp.getDefaults(),arguments,["callback","frequency"]);super(e),this.name="Clock",this.callback=je,this._lastUpdate=0,this._state=new n1("stopped"),this._boundLoop=this._loop.bind(this),this.callback=e.callback,this._tickSource=new a1({context:this.context,frequency:e.frequency,units:e.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,ot(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Qn.getDefaults(),{callback:je,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(e,n){g$(this.context);const r=this.toSeconds(e);return this.log("start",r),this._state.getValueAtTime(r)!=="started"&&(this._state.setStateAtTime("started",r),this._tickSource.start(r,n),r<this._lastUpdate&&this.emit("start",r,n)),this}stop(e){const n=this.toSeconds(e);return this.log("stop",n),this._state.cancel(n),this._state.setStateAtTime("stopped",n),this._tickSource.stop(n),n<this._lastUpdate&&this.emit("stop",n),this}pause(e){const n=this.toSeconds(e);return this._state.getValueAtTime(n)==="started"&&(this._state.setStateAtTime("paused",n),this._tickSource.pause(n),n<this._lastUpdate&&this.emit("pause",n)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(e){this._tickSource.ticks=e}get seconds(){return this._tickSource.seconds}set seconds(e){this._tickSource.seconds=e}getSecondsAtTime(e){return this._tickSource.getSecondsAtTime(e)}setTicksAtTime(e,n){return this._tickSource.setTicksAtTime(e,n),this}getTimeOfTick(e,n=this.now()){return this._tickSource.getTimeOfTick(e,n)}getTicksAtTime(e){return this._tickSource.getTicksAtTime(e)}nextTickTime(e,n){const r=this.toSeconds(n),s=this.getTicksAtTime(r);return this._tickSource.getTimeOfTick(s+e,r)}_loop(){const e=this._lastUpdate,n=this.now();this._lastUpdate=n,this.log("loop",e,n),e!==n&&(this._state.forEachBetween(e,n,r=>{switch(r.state){case"started":const s=this._tickSource.getTicksAtTime(r.time);this.emit("start",r.time,s);break;case"stopped":r.time!==0&&this.emit("stop",r.time);break;case"paused":this.emit("pause",r.time);break}}),this._tickSource.forEachTickBetween(e,n,(r,s)=>{this.callback(r,s)}))}getStateAtTime(e){const n=this.toSeconds(e);return this._state.getValueAtTime(n)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}ph.mixin(Yp);
vendor: 5,181 bytes, line 70
70class dl extends _e{constructor(){const e=xe(dl.getDefaults(),arguments,["volume"]);super(e),this.name="Volume",this.input=this.output=new nt({context:this.context,gain:e.volume,units:"decibels"}),this.volume=this.output.gain,ot(this,"volume"),this._unmutedVolume=e.volume,this.mute=e.mute}static getDefaults(){return Object.assign(_e.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(e){!this.mute&&e?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!e&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}}class u1 extends _e{constructor(){const e=xe(u1.getDefaults(),arguments);super(e),this.name="Destination",this.input=new dl({context:this.context}),this.output=new nt({context:this.context}),this.volume=this.input.volume,Lf(this.input,this.output,this.context.rawContext.destination),this.mute=e.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(_e.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(e){this.input.mute=e}chain(...e){return this.input.disconnect(),e.unshift(this.input),e.push(this.output),Lf(...e),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Hp(t=>{t.destination=new u1({context:t})});qp(t=>{t.destination.dispose()});class FH extends _e{constructor(){super(...arguments),this.name="Listener",this.positionX=new Ye({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new Ye({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new Ye({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new Ye({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new Ye({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new Ye({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new Ye({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new Ye({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new Ye({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(_e.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}Hp(t=>{t.listener=new FH({context:t})});qp(t=>{t.listener.dispose()});class l1 extends Si{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const e=xe(l1.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=e.baseUrl,Object.keys(e.urls).forEach(n=>{this._loadingCount++;const r=e.urls[n];this.add(n,r,this._bufferLoaded.bind(this,e.onload),e.onerror)})}static getDefaults(){return{baseUrl:"",onerror:je,onload:je,urls:{}}}has(e){return this._buffers.has(e.toString())}get(e){return ve(this.has(e),`ToneAudioBuffers has no buffer named: ${e}`),this._buffers.get(e.toString())}_bufferLoaded(e){this._loadingCount--,this._loadingCount===0&&e&&e()}get loaded(){return Array.from(this._buffers).every(([e,n])=>n.loaded)}add(e,n,r=je,s=je){return mi(n)?(this.baseUrl&&n.trim().substring(0,11).toLowerCase()==="data:audio/"&&(this.baseUrl=""),this._buffers.set(e.toString(),new Xe(this.baseUrl+n,r,s))):this._buffers.set(e.toString(),new Xe(n,r,s)),this}dispose(){return super.dispose(),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this}}class Mf extends Hn{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(e){return Ho(super._frequencyToUnits(e))}_ticksToUnits(e){return Ho(super._ticksToUnits(e))}_beatsToUnits(e){return Ho(super._beatsToUnits(e))}_secondsToUnits(e){return Ho(super._secondsToUnits(e))}toMidi(){return this.valueOf()}toFrequency(){return C$(this.toMidi())}transpose(e){return new Mf(this.context,this.toMidi()+e)}}class vu extends pc{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(e){return this._getPPQ()*e}_secondsToUnits(e){return Math.floor(e/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(e){return e}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class LH extends Qn{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Lr,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(e,n){return this._events.add({callback:e,time:this.toSeconds(n)}),this._events.length===1&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(e){return this._events.cancel(this.toSeconds(e)),this}_drawLoop(){const e=this.context.currentTime;
70this._events.forEachBefore(e+this.anticipation,n=>{e-n.time<=this.expiration&&n.callback(),this._events.remove(n)}),this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}Hp(t=>{t.draw=new LH({context:t})});qp(t=>{t.draw.dispose()});class MH extends Si{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(e){ve(Oe(e.time),"Events must have a time property"),ve(Oe(e.duration),"Events must have a duration parameter"),e.time=e.time.valueOf();let n=new VH(e.time,e.time+e.duration,e);for(this._root===null?this._root=n:this._root.insert(n),this._length++;n!==null;)n.updateHeight(),n.updateMax(),this._rebalance(n),n=n.parent;return this}remove(e){if(this._root!==null){const n=[];this._root.search(e.time,n);for(const r of n)if(r.event===e){this._removeNode(r),this._length--;break}}return this}get length(){return this._length}cancel(e){return this.forEachFrom(e,n=>this.remove(n)),this}_setRoot(e){this._root=e,this._root!==null&&(this._root.parent=null)}_replaceNodeInParent(e,n){e.parent!==null?(e.isLeftChild()?e.parent.left=n:e.parent.right=n,this._rebalance(e.parent)):this._setRoot(n)}_removeNode(e){if(e.left===null&&e.right===null)this._replaceNodeInParent(e,null);else if(e.right===null)this._replaceNodeInParent(e,e.left);else if(e.left===null)this._replaceNodeInParent(e,e.right);else{const n=e.getBalance();let r,s=null;if(n>0)if(e.left.right===null)r=e.left,r.right=e.right,s=r;else{for(r=e.left.right;r.right!==null;)r=r.right;r.parent&&(r.parent.right=r.left,s=r.parent,r.left=e.left,r.right=e.right)}else if(e.right.left===null)r=e.right,r.left=e.left,s=r;else{for(r=e.right.left;r.left!==null;)r=r.left;r.parent&&(r.parent.left=r.right,s=r.parent,r.left=e.left,r.right=e.right)}e.parent!==null?e.isLeftChild()?e.parent.left=r:e.parent.right=r:this._setRoot(r),s&&this._rebalance(s)}e.dispose()}_rotateLeft(e){const n=e.parent,r=e.isLeftChild(),s=e.right;s&&(e.right=s.left,s.left=e),n!==null?r?n.left=s:n.right=s:this._setRoot(s)}_rotateRight(e){const n=e.parent,r=e.isLeftChild(),s=e.left;s&&(e.left=s.right,s.right=e),n!==null?r?n.left=s:n.right=s:this._setRoot(s)}_rebalance(e){const n=e.getBalance();n>1&&e.left?e.left.getBalance()<0?this._rotateLeft(e.left):this._rotateRight(e):n<-1&&e.right&&(e.right.getBalance()>0?this._rotateRight(e.right):this._rotateLeft(e))}get(e){if(this._root!==null){const n=[];if(this._root.search(e,n),n.length>0){let r=n[0];for(let s=1;s<n.length;s++)n[s].low>r.low&&(r=n[s]);return r.event}}return null}forEach(e){if(this._root!==null){const n=[];this._root.traverse(r=>n.push(r)),n.forEach(r=>{r.event&&e(r.event)})}return this}forEachAtTime(e,n){if(this._root!==null){const r=[];this._root.search(e,r),r.forEach(s=>{s.event&&n(s.event)})}return this}forEachFrom(e,n){if(this._root!==null){const r=[];this._root.searchAfter(e,r),r.forEach(s=>{s.event&&n(s.event)})}return this}dispose(){return super.dispose(),this._root!==null&&this._root.traverse(e=>e.dispose()),this._root=null,this}}class VH{constructor(e,n,r){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=r,this.low=e,this.high=n,this.max=this.high}insert(e){e.low<=this.low?this.left===null?this.left=e:this.left.insert(e):this.right===null?this.right=e:this.right.insert(e)}search(e,n){e>this.max||(this.left!==null&&this.left.search(e,n),this.low<=e&&this.high>e&&n.push(this),!(this.low>e)&&this.right!==null&&this.right.search(e,n))}searchAfter(e,n){this.low>=e&&(n.push(this),this.left!==null&&this.left.searchAfter(e,n)),this.right!==null&&this.right.searchAfter(e,n)}traverse(e){e(this),this.left!==null&&this.left.traverse(e),this.right!==null&&this.right.traverse(e)}updateHeight(){this.left!==null&&this.right!==null?this.height=Math.max(this.left.height,this.right.height)+1:this.right!==null?this.height=this.right.height+1:this.left!==null?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,this.left!==null&&(this.max=Math.max(this.max,this.left.max)),this.right!==null&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let e=0;return this.left!==null&&this.right!==null?e=this.left.height-this.right.height:this.left!==null?e=this.left.height+1:this.right!==null&&(e=-(this.right.height+1)),e}isLeftChild(){return this.parent!==null&&this.parent.left===this}get left(){return this._left}set left(e){this._left=e,e!==null&&(e.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(e){this._right=e,e!==null&&(e.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}
vendor: 4,144 bytes, line 70
70class BH extends Si{constructor(e){super(),this.name="TimelineValue",this._timeline=new Lr({memory:10}),this._initialValue=e}set(e,n){return this._timeline.add({value:e,time:n}),this}get(e){const n=this._timeline.get(e);return n?n.value:this._initialValue}}class fa extends _e{constructor(){super(xe(fa.getDefaults(),arguments,["context"]))}connect(e,n=0,r=0){return s1(this,e,n,r),this}}class fl extends fa{constructor(){const e=xe(fl.getDefaults(),arguments,["mapping","length"]);super(e),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,lr(e.mapping)||e.mapping instanceof Float32Array?this.curve=Float32Array.from(e.mapping):cH(e.mapping)&&this.setMap(e.mapping,e.length)}static getDefaults(){return Object.assign(ht.getDefaults(),{length:1024})}setMap(e,n=1024){const r=new Float32Array(n);for(let s=0,i=n;s<i;s++){const o=s/(i-1)*2-1;r[s]=e(o,s)}return this.curve=r,this}get curve(){return this._shaper.curve}set curve(e){this._shaper.curve=e}get oversample(){return this._shaper.oversample}set oversample(e){const n=["none","2x","4x"].some(r=>r.includes(e));ve(n,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=e}dispose(){return super.dispose(),this._shaper.disconnect(),this}}let WH=class N$ extends fa{constructor(){const e=xe(N$.getDefaults(),arguments,["value"]);super(e),this.name="Pow",this._exponentScaler=this.input=this.output=new fl({context:this.context,mapping:this._expFunc(e.value),length:8192}),this._exponent=e.value}static getDefaults(){return Object.assign(fa.getDefaults(),{value:1})}_expFunc(e){return n=>Math.pow(Math.abs(n),e)}get value(){return this._exponent}set value(e){this._exponent=e,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}};class lo{constructor(e,n){this.id=lo._eventId++,this._remainderTime=0;const r=Object.assign(lo.getDefaults(),n);this.transport=e,this.callback=r.callback,this._once=r.once,this.time=Math.floor(r.time),this._remainderTime=r.time-this.time}static getDefaults(){return{callback:je,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(e){if(this.callback){const n=this.transport.bpm.getDurationOfTicks(1,e);this.callback(e+this._remainderTime*n),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}}lo._eventId=0;class c1 extends lo{constructor(e,n){super(e,n),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const r=Object.assign(c1.getDefaults(),n);this.duration=r.duration,this._interval=r.interval,this._nextTick=r.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},lo.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(e){this._createEvents(e),super.invoke(e)}_createEvent(){return Ff(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new vu(this.context,this._nextTick).toSeconds()):-1}_createEvents(e){Ff(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new vu(this.context,this._nextTick).toSeconds()))}_restart(e){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const n=this.transport.getTicksAtTime(e);Gu(n,this.time)&&(this._nextTick=this.floatTime+Math.ceil((n-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}}class Qp extends Qn{constructor(){const e=xe(Qp.getDefaults(),arguments);
70super(e),this.name="Transport",this._loop=new BH(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Lr,this._repeatedEvents=new MH,this._syncedSignals=[],this._swingAmount=0,this._ppq=e.ppq,this._clock=new Yp({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=e.ppq,this.bpm.setValueAtTime(e.bpm,0),ot(this,"bpm"),this._timeSignature=e.timeSignature,this._swingTicks=e.ppq/2}static getDefaults(){return Object.assign(Qn.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(e,n){if(this._loop.get(e)&&n>=this._loopEnd&&(this.emit("loopEnd",e),this._clock.setTicksAtTime(this._loopStart,e),n=this._loopStart,this.emit("loopStart",e,this._clock.getSecondsAtTime(e)),this.emit("loop",e)),this._swingAmount>0&&n%this._ppq!==0&&n%(this._swingTicks*2)!==0){const r=n%(this._swingTicks*2)/(this._swingTicks*2),s=Math.sin(r*Math.PI)*this._swingAmou
70nt;e+=new vu(this.context,this._swingTicks*2/3).toSeconds()*s}ZS(!0),this._timeline.forEachAtTime(n,r=>r.invoke(e)),ZS(!1)}schedule(e,n){const r=new lo(this,{callback:e,time:new pc(this.context,n).toTicks()});return this._addEvent(r,this._timeline)}scheduleRepeat(e,n,r,s=1/0){const i=new c1(this,{callback:e,duration:new is(this.context,s).toTicks(),interval:new is(this.context,n).toTicks(),time:new pc(this.context,r).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(e,n){const r=new lo(this,{callback:e,once:!0,time:new pc(this.context,n).toTicks()});return this._addEvent(r,this._timeline)}clear(e){if(this._scheduledEvents.hasOwnProperty(e)){const n=this._scheduledEvents[e.toString()];n.timeline.remove(n.event),n.event.dispose(),delete this._scheduledEvents[e.toString()]}return this}_addEvent(e,n){return this._scheduledEvents[e.id.toString()]={event:e,timeline:n},n.add(e),e.id}cancel(e=0){const n=this.toTicks(e);return this._timeline.forEachFrom(n,r=>this.clear(r.id)),this._repeatedEvents.forEachFrom(n,r=>this.clear(r.id)),this}_bindClockEvents(){this._clock.on("start",(e,n)=>{n=new vu(this.context,n).toSeconds(),this.emit("start",e,n)}),this._clock.on("stop",e=>{this.emit("stop",e)}),this._clock.on("pause",e=>{this.emit("pause",e)})}get state(){return this._clock.getStateAtTime(this.now())}start(e,n){this.context.resume();let r;return Oe(n)&&(r=this.toTicks(n)),this._clock.start(e,r),this}stop(e){return this._clock.stop(e),this}pause(e){return this._clock.pause(e),this}toggle(e){return e=this.toSeconds(e),this._clock.getStateAtTime(e)!=="started"?this.start(e):this.stop(e),this}get timeSignature(){return this._timeSignature}set timeSignature(e){lr(e)&&(e=e[0]/e[1]*4),this._timeSignature=e}get loopStart(){return new is(this.context,this._loopStart,"i").toSeconds()}set loopStart(e){this._loopStart=this.toTicks(e)}get loopEnd(){return new is(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(e){this._loopEnd=this.toTicks(e)}get loop(){return this._loop.get(this.now())}set loop(e){this._loop.set(e,this.now())}setLoopPoints(e,n){return this.loopStart=e,this.loopEnd=n,this}
70get swing(){return this._swingAmount}set swing(e){this._swingAmount=e}get swingSubdivision(){return new vu(this.context,this._swingTicks).toNotation()}set swingSubdivision(e){this._swingTicks=this.toTicks(e)}get position(){const e=this.now(),n=this._clock.getTicksAtTime(e);return new vu(this.context,n).toBarsBeatsSixteenths()}set position(e){const n=this.toTicks(e);this.ticks=n}get seconds(){return this._clock.seconds}set seconds(e){const n=this.now(),r=this._clock.frequency.timeToTicks(e,n);this.ticks=r}get progress(){if(this.loop){const e=this.now();return(this._clock.getTicksAtTime(e)-this._loopStart)/(this._loopEnd-this._loopStart)}else return 0}get ticks(){return this._clock.ticks}set ticks(e){if(this._clock.ticks!==e){const n=this.now();if(this.state==="started"){const r=this._clock.getTicksAtTime(n),s=this._clock.frequency.getDurationOfTicks(Math.ceil(r)-r,n),i=n+s;this.emit("stop",i),this._clock.setTicksAtTime(e,i),this.emit("start",i,this._clock.getSecondsAtTime(i))}else this.emit("ticks",n),this._clock.setTicksAtTime(e,n)}}getTicksAtTime(e){return this._clock.getTicksAtTime(e)}getSecondsAtTime(e){return this._clock.getSecondsAtTime(e)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(e){this._clock.frequency.multiplier=e}nextSubdivision(e){if(e=this.toTicks(e),this.state!=="started")return 0;{const n=this.now(),r=this.getTicksAtTime(n),s=e-r%e;return this._clock.nextTickTime(s,n)}}syncSignal(e,n){const r=this.now();let s=this.bpm,i=1/(60/s.getValueAtTime(r)/this.PPQ),o=[];if(e.units==="time"){const u=.015625/i,l=new nt(u),c=new WH(-1),h=new nt(u);s.chain(l,c,h),s=h,i=1/i,o=[l,c,h]}n||(e.getValueAtTime(r)!==0?n=e.getValueAtTime(r)/i:n=0);const a=new nt(n);return s.connect(a),a.connect(e._param),o.push(a),this._syncedSignals.push({initial:e.value,nodes:o,signal:e}),e.value=0,this}unsyncSignal(e){for(let n=this._syncedSignals.length-1;n>=0;n--){const r=this._syncedSignals[n];r.signal===e&&(r.nodes.forEach(s=>s.dispose()),r.signal.value=r.initial,this._syncedSignals.splice(n,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),e1(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}ph.mixin(Qp);Hp(t=>{t.transport=new Qp({context:t})});qp(t=>
vendor: 7,514 bytes, line 70
70{t.transport.dispose()});class hn extends _e{constructor(e){super(e),this.input=void 0,this._state=new n1("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=je,this._syncedStop=je,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new dl({context:this.context,mute:e.mute,volume:e.volume}),this.volume=this._volume.volume,ot(this,"volume"),this.onstop=e.onstop}static getDefaults(){return Object.assign(_e.getDefaults(),{mute:!1,onstop:je,volume:0})}get state(){return this._synced?this.context.transport.state==="started"?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}_clampToCurrentTime(e){return this._synced?e:Math.max(e,this.context.currentTime)}start(e,n,r){let s=Fr(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(s=this._clampToCurrentTime(s),!this._synced&&this._state.getValueAtTime(s)==="started")ve(Gu(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,n,r);else if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const i=this._state.get(s);i&&(i.offset=this.toSeconds(Eu(n,0)),i.duration=r?this.toSeconds(r):void 0);const o=this.context.transport.schedule(a=>{this._start(a,n,r)},s);this._scheduled.push(o),this.context.transport.state==="started"&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else g$(this.context),this._start(s,n,r);return this}stop(e){let n=Fr(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(n=this._clampToCurrentTime(n),this._state.getValueAtTime(n)==="started"||Oe(this._state.getNextState("started",n))){if(this.log("stop",n),!this._synced)this._stop(n);else{const r=this.context.transport.schedule(this._stop.bind(this),n);this._scheduled.push(r)}this._state.cancel(n),this._state.setStateAtTime("stopped",n)}return this}restart(e,n,r){return e=this.toSeconds(e),this._state.getValueAtTime(e)==="started"&&(this._state.cancel(e),this._restart(e,n,r)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(e,n)=>{if(Gu(n,0)){const r=this._state.get(n);if(r&&r.state==="started"&&r.time!==n){const s=n-this.toSeconds(r.time);let i;r.duration&&(i=this.toSeconds(r.duration)-s),this._start(e,this.toSeconds(r.offset)+s,i)}}},this._syncedStop=e=>{const n=this.context.transport.getSecondsAtTime(Math.max(e-this.sampleTime,0));this._state.getValueAtTime(n)==="started"&&this._stop(e)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(e=>this.context.transport.clear(e)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=je,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class gh extends Hu{constructor(){const e=xe(gh.getDefaults(),arguments,["url","onload"]);super(e),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,uo(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Ye({context:this.context,param:this._source.playbackRate,units:"positive",value:e.playbackRate}),this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this._buffer=new Xe(e.url,e.onload,e.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(Hu.getDefaults(),{url:new Xe,loop:!1,loopEnd:0,loopStart:0,onload:je,onerror:je,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(e){this._fadeIn=e}get fadeOut(){return this._fadeOut}set fadeOut(e){this._fadeOut=e}get curve(){return this._curve}set curve(e){this._curve=e}start(e,n,r,s=1){ve(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(e);this._startGain(i,s),this.loop?n=Eu(n,this.loopStart):n=Eu(n,0);let o=Math.max(this.toSeconds(n),0);if(this.loop){const a=this.toSeconds(this.loopEnd)||this.buffer.duration,u=this.toSeconds(this.loopStart),l=a-u;y0(o,a)&&(o=(o-u)%l+u),es(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ff(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),Oe(r)){let a=this.toSeconds(r);a=Math.max(a,0),this.stop(i+a)}return this}_stopSource(e){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(e)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(e){this._source.loopStart=this.toSeconds(e)}get loopEnd(){return this._source.loopEnd}set loopEnd(e){this._source.loopEnd=this.toSeconds(e)}get buffer(){return this._buffer}set buffer(e){this._buffer.set(e)}get loop(){return this._source.loop}set loop(e){this._source.loop=e,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Vf extends hn{constructor(){const e=xe(Vf.getDefaults(),arguments,["type"]);super(e),this.name="Noise",this._source=null,this._playbackRate=e.playbackRate,this.type=e.type,this._fadeIn=e.fadeIn,this._fadeOut=e.fadeOut}static getDefaults(){return Object.assign(hn.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(e){if(ve(e in JS,"Noise: invalid type: "+e),this._type!==e&&(this._type=e,this.state==="started")){const n=this.now();this._stop(n),this._start(n)}}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e,this._source&&(this._source.playbackRate.value=e)}_start(e){const n=JS[this._type];this._source=new gh({url:n,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(e),Math.random()*(n.duration-.001))}_stop(e){this._source&&(this._source.stop(this.toSeconds(e)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(e){this._fadeIn=e,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(e){this._fadeOut=e,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(e){this._stop(e),this._start(e)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const qa=44100*5,Rg=2,Xs={brown:null,pink:null,white:null},JS={get brown(){if(!Xs.brown){const t=[];for(let e=0;e<Rg;e++){const n=new Float32Array(qa);t[e]=n;let r=0;for(let s=0;s<qa;s++){const i=Math.random()*2-1;n[s]=(r+.02*i)/1.02,r=n[s],n[s]*=3.5}}Xs.brown=new Xe().fromArray(t)}return Xs.brown},get pink(){if(!Xs.pink){const t=[];for(let e=0;e<Rg;e++){const n=new Float32Array(qa);t[e]=n;let r,s,i,o,a,u,l;
70r=s=i=o=a=u=l=0;for(let c=0;c<qa;c++){const h=Math.random()*2-1;r=.99886*r+h*.0555179,s=.99332*s+h*.0750759,i=.969*i+h*.153852,o=.8665*o+h*.3104856,a=.55*a+h*.5329522,u=-.7616*u-h*.016898,n[c]=r+s+i+o+a+u+l+h*.5362,n[c]*=.11,l=h*.115926}}Xs.pink=new Xe().fromArray(t)}return Xs.pink},get white(){if(!Xs.white){const t=[];for(let e=0;e<Rg;e++){const n=new Float32Array(qa);t[e]=n;for(let r=0;r<qa;r++)n[r]=Math.random()*2-1}Xs.white=new Xe().fromArray(t)}return Xs.white}};function Ra(t,e){return Ot(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new Kp(1,n,t.context.sampleRate);return new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:r})).toDestination().start(0),(yield r.render()).getChannelData(0)})}class h1 extends Hu{constructor(){const e=xe(h1.getDefaults(),arguments,["frequency","type"]);super(e),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],uo(this._oscillator,this._gainNode),this.type=e.type,this.frequency=new Ye({context:this.context,param:this._oscillator.frequency,units:"frequency",value:e.frequency}),this.detune=new Ye({context:this.context,param:this._oscillator.detune,units:"cents",value:e.detune}),ot(this,["frequency","detune"])}static getDefaults(){return Object.assign(Hu.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(e){const n=this.toSeconds(e);return this.log("start",n),this._startGain(n),this._oscillator.start(n),this}_stopSource(e){this._oscillator.stop(e)}setPeriodicWave(e){return this._oscillator.setPeriodicWave(e),this}get type(){return this._oscillator.type}set type(e){this._oscillator.type=e}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}class Ft extends hn{constructor(){const e=xe(Ft.getDefaults(),arguments,["frequency","type"]);super(e),this.name="Oscillator",this._oscillator=null,this.frequency=new ht({context:this.context,units:"frequency",value:e.frequency}),ot(this,"frequency"),this.detune=new ht({context:this.context,units:"cents",value:e.detune}),ot(this,"detune"),this._partials=e.partials,this._partialCount=e.partialCount,this._type=e.type,e.partialCount&&e.type!=="custom"&&(this._type=this.baseType+e.partialCount.toString()),this.phase=e.phase}static getDefaults(){return Object.assign(hn.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(e){const n=this.toSeconds(e),r=new h1({context:this.context,onended:()=>this.onstop(this)});this._oscillator=r,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(n)}_stop(e){const n=this.toSeconds(e);this._oscillator&&this._oscillator.stop(n)}_restart(e){const n=this.toSeconds(e);return this.log("restart",n),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(n),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if(this._type==="custom")return Ft._periodicWaveCache.find(n=>n.phase===this._phase&&bH(n.partials,this._partials));{const e=Ft._periodicWaveCache.find(n=>n.type===this._type&&n.phase===this._phase);return this._partialCount=e?e.partialCount:this._partialCount,e}}get type(){return this._type}set type(e){this._type=e;const n=["sine","square","sawtooth","triangle"].indexOf(e)!==-1;if(this._phase===0&&n)this._wave=void 0,this._partialCount=0,this._oscillator!==null&&(this._oscillator.type=e);else{const r=this._getCachedPeriodicWave();if(Oe(r)){const{partials:s,wave:i}=r;this._wave=i,this._partials=s,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave)}else{const[s,i]=this._getRealImaginary(e,this._phase),o=this.context.createPeriodicWave(s,i);this._wave=o,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave),Ft._peri
70odicWaveCache.push({imag:i,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:s,type:this._type,wave:this._wave}),Ft._periodicWaveCache.length>100&&Ft._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(e){this.partialCount&&this._type!=="custom"&&e!=="custom"?this.type=e+this.partialCount:this.type=e}get partialCount(){return this._partialCount}set partialCount(e){Ir(e,0);let n=this._type;const r=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(r&&(n=r[1]),this._type!=="custom")e===0?this.type=n:this.type=n+e.toString();else{const s=new Float32Array(e);this._partials.forEach((i,o)=>s[o]=i),this._partials=Array.from(s),this.type=this._type}}_getRealImaginary(e,n){let s=2048;const i=new Float32Array(s),o=new Float32Array(s);let a=1;if(e==="custom"){if(a=this._partials.length+1,this._partialCount=this._partials.length,s=a,this._partials.length===0)return[i,o]}else{const u=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(e);u?(a=parseInt(u[2],10)+1,this._partialCount=parseInt(u[2],10),e=u[1],a=Math.max(a,2),s=a):this._partialCount=0,this._partials=[]}for(let u=1;u<s;++u){const l=2/(u*Math.PI);let c;switch(e){case"sine":c=u<=a?1:0,this._partials[u-1]=c;break;case"square":c=u&1?2*l:0,this._partials[u-1]=c;break;case"sawtooth":c=l*(u&1?1:-1),this._partials[u-1]=c;break;case"triangle":u&1?c=2*(l*l)*(u-1>>1&1?-1:1):c=0,this._partials[u-1]=c;break;case"custom":c=this._partials[u-1];break;default:throw new TypeError("Oscillator: invalid type: "+e)}c!==0?(i[u]=-c*Math.sin(n*u),o[u]=c*Math.cos(n*u)):(i[u]=0,o[u]=0)}return[i,o]}_inverseFFT(e,n,r){let s=0;const i=e.length;for(let o=0;o<i;o++)s+=e[o]*Math.cos(o*r)+n[o]*Math.sin(o*r);return s}getInitialValue(){const[e,n]=this._getRealImaginary(this._type,0);let r=0;const s=Math.PI*2,i=32;for(let o=0;o<i;o++)r=Math.max(this._inverseFFT(e,n,o/i*s),r);return SH(-this._inverseFFT(e,n,this._phase)/r,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(e){this._partials=e,this._partialCount=this._partials.length,e.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(e){this._phase=e*Math.PI/180,this.type=this._type}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this._oscillator!==null&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Ft._periodicWaveCache=[];class UH extends fa{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new fl({context:this.context,mapping:e=>(e+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}let qu=class E$ extends ht{constructor(){const e=xe(E$.getDefaults(),arguments,["value"]);super(e),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new nt({context:this.context,minValue:e.minValue,maxValue:e.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(e.value,0)}static getDefaults(){return Object.assign(ht.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}};class Zp extends hn{constructor(){const e=xe(Zp.getDefaults(),arguments,["frequency","type","modulationType"]);super(e),this.name="AMOscillator",this._modulationScale=new UH({context:this.context}),this._modulationNode=new nt({context:this.context}),this._carrier=new Ft({context:this.context,detune:e.detune,frequency:e.frequency,onstop:()=>this.onstop(this),phase:e.phase,type:e.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Ft({context:this.context,phase:e.phase,type:e.modulationType}),this.harmonicity=new qu({context:this.context,units:"positive",value:e.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),ot(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Ft.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(e){this._modulator.start(e),this._carrier.start(e)}_stop(e){this._modulator.stop(e),this._carrier.stop(e)}_restart(e){this._modulator.restart(e),this._carrier.restart(e)}get type(){return this._carrier.type}set type(e){this._carrier.type=e}get baseType(){return this._carrier.baseType}set baseType(e){this._carrier.baseType=e}get partialCount(){return this._carrier.partialCount}set partialCount(e){this._carrier.partialCount=e}get modulationType(){return this._modulator.type}set modulationType(e){this._modulator.type=e}get phase(){return this._carrier.phase}set phase(e){this._carrier.phase=e,this._modulator.phase=e}get partials(){return this._carrier.partials}set partials(e){this._carrier.partials=e}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dis
vendor: 4,472 bytes, line 70
70pose(),this._modulationScale.dispose(),this}}class Jp extends hn{constructor(){const e=xe(Jp.getDefaults(),arguments,["frequency","type","modulationType"]);super(e),this.name="FMOscillator",this._modulationNode=new nt({context:this.context,gain:0}),this._carrier=new Ft({context:this.context,detune:e.detune,frequency:0,onstop:()=>this.onstop(this),phase:e.phase,type:e.type}),this.detune=this._carrier.detune,this.frequency=new ht({context:this.context,units:"frequency",value:e.frequency}),this._modulator=new Ft({context:this.context,phase:e.phase,type:e.modulationType}),this.harmonicity=new qu({context:this.context,units:"positive",value:e.harmonicity}),this.modulationIndex=new qu({context:this.context,units:"positive",value:e.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),ot(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Ft.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(e){this._modulator.start(e),this._carrier.start(e)}_stop(e){this._modulator.stop(e),this._carrier.stop(e)}_restart(e){return this._modulator.restart(e),this._carrier.restart(e),this}get type(){return this._carrier.type}set type(e){this._carrier.type=e}get baseType(){return this._carrier.baseType}set baseType(e){this._carrier.baseType=e}get partialCount(){return this._carrier.partialCount}set partialCount(e){this._carrier.partialCount=e}get modulationType(){return this._modulator.type}set modulationType(e){this._modulator.type=e}get phase(){return this._carrier.phase}set phase(e){this._carrier.phase=e,this._modulator.phase=e}get partials(){return this._carrier.partials}set partials(e){this._carrier.partials=e}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class yh extends hn{constructor(){const e=xe(yh.getDefaults(),arguments,["frequency","width"]);super(e),this.name="PulseOscillator",this._widthGate=new nt({context:this.context,gain:0}),this._thresh=new fl({context:this.context,mapping:n=>n<=0?-1:1}),this.width=new ht({context:this.context,units:"audioRange",value:e.width}),this._triangle=new Ft({context:this.context,detune:e.detune,frequency:e.frequency,onstop:()=>this.onstop(this),phase:e.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),ot(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(hn.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(e){e=this.toSeconds(e),this._triangle.start(e),this._widthGate.gain.setValueAtTime(1,e)}_stop(e){e=this.toSeconds(e),this._triangle.stop(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(0,e)}_restart(e){this._triangle.restart(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(1,e)}get phase(){return this._triangle.phase}set phase(e){this._triangle.phase=e}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(e){this._triangle.type=e}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class em extends hn{constructor(){const e=xe(em.getDefaults(),arguments,["frequency","type","spread"]);super(e),this.name="FatOscillator",this._oscillators=[],this.frequency=new ht({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ht({context:this.context,units:"cents",value:e.detune}),this._spread=e.spread,this._type=e.type,this._phase=e.phase,this._partials=e.partials,this._partialCount=e.partialCount,this.count=e.count,ot(this,["frequency","detune"])}static getDefaults(){return Object.assign(Ft.getDefaults(),{count:3,spread:20,type:"sawtooth"})}
70_start(e){e=this.toSeconds(e),this._forEach(n=>n.start(e))}_stop(e){e=this.toSeconds(e),this._forEach(n=>n.stop(e))}_restart(e){this._forEach(n=>n.restart(e))}_forEach(e){for(let n=0;n<this._oscillators.length;n++)e(this._oscillators[n],n)}get type(){return this._type}set type(e){this._type=e,this._forEach(n=>n.type=e)}get spread(){return this._spread}set spread(e){if(this._spread=e,this._oscillators.length>1){const n=-e/2,r=e/(this._oscillators.length-1);this._forEach((s,i)=>s.detune.value=n+r*i)}}get count(){return this._oscillators.length}set count(e){if(Ir(e,1),this._oscillators.length!==e){this._forEach(n=>n.dispose()),this._oscillators=[];for(let n=0;n<e;n++){const r=new Ft({context:this.context,volume:-6-e*1.1,type:this._type,phase:this._phase+n/e*360,partialCount:this._partialCount,onstop:n===0?()=>this.onstop(this):je});this.type==="custom"&&(r.partials=this._partials),this.frequency.connect(r.frequency),this.detune.connect(r.detune),r.detune.overridden=!1,r.connect(this.output),this._oscillators[n]=r}this.spread=this._spread,this.state==="started"&&this._forEach(n=>n.start())}}get phase(){return this._phase}set phase(e){this._phase=e,this._forEach((n,r)=>n.phase=this._phase+r/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(e){this._forEach(n=>n.baseType=e),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(e){this._partials=e,this._partialCount=this._partials.length,e.length&&(this._type="custom",this._forEach(n=>n.partials=e))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(e){this._partialCount=e,this._forEach(n=>n.partialCount=e),this._type=this._oscillators[0].type}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(e=>e.dispose()),this}}class tm extends hn{constructor(){const e=xe(tm.getDefaults(),arguments,["frequency","modulationFrequency"]);super(e),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new qu({context:this.context,value:2}),this._pulse=new yh({context:this.context,frequency:e.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Ft({context:this.context,detune:e.detune,frequency:e.frequency,onstop:()=>this.onstop(this),phase:e.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),ot(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(hn.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(e){e=this.toSeconds(e),this._modulator.start(e),this._pulse.start(e)}_stop(e){e=this.toSeconds(e),this._modulator.stop(e),this._pulse.stop(e)}_restart(e){this._modulator.restart(e),this._pulse.restart(e)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(e){this._modulator.phase=e}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const eT={am:Zp,fat:em,fm:Jp,oscillator:Ft,pulse:yh,pwm:tm};class Ku extends hn{constructor(){const e=xe(Ku.getDefaults(),arguments,["frequency","type"]);super(e),this.name="OmniOscillator",this.frequency=new ht({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ht({context:this.context,units:"cents",value:e.detune}),ot(this,["frequency","detune"]),this.set(e)}static getDefaults(){return Object.assign(Ft.getDefaults(),Jp.getDefaults(),Zp.getDefaults(),em.getDefaults(),yh.getDefaults(),tm.getDefaults())}_start(e){this._oscillator.start(e)}_stop(e){this._oscillator.stop(e)}_restart(e){return this._oscillator.restart(e),this}get type(){let e="";return["am","fm","fat"].some(n=>this._sourceType===n)&&(e=this._sourceType),e+this._oscillator.type}set type(e){e.substr(0,2)==="fm"?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):e.substr(0,2)==="am"?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):e.substr(0,3)==="fat"?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(3)):e==="pwm"?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):e==="pulse"?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=e)}get partials(){return this._oscillator.partials}set partials(e){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partials=e)}get partialCount(){return this._oscillator.partialCount}set partialCount(e){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partialCount=e)}
70set(e){return Reflect.has(e,"type")&&e.type&&(this.type=e.type),super.set(e),this}_createNewOscillator(e){if(e!==this._sourceType){this._sourceType=e;const n=eT[e],r=this.now();if(this._oscillator){const s=this._oscillator;s.stop(r),this.context.setTimeout(()=>s.dispose(),this.blockTime)}this._oscillator=new n({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),this.state==="started"&&this._oscillator.start(r)}}get phase(){return this._oscillator.phase}set phase(e){this._oscillator.phase=e}get sourceType(){return this._sourceType}set sourceType(e){let n="sine";this._oscillator.type!=="pwm"&&this._oscillator.type!=="pulse"&&(n=this._oscillator.type),e==="fm"?this.type="fm"+n:e==="am"?this.type="am"+n:e==="fat"?this.type="fat"+n:e==="oscillator"?this.type=n:e==="pulse"?this.type="pulse":e==="pwm"&&(this.type="pwm")}_getOscType(e,n){return e instanceof eT[n]}get baseType(){return this._oscillator.baseType}set baseType(e){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&e!=="pulse"&&e!=="pwm"&&(this._oscillator.baseType=e)}get width(){if(this._getOscType(this._oscillator,"pulse"))return this._oscillator.width}get count(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.count}set count(e){this._getOscType(this._oscillator,"fat")&&pi(e)&&(this._oscillator.count=e)}get spread(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.spread}set spread(e){this._getOscType(this._oscillator,"fat")&&pi(e)&&(this._oscillator.spread=e)}get modulationType(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.modulationType}set modulationType(e){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&mi(e)&&(this._oscillator.modulationType=e)}get modulationIndex(){if(this._getOscType(this._oscillator,"fm"))return this._oscillator.modulationIndex}get harmonicity(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.harmonicity}get modulationFrequency(){if(this._getOscType(this._oscillator,"pwm"))return this._oscillator.modulationFrequency}asArray(){return Ot(this,arguments,void 0,function*(e=1024){return Ra(this,e)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}function k$(t,e=1/0){const n=new WeakMap;return function(r,s){Reflect.defineProperty(r,s,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(i){Ir(i,t,e),n.set(this,i)}})}}function Ti(t,e=1/0){const n=new WeakMap;return function(r,s){Reflect.defineProperty(r,s,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(i){Ir(this.toSeconds(i),t,e),n.set(this,i)}})}}class nm extends hn{constructor(){const e=xe(nm.getDefaults(),arguments,["url","onload"]);super(e),this.name="Player",this._activeSources=new Set,this._buffer=new Xe({onload:this._onload.bind(this,e.onload),onerror:e.onerror,reverse:e.reverse,url:e.url}),this.autostart=e.autostart,this._loop=e.loop,this._loopStart=e.loopStart,this._loopEnd=e.loopEnd,this._playbackRate=e.playbackRate,this.fadeIn=e.fadeIn,this.fadeOut=e.fadeOut}static getDefaults(){return Object.assign(hn.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:je,onerror:je,playbackRate:1,reverse:!1})}load(e){return Ot(this,void 0,void 0,function*(){return yield this._buffer.load(e),this._onload(),this})}_onload(e=je){e(),this.autostart&&this.start()}_onSourceEnd(e){this.onstop(this),this._activeSources.delete(e),this._activeSources.size===0&&!this._synced&&this._state.getValueAtTime(this.now())==="started"&&(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(e,n,r){return super.start(e,n,r),this}_start(e,n,r){this._loop?n=Eu(n,this._loopStart):n=Eu(n,0);const s=this.toSeconds(n),i=r;r=Eu(r,Math.max(this._buffer.duration-s,0));let o=this.toSeconds(r);o=o/this._playbackRate,e=this.toSeconds(e);const a=new gh({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);!this._loop&&!this._synced&&(this._state.cancel(e+o),this._state.setStateAtTime("stopped",e+o,{implicitEnd:!0})),this._activeSources.add(a),this._loop&&Fr(i)?a.start(e,s):a.start(e,s,o-this.toSeconds(this.fadeOut))}_stop(e){const n=this.toSeconds(e);
70this._activeSources.forEach(r=>r.stop(n))}restart(e,n,r){return super.restart(e,n,r),this}_restart(e,n,r){var s;(s=[...this._activeSources].pop())===null||s===void 0||s.stop(e),this._start(e,n,r)}seek(e,n){const r=this.toSeconds(n);if(this._state.getValueAtTime(r)==="started"){const s=this.toSeconds(e);this._stop(r),this._start(r,s)}return this}setLoopPoints(e,n){return this.loopStart=e,this.loopEnd=n,this}get loopStart(){return this._loopStart}set loopStart(e){this._loopStart=e,this.buffer.loaded&&Ir(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach(n=>{n.loopStart=e})}get loopEnd(){return this._loopEnd}set loopEnd(e){this._loopEnd=e,this.buffer.loaded&&Ir(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach(n=>{n.loopEnd=e})}get buffer(){return this._buffer}set buffer(e){this._buffer.set(e)}get loop(){return this._loop}set loop(e){if(this._loop!==e&&(this._loop=e,this._activeSources.forEach(n=>{n.loop=e}),e)){const n=this._state.getNextState("stopped",this.now());n&&this._state.cancel(n.time)}}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e;const n=this.now(),r=this._state.getNextState("stopped",n);r&&r.implicitEnd&&(this._state.cancel(r.time),this._activeSources.forEach(s=>s.cancelStop())),this._activeSources.forEach(s=>{s.playbackRate.setValueAtTime(e,n)})}get reverse(){return this._buffer.reverse}set reverse(e){this._buffer.reverse=e}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(e=>e.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}}ys([Ti(0)],nm.prototype,"fadeIn",void 0);ys([Ti(0)],nm.prototype,"fadeOut",void 0);class zH extends fa{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new fl({context:this.context,mapping:e=>Math.abs(e)*2-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Us extends _e{constructor(){const e=xe(Us.getDefaults(),arguments,["attack","decay","sustain","release"]);super(e),this.name="Envelope",this._sig=new ht({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve,this.decayCurve=e.decayCurve}static getDefaults(){return Object.assign(_e.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(e,n){if(mi(e))return e;{let r;for(r in dd)if(dd[r][n]===e)return r;return e}}_setCurve(e,n,r){if(mi(r)&&Reflect.has(dd,r)){const s=dd[r];ea(s)?e!=="_decayCurve"&&(this[e]=s[n]):this[e]=s}else if(lr(r)&&e!=="_decayCurve")this[e]=r;else throw new Error("Envelope: invalid curve: "+r)}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(e){this._setCurve("_attackCurve","In",e)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(e){this._setCurve("_releaseCurve","Out",e)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(e){this._setCurve("_decayCurve","Out",e)}triggerAttack(e,n=1){this.log("triggerAttack",e,n),e=this.toSeconds(e);let s=this.toSeconds(this.attack);const i=this.toSeconds(this.decay),o=this.getValueAtTime(e);if(o>0){const a=1/s;s=(1-o)/a}if(s<this.sampleTime)this._sig.cancelScheduledValues(e),this._sig.setValueAtTime(n,e);else if(this._attackCurve==="linear")this._sig.linearRampTo(n,s,e);else if(this._attackCurve==="exponential")this._sig.targetRampTo(n,s,e);else{this._sig.cancelAndHoldAtTime(e);let a=this._attackCurve;for(let u=1;u<a.length;u++)if(a[u-1]<=o&&o<=a[u]){a=this._attackCurve.slice(u),a[0]=o;break}this._sig.setValueCurveAtTime(a,e,s,n)}if(i&&this.sustain<1){const a=n*this.sustain,u=e+s;this.log("decay",u),this._decayCurve==="linear"?this._sig.linearRampToValueAtTime(a,i+u):this._sig.exponentialApproachValueAtTime(a,u,i)}return this}triggerRelease(e){this.log("triggerRelease",e),e=this.toSeconds(e);const n=this.getValueAtTime(e);
70if(n>0){const r=this.toSeconds(this.release);r<this.sampleTime?this._sig.setValueAtTime(0,e):this._releaseCurve==="linear"?this._sig.linearRampTo(0,r,e):this._releaseCurve==="exponential"?this._sig.targetRampTo(0,r,e):(ve(lr(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(e),this._sig.setValueCurveAtTime(this._releaseCurve,e,r,n))}return this}getValueAtTime(e){return this._sig.getValueAtTime(e)}triggerAttackRelease(e,n,r=1){return n=this.toSeconds(n),this.triggerAttack(n,r),this.triggerRelease(n+this.toSeconds(e)),this}cancel(e){return this._sig.cancelScheduledValues(this.toSeconds(e)),this}connect(e,n=0,r=0){return s1(this,e,n,r),this}asArray(){return Ot(this,arguments,void 0,function*(e=1024){const n=e/this.context.sampleRate,r=new Kp(1,n,this.context.sampleRate),s=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=s+this.toSeconds(this.release),o=i*.1,a=i+o,u=new this.constructor(Object.assign(this.get(),{attack:n*this.toSeconds(this.attack)/a,decay:n*this.toSeconds(this.decay)/a,release:n*this.toSeconds(this.release)/a,c
70ontext:r}));return u._sig.toDestination(),u.triggerAttackRelease(n*(s+o)/a,0),(yield r.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}}ys([Ti(0)],Us.prototype,"attack",void 0);ys([Ti(0)],Us.prototype,"decay",void 0);ys([k$(0,1)],Us.prototype,"sustain",void 0);ys([Ti(0)],Us.prototype,"release",void 0);const dd=(()=>{let e,n;const r=[];for(e=0;e<128;e++)r[e]=Math.sin(e/127*(Math.PI/2));const s=[],i=6.4;for(e=0;e<127;e++){n=e/127;const d=Math.sin(n*(Math.PI*2)*i-Math.PI/2)+1;s[e]=d/10+n*.83}s[127]=1;const o=[],a=5;for(e=0;e<128;e++)o[e]=Math.ceil(e/127*a)/a;const u=[];for(e=0;e<128;e++)n=e/127,u[e]=.5*(1-Math.cos(Math.PI*n));const l=[];for(e=0;e<128;e++){n=e/127;const d=Math.pow(n,3)*4+.2,f=Math.cos(d*Math.PI*2*n);l[e]=Math.abs(f*(1-n))}function c(d){const f=new Array(d.length);for(let p=0;p<d.length;p++)f[p]=1-d[p];return f}function h(d){return d.slice(0).reverse()}return{bounce:{In:c(l),Out:l},cosine:{In:r,Out:h(r)},exponential:"exponential",linear:"linear",ripple:{In:s,Out:c(s)},sine:{In:u,Out:c(u)},step:{In:o,Out:c(o)}}})();class co extends _e{constructor(){const e=xe(co.getDefaults(),arguments);super(e),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=n=>this._original_triggerRelease(n),this._volume=this.output=new dl({context:this.context,volume:e.volume}),this.volume=this._volume.volume,ot(this,"volume")}static getDefaults(){return Object.assign(_e.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let e=!1;return this._synced||(this._synced=!0,e=!0),e}_syncMethod(e,n){const r=this["_original_"+e]=this[e];this[e]=(...s)=>{const i=s[n],o=this.context.transport.schedule(a=>{s[n]=a,r.apply(this,s)},i);this._scheduledEvents.push(o)}}unsync(){return this._scheduledEvents.forEach(e=>this.context.transport.clear(e)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(e,n,r,s){const i=this.toSeconds(r),o=this.toSeconds(n);return this.triggerAttack(e,i,s),this.triggerRelease(i+o),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class gi extends co{constructor(){const e=xe(gi.getDefaults(),arguments);super(e),this.portamento=e.portamento,this.onsilence=e.onsilence}static getDefaults(){return Object.assign(co.getDefaults(),{detune:0,onsilence:je,portamento:0})}triggerAttack(e,n,r=1){this.log("triggerAttack",e,n,r);const s=this.toSeconds(n);return this._triggerEnvelopeAttack(s,r),this.setNote(e,s),this}triggerRelease(e){this.log("triggerRelease",e);const n=this.toSeconds(e);return this._triggerEnvelopeRelease(n),this}setNote(e,n){const r=this.toSeconds(n),s=e instanceof Hn?e.toFrequency():e;if(this.portamento>0&&this.getLevelAtTime(r)>.05){const i=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(s,i,r)}else this.frequency.setValueAtTime(s,r);return this}}ys([Ti(0)],gi.prototype,"portamento",void 0);class d1 extends Us{constructor(){super(xe(d1.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new nt({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}
vendor: 4,468 bytes, line 70
70dispose(){return super.dispose(),this._gainNode.dispose(),this}}class pa extends gi{constructor(){const e=xe(pa.getDefaults(),arguments);super(e),this.name="Synth",this.oscillator=new Ku(Object.assign({context:this.context,detune:e.detune,onstop:()=>this.onsilence(this)},e.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new d1(Object.assign({context:this.context},e.envelope)),this.oscillator.chain(this.envelope,this.output),ot(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(gi.getDefaults(),{envelope:Object.assign(Go(Us.getDefaults(),Object.keys(_e.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(Go(Ku.getDefaults(),[...Object.keys(hn.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(e,n){if(this.envelope.triggerAttack(e,n),this.oscillator.start(e),this.envelope.sustain===0){const r=this.toSeconds(this.envelope.attack),s=this.toSeconds(this.envelope.decay);this.oscillator.stop(e+r+s)}}_triggerEnvelopeRelease(e){this.envelope.triggerRelease(e),this.oscillator.stop(e+this.toSeconds(this.envelope.release))}getLevelAtTime(e){return e=this.toSeconds(e),this.envelope.getValueAtTime(e)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class Bf extends gi{constructor(){const e=xe(Bf.getDefaults(),arguments);super(e),this.name="ModulationSynth",this._carrier=new pa({context:this.context,oscillator:e.oscillator,envelope:e.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new pa({context:this.context,oscillator:e.modulation,envelope:e.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new ht({context:this.context,units:"frequency"}),this.detune=new ht({context:this.context,value:e.detune,units:"cents"}),this.harmonicity=new qu({context:this.context,value:e.harmonicity,minValue:0}),this._modulationNode=new nt({context:this.context,gain:0}),ot(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(gi.getDefaults(),{harmonicity:3,oscillator:Object.assign(Go(Ku.getDefaults(),[...Object.keys(hn.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(Go(Us.getDefaults(),Object.keys(_e.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(Go(Ku.getDefaults(),[...Object.keys(hn.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(Go(Us.getDefaults(),Object.keys(_e.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(e,n){this._carrier._triggerEnvelopeAttack(e,n),this._modulator._triggerEnvelopeAttack(e,n)}_triggerEnvelopeRelease(e){return this._carrier._triggerEnvelopeRelease(e),this._modulator._triggerEnvelopeRelease(e),this}getLevelAtTime(e){return e=this.toSeconds(e),this.envelope.getValueAtTime(e)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}}class Wf extends _e{constructor(){const e=xe(Wf.getDefaults(),arguments,["frequency","type"]);super(e),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Ye({context:this.context,units:"number",value:e.Q,param:this._filter.Q}),this.frequency=new Ye({context:this.context,units:"frequency",value:e.frequency,param:this._filter.frequency}),this.detune=new Ye({context:this.context,units:"cents",value:e.detune,param:this._filter.detune}),this.gain=new Ye({context:this.context,units:"decibels",convert:!1,value:e.gain,param:this._filter.gain}),this.type=e.type}static getDefaults(){return Object.assign(_e.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(e){ve(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(e)!==-1,`Invalid filter type: ${e}`),this._filter.type=e}getFrequencyResponse(e=128){const n=new Float32Array(e);for(let o=0;o<e;o++){const u=Math.pow(o/e,2)*19980+20;n[o]=u}const r=new Float32Array(e),s=new Float32Array(e),i=this.context.createBiquadFilter();
70return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(n,r,s),r}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}class f1 extends _e{constructor(){const e=xe(f1.getDefaults(),arguments,["frequency","type","rolloff"]);super(e),this.name="Filter",this.input=new nt({context:this.context}),this.output=new nt({context:this.context}),this._filters=[],this._filters=[],this.Q=new ht({context:this.context,units:"positive",value:e.Q}),this.frequency=new ht({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ht({context:this.context,units:"cents",value:e.detune}),this.gain=new ht({context:this.context,units:"decibels",convert:!1,value:e.gain}),this._type=e.type,this.rolloff=e.rolloff,ot(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(_e.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(e){ve(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(e)!==-1,`Invalid filter type: ${e}`),this._type=e,this._filters.forEach(r=>r.type=e)}get rolloff(){return this._rolloff}set rolloff(e){const n=pi(e)?e:parseInt(e,10),r=[-12,-24,-48,-96];let s=r.indexOf(n);ve(s!==-1,`rolloff can only be ${r.join(", ")}`),s+=1,this._rolloff=n,this.input.disconnect(),this._filters.forEach(i=>i.disconnect()),this._filters=new Array(s);for(let i=0;i<s;i++){const o=new Wf({context:this.context});o.type=this._type,this.frequency.connect(o.frequency),this.detune.connect(o.detune),this.Q.connect(o.Q),this.gain.connect(o.gain),this._filters[i]=o}this._internalChannels=this._filters,Lf(this.input,...this._internalChannels,this.output)}getFrequencyResponse(e=128){const n=new Wf({context:this.context,frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),r=new Float32Array(e).map(()=>1);return this._filters.forEach(()=>{n.getFrequencyResponse(e).forEach((i,o)=>r[o]*=i)}),n.dispose(),r}dispose(){return super.dispose(),this._filters.forEach(e=>{e.dispose()}),e1(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class p1 extends Bf{constructor(){const e=xe(p1.getDefaults(),arguments);super(e),this.name="FMSynth",this.modulationIndex=new qu({context:this.context,value:e.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(Bf.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class rm extends pa{constructor(){const e=xe(rm.getDefaults(),arguments);super(e),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=e.pitchDecay,this.octaves=e.octaves,ot(this,["oscillator","envelope"])}static getDefaults(){return ta(gi.getDefaults(),pa.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(e,n){const r=this.toSeconds(n),s=this.toFrequency(e instanceof Hn?e.toFrequency():e),i=s*this.octaves;return this.oscillator.frequency.setValueAtTime(i,r),this.oscillator.frequency.exponentialRampToValueAtTime(s,r+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ys([k$(0)],rm.prototype,"octaves",void 0);ys([Ti(0)],rm.prototype,"pitchDecay",void 0);const $$=new Set;function m1(t){$$.add(t)}function I$(t,e){const n=`registerProcessor("${t}", ${e})`;$$.add(n)}const jH=`
71	/**
72	 * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. 
73	 */
74	class ToneAudioWorkletProcessor extends AudioWorkletProcessor {
75
76		constructor(options) {
77			
78			super(options);
79			/**
80			 * If the processor was disposed or not. Keep alive until it's disposed.
81			 */
82			this.disposed = false;
83		   	/** 
84			 * The number of samples in the processing block
85			 */
86			this.blockSize = 128;
87			/**
88			 * the sample rate
89			 */
90			this.sampleRate = sampleRate;
91
92			this.port.onmessage = (event) => {
93				// when it receives a dispose 
94				if (event.data === "dispose") {
95					this.disposed = true;
96				}
97			};
98		}
99	}
100`;m1(jH);const GH=`
101	/**
102	 * Abstract class for a single input/output processor. 
103	 * has a 'generate' function which processes one sample at a time
104	 */
105	class SingleIOProcessor extends ToneAudioWorkletProcessor {
106
107		constructor(options) {
108			super(Object.assign(options, {
109				numberOfInputs: 1,
110				numberOfOutputs: 1
111			}));
112			/**
113			 * Holds the name of the parameter and a single value of that
114			 * parameter at the current sample
115			 * @type { [name: string]: number }
116			 */
117			this.params = {}
118		}
119
120		/**
121		 * Generate an output sample from the input sample and parameters
122		 * @abstract
123		 * @param input number
124		 * @param channel number
125		 * @param parameters { [name: string]: number }
126		 * @returns number
127		 */
128		generate(){}
129
130		/**
131		 * Update the private params object with the 
132		 * values of the parameters at the given index
133		 * @param parameters { [name: string]: Float32Array },
134		 * @param index number
135		 */
136		updateParams(parameters, index) {
137			for (const paramName in parameters) {
138				const param = parameters[paramName];
139				if (param.length > 1) {
140					this.params[paramName] = parameters[paramName][index];
141				} else {
142					this.params[paramName] = parameters[paramName][0];
143				}
144			}
145		}
146
147		/**
148		 * Process a single frame of the audio
149		 * @param inputs Float32Array[][]
150		 * @param outputs Float32Array[][]
151		 */
152		process(inputs, outputs, parameters) {
153			const input = inputs[0];
154			const output = outputs[0];
155			// get the parameter values
156			const channelCount = Math.max(input && input.length || 0, output.length);
157			for (let sample = 0; sample < this.blockSize; sample++) {
158				this.updateParams(parameters, sample);
159				for (let channel = 0; channel < channelCount; channel++) {
160					const inputSample = input && input.length ? input[channel][sample] : 0;
161					output[channel][sample] = this.generate(inputSample, channel, this.params);
162				}
163			}
164			return !this.disposed;
165		}
166	};
167`;m1(GH);const HH=`
168	/**
169	 * A multichannel buffer for use within an AudioWorkletProcessor as a delay line
170	 */
171	class DelayLine {
172		
173		constructor(size, channels) {
174			this.buffer = [];
175			this.writeHead = []
176			this.size = size;
177
178			// create the empty channels
179			for (let i = 0; i < channels; i++) {
180				this.buffer[i] = new Float32Array(this.size);
181				this.writeHead[i] = 0;
182			}
183		}
184
185		/**
186		 * Push a value onto the end
187		 * @param channel number
188		 * @param value number
189		 */
190		push(channel, value) {
191			this.writeHead[channel] += 1;
192			if (this.writeHead[channel] > this.size) {
193				this.writeHead[channel] = 0;
194			}
195			this.buffer[channel][this.writeHead[channel]] = value;
196		}
197
198		/**
199		 * Get the recorded value of the channel given the delay
200		 * @param channel number
201		 * @param delay number delay samples
202		 */
203		get(channel, delay) {
204			let readHead = this.writeHead[channel] - Math.floor(delay);
205			if (readHead < 0) {
206				readHead += this.size;
207			}
208			return this.buffer[channel][readHead];
209		}
210	}
211`;m1(HH);const qH="feedback-comb-filter",KH=`
212	class FeedbackCombFilterWorklet extends SingleIOProcessor {
213
214		constructor(options) {
215			super(options);
216			this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);
217		}
218
219		static get parameterDescriptors() {
220			return [{
221				name: "delayTime",
222				defaultValue: 0.1,
223				minValue: 0,
224				maxValue: 1,
225				automationRate: "k-rate"
226			}, {
227				name: "feedback",
228				defaultValue: 0.5,
229				minValue: 0,
230				maxValue: 0.9999,
231				automationRate: "k-rate"
232			}];
233		}
234
235		generate(input, channel, parameters) {
236			const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);
237			this.delayLine.push(channel, input + delayedSample * parameters.feedback);
238			return delayedSample;
239		}
240	}
241`;I$(qH,KH);class g1 extends co{constructor(){const e=xe(g1.getDefaults(),arguments,["voice","options"]);
vendor: 9,503 bytes, lines 241-260
241super(e),this.name="PolySynth",this._availableVoices=[],this._activeVoices=[],this._voices=[],this._gcTimeout=-1,this._averageActiveVoices=0,this._syncedRelease=s=>this.releaseAll(s),ve(!pi(e.voice),"DEPRECATED: The polyphony count is no longer the first argument.");const n=e.voice.getDefaults();this.options=Object.assign(n,e.options),this.voice=e.voice,this.maxPolyphony=e.maxPolyphony,this._dummyVoice=this._getNextAvailableVoice();const r=this._voices.indexOf(this._dummyVoice);this._voices.splice(r,1),this._gcTimeout=this.context.setInterval(this._collectGarbage.bind(this),1)}static getDefaults(){return Object.assign(co.getDefaults(),{maxPolyphony:32,options:{},voice:pa})}get activeVoices(){return this._activeVoices.length}_makeVoiceAvailable(e){this._availableVoices.push(e);const n=this._activeVoices.findIndex(r=>r.voice===e);this._activeVoices.splice(n,1)}_getNextAvailableVoice(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.length<this.maxPolyphony){const e=new this.voice(Object.assign(this.options,{context:this.context,onsilence:this._makeVoiceAvailable.bind(this)}));return ve(e instanceof gi,"Voice must extend Monophonic class"),e.connect(this.output),this._voices.push(e),e}else Gp("Max polyphony exceeded. Note dropped.")}_collectGarbage(){if(this._averageActiveVoices=Math.max(this._averageActiveVoices*.95,this.activeVoices),this._availableVoices.length&&this._voices.length>Math.ceil(this._averageActiveVoices+1)){const e=this._availableVoices.shift(),n=this._voices.indexOf(e);this._voices.splice(n,1),this.context.isOffline||e.dispose()}}_triggerAttack(e,n,r){e.forEach(s=>{const i=new Mf(this.context,s).toMidi(),o=this._getNextAvailableVoice();o&&(o.triggerAttack(s,n,r),this._activeVoices.push({midi:i,voice:o,released:!1}),this.log("triggerAttack",s,n))})}_triggerRelease(e,n){e.forEach(r=>{const s=new Mf(this.context,r).toMidi(),i=this._activeVoices.find(({midi:o,released:a})=>o===s&&!a);i&&(i.voice.triggerRelease(n),i.released=!0,this.log("triggerRelease",r,n))})}_scheduleEvent(e,n,r,s){ve(!this.disposed,"Synth was already disposed"),r<=this.now()?e==="attack"?this._triggerAttack(n,r,s):this._triggerRelease(n,r):this.context.setTimeout(()=>{this.disposed||this._scheduleEvent(e,n,r,s)},r-this.now())}triggerAttack(e,n,r){Array.isArray(e)||(e=[e]);const s=this.toSeconds(n);return this._scheduleEvent("attack",e,s,r),this}triggerRelease(e,n){Array.isArray(e)||(e=[e]);const r=this.toSeconds(n);return this._scheduleEvent("release",e,r),this}triggerAttackRelease(e,n,r,s){const i=this.toSeconds(r);if(this.triggerAttack(e,i,s),lr(n)){ve(lr(e),"If the duration is an array, the notes must also be an array"),e=e;for(let o=0;o<e.length;o++){const a=n[Math.min(o,n.length-1)],u=this.toSeconds(a);ve(u>0,"The duration must be greater than 0"),this.triggerRelease(e[o],i+u)}}else{const o=this.toSeconds(n);ve(o>0,"The duration must be greater than 0"),this.triggerRelease(e,i+o)}return this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}set(e){const n=Go(e,["onsilence","context"]);return this.options=ta(this.options,n),this._voices.forEach(r=>r.set(n)),this._dummyVoice.set(n),this}get(){return this._dummyVoice.get()}releaseAll(e){const n=this.toSeconds(e);return this._activeVoices.forEach(({voice:r})=>{r.triggerRelease(n)}),this}dispose(){return super.dispose(),this._dummyVoice.dispose(),this._voices.forEach(e=>e.dispose()),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}}class sm extends co{constructor(){const e=xe(sm.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(e),this.name="Sampler",this._activeSources=new Map;const n={};Object.keys(e.urls).forEach(r=>{const s=parseInt(r,10);if(ve(hd(r)||pi(s)&&isFinite(s),`url key is neither a note or midi pitch: ${r}`),hd(r)){const i=new Hn(this.context,r).toMidi();n[i]=e.urls[r]}else pi(s)&&isFinite(s)&&(n[s]=e.urls[s])}),this._buffers=new l1({urls:n,onload:e.onload,baseUrl:e.baseUrl,onerror:e.onerror}),this.attack=e.attack,this.release=e.release,this.curve=e.curve,this._buffers.loaded&&Promise.resolve().then(e.onload)}static getDefaults(){return Object.assign(co.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:je,onerror:je,release:.1,urls:{}})}_findClosest(e){let r=0;for(;r<96;){if(this._buffers.has(e+r))return-r;if(this._buffers.has(e-r))return r;r++}throw new Error(`No available buffers for note: ${e}`)}triggerAttack(e,n,r=1){return this.log("triggerAttack",e,n,r),Array.isArray(e)||(e=[e]),e.forEach(s=>{const i=T$(new Hn(this.context,s).toFrequency()),o=Math.round(i),a=i-o,u=this._findClosest(o),l=o-u,c=this._buffers.get(l),h=S$(u+a),d=new gh({url:c,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:h}).connect(this.output);d.start(n,0,c.duration/h,r),lr(this._activeSources.get(o))||this._activeSources.set(o,[]),this._activeSources.get(o).push(d),d.onended=()=>{if(this._activeSources&&this._activeSources.has(o)){const f=this._activeSources.get(o),p=f.indexOf(d);p!==-1&&f.splice(p,1)}}}),this}triggerRelease(e,n){return this.log("triggerRelease",e,n),Array.isArray(e)||(e=[e]),e.forEach(r=>{const s=new Hn(this.context,r).toMidi();if(this._activeSources.has(s)&&this._activeSources.get(s).length){const i=this._activeSources.get(s);n=this.toSeconds(n),i.forEach(o=>{o.stop(n)}),this._activeSources.set(s,[])}}),this}releaseAll(e){const n=this.toSeconds(e);return this._activeSources.forEach(r=>{for(;r.length;)r.shift().stop(n)}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(e,n,r,s=1){const i=this.toSeconds(r);return this.triggerAttack(e,i,s),lr(n)?(ve(lr(e),"notes must be an array when duration is array"),e.forEach((o,a)=>{const u=n[Math.min(a,n.length-1)];this.triggerRelease(o,i+this.toSeconds(u))})):this.triggerRelease(e,i+this.toSeconds(n)),this}add(e,n,r){if(ve(hd(e)||isFinite(e),`note must be a pitch or midi: ${e}`),hd(e)){const s=new Hn(this.context,e).toMidi();this._buffers.add(s,n,r)}else this._buffers.add(e,n,r);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(e=>{e.forEach(n=>n.dispose())}),this._activeSources.clear(),this}}ys([Ti(0)],sm.prototype,"attack",void 0);ys([Ti(0)],sm.prototype,"release",void 0);class y1 extends _e{constructor(){const e=xe(y1.getDefaults(),arguments,["fade"]);super(e),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new zH({context:this.context}),this.a=new nt({context:this.context,gain:0}),this.b=new nt({context:this.context,gain:0}),this.output=new nt({context:this.context}),this._internalChannels=[this.a,this.b],this.fade=new ht({context:this.context,units:"normalRange",value:e.fade}),ot(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",uo(this._split,this.a.gain,0),uo(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(_e.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}class tT extends _e{constructor(e){super(e),this.name="Effect",this._dryWet=new y1({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new nt({context:this.context}),this.effectReturn=new nt({context:this.context}),this.input=new nt({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(e.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],ot(this,"wet")}static getDefaults(){return Object.assign(_e.getDefaults(),{wet:1})}connectEffect(e){return this._internalChannels.push(e),this.effectSend.chain(e,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}}class v1 extends _e{constructor(){const e=xe(v1.getDefaults(),arguments,["pan"]);super(e),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new Ye({context:this.context,param:this._panner.pan,value:e.pan,minValue:-1,maxValue:1}),this._panner.channelCount=e.channelCount,this._panner.channelCountMode="explicit",ot(this,"pan")}static getDefaults(){return Object.assign(_e.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const XH="bit-crusher",YH=`
242	class BitCrusherWorklet extends SingleIOProcessor {
243
244		static get parameterDescriptors() {
245			return [{
246				name: "bits",
247				defaultValue: 12,
248				minValue: 1,
249				maxValue: 16,
250				automationRate: 'k-rate'
251			}];
252		}
253
254		generate(input, _channel, parameters) {
255			const step = Math.pow(0.5, parameters.bits - 1);
256			const val = step * Math.floor(input / step + 0.5);
257			return val;
258		}
259	}
260`;I$(XH,YH);
260class x1 extends _e{constructor(){const e=xe(x1.getDefaults(),arguments,["channels"]);super(e),this.name="Merge",this._merger=this.output=this.input=this.context.createChannelMerger(e.channels)}static getDefaults(){return Object.assign(_e.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}class w1 extends tT{constructor(){const e=xe(w1.getDefaults(),arguments,["decay"]);super(e),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const n=this.toSeconds(e.decay);Ir(n,.001),this._decay=n;const r=this.toSeconds(e.preDelay);Ir(r,0),this._preDelay=r,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(tT.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(e){e=this.toSeconds(e),Ir(e,.001),this._decay=e,this.generate()}get preDelay(){return this._preDelay}set preDelay(e){e=this.toSeconds(e),Ir(e,0),this._preDelay=e,this.generate()}generate(){return Ot(this,void 0,void 0,function*(){const e=this.ready,n=new Kp(2,this._decay+this._preDelay,this.context.sampleRate),r=new Vf({context:n}),s=new Vf({context:n}),i=new x1({context:n});r.connect(i,0,0),s.connect(i,0,1);const o=new nt({context:n}).toDestination();i.connect(o),r.start(0),s.start(0),o.gain.setValueAtTime(0,0),o.gain.setValueAtTime(1,this._preDelay),o.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const a=n.render();return this.ready=a.then(je),yield e,this._convolver.buffer=(yield a).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}}class Pt extends _e{constructor(){const e=xe(Pt.getDefaults(),arguments,["solo"]);super(e),this.name="Solo",this.input=this.output=new nt({context:this.context}),Pt._allSolos.has(this.context)||Pt._allSolos.set(this.context,new Set),Pt._allSolos.get(this.context).add(this),this.solo=e.solo}static getDefaults(){return Object.assign(_e.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(e){e?this._addSolo():this._removeSolo(),Pt._allSolos.get(this.context).forEach(n=>n._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){Pt._soloed.has(this.context)||Pt._soloed.set(this.context,new Set),Pt._soloed.get(this.context).add(this)}_removeSolo(){Pt._soloed.has(this.context)&&Pt._soloed.get(this.context).delete(this)}_isSoloed(){return Pt._soloed.has(this.context)&&Pt._soloed.get(this.context).has(this)}_noSolos(){return!Pt._soloed.has(this.context)||Pt._soloed.has(this.context)&&Pt._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Pt._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Pt._allSolos=new Map;Pt._soloed=new Map;class b1 extends _e{constructor(){const e=xe(b1.getDefaults(),arguments,["pan","volume"]);super(e),this.name="PanVol",this._panner=this.input=new v1({context:this.context,pan:e.pan,channelCount:e.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new dl({context:this.context,volume:e.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=e.mute,ot(this,["pan","volume"])}static getDefaults(){return Object.assign(_e.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class xu extends _e{constructor(){const e=xe(xu.getDefaults(),arguments,["volume","pan"]);super(e),this.name="Channel",this._solo=this.input=new Pt({solo:e.solo,context:this.context}),this._panVol=this.output=new b1({context:this.context,pan:e.pan,volume:e.volume,mute:e.mute,channelCount:e.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),ot(this,["pan","volume"])}static getDefaults(){return Object.assign(_e.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(e){this._solo.solo=e}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(e){this._panVol.mute=e}_getBus(e){return xu.buses.has(e)||xu.buses.set(e,new nt({context:this.context})),xu.buses.get(e)}send(e,n=0){const r=this._getBus(e),s=new nt({context:this.context,units:"decibels",gain:n});return this.connect(s),s.connect(r),s}receive(e){return this._getBus(e).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}xu.buses=new Map;function QH(){return or().now()}or().transport;or().destination;or().destination;or().listener;or().draw;or();const nT=(t,e,n)=>Math.max(Math.min(t,n),e),rT=(t,e,n,r,s,i)=>{const o=(t-e)/(n-e)*(s-r)+r;return r<s?nT(o,r,s):nT(o,s,r)};var ZH={};(function(){var t;function e(m){var b=0;return function(){return b<m.length?{done:!1,value:m[b++]}:{done:!0}}}var n=typeof Object.defineProperties=="function"?Object.defineProperty:function(m,b,C){return m==Array.prototype||m==Object.prototype||(m[b]=C.value),m};function r(m){m=[typeof globalThis=="object"&&globalThis,m,typeof window=="object"&&window,typeof self=="object"&&self,typeof Rs=="object"&&Rs];for(var b=0;b<m.length;++b){var C=m[b];if(C&&C.Math==Math)return C}throw Error("Cannot find global object")}var s=r(this);function i(m,b){if(b)e:{var C=s;m=m.split(".");for(var $=0;$<m.length-1;$++){var D=m[$];if(!(D in C))break e;C=C[D]}m=m[m.length-1],$=C[m],b=b($),b!=$&&b!=null&&n(C,m,{configurable:!0,writable:!0,value:b})}}
vendor: 5,706 bytes, line 260
260i("Symbol",function(m){function b(F){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new C($+(F||"")+"_"+D++,F)}function C(F,P){this.h=F,n(this,"description",{configurable:!0,writable:!0,value:P})}if(m)return m;C.prototype.toString=function(){return this.h};var $="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",D=0;return b}),i("Symbol.iterator",function(m){if(m)return m;m=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),C=0;C<b.length;C++){var $=s[b[C]];typeof $=="function"&&typeof $.prototype[m]!="function"&&n($.prototype,m,{configurable:!0,writable:!0,value:function(){return o(e(this))}})}return m});function o(m){return m={next:m},m[Symbol.iterator]=function(){return this},m}function a(m){var b=typeof Symbol<"u"&&Symbol.iterator&&m[Symbol.iterator];return b?b.call(m):{next:e(m)}}function u(m){if(!(m instanceof Array)){m=a(m);for(var b,C=[];!(b=m.next()).done;)C.push(b.value);m=C}return m}var l=typeof Object.assign=="function"?Object.assign:function(m,b){for(var C=1;C<arguments.length;C++){var $=arguments[C];if($)for(var D in $)Object.prototype.hasOwnProperty.call($,D)&&(m[D]=$[D])}return m};i("Object.assign",function(m){return m||l});var c=typeof Object.create=="function"?Object.create:function(m){function b(){}return b.prototype=m,new b},h;if(typeof Object.setPrototypeOf=="function")h=Object.setPrototypeOf;else{var d;e:{var f={a:!0},p={};try{p.__proto__=f,d=p.a;break e}catch{}d=!1}h=d?function(m,b){if(m.__proto__=b,m.__proto__!==b)throw new TypeError(m+" is not extensible");return m}:null}var y=h;function v(m,b){if(m.prototype=c(b.prototype),m.prototype.constructor=m,y)y(m,b);else for(var C in b)if(C!="prototype")if(Object.defineProperties){var $=Object.getOwnPropertyDescriptor(b,C);$&&Object.defineProperty(m,C,$)}else m[C]=b[C];m.ya=b.prototype}function g(){this.m=!1,this.j=null,this.i=void 0,this.h=1,this.v=this.s=0,this.l=null}function x(m){if(m.m)throw new TypeError("Generator is already running");m.m=!0}g.prototype.u=function(m){this.i=m};function w(m,b){m.l={ma:b,na:!0},m.h=m.s||m.v}g.prototype.return=function(m){this.l={return:m},this.h=this.v};function _(m,b,C){return m.h=C,{value:b}}function T(m){this.h=new g,this.i=m}function E(m,b){x(m.h);var C=m.h.j;return C?k(m,"return"in C?C.return:function($){return{value:$,done:!0}},b,m.h.return):(m.h.return(b),N(m))}function k(m,b,C,$){try{var D=b.call(m.h.j,C);if(!(D instanceof Object))throw new TypeError("Iterator result "+D+" is not an object");if(!D.done)return m.h.m=!1,D;var F=D.value}catch(P){return m.h.j=null,w(m.h,P),N(m)}return m.h.j=null,$.call(m.h,F),N(m)}function N(m){for(;m.h.h;)try{var b=m.i(m.h);if(b)return m.h.m=!1,{value:b.value,done:!1}}catch(C){m.h.i=void 0,w(m.h,C)}if(m.h.m=!1,m.h.l){if(b=m.h.l,m.h.l=null,b.na)throw b.ma;return{value:b.return,done:!0}}return{value:void 0,done:!0}}function O(m){this.next=function(b){return x(m.h),m.h.j?b=k(m,m.h.j.next,b,m.h.u):(m.h.u(b),b=N(m)),b},this.throw=function(b){return x(m.h),m.h.j?b=k(m,m.h.j.throw,b,m.h.u):(w(m.h,b),b=N(m)),b},this.return=function(b){return E(m,b)},this[Symbol.iterator]=function(){return this}}function R(m){function b($){return m.next($)}function C($){return m.throw($)}return new Promise(function($,D){function F(P){P.done?$(P.value):Promise.resolve(P.value).then(b,C).then(F,D)}F(m.next())})}function L(m){return R(new O(new T(m)))}i("Promise",function(m){function b(P){this.i=0,this.j=void 0,this.h=[],this.u=!1;var B=this.l();try{P(B.resolve,B.reject)}catch(z){B.reject(z)}}function C(){this.h=null}function $(P){return P instanceof b?P:new b(function(B){B(P)})}if(m)return m;C.prototype.i=function(P){if(this.h==null){this.h=[];var B=this;this.j(function(){B.m()})}this.h.push(P)};var D=s.setTimeout;C.prototype.j=function(P){D(P,0)},C.prototype.m=function(){for(;this.h&&this.h.length;){var P=this.h;this.h=[];for(var B=0;B<P.length;++B){var z=P[B];P[B]=null;try{z()}catch(J){this.l(J)}}}this.h=null},C.prototype.l=function(P){this.j(function(){throw P})},b.prototype.l=function(){function P(J){return function(ie){z||(z=!0,J.call(B,ie))}}var B=this,z=!1;return{resolve:P(this.I),reject:P(this.m)}},b.prototype.I=function(P){if(P===this)this.m(new TypeError("A Promise cannot resolve to itself"));else if(P instanceof b)this.L(P);else{e:switch(typeof P){case"object":var B=P!=null;break e;case"function":B=!0;break e;default:B=!1}B?this.F(P):this.s(P)}},b.prototype.F=function(P){var B=void 0;try{B=P.then}catch(z){this.m(z);return}typeof B=="function"?this.M(B,P):this.s(P)},b.prototype.m=function(P){this.v(2,P)},b.prototype.s=function(P){this.v(1,P)},b.prototype.v=function(P,B){if(this.i!=0)throw Error("Cannot settle("+P+", "+B+"): Promise already settled in state"+this.i);this.i=P,this.j=B,this.i===2&&this.K(),this.H()},b.prototype.K=function(){var P=this;D(function(){if(P.D()){var B=s.console;typeof B<"u"&&B.error(P.j)}},1)},b.prototype.D=function(){if(this.u)return!1;var P=s.CustomEvent,B=s.Event,z=s.dispatchEvent;return typeof z>"u"?!0:(typeof P=="function"?P=new P("unhandledrejection",{cancelable:!0}):typeof B=="function"?P=new B("unhandledrejection",{cancelable:!0}):(P=s.document.createEvent("CustomEvent"),P.initCustomEvent("unhandledrejection",!1,!0,P)),P.promise=this,P.reason=this.j,z(P))},b.prototype.H=function(){if(this.h!=null){for(var P=0;P<this.h.length;++P)F.i(this.h[P]);this.h=null}};var F=new C;return b.prototype.L=function(P){var B=this.l();P.T(B.resolve,B.reject)},b.prototype.M=function(P,B){var z=this.l();try{P.call(B,z.resolve,z.reject)}catch(J){z.reject(J)}},b.prototype.then=function(P,B){function z(pe,le){return typeof pe
260=="function"?function(Te){try{J(pe(Te))}catch(ke){ie(ke)}}:le}var J,ie,Se=new b(function(pe,le){J=pe,ie=le});return this.T(z(P,J),z(B,ie)),Se},b.prototype.catch=function(P){return this.then(void 0,P)},b.prototype.T=function(P,B){function z(){switch(J.i){case 1:P(J.j);break;case 2:B(J.j);break;default:throw Error("Unexpected state: "+J.i)}}var J=this;this.h==null?F.i(z):this.h.push(z),this.u=!0},b.resolve=$,b.reject=function(P){return new b(function(B,z){z(P)})},b.race=function(P){return new b(function(B,z){for(var J=a(P),ie=J.next();!ie.done;ie=J.next())$(ie.value).T(B,z)})},b.all=function(P){var B=a(P),z=B.next();return z.done?$([]):new b(function(J,ie){function Se(Te){return function(ke){pe[Te]=ke,le--,le==0&&J(pe)}}var pe=[],le=0;do pe.push(void 0),le++,$(z.value).T(Se(pe.length-1),ie),z=B.next();while(!z.done)})},b});function W(m,b){m instanceof String&&(m+="");var C=0,$=!1,D={next:function(){if(!$&&C<m.length){var F=C++;return{value:b(F,m[F]),done:!1}}return $=!0,{done:!0,value:void 0}}};return D[Symbol.iterator]=function(){return D},D}i("Array.prototype.keys",function(m){return m||function(){return W(this,function(b){return b})}}),i("Array.prototype.fill",function(m){return m||function(b,C,$){var D=this.length||0;for(0>C&&(C=Math.max(0,D+C)),($==null||$>D)&&($=D),$=Number($),0>$&&($=Math.max(0,D+$)),C=Number(C||0);C<$;C++)this[C]=b;return this}});function G(m){return m||Array.prototype.fill}i("Int8Array.prototype.fill",G),i("Uint8Array.prototype.fill",G),i("Uint8ClampedArray.prototype.fill",G),i("Int16Array.prototype.fill",G),i("Uint16Array.prototype.fill",G),i("Int32Array.prototype.fill",G),i("Uint32Array.prototype.fill",G),i("Float32Array.prototype.fill",G),i("Float64Array.prototype.fill",G),i("Object.is",function(m){return m||function(b,C){return b===C?b!==0||1/b===1/C:b!==b&&C!==C}}),i("Array.prototype.includes",function(m){return m||function(b,C){var $=this;$ instanceof String&&($=String($));var D=$.length;for(C=C||0,0>C&&(C=Math.max(C+D,0));C<D;C++){var F=$[C];if(F===b||Object.is(F,b))return!0}return!1}}),i("String.prototype.includes",function(m){return m||function(b,C){if(this==null)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return this.indexOf(b,C||0)!==-1}});var H=this||self;function X(m,b){m=m.split(".");var C=H;m[0]in C||typeof C.execScript>"u"||C.execScript("var "+m[0]);for(var $;m.length&&($=m.shift());)m.length||b===void 0?C[$]&&C[$]!==Object.prototype[$]?C=C[$]:C=C[$]={}:C[$]=b}function Q(m){var b;e:{if((b=H.navigator)&&(b=b.userAgent))break e;b=""}return b.indexOf(m)!=-1}var Y=Array.prototype.map?function(m,b){return Array.prototype.map.call(m,b,void 0)}:function(m,b){for(var C=m.length,$=Array(C),D=typeof m=="string"?m.split(""):m,F=0;F<C;F++)F in D&&($[F]=b.call(void 0,D[F],F,m));return $},j={},q=null;function Z(m){var b=m.length,C=3*b/4;C%3?C=Math.floor(C):"=.".indexOf(m[b-1])!=-1&&(C="=.".indexOf(m[b-2])!=-1?C-2:C-1);var $=new Uint8Array(C),D=0;return ae(m,function(F){$[D++]=F}),D!==C?$.subarray(0,D):$}function ae(m,b){function C(z){for(;$<m.length;){var J=m.charAt($++),ie=q[J];if(ie!=null)return ie;if(!/^[\s\xa0]*$/.test(J))throw Error("Unknown base64 encoding at char: "+J)}return z}fe();for(var $=0;;){var D=C(-1),F=C(0),P=C(64),B=C(64);if(B===64&&D===-1)break;b(D<<2|F>>4),P!=64&&(b(F<<4&240|P>>2),B!=64&&b(P<<6&192|B))}}function fe(){if(!q){q={};for(var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],C=0;5>C;C++){var $=m.concat(b[C].split(""));j[C]=$;for(var D=0;D<$.length;D++){var F=$[D];q[F]===void 0&&(q[F]=D)}}}}var We=typeof Uint8Array<"u",Ue=!(Q("Trident")||Q("MSIE"))&&typeof H.btoa=="function";function we(m){if(!Ue){var b;b===void 0&&(b=0),fe(),b=j[b];for(var C=Array(Math.floor(m.length/3)),$=b[64]||"",D=0,F=0;D<m.length-2;D+=3){var P=m[D],B=m[D+1],z=m[D+2],J=b[P>>2];P=b[(P&3)<<4|B>>4],B=b[(B&15)<<2|z>>6],z=b[z&63],C[F++]=J+P+B+z}switch(J=0,z=$,m.length-D){case 2:J=m[D+1],z=b[(J&15)<<2]||$;case 1:m=m[D],C[F]=b[m>>2]+b[(m&3)<<4|J>>4]+z+$}return C.join("")}for(b="";10240<m.length;)b+=String.fromCharCode.apply(null,m.subarray(0,10240)),m=m.subarray(10240);return b+=String.fromCharCode.apply(null,m),btoa(b)}var Ie=RegExp("[-_.]","g");function Ct(m){switch(m){case"-":return"+";case"_":return"/";case".":return"=";default:return""}}function me(m){if(!Ue)return Z(m);Ie.test(m)&&(m=m.replace(Ie,Ct)),m=atob(m);for(var b=new Uint8Array(m.length),C=0;C<m.length;C++)b[C]=m.charCodeAt(C);return b}var bs;function Gr(){return bs||(bs=new Uint8Array(0))}var xr={},ki=typeof Uint8Array.prototype.slice=="function",It=0,nn=0;function ce(m){var b=0>m;m=Math.abs(m);var C=m>>>0;m=Math.floor((m-C)/4294967296),b&&(C=a(Nt(C,m)),b=C.next().value,m=C.next().value,C=b),It=C>>>0,nn=m>>>0}var be=typeof BigInt=="function";function Nt(m,b){return b=~b,m?m=~m+1:b+=1,[m,b]}function Ze(m,b){this.i=m>>>0,this.h=b>>>0}function Fe(m){if(!m)return at||(at=new Ze(0,0));if(!/^-?\d+$/.test(m))return null;if(16>m.length)ce(Number(m));else if(be)m=BigInt(m),It=Number(m&BigInt(4294967295))>>>0,nn=Number(m>>BigInt(32)&BigInt(4294967295));else{var b=+(m[0]==="-");nn=It=0;for(var C=m.length,$=b,D=(C-b)%6+b;D<=C;$=D,D+=6)$=Number(m.slice($,D)),nn*=1e6,It=1e6*It+$,4294967296<=It&&(nn+=It/4294967296|0,It%=4294967296);b&&(b=a(Nt(It,nn)),m=b.next().value,b=b.next().value,It=m,nn=b)}return new Ze(It,nn)}var at;function En(m,b){return Error("Invalid wire type: "+m+" (at position "+b+")")}function wr(){return Error("Failed to read varint, encoding is invali
260d.")}function $i(m,b){return Error("Tried to read past the end of the data "+b+" > "+m)}function Hr(){throw Error("Invalid UTF8")}function $h(m,b){return b=String.fromCharCode.apply(null,b),m==null?b:m+b}var Ua=void 0,Em,iF=typeof TextDecoder<"u",yw,oF=typeof TextEncoder<"u",vw;function xw(m){if(m!==xr)throw Error("illegal external caller")}function Nl(m,b){if(xw(b),this.V=m,m!=null&&m.length===0)throw Error("ByteString should be constructed with non-empty values")}function km(){return vw||(vw=new Nl(null,xr))}function ww(m){xw(xr);var b=m.V;return b=b==null||We&&b!=null&&b instanceof Uint8Array?b:typeof b=="string"?me(b):null,b==null?b:m.V=b}function aF(m){if(typeof m=="string")return{buffer:me(m),C:!1};if(Array.isArray(m))return{buffer:new Uint8Array(m),C:!1};if(m.constructor===Uint8Array)return{buffer:m,C:!1};if(m.constructor===ArrayBuffer)return{buffer:new Uint8Array(m),C:!1};if(m.constructor===Nl)return{buffer:ww(m)||Gr(),C:!0};if(m instanceof Uint8Array)return{buffer:new Uint8Array(m.buffer,m.byteOffset,m.byteLength),C:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function bw(m,b){this.i=null,this.m=!1,this.h=this.j=this.l=0,$m(this,m,b)}function $m(m,b,C){C=C===void 0?{}:C,m.S=C.S===void 0?!1:C.S,b&&(b=aF(b),m.i=b.buffer,m.m=b.C,m.l=0,m.j=m.i.length,m.h=m.l)}bw.prototype.reset=function(){this.h=this.l};function No(m,b){if(m.h=b,b>m.j)throw $i(m.j,b)}function El(m){var b=m.i,C=m.h,$=b[C++],D=$&127;if($&128&&($=b[C++],D|=($&127)<<7,$&128&&($=b[C++],D|=($&127)<<14,$&128&&($=b[C++],D|=($&127)<<21,$&128&&($=b[C++],D|=$<<28,$&128&&b[C++]&128&&b[C++]&128&&b[C++]&128&&b[C++]&128&&b[C++]&128)))))throw wr();return No(m,C),D}function _w(m,b){if(0>b)throw Error("Tried to read a negative byte length: "+b);var C=m.h,$=C+b;if($>m.j)throw $i(b,m.j-C);return m.h=$,C}var Sw=[];function Im(){this.h=[]}Im.prototype.length=function(){return this.h.length},Im.prototype.end=function(){var m=this.h;return this.h=[],m};function Tw(m,b,C){for(;0<C||127<b;)m.h.push(b&127|128),b=(b>>>7|C<<25)>>>0,C>>>=7;m.h.push(b)}function Eo(m,b){for(;127<b;)m.h.push(b&127|128),b>>>=7;m.h.push(b)}function Am(m,b){if(Sw.length){var C=Sw.pop();$m(C,m,b),m=C}else m=new bw(m,b);this.h=m,this.j=this.h.h,this.i=this.l=-1,this.setOptions(b)}Am.prototype.setOptions=function(m){m=m===void 0?{}:m,this.ca=m.ca===void 0?!1:m.ca},Am.prototype.reset=function(){this.h.reset(),this.j=this.h.h,this.i=this.l=-1};function Cw(m){var b=m.h;if(b.h==b.j)return!1;m.j=m.h.h;var C=El(m.h)>>>0;if(b=C>>>3,C&=7,!(0<=C&&5>=C))throw En(C,m.j);if(1>b)throw Error("Invalid field number: "+b+" (at position "+m.j+")");return m.l=b,m.i=C,!0}function Ih(m){switch(m.i){case 0:if(m.i!=0)Ih(m);else e:{m=m.h;for(var b=m.h,C=b+10,$=m.i;b<C;)if(!($[b++]&128)){No(m,b);break e}throw wr()}break;case 1:m=m.h,No(m,m.h+8);break;case 2:m.i!=2?Ih(m):(b=El(m.h)>>>0,m=m.h,No(m,m.h+b));break;case 5:m=m.h,No(m,m.h+4);break;case 3:b=m.l;do{if(!Cw(m))throw Error("Unmatched start-group tag: stream EOF");if(m.i==4){if(m.l!=b)throw Error("Unmatched end-group tag");break}Ih(m)}while(!0);break;default:throw En(m.i,m.j)}}var Ah=[];function uF(){this.j=[],this.i=0,this.h=new Im}function za(m,b){b.length!==0&&(m.j.push(b),m.i+=b.length)}function lF(m,b){if(b=b.R){za(m,m.h.end());for(var C=0;C<b.length;C++)za(m,ww(b[C])||Gr())}}var Ks=typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():void 0;function ko(m,b){return Ks?m[Ks]|=b:m.A!==void 0?m.A|=b:(Object.defineProperties(m,{A:{value:b,configurable:!0,writable:!0,enumerable:!1}}),b)}function Nw(m,b){Ks?m[Ks]&&(m[Ks]&=~b):m.A!==void 0&&(m.A&=~b)}function At(m){var b;return Ks?b=m[Ks]:b=m.A,b??0}function _s(m,b){Ks?m[Ks]=b:m.A!==void 0?m.A=b:Object.defineProperties(m,{A:{value:b,configurable:!0,writable:!0,enumerable:!1}})}function Rm(m){return ko(m,1),m}function cF(m,b){_s(b,(m|0)&-51)}function Rh(m,b){_s(b,(m|18)&-41)}var Om={};function Oh(m){return m!==null&&typeof m=="object"&&!Array.isArray(m)&&m.constructor===Object}var kl,Ew=[];_s(Ew,23),kl=Object.freeze(Ew);function Dm(m){if(At(m.o)&2)throw Error("Cannot mutate an immutable Message")}function Pm(m){var b=m.length;(b=b?m[b-1]:void 0)&&Oh(b)?b.g=1:(b={},m.push((b.g=1,b)))}function kw(m){var b=m.i+m.G;return m.B||(m.B=m.o[b]={})}function qr(m,b){return b===-1?null:b>=m.i?m.B?m.B[b]:void 0:m.o[b+m.G]}function Ss(m,b,C,$){Dm(m),$l(m,b,C,$)}function $l(m,b,C,$){m.j&&(m.j=void 0),b>=m.i||$?kw(m)[b]=C:(m.o[b+m.G]=C,(m=m.B)&&b in m&&delete m[b])}function Fm(m,b,C,$){var D=qr(m,b);Array.isArray(D)||(D=kl);var F=At(D);if(F&1||Rm(D),$)F&2||ko(D,2),C&1||Object.freeze(D);else{$=!(C&2);var P=F&2;C&1||!P?$&&F&16&&!P&&Nw(D,16):(D=Rm(Array.prototype.slice.call(D)),$l(m,b,D))}return D}
260function Lm(m,b){var C=qr(m,b),$=C==null?C:typeof C=="number"||C==="NaN"||C==="Infinity"||C==="-Infinity"?Number(C):void 0;return $!=null&&$!==C&&$l(m,b,$),$}function $w(m,b,C,$,D){m.h||(m.h={});var F=m.h[C],P=Fm(m,C,3,D);if(!F){var B=P;F=[];var z=!!(At(m.o)&16);P=!!(At(B)&2);var J=B;!D&&P&&(B=Array.prototype.slice.call(B));for(var ie=P,Se=0;Se<B.length;Se++){var pe=B[Se],le=b,Te=!1;if(Te=Te===void 0?!1:Te,pe=Array.isArray(pe)?new le(pe):Te?new le:void 0,pe!==void 0){le=pe.o;var ke=Te=At(le);P&&(ke|=2),z&&(ke|=16),ke!=Te&&_s(le,ke),le=ke,ie=ie||!!(2&le),F.push(pe)}}return m.h[C]=F,z=At(B),b=z|33,b=ie?b&-9:b|8,z!=b&&(ie=B,Object.isFrozen(ie)&&(ie=Array.prototype.slice.call(ie)),_s(ie,b),B=ie),J!==B&&$l(m,C,B),(D||$&&P)&&ko(F,2),$&&Object.freeze(F),F}return D||(D=Object.isFrozen(F),$&&!D?Object.freeze(F):!$&&D&&(F=Array.prototype.slice.call(F),m.h[C]=F)),F}function Dh(m,b,C){var $=!!(At(m.o)&2);if(b=$w(m,b,C,$,$),m=Fm(m,C,3,$),!($||At(m)&8)){for($=0;$<b.length;$++){if(C=b[$],At(C.o)&2){var D=Pw(C,!1);D.j=C}else D=C;C!==D&&(b[$]=D,m[$]=D.o)}ko(m,8)}return b}function Ts(m,b,C){if(C!=null&&typeof C!="number")throw Error("Value of float/double field must be a number|null|undefined, found "+typeof C+": "+C);Ss(m,b,C)}function Iw(m,b,C,$,D){Dm(m);var F=$w(m,C,b,!1,!1);return C=$??new C,m=Fm(m,b,2,!1),D!=null?(F.splice(D,0,C),m.splice(D,0,C.o)):(F.push(C),m.push(C.o)),C.C()&&Nw(m,8),C}function Ph(m,b){return m??b}function Cs(m,b,C){return C=C===void 0?0:C,Ph(Lm(m,b),C)}var Fh;function hF(m){switch(typeof m){case"number":return isFinite(m)?m:String(m);case"object":if(m)if(Array.isArray(m)){if(At(m)&128)return m=Array.prototype.slice.call(m),Pm(m),m}else{if(We&&m!=null&&m instanceof Uint8Array)return we(m);if(m instanceof Nl){var b=m.V;return b==null?"":typeof b=="string"?b:m.V=we(b)}}}return m}function Aw(m,b,C,$){if(m!=null){if(Array.isArray(m))m=Mm(m,b,C,$!==void 0);else if(Oh(m)){var D={},F;for(F in m)D[F]=Aw(m[F],b,C,$);m=D}else m=b(m,$);return m}}function Mm(m,b,C,$){var D=At(m);$=$?!!(D&16):void 0,m=Array.prototype.slice.call(m);for(var F=0;F<m.length;F++)m[F]=Aw(m[F],b,C,$);return C(D,m),m}function dF(m){return m.ja===Om?m.toJSON():hF(m)}function fF(m,b){m&128&&Pm(b)}function Rw(m,b,C){if(C=C===void 0?Rh:C,m!=null){if(We&&m instanceof Uint8Array)return m.length?new Nl(new Uint8Array(m),xr):km();if(Array.isArray(m)){var $=At(m);return $&2?m:b&&!($&32)&&($&16||$===0)?(_s(m,$|2),m):(m=Mm(m,Rw,$&4?Rh:C,!0),b=At(m),b&4&&b&2&&Object.freeze(m),m)}return m.ja===Om?Dw(m):m}}function Ow(m,b,C,$,D,F,P){if(m=m.h&&m.h[C]){if($=At(m),$&2?$=m:(F=Y(m,Dw),Rh($,F),Object.freeze(F),$=F),Dm(b),P=$==null?kl:Rm([]),$!=null){for(F=!!$.length,m=0;m<$.length;m++){var B=$[m];F=F&&!(At(B.o)&2),P[m]=B.o}F=(F?8:0)|1,m=At(P),(m&F)!==F&&(Object.isFrozen(P)&&(P=Array.prototype.slice.call(P)),_s(P,m|F)),b.h||(b.h={}),b.h[C]=$}else b.h&&(b.h[C]=void 0);$l(b,C,P,D)}else Ss(b,C,Rw($,F,P),D)}function Dw(m){return At(m.o)&2||(m=Pw(m,!0),ko(m.o,2)),m}function Pw(m,b){var C=m.o,$=[];ko($,16);var D=m.constructor.h;if(D&&$.push(D),D=m.B,D){$.length=C.length,$.fill(void 0,$.length,C.length);var F={};$[$.length-1]=F}At(C)&128&&Pm($),b=b||m.C()?Rh:cF,F=m.constructor,Fh=$,$=new F($),Fh=void 0,m.R&&($.R=m.R.slice()),F=!!(At(C)&16);for(var P=D?C.length-1:C.length,B=0;B<P;B++)Ow(m,$,B-m.G,C[B],!1,F,b);if(D)for(var z in D)Ow(m,$,+z,D[z],!0,F,b);return $}function Mn(m,b,C){m==null&&(m=Fh),Fh=void 0;var $=this.constructor.i||0,D=0<$,F=this.constructor.h,P=!1;if(m==null){m=F?[F]:[];var B=48,z=!0;D&&($=0,B|=128),_s(m,B)}else{if(!Array.isArray(m)||F&&F!==m[0])throw Error();var J=B=ko(m,0);if((z=(16&J)!==0)&&((P=(32&J)!==0)||(J|=32)),D){if(128&J)$=0;else if(0<m.length){var ie=m[m.length-1];if(Oh(ie)&&"g"in ie){$=0,J|=128,delete ie.g;var Se=!0,pe;for(pe in ie){Se=!1;break}Se&&m.pop()}}}else if(128&J)throw Error();B!==J&&_s(m,J)}this.G=(F?0:-1)-$,this.h=void 0,this.o=m;e:{if(F=this.o.length,$=F-1,F&&(F=this.o[$],Oh(F))){this.B=F,this.i=$-this.G;break e}b!==void 0&&-1<b?(this.i=Math.max(b,$+1-this.G),this.B=void 0):this.i=Number.MAX_VALUE}if(!D&&this.B&&"g"in this.B)throw Error('Unexpected "g" flag in sparse object of message that is not a group type.');if(C){b=z&&!P&&!0,D=this.i;var le;for(z=0;z<C.length;z++)P=C[z],P<D?(P+=this.G,($=m[P])?Fw($,b):m[P]=kl):(le||(le=kw(this)),($=le[P])?Fw($,b):le[P]=kl)}}Mn.prototype.toJSON=function(){return Mm(this.o,dF,fF)},Mn.prototype.C=function(){return!!(At(this.o)&2)};function Fw(m,b){if(Array.isArray(m)){var C=At(m),$=1;!b||C&2||($|=16),(C&$)!==$&&_s(m,C|$)}}Mn.prototype.ja=Om,Mn.prototype.toString=function(){return this.o.toString()};function Lw(m,b,C){if(C){var $={},D;for(D in C){var F=C[D],P=F.qa;P||($.J=F.wa||F.oa.W,F.ia?($.aa=Uw(F.ia),P=function(B){return function(z,J,ie){return B.J(z,J,ie,B.aa)}}($)):F.ka?($.Z=zw(F.da.P,F.ka),P=function(B){return function(z,J,ie){return B.J(z,J,ie,B.Z)}}($)):P=$.J,F.qa=P),P(b,m,F.da),$={J:$.J,aa:$.aa,Z:$.Z}}}lF(b,m)}var Lh=Symbol();function Mw(m,b,C){return m[Lh]||(m[Lh]=function($,D){return b($,D,C)})}function Vw(m){var b=m[Lh];if(!b){var C=Bm(m);b=function($,D){return jw($,D,C)},m[Lh]=b}return b}function pF(m){var b=m.ia;if(b)return Vw(b);if(b=m.va)return Mw(m.da.P,b,m.ka)}function mF(m){var b=pF(m),C=m.da,$=m.oa.U;return b?function(D,F){return $(D,F,C,b)}:function(D,F){return $(D,F,C)}}
260function Bw(m,b){var C=m[b];return typeof C=="function"&&C.length===0&&(C=C(),m[b]=C),Array.isArray(C)&&(Al in C||Il in C||0<C.length&&typeof C[0]=="function")?C:void 0}function Ww(m,b,C,$,D,F){b.P=m[0];var P=1;if(m.length>P&&typeof m[P]!="number"){var B=m[P++];C(b,B)}for(;P<m.length;){C=m[P++];for(var z=P+1;z<m.length&&typeof m[z]!="number";)z++;switch(B=m[P++],z-=P,z){case 0:$(b,C,B);break;case 1:(z=Bw(m,P))?(P++,D(b,C,B,z)):$(b,C,B,m[P++]);break;case 2:z=P++,z=Bw(m,z),D(b,C,B,z,m[P++]);break;case 3:F(b,C,B,m[P++],m[P++],m[P++]);break;case 4:F(b,C,B,m[P++],m[P++],m[P++],m[P++]);break;default:throw Error("unexpected number of binary field arguments: "+z)}}return b}var Mh=Symbol();function Uw(m){var b=m[Mh];if(!b){var C=Vm(m);b=function($,D){return Gw($,D,C)},m[Mh]=b}return b}function zw(m,b){var C=m[Mh];return C||(C=function($,D){return Lw($,D,b)},m[Mh]=C),C}var Il=Symbol();function gF(m,b){m.push(b)}function yF(m,b,C){m.push(b,C.W)}function vF(m,b,C,$){var D=Uw($),F=Vm($).P,P=C.W;m.push(b,function(B,z,J){return P(B,z,J,F,D)})}function xF(m,b,C,$,D,F){var P=zw($,F),B=C.W;m.push(b,function(z,J,ie){return B(z,J,ie,$,P)})}function Vm(m){var b=m[Il];return b||(b=Ww(m,m[Il]=[],gF,yF,vF,xF),Al in m&&Il in m&&(m.length=0),b)}var Al=Symbol();function wF(m,b){m[0]=b}function bF(m,b,C,$){var D=C.U;m[b]=$?function(F,P,B){return D(F,P,B,$)}:D}function _F(m,b,C,$,D){var F=C.U,P=Vw($),B=Bm($).P;m[b]=function(z,J,ie){return F(z,J,ie,B,P,D)}}function SF(m,b,C,$,D,F,P){var B=C.U,z=Mw($,D,F);m[b]=function(J,ie,Se){return B(J,ie,Se,$,z,P)}}function Bm(m){var b=m[Al];return b||(b=Ww(m,m[Al]={},wF,bF,_F,SF),Al in m&&Il in m&&(m.length=0),b)}function jw(m,b,C){for(;Cw(b)&&b.i!=4;){var $=b.l,D=C[$];if(!D){var F=C[0];F&&(F=F[$])&&(D=C[$]=mF(F))}if(!D||!D(b,m,$)){D=b,$=m,F=D.j,Ih(D);var P=D;if(!P.ca){if(D=P.h.h-F,P.h.h=F,P=P.h,D==0)D=km();else{if(F=_w(P,D),P.S&&P.m)D=P.i.subarray(F,F+D);else{P=P.i;var B=F;D=F+D,D=B===D?Gr():ki?P.slice(B,D):new Uint8Array(P.subarray(B,D))}D=D.length==0?km():new Nl(D,xr)}(F=$.R)?F.push(D):$.R=[D]}}}return m}function Gw(m,b,C){for(var $=C.length,D=$%2==1,F=D?1:0;F<$;F+=2)(0,C[F+1])(b,m,C[F]);Lw(m,b,D?C[0]:void 0)}function Rl(m,b){return{U:m,W:b}}var Kr=Rl(function(m,b,C){if(m.i!==5)return!1;m=m.h;var $=m.i,D=m.h,F=$[D],P=$[D+1],B=$[D+2];return $=$[D+3],No(m,m.h+4),P=(F<<0|P<<8|B<<16|$<<24)>>>0,m=2*(P>>31)+1,F=P>>>23&255,P&=8388607,Ss(b,C,F==255?P?NaN:1/0*m:F==0?m*Math.pow(2,-149)*P:m*Math.pow(2,F-150)*(P+Math.pow(2,23))),!0},function(m,b,C){if(b=Lm(b,C),b!=null){Eo(m.h,8*C+5),m=m.h;var $=+b;$===0?0<1/$?It=nn=0:(nn=0,It=2147483648):isNaN($)?(nn=0,It=2147483647):($=(C=0>$?-2147483648:0)?-$:$,34028234663852886e22<$?(nn=0,It=(C|2139095040)>>>0):11754943508222875e-54>$?($=Math.round($/Math.pow(2,-149)),nn=0,It=(C|$)>>>0):(b=Math.floor(Math.log($)/Math.LN2),$*=Math.pow(2,-b),$=Math.round(8388608*$),16777216<=$&&++b,nn=0,It=(C|b+127<<23|$&8388607)>>>0)),C=It,m.h.push(C>>>0&255),m.h.push(C>>>8&255),m.h.push(C>>>16&255),m.h.push(C>>>24&255)}}),TF=Rl(function(m,b,C){if(m.i!==0)return!1;var $=m.h,D=0,F=m=0,P=$.i,B=$.h;do{var z=P[B++];D|=(z&127)<<F,F+=7}while(32>F&&z&128);for(32<F&&(m|=(z&127)>>4),F=3;32>F&&z&128;F+=7)z=P[B++],m|=(z&127)<<F;if(No($,B),128>z)$=D>>>0,z=m>>>0,(m=z&2147483648)&&($=~$+1>>>0,z=~z>>>0,$==0&&(z=z+1>
260>>0)),$=4294967296*z+($>>>0);else throw wr();return Ss(b,C,m?-$:$),!0},function(m,b,C){b=qr(b,C),b!=null&&(typeof b=="string"&&Fe(b),b!=null&&(Eo(m.h,8*C),typeof b=="number"?(m=m.h,ce(b),Tw(m,It,nn)):(C=Fe(b),Tw(m.h,C.i,C.h))))}),CF=Rl(function(m,b,C){return m.i!==0?!1:(Ss(b,C,El(m.h)),!0)},function(m,b,C){if(b=qr(b,C),b!=null&&b!=null)if(Eo(m.h,8*C),m=m.h,C=b,0<=C)Eo(m,C);else{for(b=0;9>b;b++)m.h.push(C&127|128),C>>=7;m.h.push(1)}}),Hw=Rl(function(m,b,C){if(m.i!==2)return!1;var $=El(m.h)>>>0;m=m.h;var D=_w(m,$);if(m=m.i,iF){var F=m,P;(P=Em)||(P=Em=new TextDecoder("utf-8",{fatal:!0})),m=D+$,F=D===0&&m===F.length?F:F.subarray(D,m);try{var B=P.decode(F)}catch(Se){if(Ua===void 0){try{P.decode(new Uint8Array([128]))}catch{}try{P.decode(new Uint8Array([97])),Ua=!0}catch{Ua=!1}}throw!Ua&&(Em=void 0),Se}}else{B=D,$=B+$,D=[];for(var z=null,J,ie;B<$;)J=m[B++],128>J?D.push(J):224>J?B>=$?Hr():(ie=m[B++],194>J||(ie&192)!==128?(B--,Hr()):D.push((J&31)<<6|ie&63)):240>J?B>=$-1?Hr():(ie=m[B++],(ie&192)!==128||J===224&&160>ie||J===237&&160<=ie||((F=m[B++])&192)!==128?(B--,Hr()):D.push((J&15)<<12|(ie&63)<<6|F&63)):244>=J?B>=$-2?Hr():(ie=m[B++],(ie&192)!==128||(J<<28)+(ie-144)>>30||((F=m[B++])&192)!==128||((P=m[B++])&192)!==128?(B--,Hr()):(J=(J&7)<<18|(ie&63)<<12|(F&63)<<6|P&63,J-=65536,D.push((J>>10&1023)+55296,(J&1023)+56320))):Hr(),8192<=D.length&&(z=$h(z,D),D.length=0);B=$h(z,D)}return Ss(b,C,B),!0},function(m,b,C){if(b=qr(b,C),b!=null){var $=!1;if($=$===void 0?!1:$,oF){if($&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(b))throw Error("Found an unpaired surrogate");b=(yw||(yw=new TextEncoder)).encode(b)}else{for(var D=0,F=new Uint8Array(3*b.length),P=0;P<b.length;P++){var B=b.charCodeAt(P);if(128>B)F[D++]=B;else{if(2048>B)F[D++]=B>>6|192;else{if(55296<=B&&57343>=B){if(56319>=B&&P<b.length){var z=b.charCodeAt(++P);if(56320<=z&&57343>=z){B=1024*(B-55296)+z-56320+65536,F[D++]=B>>18|240,F[D++]=B>>12&63|128,F[D++]=B>>6&63|128,F[D++]=B&63|128;continue}else P--}if($)throw Error("Found an unpaired surrogate");B=65533}F[D++]=B>>12|224,F[D++]=B>>6&63|128}F[D++]=B&63|128}}b=D===F.length?F:F.subarray(0,D)}Eo(m.h,8*C+2),Eo(m.h,b.length),za(m,m.h.end()),za(m,b)}}),qw=Rl(function(m,b,C,$,D){if(m.i!==2)return!1;b=Iw(b,C,$),C=m.h.j,$=El(m.h)>>>0;var F=m.h.h+$,P=F-C;if(0>=P&&(m.h.j=F,D(b,m,void 0,void 0,void 0),P=F-m.h.h),P)throw Error("Message parsing ended unexpectedly. Expected to read "+($+" bytes, instead read "+($-P)+" bytes, either the data ended unexpectedly or the message misreported its own length"));return m.h.h=F,m.h.j=C,!0},function(m,b,C,$,D){if(b=Dh(b,$,C),b!=null)for($=0;$<b.length;$++){var F=m;Eo(F.h,8*C+2);var P=F.h.end();za(F,P),P.push(F.i),F=P,D(b[$],m),P=m;var B=F.pop();for(B=P.i+P.h.length()-B;127<B;)F.push(B&127|128),B>>>=7,P.i++;F.push(B),P.i++}});function Wm(m){return function(b,C){e:{if(Ah.length){var $=Ah.pop();$.setOptions(C),$m($.h,b,C),b=$}else b=new Am(b,C);try{var D=Bm(m),F=jw(new D.P,b,D);break e}finally{D=b.h,D.i=null,D.m=!1,D.l=0,D.j=0,D.h=0,D.S=!1,b.l=-1,b.i=-1,100>Ah.length&&Ah.push(b)}F=void 0}return F}}function Um(m){return function(){var b=new uF;Gw(this,b,Vm(m)),za(b,b.h.end());for(var C=new Uint8Array(b.i),$=b.j,D=$.length,F=0,P=0;P<D;P++){var B=$[P];C.set(B,F),F+=B.length}return b.j=[C],C}}function ja(m){Mn.call(this,m)}v(ja,Mn);var Kw=[ja,1,CF,2,Kr,3,Hw,4,Hw];ja.prototype.l=Um(Kw);function zm(m){Mn.call(this,m,-1,NF)}v(zm,Mn),zm.prototype.addClassification=function(m,b){return Iw(this,1,ja,m,b),this};var NF=[1],Xw=Wm([zm,1,qw,Kw]);function Ga(m){Mn.call(this,m)}v(Ga,Mn);var Yw=[Ga,1,Kr,2,Kr,3,Kr,4,Kr,5,Kr];Ga.prototype.l=Um(Yw);function Qw(m){Mn.call(this,m,-1,EF)}v(Qw,Mn);var EF=[1],Zw=Wm([Qw,1,qw,Yw]);function Vh(m){Mn.call(this,m)}v(Vh,Mn);var Jw=[Vh,1,Kr,2,Kr,3,Kr,4,Kr,5,Kr,6,TF],kF=Wm(Jw);Vh.prototype.l=Um(Jw);function eb(m,b,C){if(C=m.createShader(C===0?m.VERTEX_SHADER:m.FRAGMENT_SHADER),m.shaderSource(C,b),m.compileShader(C),!m.getShaderParameter(C,m.COMPILE_STATUS))throw Error(`Could not compile WebGL shader.
261
262`+m.getShaderInfoLog(C));return C}function tb(m){return Dh(m,ja,1).map(function(b){var C=qr(b,1);return{index:C??0,score:Cs(b,2),label:qr(b,3)!=null?Ph(qr(b,3),""):void 0,displayName:qr(b,4)!=null?Ph(qr(b,4),""):void 0}})}function nb(m){return{x:Cs(m,1),y:Cs(m,2),z:Cs(m,3),visibility:Lm(m,4)!=null?Cs(m,4):void 0}}function rb(m){return m.map(function(b){return Dh(Zw(b),Ga,1).map(nb)})}function jm(m,b){this.i=m,this.h=b,this.m=0}
vendor: 6,378 bytes, lines 262-277
262function sb(m,b,C){return $F(m,b),typeof m.h.canvas.transferToImageBitmap=="function"?Promise.resolve(m.h.canvas.transferToImageBitmap()):C?Promise.resolve(m.h.canvas):typeof createImageBitmap=="function"?createImageBitmap(m.h.canvas):(m.j===void 0&&(m.j=document.createElement("canvas")),new Promise(function($){m.j.height=m.h.canvas.height,m.j.width=m.h.canvas.width,m.j.getContext("2d",{}).drawImage(m.h.canvas,0,0,m.h.canvas.width,m.h.canvas.height),$(m.j)}))}function $F(m,b){var C=m.h;if(m.s===void 0){var $=eb(C,`
263  attribute vec2 aVertex;
264  attribute vec2 aTex;
265  varying vec2 vTex;
266  void main(void) {
267    gl_Position = vec4(aVertex, 0.0, 1.0);
268    vTex = aTex;
269  }`,0),D=eb(C,`
270  precision mediump float;
271  varying vec2 vTex;
272  uniform sampler2D sampler0;
273  void main(){
274    gl_FragColor = texture2D(sampler0, vTex);
275  }`,1),F=C.createProgram();if(C.attachShader(F,$),C.attachShader(F,D),C.linkProgram(F),!C.getProgramParameter(F,C.LINK_STATUS))throw Error(`Could not compile WebGL program.
276
277`+C.getProgramInfoLog(F));$=m.s=F,C.useProgram($),D=C.getUniformLocation($,"sampler0"),m.l={O:C.getAttribLocation($,"aVertex"),N:C.getAttribLocation($,"aTex"),xa:D},m.v=C.createBuffer(),C.bindBuffer(C.ARRAY_BUFFER,m.v),C.enableVertexAttribArray(m.l.O),C.vertexAttribPointer(m.l.O,2,C.FLOAT,!1,0,0),C.bufferData(C.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),C.STATIC_DRAW),C.bindBuffer(C.ARRAY_BUFFER,null),m.u=C.createBuffer(),C.bindBuffer(C.ARRAY_BUFFER,m.u),C.enableVertexAttribArray(m.l.N),C.vertexAttribPointer(m.l.N,2,C.FLOAT,!1,0,0),C.bufferData(C.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),C.STATIC_DRAW),C.bindBuffer(C.ARRAY_BUFFER,null),C.uniform1i(D,0)}$=m.l,C.useProgram(m.s),C.canvas.width=b.width,C.canvas.height=b.height,C.viewport(0,0,b.width,b.height),C.activeTexture(C.TEXTURE0),m.i.bindTexture2d(b.glName),C.enableVertexAttribArray($.O),C.bindBuffer(C.ARRAY_BUFFER,m.v),C.vertexAttribPointer($.O,2,C.FLOAT,!1,0,0),C.enableVertexAttribArray($.N),C.bindBuffer(C.ARRAY_BUFFER,m.u),C.vertexAttribPointer($.N,2,C.FLOAT,!1,0,0),C.bindFramebuffer(C.DRAW_FRAMEBUFFER?C.DRAW_FRAMEBUFFER:C.FRAMEBUFFER,null),C.clearColor(0,0,0,0),C.clear(C.COLOR_BUFFER_BIT),C.colorMask(!0,!0,!0,!0),C.drawArrays(C.TRIANGLE_FAN,0,4),C.disableVertexAttribArray($.O),C.disableVertexAttribArray($.N),C.bindBuffer(C.ARRAY_BUFFER,null),m.i.bindTexture2d(0)}function IF(m){this.h=m}var AF=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function RF(m,b){return b+m}function ib(m,b){window[m]=b}function OF(m){var b=document.createElement("script");return b.setAttribute("src",m),b.setAttribute("crossorigin","anonymous"),new Promise(function(C){b.addEventListener("load",function(){C()},!1),b.addEventListener("error",function(){C()},!1),document.body.appendChild(b)})}function DF(){return L(function(m){switch(m.h){case 1:return m.s=2,_(m,WebAssembly.instantiate(AF),4);case 4:m.h=3,m.s=0;break;case 2:return m.s=0,m.l=null,m.return(!1);case 3:return m.return(!0)}})}function Gm(m){if(this.h=m,this.listeners={},this.l={},this.L={},this.s={},this.v={},this.M=this.u=this.ga=!0,this.I=Promise.resolve(),this.fa="",this.D={},this.locateFile=m&&m.locateFile||RF,typeof window=="object")var b=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else if(typeof location<"u")b=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/";else throw Error("solutions can only be loaded on a web page or in a web worker");if(this.ha=b,m.options){b=a(Object.keys(m.options));for(var C=b.next();!C.done;C=b.next()){C=C.value;var $=m.options[C].default;$!==void 0&&(this.l[C]=typeof $=="function"?$():$)}}}t=Gm.prototype,t.close=function(){return this.j&&this.j.delete(),Promise.resolve()};function PF(m){var b,C,$,D,F,P,B,z,J,ie,Se;return L(function(pe){switch(pe.h){case 1:return m.ga?(b=m.h.files===void 0?[]:typeof m.h.files=="function"?m.h.files(m.l):m.h.files,_(pe,DF(),2)):pe.return();case 2:if(C=pe.i,typeof window=="object")return ib("createMediapipeSolutionsWasm",{locateFile:m.locateFile}),ib("createMediapipeSolutionsPackedAssets",{locateFile:m.locateFile}),P=b.filter(function(le){return le.data!==void 0}),B=b.filter(function(le){return le.data===void 0}),z=Promise.all(P.map(function(le){var Te=Bh(m,le.url);if(le.path!==void 0){var ke=le.path;Te=Te.then(function(ut){return m.overrideFile(ke,ut),Promise.resolve(ut)})}return Te})),J=Promise.all(B.map(function(le){return le.simd===void 0||le.simd&&C||!le.simd&&!C?OF(m.locateFile(le.url,m.ha)):Promise.resolve()})).then(function(){var le,Te,ke;return L(function(ut){if(ut.h==1)return le=window.createMediapipeSolutionsWasm,Te=window.createMediapipeSolutionsPackedAssets,ke=m,_(ut,le(Te),2);ke.i=ut.i,ut.h=0})}),ie=function(){return L(function(le){return m.h.graph&&m.h.graph.url?le=_(le,Bh(m,m.h.graph.url),0):(le.h=0,le=void 0),le})}(),_(pe,Promise.all([J,z,ie]),7);if(typeof importScripts!="function")throw Error("solutions can only be loaded on a web page or in a web worker");return $=b.filter(function(le){return le.simd===void 0||le.simd&&C||!le.simd&&!C}).map(function(le){return m.locateFile(le.url,m.ha)}),importScripts.apply(null,u($)),D=m,_(pe,createMediapipeSolutionsWasm(Module),6);case 6:D.i=pe.i,m.m=new OffscreenCanvas(1,1),m.i.canvas=m.m,F=m.i.GL.createContext(m.m,{antialias:!1,alpha:!1,ua:typeof WebGL2RenderingContext<"u"?2:1}),m.i.GL.makeContextCurrent(F),pe.h=4;break;case 7:if(m.m=document.createElement("canvas"),Se=m.m.getContext("webgl2",{}),!Se&&(Se=m.m.getContext("webgl",{}),!Se))return alert("Failed to create WebGL canvas context when passing video frame."),pe.return();m.K=Se,m.i.canvas=m.m,m.i.createContext(m.m,!0,!0,{});case 4:m.j=new m.i.SolutionWasm,m.ga=!1,pe.h=0}})}function FF(m){var b,C,$,D,F,P,B,z;return L(function(J){if(J.h==1){if(m.h.graph&&m.h.graph.url&&m.fa===m.h.graph.url)return J.return();if(m.u=!0,!m.h.graph||!m.h.graph.url){J.h=2;return}return m.fa=m.h.graph.url,_(J,Bh(m,m.h.graph.url),3)}for(J.h!=2&&(b=J.i,m.j.loadGraph(b)),C=a(Object.keys(m.D)),$=C.next();!$.done;$=C.next())D=$.value,m.j.overrideFile(D,m.D[D]);if(m.D={},m.h.listeners)for(F=a(m.h.listeners),P=F.next();!P.done;P=F.next())B=P.value,BF(m,B);z=m.l,m.l={},m.setOptions(z),J.h=0})}t.reset=function(){var m=this;return L(function(b){m.j&&(m.j.reset(),m.s={},m.v={}),b.h=0})}
277,t.setOptions=function(m,b){var C=this;if(b=b||this.h.options){for(var $=[],D=[],F={},P=a(Object.keys(m)),B=P.next();!B.done;F={X:F.X,Y:F.Y},B=P.next())if(B=B.value,!(B in this.l&&this.l[B]===m[B])){this.l[B]=m[B];var z=b[B];z!==void 0&&(z.onChange&&(F.X=z.onChange,F.Y=m[B],$.push(function(J){return function(){var ie;return L(function(Se){if(Se.h==1)return _(Se,J.X(J.Y),2);ie=Se.i,ie===!0&&(C.u=!0),Se.h=0})}}(F))),z.graphOptionXref&&(B=Object.assign({},{calculatorName:"",calculatorIndex:0},z.graphOptionXref,{valueNumber:z.type===1?m[B]:0,valueBoolean:z.type===0?m[B]:!1,valueString:z.type===2?m[B]:""}),D.push(B)))}($.length!==0||D.length!==0)&&(this.u=!0,this.H=(this.H===void 0?[]:this.H).concat(D),this.F=(this.F===void 0?[]:this.F).concat($))}};function LF(m){var b,C,$,D,F,P,B;return L(function(z){switch(z.h){case 1:if(!m.u)return z.return();if(!m.F){z.h=2;break}b=a(m.F),C=b.next();case 3:if(C.done){z.h=5;break}return $=C.value,_(z,$(),4);case 4:C=b.next(),z.h=3;break;case 5:m.F=void 0;case 2:if(m.H){for(D=new m.i.GraphOptionChangeRequestList,F=a(m.H),P=F.next();!P.done;P=F.next())B=P.value,D.push_back(B);m.j.changeOptions(D),D.delete(),m.H=void 0}m.u=!1,z.h=0}})}t.initialize=function(){var m=this;return L(function(b){return b.h==1?_(b,PF(m),2):b.h!=3?_(b,FF(m),3):_(b,LF(m),0)})};function Bh(m,b){var C,$;return L(function(D){return b in m.L?D.return(m.L[b]):(C=m.locateFile(b,""),$=fetch(C).then(function(F){return F.arrayBuffer()}),m.L[b]=$,D.return($))})}t.overrideFile=function(m,b){this.j?this.j.overrideFile(m,b):this.D[m]=b},t.clearOverriddenFiles=function(){this.D={},this.j&&this.j.clearOverriddenFiles()},t.send=function(m,b){var C=this,$,D,F,P,B,z,J,ie,Se;return L(function(pe){switch(pe.h){case 1:return C.h.inputs?($=1e3*(b??performance.now()),_(pe,C.I,2)):pe.return();case 2:return _(pe,C.initialize(),3);case 3:for(D=new C.i.PacketDataList,F=a(Object.keys(m)),P=F.next();!P.done;P=F.next())if(B=P.value,z=C.h.inputs[B]){e:{var le=m[B];switch(z.type){case"video":var Te=C.s[z.stream];if(Te||(Te=new jm(C.i,C.K),C.s[z.stream]=Te),Te.m===0&&(Te.m=Te.i.createTexture()),typeof HTMLVideoElement<"u"&&le instanceof HTMLVideoElement)var ke=le.videoWidth,ut=le.videoHeight;else typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(ke=le.naturalWidth,ut=le.naturalHeight):(ke=le.width,ut=le.height);ut={glName:Te.m,width:ke,height:ut},ke=Te.h,ke.canvas.width=ut.width,ke.canvas.height=ut.height,ke.activeTexture(ke.TEXTURE0),Te.i.bindTexture2d(Te.m),ke.texImage2D(ke.TEXTURE_2D,0,ke.RGBA,ke.RGBA,ke.UNSIGNED_BYTE,le),Te.i.bindTexture2d(0),Te=ut;break e;case"detections":for(Te=C.s[z.stream],Te||(Te=new IF(C.i),C.s[z.stream]=Te),Te.data||(Te.data=new Te.h.DetectionListData),Te.data.reset(le.length),ut=0;ut<le.length;++ut){ke=le[ut];var Je=Te.data,rn=Je.setBoundingBox,br=ut,Vn=ke.la,Be=new Vh;if(Ts(Be,1,Vn.ra),Ts(Be,2,Vn.sa),Ts(Be,3,Vn.height),Ts(Be,4,Vn.width),Ts(Be,5,Vn.rotation),Ss(Be,6,Vn.pa),Vn=Be.l(),rn.call(Je,br,Vn),ke.ea)for(Je=0;Je<ke.ea.length;++Je){Be=ke.ea[Je],rn=Te.data,br=rn.addNormalizedLandmark,Vn=ut,Be=Object.assign({},Be,{visibility:Be.visibility?Be.visibility:0});var sn=new Ga;Ts(sn,1,Be.x),Ts(sn,2,Be.y),Ts(sn,3,Be.z),Be.visibility&&Ts(sn,4,Be.visibility),Be=sn.l(),br.call(rn,Vn,Be)}if(ke.ba)for(Je=0;Je<ke.ba.length;++Je)rn=Te.data,br=rn.addClassification,Vn=ut,Be=ke.ba[Je],sn=new ja,Ts(sn,2,Be.score),Be.index&&Ss(sn,1,Be.index),Be.label&&Ss(sn,3,Be.label),Be.displayName&&Ss(sn,4,Be.displayName),Be=sn.l(),br.call(rn,Vn,Be)}Te=Te.data;break e;default:Te={}}}switch(J=Te,ie=z.stream,z.type){case"video":D.pushTexture2d(Object.assign({},J,{stream:ie,timestamp:$}));break;case"detections":Se=J,Se.stream=ie,Se.timestamp=$,D.pushDetectionList(Se);break;default:throw Error("Unknown input config type: '"+z.type+"'")}}return C.j.send(D),_(pe,C.I,4);case 4:D.delete(),pe.h=0}})};function MF(m,b,C){var $,D,F,P,B,z,J,ie,Se,pe,le,Te,ke,ut;return L(function(Je){switch(Je.h){case 1:if(!C)return Je.return(b);for($={},D=0,F=a(Object.keys(C)),P=F.next();!P.done;P=F.next())B=P.value,z=C[B],typeof z!="string"&&z.type==="texture"&&b[z.stream]!==void 0&&++D;1<D&&(m.M=!1),J=a(Object.keys(C)),P=J.next();case 2:if(P.done){Je.h=4;break}if(ie=P.value,Se=C[ie],typeof Se=="string")return ke=$,ut=ie,_(Je,VF(m,ie,b[Se]),14);if(pe=b[Se.stream],Se.type==="detection_list"){if(pe){for(var rn=pe.getRectList(),br=pe.getLandmarksList(),Vn=pe.getClassificationsList(),Be=[],sn=0;sn<rn.size();
277++sn){var Ii=kF(rn.get(sn)),WF=Cs(Ii,1),UF=Cs(Ii,2),zF=Cs(Ii,3),jF=Cs(Ii,4),GF=Cs(Ii,5,0),Wh=void 0;Wh=Wh===void 0?0:Wh,Ii={la:{ra:WF,sa:UF,height:zF,width:jF,rotation:GF,pa:Ph(qr(Ii,6),Wh)},ea:Dh(Zw(br.get(sn)),Ga,1).map(nb),ba:tb(Xw(Vn.get(sn)))},Be.push(Ii)}rn=Be}else rn=[];$[ie]=rn,Je.h=7;break}if(Se.type==="proto_list"){if(pe){for(rn=Array(pe.size()),br=0;br<pe.size();br++)rn[br]=pe.get(br);pe.delete()}else rn=[];$[ie]=rn,Je.h=7;break}if(pe===void 0){Je.h=3;break}if(Se.type==="float_list"){$[ie]=pe,Je.h=7;break}if(Se.type==="proto"){$[ie]=pe,Je.h=7;break}if(Se.type!=="texture")throw Error("Unknown output config type: '"+Se.type+"'");return le=m.v[ie],le||(le=new jm(m.i,m.K),m.v[ie]=le),_(Je,sb(le,pe,m.M),13);case 13:Te=Je.i,$[ie]=Te;case 7:Se.transform&&$[ie]&&($[ie]=Se.transform($[ie])),Je.h=3;break;case 14:ke[ut]=Je.i;case 3:P=J.next(),Je.h=2;break;case 4:return Je.return($)}})}function VF(m,b,C){var $;return L(function(D){return typeof C=="number"||C instanceof Uint8Array||C instanceof m.i.Uint8BlobList?D.return(C):C instanceof m.i.Texture2dDataOut?($=m.v[b],$||($=new jm(m.i,m.K),m.v[b]=$),D.return(sb($,C,m.M))):D.return(void 0)})}function BF(m,b){for(var C=b.name||"$",$=[].concat(u(b.wants)),D=new m.i.StringList,F=a(b.wants),P=F.next();!P.done;P=F.next())D.push_back(P.value);F=m.i.PacketListener.implement({onResults:function(B){for(var z={},J=0;J<b.wants.length;++J)z[$[J]]=B.get(J);var ie=m.listeners[C];ie&&(m.I=MF(m,z,b.outs).then(function(Se){Se=ie(Se);for(var pe=0;pe<b.wants.length;++pe){var le=z[$[pe]];typeof le=="object"&&le.hasOwnProperty&&le.hasOwnProperty("delete")&&le.delete()}Se&&(m.I=Se)}))}}),m.j.attachMultiListener(D,F),D.delete()}t.onResults=function(m,b){this.listeners[b||"$"]=m},X("Solution",Gm),X("OptionType",{BOOL:0,NUMBER:1,ta:2,0:"BOOL",1:"NUMBER",2:"STRING"});function ob(m){return m===void 0&&(m=0),m===1?"hand_landmark_full.tflite":"hand_landmark_lite.tflite"}function ab(m){var b=this;m=m||{},this.h=new Gm({locateFile:m.locateFile,files:function(C){return[{url:"hands_solution_packed_assets_loader.js"},{simd:!1,url:"hands_solution_wasm_bin.js"},{simd:!0,url:"hands_solution_simd_wasm_bin.js"},{data:!0,url:ob(C.modelComplexity)}]},graph:{url:"hands.binarypb"},inputs:{image:{type:"video",stream:"input_frames_gpu"}},listeners:[{wants:["multi_hand_landmarks","multi_hand_world_landmarks","image_transformed","multi_handedness"],outs:{image:"image_transformed",multiHandLandmarks:{type:"proto_list",stream:"multi_hand_landmarks",transform:rb},multiHandWorldLandmarks:{type:"proto_list",stream:"multi_hand_world_landmarks",transform:rb},multiHandedness:{type:"proto_list",stream:"multi_handedness",transform:function(C){return C.map(function($){return tb(Xw($))[0]})}}}}],options:{useCpuInference:{type:0,graphOptionXref:{calculatorType:"InferenceCalculator",fieldName:"use_cpu_inference"},default:typeof window!="object"||window.navigator===void 0?!1:"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},selfieMode:{type:0,graphOptionXref:{calculatorType:"GlScalerCalculator",calculatorIndex:1,fieldName:"flip_horizontal"}},maxNumHands:{type:1,graphOptionXref:{calculatorType:"ConstantSidePacketCalculator",calculatorName:"ConstantSidePacketCalculator",fieldName:"int_value"}},modelComplexity:{type:1,graphOptionXref:{calculatorType:"ConstantSidePacketCalculator",calculatorName:"ConstantSidePacketCalculatorModelComplexity",fieldName:"int_value"},onChange:function(C){var $,D,F;return L(function(P){return P.h==1?($=ob(C),D="third_party/mediapipe/modules/hand_landmark/"+$,_(P,Bh(b.h,$),2)):(F=P.i,b.h.overrideFile(D,F),P.return(!0))})}},minDetectionConfidence:{type:1,graphOptionXref:{calculatorType:"TensorsToDetectionsCalculator",calculatorName:"handlandmarktrackinggpu__palmdetectiongpu__TensorsToDetectionsCalculator",fieldName:"min_score_thresh"}},minTrackingConfidence:{type:1,graphOptionXref:{calculatorType:"ThresholdingCalculator",calculatorName:"handlandmarktrackinggpu__handlandmarkgpu__ThresholdingCalculator",fieldName:"threshold"}}}})}t=ab.prototype,t.close=function(){return this.h.close(),Promise.resolve()},t.onResults=function(m){this.h.onResults(m)},t.initialize=function(){var m=this;return L(function(b){return _(b,m.h.initialize(),0)})},t.reset=function(){this.h.reset()},t.send=function(m){var b=this;return L(function(C){return _(C,b.h.send(m),0)})},t.setOptions=function(m){this.h.setOptions(m)},X("Hands",ab),X("HAND_CONNECTIONS",[[0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]]),X("VERSION","0.4.1675469240")}).call(Rs);/**
278 * @license
279 * Copyright 2020 Google LLC. All Rights Reserved.
280 * Licensed under the Apache License, Version 2.0 (the "License");
281 * you may not use this file except in compliance with the License.
282 * You may obtain a copy of the License at
283 *
284 * http://www.apache.org/licenses/LICENSE-2.0
285 *
286 * Unless required by applicable law or agreed to in writing, software
287 * distributed under the License is distributed on an "AS IS" BASIS,
288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289 * See the License for the specific language governing permissions and
290 * limitations under the License.
291 * =============================================================================
292 */const JH=1e-7,e5=1e-4;class t5{constructor(e,n){this.backend=e,this.dataMover=n,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,n){this.dataIdsCount++,this.data.set(e,n)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class A${refCount(e){return Bn("refCount")}incRef(e){return Bn("incRef")}timerAvailable(){return!0}time(e){return Bn("time")}read(e){return Bn("read")}readSync(e){return Bn("readSync")}readToGPU(e,n){return Bn("readToGPU")}numDataIds(){return Bn("numDataIds")}disposeData(e,n){return Bn("disposeData")}write(e,n,r){return Bn("write")}move(e,n,r,s,i){return Bn("move")}createTensorFromGPUData(e,n,r){return Bn("createTensorFromGPUData")}memory(){return Bn("memory")}floatPrecision(){return Bn("floatPrecision")}epsilon(){return this.floatPrecision()===32?JH:e5}dispose(){return Bn("dispose")}}function Bn(t){throw new Error(`'${t}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}/**
293 * @license
294 * Copyright 2020 Google LLC. All Rights Reserved.
295 * Licensed under the Apache License, Version 2.0 (the "License");
296 * you may not use this file except in compliance with the License.
297 * You may obtain a copy of the License at
298 *
299 * http://www.apache.org/licenses/LICENSE-2.0
300 *
301 * Unless required by applicable law or agreed to in writing, software
302 * distributed under the License is distributed on an "AS IS" BASIS,
303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304 * See the License for the specific language governing permissions and
305 * limitations under the License.
306 * =============================================================================
307 */function Uf(t,e,n){return Math.max(t,Math.min(e,n))}function _1(t){return t%2===0?t:t+1}function Ul(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function n5(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n];return e}function A(t,e){if(!t)throw new Error(typeof e=="string"?e:e())}function mr(t,e,n=""){A(xt(t,e),()=>n+` Shapes ${t} and ${e} must match`)}function pl(t){A(t!=null,()=>"The input to the tensor constructor must be a non-null value.")}function ne(t){if(t.length===0)return 1;let e=t[0];for(let n=1;n<t.length;n++)e*=t[n];return e}function r5(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==null&&e[n]!==null&&t[n]!==e[n])return!1;return!0}function xt(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function Xu(t){return t%1===0}function v0(t){const e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function ku(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function sT(t,e=s=>0,n,r){return new Promise((s,i)=>{let o=0;const a=()=>{if(t()){s();return}o++;const u=e(o);if(n!=null&&o>=n){i();return}r!=null?r(a,u):setTimeout(a,u)};a()})}function s5(t,e){let n=1,r=-1;for(let i=0;i<t.length;++i)if(t[i]>=0)n*=t[i];else if(t[i]===-1){if(r!==-1)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(r===-1){if(e>0&&e!==n)throw Error(`Size(${e}) must match the product of shape ${t}`);return t}if(n===0)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}`);const s=t.slice();return s[r]=e/n,s}function Gt(t,e){const n=e.length;return t=t==null?e.map((r,s)=>s):[].concat(t),A(t.every(r=>r>=-n&&r<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${t}`),A(t.every(r=>Xu(r)),()=>`All values in axis param must be integers but got axis ${t}`),t.map(r=>r<0?n+r:r)}function _o(t,e){const n=[],r=[],s=e!=null&&Array.isArray(e)&&e.length===0,i=e==null||s?null:Gt(e,t).sort();let o=0;for(let a=0;a<t.length;++a){if(i!=null){if(i[o]===a&&t[a]!==1)throw new Error(`Can't squeeze axis ${a} since its dim '${t[a]}' is not 1`);(i[o]==null||i[o]>a)&&t[a]===1&&(n.push(t[a]),r.push(a)),i[o]<=a&&o++}t[a]!==1&&(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}}function ho(t,e){return zt(t,e)}function zt(t,e){let n=null;if(t==null||t==="float32")n=new Float32Array(e);else if(t==="int32")n=new Int32Array(e);else if(t==="bool")n=new Uint8Array(e);else if(t==="string")n=new Array(e);else throw new Error(`Unknown data type ${t}`);return n}function i5(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(isNaN(r)||!isFinite(r))throw Error(`A tensor of type ${e} being uploaded contains ${r}.`)}}function o5(t){return t==="bool"||t==="complex64"||t==="float32"||t==="int32"||t==="string"}function a5(t,e){return!(e==="complex64"||e==="float32"&&t!=="complex64"||e==="int32"&&t!=="float32"&&t!=="complex64"||e==="bool"&&t==="bool")}function zf(t){if(t==="float32"||t==="int32")return 4;if(t==="complex64")return 8;if(t==="bool")return 1;throw new Error(`Unknown dtype ${t}`)}function u5(t){if(t==null)return 0;let e=0;return t.forEach(n=>e+=n.length),e}function im(t){return typeof t=="string"||t instanceof String}function l5(t){return typeof t=="boolean"}function c5(t){return typeof t=="number"}function vh(t){return Array.isArray(t)?vh(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray?"int32":c5(t)?"float32":im(t)?"string":l5(t)?"bool":"float32"}function x0(t){return!!(t&&t.constructor&&t.call&&t.apply)}function w0(t,e){for(let n=e;n<t;++n)if(t%n===0)return n;return t}function Zt(t){const e=t.length;if(e<2)return[];const n=new Array(e-1);n[e-2]=t[e-1];for(let r=e-3;r>=0;--r)n[r]=n[r+1]*t[r+1];return n}function R$(t,e,n,r=!1){const s=new Array;
vendor: 4,232 bytes, lines 307-325
307if(e.length===1){const i=e[0]*(r?2:1);for(let o=0;o<i;o++)s[o]=n[t+o]}else{const i=e[0],o=e.slice(1),a=o.reduce((u,l)=>u*l)*(r?2:1);for(let u=0;u<i;u++)s[u]=R$(t+u*a,o,n,r)}return s}function b0(t,e,n=!1){if(t.length===0)return e[0];const r=t.reduce((s,i)=>s*i)*(n?2:1);if(r===0)return[];if(r!==e.length)throw new Error(`[${t}] does not match the input size ${e.length}${n?" for a complex tensor":""}.`);return R$(0,t,e,n)}function O$(t,e){const n=fo(t,e);for(let r=0;r<n.length;r++)n[r]=1;return n}function fo(t,e){if(e==null||e==="float32"||e==="complex64")return new Float32Array(t);if(e==="int32")return new Int32Array(t);if(e==="bool")return new Uint8Array(t);throw new Error(`Unknown data type ${e}`)}function gr(t){t.forEach(e=>{A(Number.isInteger(e)&&e>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${t}].`)})}function _0(t,e,n){if(e===0)return 0;if(e===1)return t[0];let r=t[t.length-1];for(let s=0;s<t.length-1;++s)r+=n[s]*t[s];return r}function S1(t,e,n){if(e===0)return[];if(e===1)return[t];const r=new Array(e);for(let s=0;s<r.length-1;++s)r[s]=Math.floor(t/n[s]),t-=r[s]*n[s];return r[r.length-1]=t,r}function ma(t){return t&&t.then&&typeof t.then=="function"}/**
308 * @license
309 * Copyright 2017 Google LLC. All Rights Reserved.
310 * Licensed under the Apache License, Version 2.0 (the "License");
311 * you may not use this file except in compliance with the License.
312 * You may obtain a copy of the License at
313 *
314 * http://www.apache.org/licenses/LICENSE-2.0
315 *
316 * Unless required by applicable law or agreed to in writing, software
317 * distributed under the License is distributed on an "AS IS" BASIS,
318 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
319 * See the License for the specific language governing permissions and
320 * limitations under the License.
321 * =============================================================================
322 */const iT="tfjsflags";class h5{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=d5,this.populateURLFlags()}setPlatform(e,n){this.platform!=null&&(U().getBool("IS_TEST")||U().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=n}registerFlag(e,n,r){if(this.flagRegistry[e]={evaluationFn:n,setHook:r},this.urlFlags[e]!=null){const s=this.urlFlags[e];U().getBool("IS_TEST")||U().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${s}.`),this.set(e,s)}}async getAsync(e){return e in this.flags?this.flags[e]:(this.flags[e]=await this.evaluateFlag(e),this.flags[e])}get(e){if(e in this.flags)return this.flags[e];const n=this.evaluateFlag(e);if(ma(n))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=n,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,n){if(this.flagRegistry[e]==null)throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=n,this.flagRegistry[e].setHook!=null&&this.flagRegistry[e].setHook(n)}evaluateFlag(e){if(this.flagRegistry[e]==null)throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(typeof this.global>"u"||typeof this.global.location>"u"||typeof this.global.location.search>"u")return;const e=this.getQueryParams(this.global.location.search);iT in e&&e[iT].split(",").forEach(r=>{const[s,i]=r.split(":");this.urlFlags[s]=p5(s,i)})}}function d5(t){const e={};return t.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...r)=>(f5(e,r[0],r[1]),r.join("="))),e}function f5(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}function p5(t,e){const n=e.toLowerCase();return n==="true"||n==="false"?n==="true":`${+n}`===n?+n:e}function U(){return D$}let D$=null;function m5(t){D$=t}/**
323 * @license
324 * Copyright 2020 Google LLC. All Rights Reserved.
325 * Licensed under the Apache License, Version 2.0 (the "License");
326 * you may not use this file except in compliance with the License.
327 * You may obtain a copy of the License at
328 *
329 * http://www.apache.org/licenses/LICENSE-2.0
330 *
331 * Unless required by applicable law or agreed to in writing, software
332 * distributed under the License is distributed on an "AS IS" BASIS,
333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334 * See the License for the specific language governing permissions and
335 * limitations under the License.
336 * =============================================================================
337 */let Og;function P$(){if(Og==null){let t;if(typeof window<"u")t=window;else if(typeof global<"u")t=global;else if(typeof process<"u")t=process;else if(typeof self<"u")t=self;else throw new Error("Could not find a global object");Og=t}return Og}function g5(){const t=P$();return t._tfGlobals==null&&(t._tfGlobals=new Map),t._tfGlobals}function T1(t,e){const n=g5();if(n.has(t))return n.get(t);{const r=e();return n.set(t,r),n.get(t)}}const F$="Abs",L$="Acos",M$="Acosh",C1="Add",V$="AddN",B$="All",W$="Any",U$="ArgMax",z$="ArgMin",j$="Asin",G$="Asinh",H$="Atan",q$="Atanh",K$="Atan2",X$="AvgPool",y5="AvgPoolGrad",Y$="AvgPool3D",v5="AvgPool3DGrad",Q$="BatchMatMul",Z$="BatchToSpaceND",J$="Bincount",eI="BitwiseAnd",tI="BroadcastArgs",N1="Cast",nI="Ceil",rI="ClipByValue",sI="Complex",iI="ComplexAbs",oI="Concat",aI="Conv2D",uI="Conv2DBackpropFilter",lI="Conv2DBackpropInput",cI="Conv3D",x5="Conv3DBackpropFilterV2",hI="Conv3DBackpropInputV2",dI="Cos",fI="Cosh",pI="Cumprod",mI="Cumsum",gI="CropAndResize",yI="DenseBincount",vI="DepthToSpace",xI="DepthwiseConv2dNative",wI="DepthwiseConv2dNativeBackpropFilter",bI="DepthwiseConv2dNativeBackpropInput",_I="Diag",SI="Dilation2D",TI="RealDiv",CI="Einsum",NI="Elu",w5="EluGrad",EI="Erf",kI="Equal",$I="Exp",II="ExpandDims",AI="Expm1",RI="FFT",OI="Fill",DI="FlipLeftRight",PI="Floor",FI="FloorDiv",LI="FusedBatchNorm",MI="GatherV2",VI="GatherNd",BI="Greater",WI="GreaterEqual",E1="Identity",UI="IFFT",zI="Imag",jI="IsFinite",GI="IsInf",HI="IsNan",qI="LeakyRelu",KI="Less",XI="LessEqual",YI="LinSpace",QI="Log",ZI="Log1p",JI="LogicalAnd",eA="LogicalNot",tA="LogicalOr",nA="LRN",b5="LRNGrad",rA="Max",sA="Maximum",iA="MaxPool",_5="MaxPoolGrad",oA="MaxPool3D",S5="MaxPool3DGrad",aA="MaxPoolWithArgmax",uA="Mean",lA="Min",cA="Minimum",hA="MirrorPad",dA="Mod",fA="Multinomial",pA="Multiply",mA="Neg",gA="NotEqual",yA="NonMaxSuppressionV3",vA="NonMaxSuppressionV4",xA="NonMaxSuppressionV5",wA="OnesLike",bA="OneHot",_A="Pack",SA="PadV2",TA="Pow",CA="Prelu",NA="Prod",EA="RaggedGather",kA="RaggedRange",$A="RaggedTensorToTensor",IA="Range",AA="Real",RA="Reciprocal",OA="Relu",DA="Reshape",PA="ResizeNearestNeighbor",T5="ResizeNearestNeighborGrad",FA="ResizeBilinear",C5="ResizeBilinearGrad",LA="Relu6",MA="Reverse",VA="Round",BA="Rsqrt",WA="ScatterNd",UA="TensorScatterUpdate",zA="SearchSorted",jA="Select",GA="Selu",HA="Slice",qA="Sin",KA="Sinh",XA="Sign",YA="Sigmoid",QA="Softplus",ZA="Sqrt",JA="Sum",eR="SpaceToBatchND",tR="SplitV",nR="Softmax",rR="SparseFillEmptyRows",sR="SparseReshape",iR="SparseSegmentMean",oR="SparseSegmentSum",aR="SparseToDense",uR="SquaredDifference",N5="Square",lR="StaticRegexReplace",cR="StridedSlice",hR="StringNGrams",dR="StringSplit",fR="StringToHashBucketFast",pR="Sub",mR="Tan",gR="Tanh",k1="Tile",yR="TopK",vR="Transform",jd="Transpose",xR="Unique",wR="Unpack",bR="UnsortedSegmentSum",_R="ZerosLike",SR="Step",S0="FromPixels",TR="RotateWithOffset",T0="_FusedMatMul",C0="FusedConv2D",N0="FusedDepthwiseConv2D";/**
338 * @license
339 * Copyright 2018 Google LLC. All Rights Reserved.
340 * Licensed under the Apache License, Version 2.0 (the "License");
341 * you may not use this file except in compliance with the License.
342 * You may obtain a copy of the License at
343 *
344 * http://www.apache.org/licenses/LICENSE-2.0
345 *
346 * Unless required by applicable law or agreed to in writing, software
347 * distributed under the License is distributed on an "AS IS" BASIS,
348 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
349 * See the License for the specific language governing permissions and
350 * limitations under the License.
351 * =============================================================================
352 */function ss(...t){U().getBool("IS_TEST")||U().getBool("PROD")||console.warn(...t)}function E5(...t){U().getBool("IS_TEST")||U().getBool("PROD")||console.log(...t)}/**
353 * @license
354 * Copyright 2019 Google LLC. All Rights Reserved.
355 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 10,814 bytes, lines 356-382
356 * you may not use this file except in compliance with the License.
357 * You may obtain a copy of the License at
358 *
359 * http://www.apache.org/licenses/LICENSE-2.0
360 *
361 * Unless required by applicable law or agreed to in writing, software
362 * distributed under the License is distributed on an "AS IS" BASIS,
363 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
364 * See the License for the specific language governing permissions and
365 * limitations under the License.
366 * =============================================================================
367 */const jf=T1("kernelRegistry",()=>new Map),k5=T1("gradRegistry",()=>new Map);function E0(t,e){const n=CR(t,e);return jf.get(n)}function oT(t){return k5.get(t)}function aT(t){const e=jf.entries(),n=[];for(;;){const{done:r,value:s}=e.next();if(r)break;const[i,o]=s,[a]=i.split("_");a===t&&n.push(o)}return n}function $5(t){const{kernelName:e,backendName:n}=t,r=CR(e,n);jf.has(r)&&ss(`The kernel '${e}' for backend '${n}' is already registered`),jf.set(r,t)}function CR(t,e){return`${e}_${t}`}/**
368 * @license
369 * Copyright 2023 Google LLC.
370 * Licensed under the Apache License, Version 2.0 (the "License");
371 * you may not use this file except in compliance with the License.
372 * You may obtain a copy of the License at
373 *
374 * http://www.apache.org/licenses/LICENSE-2.0
375 *
376 * Unless required by applicable law or agreed to in writing, software
377 * distributed under the License is distributed on an "AS IS" BASIS,
378 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379 * See the License for the specific language governing permissions and
380 * limitations under the License.
381 * =============================================================================
382 */function NR(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray}var ER=rt,Ar=null;try{Ar=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function rt(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}rt.prototype.__isLong__;Object.defineProperty(rt.prototype,"__isLong__",{value:!0});function er(t){return(t&&t.__isLong__)===!0}rt.isLong=er;var uT={},lT={};function Oa(t,e){var n,r,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(r=lT[t],r)?r:(n=st(t,(t|0)<0?-1:0,!0),s&&(lT[t]=n),n)):(t|=0,(s=-128<=t&&t<128)&&(r=uT[t],r)?r:(n=st(t,t<0?-1:0,!1),s&&(uT[t]=n),n))}rt.fromInt=Oa;function Rr(t,e){if(isNaN(t))return e?qo:Or;if(e){if(t<0)return qo;if(t>=kR)return AR}else{if(t<=-hT)return qn;if(t+1>=hT)return IR}return t<0?Rr(-t,e).neg():st(t%Yu|0,t/Yu|0,e)}rt.fromNumber=Rr;function st(t,e,n){return new rt(t,e,n)}rt.fromBits=st;var Gf=Math.pow;function $1(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return Or;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return $1(t.substring(1),e,n).neg();for(var s=Rr(Gf(n,8)),i=Or,o=0;o<t.length;o+=8){var a=Math.min(8,t.length-o),u=parseInt(t.substring(o,o+a),n);if(a<8){var l=Rr(Gf(n,a));i=i.mul(l).add(Rr(u))}else i=i.mul(s),i=i.add(Rr(u))}return i.unsigned=e,i}rt.fromString=$1;function vs(t,e){return typeof t=="number"?Rr(t,e):typeof t=="string"?$1(t,e):st(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}rt.fromValue=vs;var cT=65536,I5=1<<24,Yu=cT*cT,kR=Yu*Yu,hT=kR/2,dT=Oa(I5),Or=Oa(0);rt.ZERO=Or;var qo=Oa(0,!0);rt.UZERO=qo;var wu=Oa(1);rt.ONE=wu;var $R=Oa(1,!0);rt.UONE=$R;var k0=Oa(-1);rt.NEG_ONE=k0;var IR=st(-1,2147483647,!1);rt.MAX_VALUE=IR;var AR=st(-1,-1,!0);rt.MAX_UNSIGNED_VALUE=AR;var qn=st(0,-2147483648,!1);rt.MIN_VALUE=qn;var oe=rt.prototype;oe.toInt=function(){return this.unsigned?this.low>>>0:this.low};oe.toNumber=function(){return this.unsigned?(this.high>>>0)*Yu+(this.low>>>0):this.high*Yu+(this.low>>>0)};oe.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(qn)){var n=Rr(e),r=this.div(n),s=r.mul(n).sub(this);return r.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=Rr(Gf(e,6),this.unsigned),o=this,a="";;){var u=o.div(i),l=o.sub(u.mul(i)).toInt()>>>0,c=l.toString(e);if(o=u,o.isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}};oe.getHighBits=function(){return this.high};oe.getHighBitsUnsigned=function(){return this.high>>>0};oe.getLowBits=function(){return this.low};oe.getLowBitsUnsigned=function(){return this.low>>>0};oe.getNumBitsAbs=function(){if(this.isNegative())return this.eq(qn)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};oe.isZero=function(){return this.high===0&&this.low===0};oe.eqz=oe.isZero;oe.isNegative=function(){return!this.unsigned&&this.high<0};oe.isPositive=function(){return this.unsigned||this.high>=0};oe.isOdd=function(){return(this.low&1)===1};oe.isEven=function(){return(this.low&1)===0};oe.equals=function(e){return er(e)||(e=vs(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};oe.eq=oe.equals;oe.notEquals=function(e){return!this.eq(e)};oe.neq=oe.notEquals;oe.ne=oe.notEquals;oe.lessThan=function(e){return this.comp(e)<0};oe.lt=oe.lessThan;oe.lessThanOrEqual=function(e){return this.comp(e)<=0};oe.lte=oe.lessThanOrEqual;oe.le=oe.lessThanOrEqual;oe.greaterThan=function(e){return this.comp(e)>0};oe.gt=oe.greaterThan;oe.greaterThanOrEqual=function(e){return this.comp(e)>=0};oe.gte=oe.greaterThanOrEqual;oe.ge=oe.greaterThanOrEqual;oe.compare=function(e){if(er(e)||(e=vs(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};oe.comp=oe.compare;oe.negate=function(){return!this.unsigned&&this.eq(qn)?qn:this.not().add(wu)};oe.neg=oe.negate;oe.add=function(e){er(e)||(e=vs(e));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=e.high>>>16,a=e.high&65535,u=e.low>>>16,l=e.low&65535,c=0,h=0,d=0,f=0;return f+=i+l,d+=f>>>16,f&=65535,d+=s+u,h+=d>>>16,d&=65535,h+=r+a,c+=h>>>16,h&=65535,c+=n+o,c&=65535,st(d<<16|f,c<<16|h,this.unsigned)};oe.subtract=function(e){return er(e)||(e=vs(e)),this.add(e.neg())};oe.sub=oe.subtract;oe.multiply=function(e){if(this.isZero())return Or;if(er(e)||(e=vs(e)),Ar){var n=Ar.mul(this.low,this.high,e.low,e.high);return st(n,Ar.get_high(),this.unsigned)}if(e.isZero())return Or;if(this.eq(qn))return e.isOdd()?qn:Or;if(e.eq(qn))return this.isOdd()?qn:Or;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(dT)&&e.lt(dT))return Rr(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=e.high>>>16,u=e.high&65535,l=e.low>>>16,c=e.low&65535,h=0,d=0,f=0,p=0;return p+=o*c,f+=p>>>16,p&=65535,f+=i*c,d+=f>>>16,f&=65535,f+=o*l,d+=f>>>16,f&=65535,d+=s*c,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,d+=o*u,h+=d>>>16,d&=65535,h+=r*c+s*l+i*u+o*a,h&=65535,st(f<<16|p,h<<16|d,this.unsigned)};oe.mul=oe.multiply;oe.divide=function(e){if(er(e)||(e=vs(e)),e.isZero())throw Error("division by zero");if(Ar){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?Ar.div_u:Ar.div_s)(this.low,this.high,e.low,e.high);return st(n,Ar.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?qo:Or;var r,s,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return qo;if(e.gt(this.shru(1)))return $R;i=qo}else{if(this.eq(qn)){if(e.eq(wu)||e.eq(k0))return qn;if(e.eq(qn))return wu;var o=this.shr(1);return r=o.div(e).shl(1),r.eq(Or)?e.isNegative()?wu:k0:(s=this.sub(e.mul(r)),i=r.add(s.div(e)),i)}else if(e.eq(qn))return this.unsigned?qo:Or;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=Or}for(s=this;s.gte(e);){r=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),u=a<=48?1:Gf(2,a-48),l=Rr(r),c=l.mul(e);c.isNegative()||c.gt(s);)r-=u,l=Rr(r,this.unsigned),c=l.mul(e);l.isZero()&&(l=wu),i=i.add(l),s=s.sub(c)}return i};oe.div=oe.divide;oe.modulo=function(e){if(er(e)||(e=vs(e)),Ar){var n=(this.unsigned?Ar.rem_u:Ar.rem_s)(this.low,this.high,e.low,e.high);return st(n,Ar.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};oe.mod=oe.modulo;oe.rem=oe.modulo;oe.not=function(){return st(~this.low,~this.high,this.unsigned)};oe.and=function(e){return er(e)||(e=vs(e)),st(this.low&e.low,this.high&e.high,this.unsigned)};oe.or=function(e){return er(e)||(e=vs(e)),st(this.low|e.low,this.high|e.high,this.unsigned)};oe.xor=function(e){return er(e)||(e=vs(e)),st(this.low^e.low,this.high^e.high,this.unsigned)};oe.shiftLeft=function(e){return er(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?st(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):st(0,this.low<<e-32,this.unsigned)};oe.shl=oe.shiftLeft;oe.shiftRight=function(e){return er(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?st(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):st(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};oe.shr=oe.shiftRight;oe.shiftRightUnsigned=function(e){if(er(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return st(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?st(n,0,this.unsigned):st(n>>>e-32,0,this.unsigned)};oe.shru=oe.shiftRightUnsigned;oe.shr_u=oe.shiftRightUnsigned;oe.toSigned=function(){return this.unsigned?st(this.low,this.high,!1):this};oe.toUnsigned=function(){return this.unsigned?this:st(this.low,this.high,!0)};oe.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};oe.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>
vendor: 17,668 bytes, lines 382-479
382>8&255,e>>>16&255,e>>>24]};oe.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};rt.fromBytes=function(e,n,r){return r?rt.fromBytesLE(e,n):rt.fromBytesBE(e,n)};rt.fromBytesLE=function(e,n){return new rt(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};rt.fromBytesBE=function(e,n){return new rt(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)};const RR=EC(ER),A5=HF({__proto__:null,default:RR},[ER]);/**
383 * @license
384 * Copyright 2021 Google LLC. All Rights Reserved.
385 * Licensed under the Apache License, Version 2.0 (the "License");
386 * you may not use this file except in compliance with the License.
387 * You may obtain a copy of the License at
388 *
389 * http://www.apache.org/licenses/LICENSE-2.0
390 *
391 * Unless required by applicable law or agreed to in writing, software
392 * distributed under the License is distributed on an "AS IS" BASIS,
393 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
394 * See the License for the specific language governing permissions and
395 * limitations under the License.
396 * =============================================================================
397 */const Lo=RR||A5;function om(t){return Lo.fromString(t,!0,16)}const OR=om("c3a5c85c97cb3127"),Fo=om("b492b66fbe98f273"),xn=om("9ae16a3b2f90404f");function $0(t){return t.xor(t.shru(47))}function DR(t,e,n){const r=t.slice(e,e+n);return Lo.fromBytes(Array.from(r),!0,!0)}function Qe(t,e){return DR(t,e,8)}function fT(t,e){return DR(t,e,4)}function Wt(t,e){return e===0?t:t.shru(e).or(t.shl(64-e))}function to(t,e,n=om("9ddfea08eb382d69")){let r=t.xor(e).mul(n);r=r.xor(r.shru(47));let s=e.xor(r).mul(n);return s=s.xor(s.shru(47)),s=s.mul(n),s}function R5(t,e,n,r,s,i){s=s.add(t),i=Wt(i.add(s).add(r),21);const o=s;return s=s.add(e),s=s.add(n),i=i.add(Wt(s,44)),[s.add(r),i.add(o)]}function fd(t,e,n,r){return R5(Qe(t,e),Qe(t,e+8),Qe(t,e+16),Qe(t,e+24),n,r)}function O5(t,e=t.length){if(e>=8){const n=xn.add(e*2),r=Qe(t,0).add(xn),s=Qe(t,e-8),i=Wt(s,37).mul(n).add(r),o=Wt(r,25).add(s).mul(n);return to(i,o,n)}if(e>=4){const n=xn.add(e*2),r=fT(t,0);return to(r.shl(3).add(e),fT(t,e-4),n)}if(e>0){const n=t[0],r=t[e>>1],s=t[e-1],i=n+(r<<8),o=e+(s<<2);return $0(xn.mul(i).xor(OR.mul(o))).mul(xn)}return xn}function D5(t,e=t.length){const n=xn.add(e*2),r=Qe(t,0).mul(Fo),s=Qe(t,8),i=Qe(t,e-8).mul(n),o=Qe(t,e-16).mul(xn);return to(Wt(r.add(s),43).add(Wt(i,30)).add(o),r.add(Wt(s.add(xn),18)).add(i),n)}function P5(t,e=t.length){const n=xn.add(e*2),r=Qe(t,0).mul(xn),s=Qe(t,8),i=Qe(t,e-8).mul(n),o=Qe(t,e-16).mul(xn),a=Wt(r.add(s),43).add(Wt(i,30)).add(o),u=to(a,r.add(Wt(s.add(xn),18)).add(i),n),l=Qe(t,16).mul(n),c=Qe(t,24),h=a.add(Qe(t,e-32)).mul(n),d=u.add(Qe(t,e-24)).mul(n);return to(Wt(l.add(c),43).add(Wt(h,30)).add(d),l.add(Wt(c.add(r),18)).add(h),n)}function F5(t,e=t.length){const n=Lo.fromNumber(81,!0);if(e<=32)return e<=16?O5(t,e):D5(t,e);if(e<=64)return P5(t,e);let r=n,s=n.mul(Fo).add(113),i=$0(s.mul(xn).add(113)).mul(xn),o=[Lo.UZERO,Lo.UZERO],a=[Lo.UZERO,Lo.UZERO];r=r.mul(xn).add(Qe(t,0));let u=0;const l=(e-1>>6)*64,c=l+(e-1&63)-63;do r=Wt(r.add(s).add(o[0]).add(Qe(t,u+8)),37).mul(Fo),s=Wt(s.add(o[1]).add(Qe(t,u+48)),42).mul(Fo),r=r.xor(a[1]),s=s.add(o[0]).add(Qe(t,u+40)),i=Wt(i.add(a[0]),33).mul(Fo),o=fd(t,u,o[1].mul(Fo),r.add(a[0])),a=fd(t,u+32,i.add(a[1]),s.add(Qe(t,u+16))),[i,r]=[r,i],u+=64;while(u!==l);const h=Fo.add(i.and(255).shl(1));return u=c,a[0]=a[0].add(e-1&63),o[0]=o[0].add(a[0]),a[0]=a[0].add(o[0]),r=Wt(r.add(s).add(o[0]).add(Qe(t,u+8)),37).mul(h),s=Wt(s.add(o[1]).add(Qe(t,u+48)),42).mul(h),r=r.xor(a[1].mul(9)),s=s.add(o[0].mul(9).add(Qe(t,u+40))),i=Wt(i.add(a[0]),33).mul(h),o=fd(t,u,o[1].mul(h),r.add(a[0])),a=fd(t,u+32,i.add(a[1]),s.add(Qe(t,u+16))),[i,r]=[r,i],to(to(o[0],a[0],h).add($0(s).mul(OR)).add(i),to(o[1],a[1],h).add(r),h)}/**
398 * @license
399 * Copyright 2017 Google LLC. All Rights Reserved.
400 * Licensed under the Apache License, Version 2.0 (the "License");
401 * you may not use this file except in compliance with the License.
402 * You may obtain a copy of the License at
403 *
404 * http://www.apache.org/licenses/LICENSE-2.0
405 *
406 * Unless required by applicable law or agreed to in writing, software
407 * distributed under the License is distributed on an "AS IS" BASIS,
408 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409 * See the License for the specific language governing permissions and
410 * limitations under the License.
411 * =============================================================================
412 */function ml(t,e){return e==="string"?na(t):am([t],e)}function L5(t,e){return t instanceof Float32Array&&e==="float32"||t instanceof Int32Array&&e==="int32"||t instanceof Uint8Array&&e==="bool"}function am(t,e){if(e==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=ga(t)),U().getBool("DEBUG")&&i5(t,e),L5(t,e))return t;if(e==null||e==="float32"||e==="complex64")return new Float32Array(t);if(e==="int32")return new Int32Array(t);if(e==="bool"){const n=new Uint8Array(t.length);for(let r=0;r<n.length;++r)Math.round(t[r])!==0&&(n[r]=1);return n}else throw new Error(`Unknown data type ${e}`)}function Zr(){return U().platform.now()}function na(t,e="utf-8"){return e=e||"utf-8",U().platform.encode(t,e)}function Qu(t,e="utf-8"){return e=e||"utf-8",U().platform.decode(t,e)}function Br(t){return U().platform.isTypedArray!=null?U().platform.isTypedArray(t):NR(t)}function ga(t,e=[],n=!1){if(e==null&&(e=[]),typeof t=="boolean"||typeof t=="number"||typeof t=="string"||ma(t)||t==null||Br(t)&&n)e.push(t);else if(Array.isArray(t)||Br(t))for(let r=0;r<t.length;++r)ga(t[r],e,n);else{let r=-1;for(const s of Object.keys(t))/^([1-9]+[0-9]*|0)$/.test(s)&&(r=Math.max(r,Number(s)));for(let s=0;s<=r;s++)ga(t[s],e,n)}return e}/**
413 * @license
414 * Copyright 2018 Google LLC. All Rights Reserved.
415 * Licensed under the Apache License, Version 2.0 (the "License");
416 * you may not use this file except in compliance with the License.
417 * You may obtain a copy of the License at
418 *
419 * http://www.apache.org/licenses/LICENSE-2.0
420 *
421 * Unless required by applicable law or agreed to in writing, software
422 * distributed under the License is distributed on an "AS IS" BASIS,
423 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424 * See the License for the specific language governing permissions and
425 * limitations under the License.
426 * =============================================================================
427 */class M5{constructor(e,n){this.backendTimer=e,this.logger=n,n==null&&(this.logger=new B5)}profileKernel(e,n,r){let s;const i=()=>{s=r()};let o;const a=Zr();if(this.backendTimer.timerAvailable())o=this.backendTimer.time(i);else{i();for(const l of s)l.dataSync();o=Promise.resolve({kernelMs:Zr()-a})}if(U().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let l=0;l<s.length;l++){const c=s[l];c.data().then(h=>{V5(h,c.dtype,e)})}return{kernelName:e,outputs:s,inputs:n,timeMs:o.then(l=>l.kernelMs),extraInfo:o.then(l=>l.getExtraProfileInfo!=null?l.getExtraProfileInfo():"")}}logKernelProfile(e){const{kernelName:n,outputs:r,timeMs:s,inputs:i,extraInfo:o}=e;r.forEach(a=>{Promise.all([a.data(),s,o]).then(u=>{this.logger.logKernelProfile(n,a,u[0],u[1],i,u[2])})})}}function V5(t,e,n){if(e!=="float32")return!1;for(let r=0;r<t.length;r++){const s=t[r];if(isNaN(s)||!isFinite(s))return console.warn(`Found ${s} in the result of '${n}'`),!0}return!1}class B5{logKernelProfile(e,n,r,s,i,o){const a=typeof s=="number"?ku(`${s}ms`,9):s.error,u=ku(e,25),l=n.rank,c=n.size,h=ku(n.shape.toString(),14);let d="";for(const f in i){const p=i[f];if(p!=null){const y=p.shape||n.shape,v=y.length;d+=`${f}: ${v}D ${v>0?y:""} `}}console.log(`%c${u}	%c${a}	%c${l}D ${h}	%c${c}	%c${d}	%c${o}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}/**
428 * @license
429 * Copyright 2017 Google LLC. All Rights Reserved.
430 * Licensed under the Apache License, Version 2.0 (the "License");
431 * you may not use this file except in compliance with the License.
432 * You may obtain a copy of the License at
433 *
434 * http://www.apache.org/licenses/LICENSE-2.0
435 *
436 * Unless required by applicable law or agreed to in writing, software
437 * distributed under the License is distributed on an "AS IS" BASIS,
438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
439 * See the License for the specific language governing permissions and
440 * limitations under the License.
441 * =============================================================================
442 */function W5(t,e,n){const r={},s={};for(let u=0;u<e.length;u++)r[e[u].id]=!0;for(let u=0;u<t.length;u++){const l=t[u],c=l.inputs;for(const h in c){const d=c[h];let f=!1;for(let p=0;p<e.length;p++)if(r[d.id]){l.outputs.forEach(y=>r[y.id]=!0),f=!0,s[l.id]=!0;break}if(f)break}}const i={};i[n.id]=!0;const o={};for(let u=t.length-1;u>=0;u--){const l=t[u],c=l.inputs;for(let h=0;h<l.outputs.length;h++)if(i[l.outputs[h].id]){for(const d in c)i[c[d].id]=!0,o[l.id]=!0;break}}const a=[];for(let u=0;u<t.length;u++){const l=t[u];if(s[l.id]&&o[l.id]){const c={};for(const d in l.inputs){const f=l.inputs[d];r[f.id]&&(c[d]=f)}const h=Object.assign({},l);h.inputs=c,h.outputs=l.outputs,a.push(h)}}return a}function U5(t,e,n,r){for(let s=e.length-1;s>=0;s--){const i=e[s],o=[];if(i.outputs.forEach(u=>{const l=t[u.id];l!=null?o.push(l):o.push(null)}),i.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${i.kernelName}.`);const a=i.gradient(o);for(const u in i.inputs){if(!(u in a))throw new Error(`Cannot backprop through input ${u}. Available gradients found: ${Object.keys(a)}.`);const l=n(()=>a[u]());if(l.dtype!=="float32")throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input ${u} must have 'float32' dtype, but has '${l.dtype}'`);const c=i.inputs[u];if(!xt(l.shape,c.shape))throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input '${u}' has shape '${l.shape}', which does not match the shape of the input '${c.shape}'`);if(t[c.id]==null)t[c.id]=l;else{const h=t[c.id];t[c.id]=r(h,l),h.dispose()}}}}/**
443 * @license
444 * Copyright 2018 Google LLC. All Rights Reserved.
445 * Licensed under the Apache License, Version 2.0 (the "License");
446 * you may not use this file except in compliance with the License.
447 * You may obtain a copy of the License at
448 *
449 * http://www.apache.org/licenses/LICENSE-2.0
450 *
451 * Unless required by applicable law or agreed to in writing, software
452 * distributed under the License is distributed on an "AS IS" BASIS,
453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
454 * See the License for the specific language governing permissions and
455 * limitations under the License.
456 * =============================================================================
457 */const pT=20,zl=3,Dg=7;function z5(t,e,n,r){const s=Zt(e),i=j5(t,e,n,s),o=e.length,a=Gd(t,e,n,s,i),u=["Tensor"];return r&&(u.push(`  dtype: ${n}`),u.push(`  rank: ${o}`),u.push(`  shape: [${e}]`),u.push("  values:")),u.push(a.map(l=>"    "+l).join(`
458`)),u.join(`
459`)}function j5(t,e,n,r){const s=ne(e),i=r[r.length-1],o=new Array(i).fill(0),a=e.length,u=n==="complex64"?Jl(t):t;if(a>1)for(let l=0;l<s/i;l++){const c=l*i;for(let h=0;h<i;h++)o[h]=Math.max(o[h],Zl(u[c+h],0,n).length)}return o}function Zl(t,e,n){let r;return Array.isArray(t)?r=`${parseFloat(t[0].toFixed(Dg))} + ${parseFloat(t[1].toFixed(Dg))}j`:im(t)?r=`'${t}'`:n==="bool"?r=PR(t):r=parseFloat(t.toFixed(Dg)).toString(),ku(r,e)}function PR(t){return t===0?"false":"true"}function Gd(t,e,n,r,s,i=!0){const o=n==="complex64"?2:1,a=e[0],u=e.length;if(u===0){if(n==="complex64"){const y=Jl(t);return[Zl(y[0],0,n)]}return n==="bool"?[PR(t[0])]:[t[0].toString()]}if(u===1){if(a>pT){const v=zl*o;let g=Array.from(t.slice(0,v)),x=Array.from(t.slice((a-zl)*o,a*o));return n==="complex64"&&(g=Jl(g),x=Jl(x)),["["+g.map((w,_)=>Zl(w,s[_],n)).join(", ")+", ..., "+x.map((w,_)=>Zl(w,s[a-zl+_],n)).join(", ")+"]"]}return["["+(n==="complex64"?Jl(t):Array.from(t)).map((v,g)=>Zl(v,s[g],n)).join(", ")+"]"]}const l=e.slice(1),c=r.slice(1),h=r[0]*o,d=[];if(a>pT){for(let y=0;y<zl;y++){const v=y*h,g=v+h;d.push(...Gd(t.slice(v,g),l,n,c,s,!1))}d.push("...");for(let y=a-zl;y<a;y++){const v=y*h,g=v+h;d.push(...Gd(t.slice(v,g),l,n,c,s,y===a-1))}}else for(let y=0;y<a;y++){const v=y*h,g=v+h;d.push(...Gd(t.slice(v,g),l,n,c,s,y===a-1))}const f=u===2?",":"";d[0]="["+(a>0?d[0]+f:"");for(let y=1;y<d.length-1;y++)d[y]=" "+d[y]+f;let p=`,
460`;for(let y=2;y<u;y++)p+=`
461`;return d[d.length-1]=" "+d[d.length-1]+"]"+(i?"":p),d}function Jl(t){const e=[];for(let n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}/**
462 * @license
463 * Copyright 2017 Google LLC. All Rights Reserved.
464 * Licensed under the Apache License, Version 2.0 (the "License");
465 * you may not use this file except in compliance with the License.
466 * You may obtain a copy of the License at
467 *
468 * http://www.apache.org/licenses/LICENSE-2.0
469 *
470 * Unless required by applicable law or agreed to in writing, software
471 * distributed under the License is distributed on an "AS IS" BASIS,
472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
473 * See the License for the specific language governing permissions and
474 * limitations under the License.
475 * =============================================================================
476 */class Zu{constructor(e,n,r){if(this.dtype=n,this.shape=e.slice(),this.size=ne(e),r!=null){const s=r.length;A(s===this.size,()=>`Length of values '${s}' does not match the size inferred by the shape '${this.size}'.`)}if(n==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=r||zt(n,this.size),this.strides=Zt(e)}set(e,...n){n.length===0&&(n=[0]),A(n.length===this.rank,()=>`The number of provided coordinates (${n.length}) must match the rank (${this.rank})`);const r=this.locToIndex(n);this.values[r]=e}get(...e){e.length===0&&(e=[0]);let n=0;for(const s of e){if(s<0||s>=this.shape[n]){const i=`Requested out of range element at ${e}.   Buffer shape=${this.shape}`;throw new Error(i)}n++}let r=e[e.length-1];for(let s=0;s<e.length-1;++s)r+=this.strides[s]*e[s];return this.values[r]}locToIndex(e){if(this.rank===0)return 0;if(this.rank===1)return e[0];let n=e[e.length-1];for(let r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return n}indexToLoc(e){if(this.rank===0)return[];if(this.rank===1)return[e];const n=new Array(this.shape.length);for(let r=0;r<n.length-1;++r)n[r]=Math.floor(e/this.strides[r]),e-=n[r]*this.strides[r];return n[n.length-1]=e,n}get rank(){return this.shape.length}toTensor(){return ts().makeTensor(this.values,this.shape,this.dtype)}}let ts=null,Ya=null;function G5(t){ts=t}function H5(t){Ya=t}class Lt{constructor(e,n,r,s){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=n||"float32",this.size=ne(e),this.strides=Zt(e),this.dataId=r,this.id=s,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return Ya.buffer(this.shape,this.dtype,e)}bufferSync(){return Ya.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return b0(this.shape,e,this.dtype==="complex64")}arraySync(){return b0(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();const e=ts().read(this.dataId);if(this.dtype==="string"){const n=await e;try{return n.map(r=>Qu(r))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),ts().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=ts().readSync(this.dataId);if(this.dtype==="string")try{return e.map(n=>Qu(n))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await ts().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),ts().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return Ya.print(this,e)}clone(){return this.throwIfDisposed(),Ya.clone(this)}toString(e=!1){const n=this.dataSync();return z5(n,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),Ya.cast(this,e)}variable(e=!0,n,r){return this.throwIfDisposed(),ts().makeVariable(this,e,n,r)}}Object.defineProperty(Lt,Symbol.hasInstance,{value:t=>!!t&&t.data!=null&&t.dataSync!=null&&t.throwIfDisposed!=null});function FR(){return T1("Tensor",()=>Lt)}FR();class Hf extends Lt{constructor(e,n,r,s){super(e.shape,e.dtype,e.dataId,s),this.trainable=n,this.name=r}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!xt(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);ts().disposeTensor(this),this.dataId=e.dataId,ts().incRef(this,null)}dispose(){ts().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(Hf,Symbol.hasInstance,{value:t=>t instanceof Lt&&t.assign!=null&&t.assign instanceof Function});/**
477 * @license
478 * Copyright 2017 Google LLC. All Rights Reserved.
479 * Licensed under the Apache License, Version 2.0 (the "License");
480 * you may not use this file except in compliance with the License.
481 * You may obtain a copy of the License at
482 *
483 * http://www.apache.org/licenses/LICENSE-2.0
484 *
485 * Unless required by applicable law or agreed to in writing, software
486 * distributed under the License is distributed on an "AS IS" BASIS,
487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
488 * See the License for the specific language governing permissions and
489 * limitations under the License.
490 * =============================================================================
491 */var mT;(function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"})(mT||(mT={}));var I0;(function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"})(I0||(I0={}));var A0;(function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"})(A0||(A0={}));var R0;(function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"})(R0||(R0={}));var O0;(function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"})(O0||(O0={}));const q5={float32:R0,int32:I0,bool:A0,complex64:O0};function zs(t,e){if(t==="string"||e==="string"){if(t==="string"&&e==="string")return"string";throw new Error(`Can not upcast ${t} with ${e}`)}return q5[t][e]}function I1(t){return zs(t,"int32")}function LR(t){return t!=null&&typeof t=="object"&&"texture"in t&&t.texture instanceof WebGLTexture}function MR(t){return typeof GPUBuffer<"u"&&t!=null&&typeof t=="object"&&"buffer"in t&&t.buffer instanceof GPUBuffer}/**
492 * @license
493 * Copyright 2018 Google LLC. All Rights Reserved.
494 * Licensed under the Apache License, Version 2.0 (the "License");
495 * you may not use this file except in compliance with the License.
496 * You may obtain a copy of the License at
497 *
498 * http://www.apache.org/licenses/LICENSE-2.0
499 *
500 * Unless required by applicable law or agreed to in writing, software
501 * distributed under the License is distributed on an "AS IS" BASIS,
502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
503 * See the License for the specific language governing permissions and
504 * limitations under the License.
505 * =============================================================================
506 */function Tt(t,e){if(t.dtype===e.dtype)return[t,e];const n=zs(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function K5(t,e){A(t.dtype===e.dtype,()=>`The dtypes of the first(${t.dtype}) and second(${e.dtype}) input must match`)}function VR(t){const e=[];return BR(t,e,new Set),e}function BR(t,e,n){if(t==null)return;if(t instanceof Lt){e.push(t);return}if(!X5(t))return;const r=t;for(const s in r){const i=r[s];n.has(i)||(n.add(i),BR(i,e,n))}}function X5(t){return Array.isArray(t)||typeof t=="object"}/**
507 * @license
508 * Copyright 2018 Google LLC. All Rights Reserved.
509 * Licensed under the Apache License, Version 2.0 (the "License");
510 * you may not use this file except in compliance with the License.
511 * You may obtain a copy of the License at
512 *
513 * http://www.apache.org/licenses/LICENSE-2.0
514 *
515 * Unless required by applicable law or agreed to in writing, software
516 * distributed under the License is distributed on an "AS IS" BASIS,
517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
518 * See the License for the specific language governing permissions and
519 * limitations under the License.
520 * =============================================================================
521 */function Pg(t){return t.kernelName!=null}class gT{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class Ju{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new gT}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;const e=this.getSortedBackends();for(let n=0;n<e.length;n++){const r=e[n];if(await this.initializeBackend(r).success){await this.setBackend(r);return}}throw new Error("Could not initialize any backends, all backend initializations failed.")}
vendor: 14,681 bytes, lines 521-524
521get backend(){if(this.pendingBackendInit!=null)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(this.backendInstance==null){const{name:e,asyncInit:n}=this.initializeBackendsAndReturnBest();if(n)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry))if(e in this.registryFactory){const{asyncInit:n}=this.initializeBackend(e);if(n)return null}else return null;return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,n,r=1){return e in this.registryFactory?(ss(`${e} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[e]={factory:n,priority:r},!0)}async setBackend(e){if(this.registryFactory[e]==null)throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,this.registry[e]==null){this.backendInstance=null;const{success:n,asyncInit:r}=this.initializeBackend(e);if(!(r?await n:n))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new M5(this.backendInstance),!0}setupRegisteredKernels(){aT(this.backendName).forEach(n=>{n.setupFunc!=null&&n.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){aT(e).forEach(r=>{r.disposeFunc!=null&&r.disposeFunc(this.registry[e])})}initializeBackend(e){const n=this.registryFactory[e];if(n==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const r=n.factory();if(r&&!(r instanceof A$)&&typeof r.then=="function"){const s=++this.pendingBackendInitId,i=r.then(o=>s<this.pendingBackendInitId?!1:(this.registry[e]=o,this.pendingBackendInit=null,!0)).catch(o=>(s<this.pendingBackendInitId||(this.pendingBackendInit=null,ss(`Initialization of backend ${e} failed`),ss(o.stack||o.message)),!1));return this.pendingBackendInit=i,{success:i,asyncInit:!0}}else return this.registry[e]=r,{success:!0,asyncInit:!1}}catch(r){return ss(`Initialization of backend ${e} failed`),ss(r.stack||r.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((e,n)=>this.registryFactory[n].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let n=0;n<e.length;n++){const r=e[n],{success:s,asyncInit:i}=this.initializeBackend(r);if(i||s)return{name:r,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,n){const r=this.state.tensorInfo.get(n),s=r.backend,i=this.readSync(n),o=s.refCount(n);s.disposeData(n,!0),r.backend=e,e.move(n,i,r.shape,r.dtype,o),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,n){let r=null;if(n==null){if(typeof e!="function")throw new Error("Please provide a function to tidy()");n=e}else{if(typeof e!="string"&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof n!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=e}let s;return this.scopedRun(()=>this.startScope(r),()=>this.endScope(s),()=>(s=n(),s instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),s))}scopedRun(e,n,r){e();try{const s=r();return n(),s}catch(s){throw n(),s}}nextTensorId(){return Ju.nextTensorId++}nextVariableId(){return Ju.nextVariableId++}clone(e){const n=V.runKernel(E1,{x:e}),r={x:e},s=o=>({x:()=>{const a="float32",u={x:o},l={dtype:a};return V.runKernel(N1,u,l)}}),i=[];return this.addTapeNode(this.state.activeScope.name,r,[n],s,i,{}),n}runKernel(e,n,r){if(this.backendName==null&&this.backend,!(E0(e,this.backendName)!=null))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:n,attrs:r})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,n,r){const s=this.backend.numDataIds();let i=0;r.forEach(u=>{i+=u.dtype==="complex64"?3:1});const o=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],a=s-n-i-o;if(a>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${a} data ids) after running '${e}'`)}runKernelFunc(e){let n,r=[];const s=this.isTapeOn(),i=this.state.numBytes,o=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let a;this.backendName==null&&this.backend;let u;const l=Pg(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Pg(e)){const{kernelName:p,inputs:y,attrs:v}=e;this.backendName==null&&this.backend;const g=E0(p,this.backendName);A(g!=null,()=>`Cannot find registered kernel '${p}' for backend '${this.backendName}'`),a=()=>{const x=this.backend.numDataIds();u=g.kernelFunc({inputs:y,attrs:v,backend:this.backend});const w=Array.isArray(u)?u:[u];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(p,x,w);const _=w.map(T=>T.rank!=null?T:this.makeTensorFromTensorInfo(T));if(s){const T=this.getTensorsForGradient(p,y,_);r=this.saveTensorsForBackwardMode(T)}return _}}else{const{forwardFunc:p}=e,y=v=>{s&&(r=v.map(g=>this.keep(this.clone(g))))};a=()=>{const v=this.backend.numDataIds();u=this.tidy(()=>p(this.backend,y));const g=Array.isArray(u)?u:[u];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,v,g),g}}const{inputs:c,attrs:h}=e,d=Pg(e)?null:e.backwardsFunc;let f;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?n=a():(f=this.profiler.profileKernel(l,c,()=>a()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),n=f.outputs)}),s&&this.addTapeNode(l,c,n,d,r,h),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-i,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-o,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(c).map(p=>c[p]!=null?c[p].shape:null),outputShapes:n.map(p=>p.shape),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(u)?n:n[0]}saveTensorsForBackwardMode(e){return e.map(r=>this.keep(this.clone(r)))}getTensorsForGradient(e,n,r){const s=oT(e);if(s!=null){const i=s.inputsToSave||[],o=s.outputsToSave||[];let a;s.saveAllInputs?(A(Array.isArray(n),()=>"saveAllInputs is true, expected inputs to be an array."),a=Object.keys(n).map(l=>n[l])):a=i.map(l=>n[l]);const u=r.filter((l,c)=>o[c]);return a.concat(u)}return[]}makeTensor(e,n,r,s){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");r=r||"float32",s=s||this.backend;let i=e;r==="string"&&im(e[0])&&(i=e.map(u=>na(u)));const o=s.write(i,n,r),a=new Lt(n,r,o,this.nextTensorId());if(this.trackTensor(a,s),r==="string"){const u=this.state.tensorInfo.get(o),l=u5(i);this.state.numBytes+=l-u.bytes,u.bytes=l}return a}makeTensorFromDataId(e,n,r,s){r=r||"float32";const i={dataId:e,shape:n,dtype:r};return this.makeTensorFromTensorInfo(i,s)}makeTensorFromTensorInfo(e,n){const{dataId:r,shape:s,dtype:i}=e,o=new Lt(s,i,r,this.nextTensorId());return this.trackTensor(o,n),o}makeVariable(e,n=!0,r,s){r=r||this.nextVariableId().toString(),s!=null&&s!==e.dtype&&(e=e.cast(s));const i=new Hf(e,n,r,this.nextTensorId());if(this.state.registeredVariables[i.name]!=null)throw new Error(`Variable with name ${i.name} was already registered`);return this.state.registeredVariables[i.name]=i,this.incRef(i,this.backend),i}trackTensor(e,n){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let r=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(r=e.size*zf(e.dtype)),this.state.numBytes+=r,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:n||this.backend,dtype:e.dtype,shape:e.shape,bytes:r})),e instanceof Hf||this.track(e)}incRef(e,n){this.trackTensor(e,n),this.backend.incRef(e.dataId)}removeDataId(e,n){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===n&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const n=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=n.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){const r=e.size*zf(e.dtype);this.state.numBytes-=r}n.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,n.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const n=this.state.registeredVariables[e];this.disposeVariable(n)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const n=this.state.numBytes,r=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(s=>s.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-n,this.state.activeProfile.newTensors=this.state.numTensors-r;for(const s of this.state.activeProfile.kernels)s.kernelTimeMs=await s.kernelTimeMs,s.extraInfo=await s.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,n,r,s,i,o){const a={id:this.state.nextTapeNodeId++,kernelName:e,inputs:n,outputs:r,saved:i},u=oT(e);u!=null&&(s=u.gradFunc),s!=null&&(a.gradient=l=>(l=l.map((c,h)=>{if(c==null){const d=r[h],f=fo(d.size,d.dtype);return this.makeTensor(f,d.shape,d.dtype)}return c}),s(l.length>1?l:l[0],i,o))),this.state.activeTape.push(a)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const n={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(n.name=e),this.state.scopeStack.push(n),this.state.activeScope=n}endScope(e){const n=VR(e),r=new Set(n.map(i=>i.id));for(let i=0;i<this.state.activeScope.track.length;i++){const o=this.state.activeScope.track[i];!o.kept&&!r.has(o.id)&&o.dispose()}const s=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(i=>{!i.kept&&i.scopeId===s.id&&this.track(i)})}gradients(e,n,r,s=!1){if(A(n.length>0,()=>"gradients() received an empty list of xs."),r!=null&&r.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${r.dtype}'`);const i=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));A(i instanceof Lt,()=>"The result y returned by f() must be a tensor.");const o=W5(this.state.activeTape,n,i);if(!s&&o.length===0&&n.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{const a={};a[i.id]=r??Y5(i.shape),U5(a,o,l=>this.tidy(l),Q5);const u=n.map(l=>a[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(const c of l.saved)c.dispose()}),this.state.activeTape=null),{value:i,grads:u}})}customGrad(e){return A(x0(e),()=>"The f passed in customGrad(f) must be a function."),(...n)=>{A(n.every(a=>a instanceof Lt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let r;const s={};n.forEach((a,u)=>{s[u]=a});const i=(a,u)=>(r=e(...n,u),A(r.value instanceof Lt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),A(x0(r.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),r.value),o=(a,u)=>{const l=r.gradFunc(a,u),c=Array.isArray(l)?l:[l];A(c.length===n.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),A(c.every(d=>d instanceof Lt),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const h={};return c.forEach((d,f)=>{h[f]=()=>d}),h};return this.runKernelFunc({forwardFunc:i,backwardsFunc:o,inputs:s})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,n){return this.state.tensorInfo.get(e).backend.readToGPU(e,n)}async time(e){const n=Zr(),r=await this.backend.time(e);return r.wallMs=Zr()-n,r}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new gT;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}Ju.nextTensorId=0;Ju.nextVariableId=0;function Y5(t){const e=O$(ne(t),"float32");return V.makeTensor(e,t,"float32")}function WR(){const t=P$();if(t._tfengine==null){const e=new h5(t);t._tfengine=new Ju(e)}return m5(t._tfengine.ENV),G5(()=>t._tfengine),t._tfengine}const V=WR();function Q5(t,e){const n={a:t,b:e};return V.runKernel(C1,n)}/**
522 * @license
523 * Copyright 2017 Google LLC. All Rights Reserved.
524 * Licensed under the Apache License, Version 2.0 (the "License");
525 * you may not use this file except in compliance with the License.
526 * You may obtain a copy of the License at
527 *
528 * http://www.apache.org/licenses/LICENSE-2.0
529 *
530 * Unless required by applicable law or agreed to in writing, software
531 * distributed under the License is distributed on an "AS IS" BASIS,
532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
533 * See the License for the specific language governing permissions and
534 * limitations under the License.
535 * =============================================================================
536 */function Z5(){return typeof navigator<"u"&&navigator!=null}function UR(t){if(t||Z5()){if(t||(t=navigator),t.product==="ReactNative")return!0;const e=t.userAgent||t.vendor||(typeof window<"u"?window.opera:"");if(!e){const n=t;return n.userAgentData&&n.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}return!1}function zR(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}/**
537 * @license
538 * Copyright 2019 Google LLC. All Rights Reserved.
539 * Licensed under the Apache License, Version 2.0 (the "License");
540 * you may not use this file except in compliance with the License.
541 * You may obtain a copy of the License at
542 *
543 * http://www.apache.org/licenses/LICENSE-2.0
544 *
545 * Unless required by applicable law or agreed to in writing, software
546 * distributed under the License is distributed on an "AS IS" BASIS,
547 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
548 * See the License for the specific language governing permissions and
549 * limitations under the License.
550 * =============================================================================
551 */const On=U();On.registerFlag("DEBUG",()=>!1,t=>{t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});On.registerFlag("IS_BROWSER",()=>zR());On.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u");On.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));On.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor));On.registerFlag("PROD",()=>!1);On.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>On.getBool("DEBUG"));On.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);On.registerFlag("IS_TEST",()=>!1);On.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>On.getBool("DEBUG"));On.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);On.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1);On.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);/**
552 * @license
553 * Copyright 2018 Google LLC. All Rights Reserved.
554 * Licensed under the Apache License, Version 2.0 (the "License");
555 * you may not use this file except in compliance with the License.
556 * You may obtain a copy of the License at
557 *
558 * http://www.apache.org/licenses/LICENSE-2.0
559 *
560 * Unless required by applicable law or agreed to in writing, software
561 * distributed under the License is distributed on an "AS IS" BASIS,
562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
563 * See the License for the specific language governing permissions and
564 * limitations under the License.
565 * =============================================================================
566 */function So(t,e){let n=t;if(Br(t))return e==="string"?[]:[t.length];if(LR(t)){const s=t.channels||"RGBA";return[t.height,t.width*s.length]}else if(MR(t))return[t.buffer.size/(e==null?4:zf(e))];if(!Array.isArray(t))return[];const r=[];for(;Array.isArray(n)||Br(n)&&e!=="string";)r.push(n.length),n=n[0];return Array.isArray(t)&&U().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&jR(t,r,[]),r}function jR(t,e,n){if(n=n||[],!Array.isArray(t)&&!Br(t)){A(e.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${e[0]} elements`);return}A(e.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${t.length} elements`),A(t.length===e[0],()=>`Element arr[${n.join("][")}] should have ${e[0]} elements, but has ${t.length} elements`);const r=e.slice(1);for(let s=0;s<t.length;++s)jR(t[s],r,n.concat(s))}function yT(t,e,n,r){if(t!=="string_or_numeric"){if(t==null)throw new Error("Expected dtype cannot be null.");if(t!=="numeric"&&t!==e||t==="numeric"&&e==="string")throw new Error(`Argument '${n}' passed to '${r}' must be ${t} tensor, but got ${e} tensor`)}}function I(t,e,n,r="numeric"){if(t instanceof FR())return yT(r,t.dtype,e,n),t;let s=vh(t);
vendor: 4,690 bytes, lines 566-614
566if(s!=="string"&&["bool","int32","float32"].indexOf(r)>=0&&(s=r),yT(r,s,e,n),t==null||!Br(t)&&!Array.isArray(t)&&typeof t!="number"&&typeof t!="boolean"&&typeof t!="string"){const u=t==null?"null":t.constructor.name;throw new Error(`Argument '${e}' passed to '${n}' must be a Tensor or TensorLike, but got '${u}'`)}const i=So(t,s);!Br(t)&&!Array.isArray(t)&&(t=[t]);const a=s!=="string"?am(t,s):ga(t,[],!0);return V.makeTensor(a,i,s)}function qf(t,e,n,r="numeric"){if(!Array.isArray(t))throw new Error(`Argument ${e} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return t.map((i,o)=>I(i,`${e}[${o}]`,n,r))}/**
567 * @license
568 * Copyright 2018 Google LLC. All Rights Reserved.
569 * Licensed under the Apache License, Version 2.0 (the "License");
570 * you may not use this file except in compliance with the License.
571 * You may obtain a copy of the License at
572 *
573 * http://www.apache.org/licenses/LICENSE-2.0
574 *
575 * Unless required by applicable law or agreed to in writing, software
576 * distributed under the License is distributed on an "AS IS" BASIS,
577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
578 * See the License for the specific language governing permissions and
579 * limitations under the License.
580 * =============================================================================
581 */const GR="__op";function M(t){const e=Object.keys(t);if(e.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${e.length} keys.`);let n=e[0];const r=t[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+GR;const s=(...i)=>{V.startScope(n);try{const o=r(...i);return ma(o)&&console.error("Cannot return a Promise inside of tidy."),V.endScope(o),o}catch(o){throw V.endScope(null),o}};return Object.defineProperty(s,"name",{value:n,configurable:!0}),s}/**
582 * @license
583 * Copyright 2020 Google LLC. All Rights Reserved.
584 * Licensed under the Apache License, Version 2.0 (the "License");
585 * you may not use this file except in compliance with the License.
586 * You may obtain a copy of the License at
587 *
588 * http://www.apache.org/licenses/LICENSE-2.0
589 *
590 * Unless required by applicable law or agreed to in writing, software
591 * distributed under the License is distributed on an "AS IS" BASIS,
592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
593 * See the License for the specific language governing permissions and
594 * limitations under the License.
595 * =============================================================================
596 */function J5(t,e){const n=I(t,"real","complex"),r=I(e,"imag","complex");mr(n.shape,r.shape,`real and imag shapes, ${n.shape} and ${r.shape}, must match in call to tf.complex().`);const s={real:n,imag:r};return V.runKernel(sI,s)}const po=M({complex_:J5});/**
597 * @license
598 * Copyright 2018 Google LLC. All Rights Reserved.
599 * Licensed under the Apache License, Version 2.0 (the "License");
600 * you may not use this file except in compliance with the License.
601 * You may obtain a copy of the License at
602 *
603 * http://www.apache.org/licenses/LICENSE-2.0
604 *
605 * Unless required by applicable law or agreed to in writing, software
606 * distributed under the License is distributed on an "AS IS" BASIS,
607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
608 * See the License for the specific language governing permissions and
609 * limitations under the License.
610 * =============================================================================
611 */function To(t,e,n,r){if(r==null)r=vh(t);else if(r==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(MR(t)||LR(t)){if(r!=="float32"&&r!=="int32")throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${r}.`);return V.backend.createTensorFromGPUData(t,e||n,r)}if(!Br(t)&&!Array.isArray(t)&&typeof t!="number"&&typeof t!="boolean"&&typeof t!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(e!=null){gr(e);const s=ne(e),i=ne(n);A(s===i,()=>`Based on the provided shape, [${e}], the tensor should have ${s} values but has ${i}`);for(let o=0;o<n.length;++o){const a=n[o],u=o===n.length-1?a!==ne(e.slice(o)):!0;A(n[o]===e[o]||!u,()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${e}). `)}}return!Br(t)&&!Array.isArray(t)&&(t=[t]),e=e||n,t=r!=="string"?am(t,r):ga(t,[],!0),V.makeTensor(t,e,r)}/**
612 * @license
613 * Copyright 2018 Google LLC. All Rights Reserved.
614 * Licensed under the Apache License, Version 2.0 (the "License");
615 * you may not use this file except in compliance with the License.
616 * You may obtain a copy of the License at
617 *
618 * http://www.apache.org/licenses/LICENSE-2.0
619 *
620 * Unless required by applicable law or agreed to in writing, software
621 * distributed under the License is distributed on an "AS IS" BASIS,
622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
623 * See the License for the specific language governing permissions and
624 * limitations under the License.
625 * =============================================================================
626 */function Vs(t,e,n){const r=So(t,n);return To(t,e,r,n)}/**
627 * @license
628 * Copyright 2018 Google LLC. All Rights Reserved.
629 * Licensed under the Apache License, Version 2.0 (the "License");
630 * you may not use this file except in compliance with the License.
631 * You may obtain a copy of the License at
632 *
633 * http://www.apache.org/licenses/LICENSE-2.0
634 *
635 * Unless required by applicable law or agreed to in writing, software
636 * distributed under the License is distributed on an "AS IS" BASIS,
637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
638 * See the License for the specific language governing permissions and
639 * limitations under the License.
640 * =============================================================================
641 */const ya={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class xs{static join(e){return new xs(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,e==null||(e instanceof Array||(e=[e]),e=e.map(r=>Br(r)?r.buffer:r),e.length===0))return;this.bufferUniformSize=e[0].byteLength;let n=0;for(let r=0;r<e.length;r++){const s=e[r];r!==e.length-1&&s.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const i=n+s.byteLength;this.shards.push({buffer:s,start:n,end:i}),n=i}this.shards.length===0&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,n=this.byteLength){if(this.shards.length===0)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,n=isNaN(Number(n))?0:n,e=Math.max(0,e),n=Math.min(this.byteLength,n),n<=e)return new ArrayBuffer(0);const r=this.findShardForByte(e);if(r===-1)throw new Error(`Could not find start shard for byte ${e}`);const s=n-e,i=new ArrayBuffer(s),o=new Uint8Array(i);let a=0;for(let u=r;u<this.shards.length;u++){const l=this.shards[u],h=e+a-l.start,d=a,p=Math.min(n,l.end)-l.start,y=new Uint8Array(l.buffer,h,p-h);if(o.set(y,d),a+=y.length,n<l.end)break}return i}findShardForByte(e){if(this.shards.length===0||e<0||e>=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function n(s){return e<s.start?-1:e>=s.end?1:0}
641if(n(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;const r=eq(this.shards,n);return r===-1?-1:(this.previousShardIndex=r,this.previousShardIndex)}}function eq(t,e){let n=0,r=t.length;for(;n<=r;){const s=Math.floor((r-n)/2)+n,i=e(t[s]);if(i===0)return s;i<0?r=s:n=s+1}return-1}/**
642 * @license
643 * Copyright 2018 Google LLC. All Rights Reserved.
644 * Licensed under the Apache License, Version 2.0 (the "License");
645 * you may not use this file except in compliance with the License.
646 * You may obtain a copy of the License at
647 *
648 * http://www.apache.org/licenses/LICENSE-2.0
649 *
650 * Unless required by applicable law or agreed to in writing, software
651 * distributed under the License is distributed on an "AS IS" BASIS,
652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
653 * See the License for the specific language governing permissions and
654 * limitations under the License.
655 * =============================================================================
656 */function Oi(){return V}function $e(t,e){return V.tidy(t,e)}function mt(t){VR(t).forEach(n=>n.dispose())}function Is(t){return V.keep(t)}function tq(){return V.backendName}function nq(t,e,n=1){return V.registerBackend(t,e,n)}function rq(){return V.backend}/**
657 * @license
658 * Copyright 2018 Google LLC. All Rights Reserved.
659 * Licensed under the Apache License, Version 2.0 (the "License");
660 * you may not use this file except in compliance with the License.
661 * You may obtain a copy of the License at
662 *
663 * http://www.apache.org/licenses/LICENSE-2.0
664 *
665 * Unless required by applicable law or agreed to in writing, software
666 * distributed under the License is distributed on an "AS IS" BASIS,
667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
668 * See the License for the specific language governing permissions and
669 * limitations under the License.
670 * =============================================================================
671 */const mo=4;async function sq(t,e){const n=[],r=[],s=Array.isArray(t)?t.map(o=>o.name):Object.keys(t);for(let o=0;o<s.length;++o){const a=s[o],u=Array.isArray(t)?t[o].tensor:t[a];if(u.dtype!=="float32"&&u.dtype!=="int32"&&u.dtype!=="bool"&&u.dtype!=="string"&&u.dtype!=="complex64")throw new Error(`Unsupported dtype in weight '${a}': ${u.dtype}`);const l={name:a,shape:u.shape,dtype:u.dtype};if(u.dtype==="string"){const c=new Promise(async h=>{const d=await u.bytes(),f=d.reduce((v,g)=>v+g.length,0)+mo*d.length,p=new Uint8Array(f);let y=0;for(let v=0;v<d.length;v++){const g=d[v],x=new Uint8Array(new Uint32Array([g.length]).buffer);p.set(x,y),y+=mo,p.set(g,y),y+=g.length}h(p)});r.push(c)}else r.push(u.data());e!=null&&(l.group=e),n.push(l)}const i=await Promise.all(r);return{data:aq(i),specs:n}}function HR(t,e){const n=new xs(t),r={};let s=0;for(const i of e){const o=iq(i,(a,u)=>n.slice(s+a,s+u));r[i.name]=qR(i,n.slice(s,s+o)),s+=o}return r}function iq(t,e){const n=ne(t.shape);let r;if("quantization"in t){const s=t.quantization;r=ya[s.dtype]}else if(t.dtype==="string"){let s=0;for(let i=0;i<n;i++)s+=mo+new Uint32Array(e(s,s+mo))[0];return s}else r=ya[t.dtype];return n*r}async function oq(t,e){const n=ne(t.shape);let r;if("quantization"in t){const s=t.quantization;r=ya[s.dtype]}else if(t.dtype==="string"){let s=0;for(let i=0;i<n;i++)s+=mo+new Uint32Array(await e(s,s+mo))[0];return s}else r=ya[t.dtype];return n*r}function qR(t,e){const n=t.name,r=t.dtype,s=t.shape,i=ne(s);let o,a=0;if("quantization"in t){const u=t.quantization;if(u.dtype==="uint8"||u.dtype==="uint16"){if(!("min"in u&&"scale"in u))throw new Error(`Weight ${t.name} with quantization ${u.dtype} doesn't have corresponding metadata min and scale.`)}else if(u.dtype==="float16"){if(r!=="float32")throw new Error(`Weight ${t.name} is quantized with ${u.dtype} which only supports weights of type float32 not ${r}.`)}else throw new Error(`Weight ${t.name} has unknown quantization dtype ${u.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);const l=ya[u.dtype],c=u.dtype==="uint8"?new Uint8Array(e):new Uint16Array(e);if(r==="float32")if(u.dtype==="uint8"||u.dtype==="uint16"){o=new Float32Array(c.length);for(let h=0;h<c.length;h++){const d=c[h];o[h]=d*u.scale+u.min}}else if(u.dtype==="float16")o=pq()(c);else throw new Error(`Unsupported quantization type ${u.dtype} for weight type float32.`);else if(r==="int32"){if(u.dtype!=="uint8"&&u.dtype!=="uint16")throw new Error(`Unsupported quantization type ${u.dtype} for weight type int32.`);o=new Int32Array(c.length);for(let h=0;h<c.length;h++){const d=c[h];o[h]=Math.round(d*u.scale+u.min)}}else throw new Error(`Unsupported dtype in weight '${n}': ${r}`);a+=i*l}else if(r==="string"){const u=ne(t.shape);o=[];for(let l=0;l<u;l++){const c=new Uint32Array(e.slice(a,a+mo))[0];a+=mo;const h=new Uint8Array(e.slice(a,a+c));o.push(h),a+=c}}else{const u=ya[r];if(r==="float32")o=new Float32Array(e);else if(r==="int32")o=new Int32Array(e);else if(r==="bool")o=new Uint8Array(e);else if(r==="complex64"){o=new Float32Array(e);const l=new Float32Array(o.length/2),c=new Float32Array(o.length/2);for(let p=0;p<l.length;
671p++)l[p]=o[p*2],c[p]=o[p*2+1];const h=Vs(l,s,"float32"),d=Vs(c,s,"float32"),f=po(h,d);return h.dispose(),d.dispose(),f}else throw new Error(`Unsupported dtype in weight '${n}': ${r}`);a+=i*u}return Vs(o,s,r)}async function vT(t,e,n){let r=new Uint8Array(e);for(;r.byteLength<n;){const{done:s,value:i}=await t.read();if(s&&i==null){const a=n-r.byteLength;throw new Error(`Reader is done but ${a} bytes are still expected`)}const o=new Uint8Array(r.length+i.byteLength);o.set(r,0),o.set(new Uint8Array(i),r.length),r=o}return r.buffer}async function KR(t,e){const n={},r=t.getReader();let s=new ArrayBuffer(0);for(const i of e){const o=await oq(i,async(l,c)=>(s=await vT(r,s,c),s.slice(l,c)));s=await vT(r,s,o);const a=s.slice(0,o);s=s.slice(o);const u=qR(i,a);if(n[i.name]=u,tq()==="webgpu"){const l=rq();"uploadToGPU"in l&&ne(u.shape)>=U().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&l.uploadToGPU(u.dataId)}}return n}function aq(t){if(t===null)throw new Error(`Invalid input value: ${JSON.stringify(t)}`);let e=0;const n=[];t.forEach(i=>{if(e+=i.byteLength,n.push(i.byteLength===i.buffer.byteLength?i:new i.constructor(i)),!(i instanceof Float32Array||i instanceof Int32Array||i instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${i.constructor.name}`)});const r=new Uint8Array(e);let s=0;return n.forEach(i=>{r.set(new Uint8Array(i.buffer),s),s+=i.byteLength}),r.buffer}const A1=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function xT(t){return A1?Buffer.byteLength(t,"utf8"):new Blob([t]).size}function uq(t){if(A1)return Buffer.from(t).toString("base64");const e=new Uint8Array(t);let n="";for(let r=0,s=e.length;r<s;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function lq(t){if(A1){const r=Buffer.from(t,"base64");return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;++r)n.set([e.charCodeAt(r)],r);return n.buffer}function cq(t){return xs.join(t)}function wT(t){const e="/";for(t=t.trim();t.endsWith(e);)t=t.slice(0,t.length-1);const n=t.split(e);return n[n.length-1]}function XR(t,e){const n={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:e};return t.signature!=null&&(n.signature=t.signature),t.userDefinedMetadata!=null&&(n.userDefinedMetadata=t.userDefinedMetadata),t.modelInitializer!=null&&(n.modelInitializer=t.modelInitializer),t.initializerSignature!=null&&(n.initializerSignature=t.initializerSignature),t.trainingConfig!=null&&(n.trainingConfig=t.trainingConfig),n}function YR(t,e,n){const r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy};if(t.trainingConfig!=null&&(r.trainingConfig=t.trainingConfig),t.weightsManifest!=null){if(!e)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");r.weightSpecs=e,r.weightData=n}return t.signature!=null&&(r.signature=t.signature),t.userDefinedMetadata!=null&&(r.userDefinedMetadata=t.userDefinedMetadata),t.modelInitializer!=null&&(r.modelInitializer=t.modelInitializer),t.initializerSignature!=null&&(r.initializerSignature=t.initializerSignature),r}async function R1(t,e){let n,r;return t.weightsManifest!=null&&([n,r]=await e(t.weightsManifest)),YR(t,n,r)}function xh(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:t.modelTopology==null?0:xT(JSON.stringify(t.modelTopology)),weightSpecsBytes:t.weightSpecs==null?0:xT(JSON.stringify(t.weightSpecs)),weightDataBytes:t.weightData==null?0:new xs(t.weightData).byteLength}}function D0(t){const e=[];for(const n of t)e.push(...n.weights);return e}function hq(){const t=n=>{let r=n<<13,s=0;for(;!(r&8388608);)s-=8388608,r<<=1;return r&=-8388609,s+=947912704,r|s},e=new Uint32Array(2048);e[0]=0;for(let n=1;n<1024;n++)e[n]=t(n);for(let n=1024;n<2048;n++)e[n]=939524096+(n-1024<<13);return e}function dq(){const t=new Uint32Array(64);t[0]=0,t[31]=1199570944,t[32]=2147483648,t[63]=3347054592;for(let e=1;e<31;e++)t[e]=e<<23;
vendor: 10,204 bytes, lines 671-716
671for(let e=33;e<63;e++)t[e]=2147483648+(e-32<<23);return t}function fq(){const t=new Uint32Array(64);for(let e=0;e<64;e++)t[e]=1024;return t[0]=t[32]=0,t}function pq(){const t=hq(),e=dq(),n=fq();return r=>{const s=new ArrayBuffer(4*r.length),i=new Uint32Array(s);for(let o=0;o<r.length;o++){const a=r[o],u=t[n[a>>10]+(a&1023)]+e[a>>10];i[o]=u}return new Float32Array(s)}}/**
672 * @license
673 * Copyright 2018 Google LLC. All Rights Reserved.
674 * Licensed under the Apache License, Version 2.0 (the "License");
675 * you may not use this file except in compliance with the License.
676 * You may obtain a copy of the License at
677 *
678 * http://www.apache.org/licenses/LICENSE-2.0
679 *
680 * Unless required by applicable law or agreed to in writing, software
681 * distributed under the License is distributed on an "AS IS" BASIS,
682 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
683 * See the License for the specific language governing permissions and
684 * limitations under the License.
685 * =============================================================================
686 */class ft{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return ft.instance==null&&(ft.instance=new ft),ft.instance}static registerSaveRouter(e){ft.getInstance().saveRouters.push(e)}static registerLoadRouter(e){ft.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return ft.getHandlers(e,"save")}static getLoadHandlers(e,n){return ft.getHandlers(e,"load",n)}static getHandlers(e,n,r){const s=[];return(n==="load"?ft.getInstance().loadRouters:ft.getInstance().saveRouters).forEach(o=>{const a=o(e,r);a!==null&&s.push(a)}),s}}const mq=t=>ft.registerSaveRouter(t),gq=t=>ft.registerLoadRouter(t),yq=t=>ft.getSaveHandlers(t),vq=(t,e)=>ft.getLoadHandlers(t,e);/**
687 * @license
688 * Copyright 2018 Google LLC. All Rights Reserved.
689 * Licensed under the Apache License, Version 2.0 (the "License");
690 * you may not use this file except in compliance with the License.
691 * You may obtain a copy of the License at
692 *
693 * http://www.apache.org/licenses/LICENSE-2.0
694 *
695 * Unless required by applicable law or agreed to in writing, software
696 * distributed under the License is distributed on an "AS IS" BASIS,
697 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
698 * See the License for the specific language governing permissions and
699 * limitations under the License.
700 * =============================================================================
701 */const P0="tensorflowjs",F0=1,Ko="models_store",ji="model_info_store";function QR(){if(!U().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const t=typeof window>"u"?self:window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(e==null)throw new Error("The current browser does not appear to support IndexedDB.");return e}function L0(t){const e=t.result;e.createObjectStore(Ko,{keyPath:"modelPath"}),e.createObjectStore(ji,{keyPath:"modelPath"})}class va{constructor(e){if(this.indexedDB=QR(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,n){return new Promise((r,s)=>{const i=this.indexedDB.open(P0,F0);i.onupgradeneeded=()=>L0(i),i.onsuccess=()=>{const o=i.result;if(n==null){const a=o.transaction(Ko,"readonly"),l=a.objectStore(Ko).get(this.modelPath);l.onsuccess=()=>{if(l.result==null)return o.close(),s(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));r(l.result.modelArtifacts)},l.onerror=c=>(o.close(),s(l.error)),a.oncomplete=()=>o.close()}else{n.weightData=xs.join(n.weightData);const a=xh(n),u=o.transaction(ji,"readwrite");let l=u.objectStore(ji),c;try{c=l.put({modelPath:this.modelPath,modelArtifactsInfo:a})}catch(d){return s(d)}let h;c.onsuccess=()=>{h=o.transaction(Ko,"readwrite");const d=h.objectStore(Ko);let f;try{f=d.put({modelPath:this.modelPath,modelArtifacts:n,modelArtifactsInfo:a})}catch(p){return s(p)}f.onsuccess=()=>r({modelArtifactsInfo:a}),f.onerror=p=>{l=u.objectStore(ji);const y=l.delete(this.modelPath);y.onsuccess=()=>(o.close(),s(f.error)),y.onerror=v=>(o.close(),s(f.error))}},c.onerror=d=>(o.close(),s(c.error)),u.oncomplete=()=>{h==null?o.close():h.oncomplete=()=>o.close()}}},i.onerror=o=>s(i.error)})}}va.URL_SCHEME="indexeddb://";const ZR=t=>U().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(va.URL_SCHEME)?xq(t.slice(va.URL_SCHEME.length)):null;ft.registerSaveRouter(ZR);ft.registerLoadRouter(ZR);function xq(t){return new va(t)}function wq(t){return t.startsWith(va.URL_SCHEME)?t.slice(va.URL_SCHEME.length):t}class bq{constructor(){this.indexedDB=QR()}async listModels(){return new Promise((e,n)=>{const r=this.indexedDB.open(P0,F0);r.onupgradeneeded=()=>L0(r),r.onsuccess=()=>{const s=r.result,i=s.transaction(ji,"readonly"),a=i.objectStore(ji).getAll();a.onsuccess=()=>{const u={};for(const l of a.result)u[l.modelPath]=l.modelArtifactsInfo;e(u)},a.onerror=u=>(s.close(),n(a.error)),i.oncomplete=()=>s.close()},r.onerror=s=>n(r.error)})}async removeModel(e){return e=wq(e),new Promise((n,r)=>{const s=this.indexedDB.open(P0,F0);s.onupgradeneeded=()=>L0(s),s.onsuccess=()=>{const i=s.result,o=i.transaction(ji,"readwrite"),a=o.objectStore(ji),u=a.get(e);let l;u.onsuccess=()=>{if(u.result==null)return i.close(),r(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const c=a.delete(e),h=()=>{l=i.transaction(Ko,"readwrite");const f=l.objectStore(Ko).delete(e);f.onsuccess=()=>n(u.result.modelArtifactsInfo),f.onerror=p=>r(u.error)};c.onsuccess=h,c.onerror=d=>(h(),i.close(),r(u.error))}},u.onerror=c=>(i.close(),r(u.error)),o.oncomplete=()=>{l==null?i.close():l.oncomplete=()=>i.close()}},s.onerror=i=>r(s.error)})}}/**
702 * @license
703 * Copyright 2018 Google LLC. All Rights Reserved.
704 * Licensed under the Apache License, Version 2.0 (the "License");
705 * you may not use this file except in compliance with the License.
706 * You may obtain a copy of the License at
707 *
708 * http://www.apache.org/licenses/LICENSE-2.0
709 *
710 * Unless required by applicable law or agreed to in writing, software
711 * distributed under the License is distributed on an "AS IS" BASIS,
712 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
713 * See the License for the specific language governing permissions and
714 * limitations under the License.
715 * =============================================================================
716 */const ti="/",Qa="tensorflowjs_models",JR="info",_q="model_topology",Sq="weight_specs",Tq="weight_data",Cq="model_metadata";function eO(t){return{info:[Qa,t,JR].join(ti),topology:[Qa,t,_q].join(ti),weightSpecs:[Qa,t,Sq].join(ti),weightData:[Qa,t,Tq].join(ti),modelMetadata:[Qa,t,Cq].join(ti)}}function tO(t){for(const e of Object.values(t))window.localStorage.removeItem(e)}function Nq(t){const e=t.split(ti);if(e.length<3)throw new Error(`Invalid key format: ${t}`);return e.slice(1,e.length-1).join(ti)}function Eq(t){return t.startsWith(xa.URL_SCHEME)?t.slice(xa.URL_SCHEME.length):t}class xa{constructor(e){if(!U().getBool("IS_BROWSER")||typeof window>"u"||typeof window.localStorage>"u")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=eO(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const n=JSON.stringify(e.modelTopology),r=JSON.stringify(e.weightSpecs),s=xh(e),i=xs.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(s)),this.LS.setItem(this.keys.topology,n),this.LS.setItem(this.keys.weightSpecs,r),this.LS.setItem(this.keys.weightData,uq(i));const o={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:e.signature!=null?e.signature:void 0,userDefinedMetadata:e.userDefinedMetadata!=null?e.userDefinedMetadata:void 0,modelInitializer:e.modelInitializer!=null?e.modelInitializer:void 0,initializerSignature:e.initializerSignature!=null?e.initializerSignature:void 0,trainingConfig:e.trainingConfig!=null?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(o)),{modelArtifactsInfo:s}}catch{throw tO(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${s.modelTopologyBytes}, weightSpecsBytes=${s.weightSpecsBytes}, weightDataBytes=${s.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const n={},r=JSON.parse(this.LS.getItem(this.keys.topology));if(r==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);n.modelTopology=r;const s=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(s==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);n.weightSpecs=s;const i=this.LS.getItem(this.keys.modelMetadata);if(i!=null){const a=JSON.parse(i);n.format=a.format,n.generatedBy=a.generatedBy,n.convertedBy=a.convertedBy,a.signature!=null&&(n.signature=a.signature),a.userDefinedMetadata!=null&&(n.userDefinedMetadata=a.userDefinedMetadata),a.modelInitializer!=null&&(n.modelInitializer=a.modelInitializer),a.initializerSignature!=null&&(n.initializerSignature=a.initializerSignature),a.trainingConfig!=null&&(n.trainingConfig=a.trainingConfig)}const o=this.LS.getItem(this.keys.weightData);if(o==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);
716return n.weightData=lq(o),n}}xa.URL_SCHEME="localstorage://";const nO=t=>U().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(xa.URL_SCHEME)?kq(t.slice(xa.URL_SCHEME.length)):null;ft.registerSaveRouter(nO);ft.registerLoadRouter(nO);function kq(t){return new xa(t)}class $q{constructor(){A(U().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),A(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const e={},n=Qa+ti,r=ti+JR;for(let s=0;s<this.LS.length;++s){const i=this.LS.key(s);if(i.startsWith(n)&&i.endsWith(r)){const o=Nq(i);e[o]=JSON.parse(this.LS.getItem(i))}}return e}async removeModel(e){e=Eq(e);const n=eO(e);if(this.LS.getItem(n.info)==null)throw new Error(`Cannot find model at path '${e}'`);const r=JSON.parse(this.LS.getItem(n.info));return tO(n),r}}/**
717 * @license
718 * Copyright 2018 Google LLC. All Rights Reserved.
719 * Licensed under the Apache License, Version 2.0 (the "License");
720 * you may not use this file except in compliance with the License.
721 * You may obtain a copy of the License at
722 *
723 * http://www.apache.org/licenses/LICENSE-2.0
724 *
725 * Unless required by applicable law or agreed to in writing, software
726 * distributed under the License is distributed on an "AS IS" BASIS,
727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
728 * See the License for the specific language governing permissions and
729 * limitations under the License.
730 * =============================================================================
731 */const $u="://";class yn{constructor(){this.managers={}}static getInstance(){return yn.instance==null&&(yn.instance=new yn),yn.instance}static registerManager(e,n){A(e!=null,()=>"scheme must not be undefined or null."),e.endsWith($u)&&(e=e.slice(0,e.indexOf($u))),A(e.length>0,()=>"scheme must not be an empty string.");const r=yn.getInstance();A(r.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),r.managers[e]=n}static getManager(e){const n=yn.getInstance().managers[e];if(n==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return n}static getSchemes(){return Object.keys(yn.getInstance().managers)}}function Hd(t){if(t.indexOf($u)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${yn.getSchemes().join(",")}`);return{scheme:t.split($u)[0],path:t.split($u)[1]}}async function rO(t,e,n=!1){A(t!==e,()=>`Old path and new path are the same: '${t}'`);const r=ft.getLoadHandlers(t);A(r.length>0,()=>`Copying failed because no load handler is found for source URL ${t}.`),A(r.length<2,()=>`Copying failed because more than one (${r.length}) load handlers for source URL ${t}.`);const s=r[0],i=ft.getSaveHandlers(e);A(i.length>0,()=>`Copying failed because no save handler is found for destination URL ${e}.`),A(i.length<2,()=>`Copying failed because more than one (${r.length}) save handlers for destination URL ${e}.`);const o=i[0],a=Hd(t).scheme,u=Hd(t).path,l=a===Hd(t).scheme,c=await s.load();n&&l&&await yn.getManager(a).removeModel(u);const h=await o.save(c);return n&&!l&&await yn.getManager(a).removeModel(u),h.modelArtifactsInfo}async function Iq(){const t=yn.getSchemes(),e={};for(const n of t){const r=await yn.getManager(n).listModels();for(const s in r){const i=n+$u+s;e[i]=r[s]}}return e}async function Aq(t){const e=Hd(t);return yn.getManager(e.scheme).removeModel(e.path)}async function Rq(t,e){return rO(t,e,!1)}async function Oq(t,e){return rO(t,e,!0)}/**
732 * @license
733 * Copyright 2019 Google LLC. All Rights Reserved.
734 * Licensed under the Apache License, Version 2.0 (the "License");
735 * you may not use this file except in compliance with the License.
736 * You may obtain a copy of the License at
737 *
738 * http://www.apache.org/licenses/LICENSE-2.0
739 *
740 * Unless required by applicable law or agreed to in writing, software
741 * distributed under the License is distributed on an "AS IS" BASIS,
742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
743 * See the License for the specific language governing permissions and
744 * limitations under the License.
745 * =============================================================================
746 */class Dq{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}
vendor: 4,471 bytes, lines 746-794
746fetch(e,n){return fetch(e,n)}now(){return performance.now()}encode(e,n){if(n!=="utf-8"&&n!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${n}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,n){return new TextDecoder(n).decode(e)}setTimeoutCustom(e,n){if(typeof window>"u"||!U().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(e,n);return}this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},n),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",r=>{if(r.source===window&&r.data.name===this.messageName){r.stopPropagation();const s=this.functionRefs[r.data.index];s(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(e){return NR(e)}}if(U().get("IS_BROWSER")){U().setPlatform("browser",new Dq);try{yn.registerManager(xa.URL_SCHEME,new $q)}catch{}try{yn.registerManager(va.URL_SCHEME,new bq)}catch{}}/**
747 * @license
748 * Copyright 2019 Google LLC. All Rights Reserved.
749 * Licensed under the Apache License, Version 2.0 (the "License");
750 * you may not use this file except in compliance with the License.
751 * You may obtain a copy of the License at
752 *
753 * http://www.apache.org/licenses/LICENSE-2.0
754 *
755 * Unless required by applicable law or agreed to in writing, software
756 * distributed under the License is distributed on an "AS IS" BASIS,
757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
758 * See the License for the specific language governing permissions and
759 * limitations under the License.
760 * =============================================================================
761 */const Pq={importFetch:()=>require("node-fetch")};let Fg;class Fq{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,n){return U().global.fetch!=null?U().global.fetch(e,n):(Fg==null&&(Fg=Pq.importFetch()),Fg(e,n))}now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,n){if(n!=="utf-8"&&n!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${n}`);return this.textEncoder.encode(e)}decode(e,n){return e.length===0?"":new this.util.TextDecoder(n).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}U().get("IS_NODE")&&!U().get("IS_BROWSER")&&U().setPlatform("node",new Fq);/**
762 * @license
763 * Copyright 2020 Google Inc. All Rights Reserved.
764 * Licensed under the Apache License, Version 2.0 (the "License");
765 * you may not use this file except in compliance with the License.
766 * You may obtain a copy of the License at
767 *
768 * http://www.apache.org/licenses/LICENSE-2.0
769 *
770 * Unless required by applicable law or agreed to in writing, software
771 * distributed under the License is distributed on an "AS IS" BASIS,
772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
773 * See the License for the specific language governing permissions and
774 * limitations under the License.
775 * =============================================================================
776 */function wt(t,e="float32",n){return e=e||"float32",gr(t),new Zu(t,e,n)}/**
777 * @license
778 * Copyright 2020 Google Inc. All Rights Reserved.
779 * Licensed under the Apache License, Version 2.0 (the "License");
780 * you may not use this file except in compliance with the License.
781 * You may obtain a copy of the License at
782 *
783 * http://www.apache.org/licenses/LICENSE-2.0
784 *
785 * Unless required by applicable law or agreed to in writing, software
786 * distributed under the License is distributed on an "AS IS" BASIS,
787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
788 * See the License for the specific language governing permissions and
789 * limitations under the License.
790 * =============================================================================
791 */function Lq(t,e){const n=I(t,"x","cast");if(!o5(e))throw new Error(`Failed to cast to unknown dtype ${e}`);if(e==="string"&&n.dtype!=="string"||e!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");const r={x:n},s={dtype:e};return V.runKernel(N1,r,s)}const vt=M({cast_:Lq});/**
792 * @license
793 * Copyright 2020 Google LLC. All Rights Reserved.
794 * Licensed under the Apache License, Version 2.0 (the "License");
795 * you may not use this file except in compliance with the License.
796 * You may obtain a copy of the License at
797 *
798 * http://www.apache.org/licenses/LICENSE-2.0
799 *
800 * Unless required by applicable law or agreed to in writing, software
801 * distributed under the License is distributed on an "AS IS" BASIS,
802 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
803 * See the License for the specific language governing permissions and
804 * limitations under the License.
805 * =============================================================================
806 */function Mq(t){const n={x:I(t,"x","clone","string_or_numeric")};return V.runKernel(E1,n)}const no=M({clone_:Mq});/**
807 * @license
808 * Copyright 2020 Google Inc. All Rights Reserved.
809 * Licensed under the Apache License, Version 2.0 (the "License");
810 * you may not use this file except in compliance with the License.
811 * You may obtain a copy of the License at
812 *
813 * http://www.apache.org/licenses/LICENSE-2.0
814 *
815 * Unless required by applicable law or agreed to in writing, software
816 * distributed under the License is distributed on an "AS IS" BASIS,
817 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
818 * See the License for the specific language governing permissions and
819 * limitations under the License.
820 * =============================================================================
821 */function sO(t,e=!1){console.log(t.toString(e))}/**
822 * @license
823 * Copyright 2020 Google Inc. All Rights Reserved.
824 * Licensed under the Apache License, Version 2.0 (the "License");
825 * you may not use this file except in compliance with the License.
826 * You may obtain a copy of the License at
827 *
828 * http://www.apache.org/licenses/LICENSE-2.0
829 *
830 * Unless required by applicable law or agreed to in writing, software
831 * distributed under the License is distributed on an "AS IS" BASIS,
832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
833 * See the License for the specific language governing permissions and
834 * limitations under the License.
835 * =============================================================================
836 */WR();const Vq={buffer:wt,cast:vt,clone:no,print:sO};H5(Vq);/**
837 * @license
838 * Copyright 2020 Google LLC. All Rights Reserved.
839 * Licensed under the Apache License, Version 2.0 (the "License");
840 * you may not use this file except in compliance with the License.
841 * You may obtain a copy of the License at
842 *
843 * http://www.apache.org/licenses/LICENSE-2.0
844 *
845 * Unless required by applicable law or agreed to in writing, software
846 * distributed under the License is distributed on an "AS IS" BASIS,
847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
848 * See the License for the specific language governing permissions and
849 * limitations under the License.
850 * =============================================================================
851 */function Bq(t,e){let n=I(t,"a","add"),r=I(e,"b","add");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(C1,s)}const ge=M({add_:Bq});/**
852 * @license
853 * Copyright 2020 Google LLC. All Rights Reserved.
854 * Licensed under the Apache License, Version 2.0 (the "License");
855 * you may not use this file except in compliance with the License.
856 * You may obtain a copy of the License at
857 *
858 * http://www.apache.org/licenses/LICENSE-2.0
859 *
860 * Unless required by applicable law or agreed to in writing, software
861 * distributed under the License is distributed on an "AS IS" BASIS,
862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
863 * See the License for the specific language governing permissions and
864 * limitations under the License.
865 * =============================================================================
866 */function Wq(t,e){let n=I(t,"a","floorDiv"),r=I(e,"b","floorDiv");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(FI,s)}const iO=M({floorDiv_:Wq});/**
867 * @license
868 * Copyright 2020 Google LLC. All Rights Reserved.
869 * Licensed under the Apache License, Version 2.0 (the "License");
870 * you may not use this file except in compliance with the License.
871 * You may obtain a copy of the License at
872 *
873 * http://www.apache.org/licenses/LICENSE-2.0
874 *
875 * Unless required by applicable law or agreed to in writing, softw
875are
876 * distributed under the License is distributed on an "AS IS" BASIS,
877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
878 * See the License for the specific language governing permissions and
879 * limitations under the License.
880 * =============================================================================
881 */function Uq(t,e){let n=I(t,"a","div"),r=I(e,"b","div");if([n,r]=Tt(n,r),n.dtype==="int32"&&r.dtype==="int32")return iO(n,r);const s={a:n,b:r},i={};return V.runKernel(TI,s,i)}const Ae=M({div_:Uq});/**
882 * @license
883 * Copyright 2020 Google LLC. All Rights Reserved.
884 * Licensed under the Apache License, Version 2.0 (the "License");
885 * you may not use this file except in compliance with the License.
886 * You may obtain a copy of the License at
887 *
888 * http://www.apache.org/licenses/LICENSE-2.0
889 *
890 * Unless required by applicable law or agreed to in writing, software
891 * distributed under the License is distributed on an "AS IS" BASIS,
892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
893 * See the License for the specific language governing permissions and
894 * limitations under the License.
895 * =============================================================================
896 */function zq(t,e){let n=I(t,"a","mul"),r=I(e,"b","mul");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(pA,s)}const re=M({mul_:zq});/**
897 * @license
898 * Copyright 2018 Google LLC. All Rights Reserved.
899 * Licensed under the Apache License, Version 2.0 (the "License");
900 * you may not use this file except in compliance with the License.
901 * You may obtain a copy of the License at
902 *
903 * http://www.apache.org/licenses/LICENSE-2.0
904 *
905 * Unless required by applicable law or agreed to in writing, software
906 * distributed under the License is distributed on an "AS IS" BASIS,
907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
908 * See the License for the specific language governing permissions and
909 * limitations under the License.
910 * =============================================================================
911 */function jq(t){const e=I(t,"x","abs");if(e.dtype==="complex64"){const n={x:e};return V.runKernel(iI,n)}else{const n={x:e};return V.runKernel(F$,n)}}const rr=M({abs_:jq});/**
912 * @license
913 * Copyright 2018 Google LLC. All Rights Reserved.
914 * Licensed under the Apache License, Version 2.0 (the "License");
915 * you may not use this file except in compliance with the License.
916 * You may obtain a copy of the License at
917 *
918 * http://www.apache.org/licenses/LICENSE-2.0
919 *
920 * Unless required by applicable law or agreed to in writing, software
921 * distributed under the License is distributed on an "AS IS" BASIS,
922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
923 * See the License for the specific language governing permissions and
924 * limitations under the License.
925 * =============================================================================
926 */function Gq(t){const n={x:I(t,"x","acos")};return V.runKernel(L$,n)}const Hq=M({acos_:Gq});/**
927 * @license
928 * Copyright 2018 Google LLC. All Rights Reserved.
929 * Licensed under the Apache License, Version 2.0 (the "License");
930 * you may not use this file except in compliance with the License.
931 * You may obtain a copy of the License at
932 *
933 * http://www.apache.org/licenses/LICENSE-2.0
934 *
935 * Unless required by applicable law or agreed to in writing, software
936 * distributed under the License is distributed on an "AS IS" BASIS,
937 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
938 * See the License for the specific language governing permissions and
939 * limitations under the License.
940 * =============================================================================
941 */function qq(t){const n={x:I(t,"x","acosh")};return V.runKernel(M$,n)}const Kq=M({acosh_:qq});/**
942 * @license
943 * Copyright 2020 Google LLC. All Rights Reserved.
944 * Licensed under the Apache License, Version 2.0 (the "License");
945 * you may not use this file except in compliance with the License.
946 * You may obtain a copy of the License at
947 *
948 * http://www.apache.org/licenses/LICENSE-2.0
949 *
950 * Unless required by applicable law or agreed to in writing, softw
950are
951 * distributed under the License is distributed on an "AS IS" BASIS,
952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
953 * See the License for the specific language governing permissions and
954 * limitations under the License.
955 * =============================================================================
956 */function Xq(t){A(Array.isArray(t),()=>"The argument passed to tf.addN() must be a list of tensors"),A(t.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${t.length}`);const e=t.map((s,i)=>I(s,`tensors${i}`,"addN")),n=e[0];e.forEach(s=>{if(s.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),e.forEach(s=>{if(!xt(s.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});const r=e;return V.runKernel(V$,r)}const Yq=M({addN_:Xq});/**
957 * @license
958 * Copyright 2020 Google LLC. All Rights Reserved.
959 * Licensed under the Apache License, Version 2.0 (the "License");
960 * you may not use this file except in compliance with the License.
961 * You may obtain a copy of the License at
962 *
963 * http://www.apache.org/licenses/LICENSE-2.0
964 *
965 * Unless required by applicable law or agreed to in writing, software
966 * distributed under the License is distributed on an "AS IS" BASIS,
967 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
968 * See the License for the specific language governing permissions and
969 * limitations under the License.
970 * =============================================================================
971 */function Qq(t,e=null,n=!1){const s={x:I(t,"x","all","bool")},i={axis:e,keepDims:n};return V.runKernel(B$,s,i)}const Zq=M({all_:Qq});/**
972 * @license
973 * Copyright 2020 Google LLC. All Rights Reserved.
974 * Licensed under the Apache License, Version 2.0 (the "License");
975 * you may not use this file except in compliance with the License.
976 * You may obtain a copy of the License at
977 *
978 * http://www.apache.org/licenses/LICENSE-2.0
979 *
980 * Unless required by applicable law or agreed to in writing, software
981 * distributed under the License is distributed on an "AS IS" BASIS,
982 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
983 * See the License for the specific language governing permissions and
984 * limitations under the License.
985 * =============================================================================
986 */function Jq(t,e=null,n=!1){const s={x:I(t,"x","any","bool")},i={axis:e,keepDims:n};return V.runKernel(W$,s,i)}const e8=M({any_:Jq});/**
987 * @license
988 * Copyright 2020 Google Inc. All Rights Reserved.
989 * Licensed under the Apache License, Version 2.0 (the "License");
990 * you may not use this file except in compliance with the License.
991 * You may obtain a copy of the License at
992 *
993 * http://www.apache.org/licenses/LICENSE-2.0
994 *
995 * Unless required by applicable law or agreed to in writing, software
996 * distributed under the License is distributed on an "AS IS" BASIS,
997 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
998 * See the License for the specific language governing permissions and
999 * limitations under the License.
1000 * =============================================================================
1001 */function t8(t,e=0){const r={x:I(t,"x","argMax")},s={axis:e};return V.runKernel(U$,r,s)}const n8=M({argMax_:t8});/**
1002 * @license
1003 * Copyright 2020 Google Inc. All Rights Reserved.
1004 * Licensed under the Apache License, Version 2.0 (the "License");
1005 * you may not use this file except in compliance with the License.
1006 * You may obtain a copy of the License at
1007 *
1008 * http://www.apache.org/licenses/LICENSE-2.0
1009 *
1010 * Unless required by applicable law or agreed to in writing, software
1011 * distributed under the License is distributed on an "AS IS" BASIS,
1012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1013 * See the License for the specific language governing permissions and
1014 * limitations under the License.
1015 * =============================================================================
1016 */function r8(t,e=0){const r={x:I(t,"x","argMin")},s={axis:e};return V.runKernel(z$,r,s)}const s8=M({argMin_:r8});/**
1017 * @license
1018 * Copyright 2018 Google LLC. All Rights Reserved.
1019 * Licensed under the Apache License, Version 2.0 (the "License");
1020 * you may not use this file except in compliance with the License.
1021 * You may obtain a copy of the License at
1022 *
1023 * http://www.apache.org/licenses/LICENSE-2.0
1024 *
1025 * Unless required by applicable law or agreed to in writing, software
1026 * distributed under the License is distributed on an "AS IS" BASIS,
1027 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1028 * See the License for the specific language governing permissions and
1029 * limitations under the License.
1030 * =============================================================================
1031 */function i8(t){const n={x:I(t,"x","asin")};return V.runKernel(j$,n)}const o8=M({asin_:i8});/**
1032 * @license
1033 * Copyright 2018 Google LLC. All Rights Reserved.
1034 * Licensed under the Apache License, Version 2.0 (the "License");
1035 * you may not use this file except in compliance with the License.
1036 * You may obtain a copy of the License at
1037 *
1038 * http://www.apache.org/licenses/LICENSE-2.0
1039 *
1040 * Unless required by applicable law or agreed to in writing, software
1041 * distributed under the License is distributed on an "AS IS" BASIS,
1042 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1043 * See the License for the specific language governing permissions and
1044 * limitations under the License.
1045 * =============================================================================
1046 */function a8(t){const n={x:I(t,"x","asinh")};return V.runKernel(G$,n)}const u8=M({asinh_:a8});/**
1047 * @license
1048 * Copyright 2018 Google LLC. All Rights Reserved.
1049 * Licensed under the Apache License, Version 2.0 (the "License");
1050 * you may not use this file except in compliance with the License.
1051 * You may obtain a copy of the License at
1052 *
1053 * http://www.apache.org/licenses/LICENSE-2.0
1054 *
1055 * Unless required by applicable law or agreed to in writing, software
1056 * distributed under the License is distributed on an "AS IS" BASIS,
1057 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1058 * See the License for the specific language governing permissions and
1059 * limitations under the License.
1060 * =============================================================================
1061 */function l8(t){const n={x:I(t,"x","atan")};return V.runKernel(H$,n)}const c8=M({atan_:l8});/**
1062 * @license
1063 * Copyright 2020 Google LLC. All Rights Reserved.
1064 * Licensed under the Apache License, Version 2.0 (the "License");
1065 * you may not use this file except in compliance with the License.
1066 * You may obtain a copy of the License at
1067 *
1068 * http://www.apache.org/licenses/LICENSE-2.0
1069 *
1070 * Unless required by applicable law or agreed to in writing, software
1071 * distributed under the License is distributed on an "AS IS" BASIS,
1072 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1073 * See the License for the specific language governing permissions and
1074 * limitations under the License.
1075 * =============================================================================
1076 */function h8(t,e){let n=I(t,"a","atan2"),r=I(e,"b","atan2");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(K$,s)}const d8=M({atan2_:h8});/**
1077 * @license
1078 * Copyright 2018 Google LLC. All Rights Reserved.
1079 * Licensed under the Apache License, Version 2.0 (the "License");
1080 * you may not use this file except in compliance with the License.
1081 * You may obtain a copy of the License at
1082 *
1083 * http://www.apache.org/licenses/LICENSE-2.0
1084 *
1085 * Unless required by applicable law or agreed to in writing, software
1086 * distributed under the License is distributed on an "AS IS" BASIS,
1087 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1088 * See the License for the specific language governing permissions and
1089 * limitations under the License.
1090 * =============================================================================
1091 */function f8(t){const n={x:I(t,"x","atanh")};return V.runKernel(q$,n)}const p8=M({atanh_:f8});/**
1092 * @license
1093 * Copyright 2020 Google LLC. All Rights Reserved.
1094 * Licensed under the Apache License, Version 2.0 (the "License");
1095 * you may not use this file except in compliance with the License.
1096 * You may obtain a copy of the License at
1097 *
1098 * http://www.apache.org/licenses/LICENSE-2.0
1099 *
1100 * Unless required by applicable law or agreed to in writing, softw
vendor: 9,233 bytes, lines 1100-1160
1100are
1101 * distributed under the License is distributed on an "AS IS" BASIS,
1102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1103 * See the License for the specific language governing permissions and
1104 * limitations under the License.
1105 * =============================================================================
1106 */function oO(t,e,n,r,s="NHWC",i){const o=t[3],a=[...e,o],u=gl(s);return yr(t,a,n,i,r,null,null,u)}function Da(t,e,n,r,s,i,o="channelsLast"){const[a,u]=Bc(e);let l;if(o==="channelsLast")l=[a,u,t[3],t[3]];else if(o==="channelsFirst")l=[a,u,t[1],t[1]];else throw new Error(`Unknown dataFormat ${o}`);return yr(t,l,n,r,s,i,!1,o)}function wh(t,e,n,r,s,i,o="NDHWC"){const[a,u,l]=M0(e);let c,h;if(o==="NDHWC")h="channelsLast",c=[a,u,l,t[4],t[4]];else if(o==="NCDHW")h="channelsFirst",c=[a,u,l,t[1],t[1]];else throw new Error(`Unknown dataFormat ${o}`);return bh(t,c,n,r,s,!1,h,i)}function yr(t,e,n,r,s,i,o=!1,a="channelsLast"){let[u,l,c,h]=[-1,-1,-1,-1];if(a==="channelsLast")[u,l,c,h]=t;else if(a==="channelsFirst")[u,h,l,c]=t;else throw new Error(`Unknown dataFormat ${a}`);const[d,f,,p]=e,[y,v]=Bc(n),[g,x]=Bc(r),w=Iu(d,g),_=Iu(f,x),{padInfo:T,outHeight:E,outWidth:k}=y8(s,l,c,y,v,w,_,i,a),N=o?p*h:p;let O;return a==="channelsFirst"?O=[u,N,E,k]:a==="channelsLast"&&(O=[u,E,k,N]),{batchSize:u,dataFormat:a,inHeight:l,inWidth:c,inChannels:h,outHeight:E,outWidth:k,outChannels:N,padInfo:T,strideHeight:y,strideWidth:v,filterHeight:d,filterWidth:f,effectiveFilterHeight:w,effectiveFilterWidth:_,dilationHeight:g,dilationWidth:x,inShape:t,outShape:O,filterShape:e}}function bh(t,e,n,r,s,i=!1,o="channelsLast",a){let[u,l,c,h,d]=[-1,-1,-1,-1,-1];if(o==="channelsLast")[u,l,c,h,d]=t;else if(o==="channelsFirst")[u,d,l,c,h]=t;else throw new Error(`Unknown dataFormat ${o}`);const[f,p,y,,v]=e,[g,x,w]=M0(n),[_,T,E]=M0(r),k=Iu(f,_),N=Iu(p,T),O=Iu(y,E),{padInfo:R,outDepth:L,outHeight:W,outWidth:G}=v8(s,l,c,h,g,x,w,k,N,O,a),H=i?v*d:v;let X;return o==="channelsFirst"?X=[u,H,L,W,G]:o==="channelsLast"&&(X=[u,L,W,G,H]),{batchSize:u,dataFormat:o,inDepth:l,inHeight:c,inWidth:h,inChannels:d,outDepth:L,outHeight:W,outWidth:G,outChannels:H,padInfo:R,strideDepth:g,strideHeight:x,strideWidth:w,filterDepth:f,filterHeight:p,filterWidth:y,effectiveFilterDepth:k,effectiveFilterHeight:N,effectiveFilterWidth:O,dilationDepth:_,dilationHeight:T,dilationWidth:E,inShape:t,outShape:X,filterShape:e}}function m8(t,e,n,r,s){r==null&&(r=O1(t,e,n));const i=t[0],o=t[1],a=Wc((i-e+2*r)/n+1,s),u=Wc((o-e+2*r)/n+1,s);return[a,u]}function g8(t,e,n,r,s,i){s==null&&(s=O1(t,e[0],r[0]));const o=[0,0,0,n];for(let a=0;a<3;a++)t[a]+2*s>=e[a]&&(o[a]=Wc((t[a]-e[a]+2*s)/r[a]+1,i));return o}function O1(t,e,n,r=1){const s=Iu(e,r);return Math.floor((t[0]*(n-1)-n+s)/2)}function Bc(t){return typeof t=="number"?[t,t,t]:t.length===2?[t[0],t[1],1]:t}function M0(t){return typeof t=="number"?[t,t,t]:t}function Iu(t,e){return e<=1?t:t+(t-1)*(e-1)}function y8(t,e,n,r,s,i,o,a,u){let l,c,h;if(typeof t=="number"){l={top:t,bottom:t,left:t,right:t,type:t===0?"VALID":"NUMBER"};const f=m8([e,n],i,r,t,a);c=f[0],h=f[1]}else if(t==="same"){c=Math.ceil(e/r),h=Math.ceil(n/s);const d=Math.max(0,(c-1)*r+i-e),f=Math.max(0,(h-1)*s+o-n),p=Math.floor(d/2),y=d-p,v=Math.floor(f/2),g=f-v;l={top:p,bottom:y,left:v,right:g,type:"SAME"}}else if(t==="valid")l={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((e-i+1)/r),h=Math.ceil((n-o+1)/s);else if(typeof t=="object"){const d=u==="channelsLast"?t[1][0]:t[2][0],f=u==="channelsLast"?t[1][1]:t[2][1],p=u==="channelsLast"?t[2][0]:t[3][0],y=u==="channelsLast"?t[2][1]:t[3][1];l={top:d,bottom:f,left:p,right:y,type:d===0&&f===0&&p===0&&y===0?"VALID":"EXPLICIT"},c=Wc((e-i+d+f)/r+1,a),h=Wc((n-o+p+y)/s+1,a)}else throw Error(`Unknown padding parameter: ${t}`);return{padInfo:l,outHeight:c,outWidth:h}}function v8(t,e,n,r,s,i,o,a,u,l,c){let h,d,f,p;if(t==="valid"&&(t=0),typeof t=="number"){h={top:t,bottom:t,left:t,right:t,front:t,back:t,type:t===0?"VALID":"NUMBER"};const v=g8([e,n,r,1],[a,u,l],1,[s,i,o],t,c);d=v[0],f=v[1],p=v[2]}else if(t==="same"){d=Math.ceil(e/s),f=Math.ceil(n/i),p=Math.ceil(r/o);const y=(d-1)*s+a-e,v=(f-1)*i+u-n,g=(p-1)*o+l-r,x=Math.floor(y/2),w=y-x,_=Math.floor(v/2),T=v-_,E=Math.floor(g/2),k=g-E;h={top:_,bottom:T,left:E,right:k,front:x,back:w,type:"SAME"}}else throw Error(`Unknown padding parameter: ${t}`);return{padInfo:h,outDepth:d,outHeight:f,outWidth:p}}function Wc(t,e){if(!e)return Math.trunc(t);switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error(`Unknown roundingMode ${e}`)}}function Uc(t){const[e,n,r]=Bc(t);return e===1&&n===1&&r===1}function tr(t,e){return Uc(t)||Uc(e)}function wa(t){return Bc(t).every(e=>e>0)}function gl(t){if(t==="NHWC")return"channelsLast";if(t==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${t}`)}function Wr(t,e,n){if(n!=null){if(typeof e=="string")throw Error(`Error in ${t}: pad must be an integer when using dimRoundingMode ${n} but got pad ${e}.`);if(typeof e=="number")A(Xu(e),()=>`Error in ${t}: pad must be an integer when using dimRoundingMode ${n} but got pad ${e}.`);else if(typeof e=="object")e.forEach(r=>{r.forEach(s=>{A(Xu(s),()=>`Error in ${t}: pad must be an integer when using dimRoundingMode ${n} but got pad ${s}.`)})});else throw Error(`Error in ${t}: Unknown padding parameter: ${e}`)}}/**
1107 * @license
1108 * Copyright 2020 Google LLC. All Rights Reserved.
1109 * Licensed under the Apache License, Version 2.0 (the "License");
1110 * you may not use this file except in compliance with the License.
1111 * You may obtain a copy of the License at
1112 *
1113 * http://www.apache.org/licenses/LICENSE-2.0
1114 *
1115 * Unless required by applicable law or agreed to in writing, software
1116 * distributed under the License is distributed on an "AS IS" BASIS,
1117 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1118 * See the License for the specific language governing permissions and
1119 * limitations under the License.
1120 * =============================================================================
1121 */function x8(t,e){const r={x:I(t,"x","reshape","string_or_numeric")},s={shape:e};return V.runKernel(DA,r,s)}const K=M({reshape_:x8});/**
1122 * @license
1123 * Copyright 2020 Google LLC. All Rights Reserved.
1124 * Licensed under the Apache License, Version 2.0 (the "License");
1125 * you may not use this file except in compliance with the License.
1126 * You may obtain a copy of the License at
1127 *
1128 * http://www.apache.org/licenses/LICENSE-2.0
1129 *
1130 * Unless required by applicable law or agreed to in writing, software
1131 * distributed under the License is distributed on an "AS IS" BASIS,
1132 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1133 * See the License for the specific language governing permissions and
1134 * limitations under the License.
1135 * =============================================================================
1136 */function w8(t,e,n,r,s){const i=I(t,"x","avgPool","float32"),o=1;A(tr(n,o),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`);let a=i,u=!1;i.rank===3&&(u=!0,a=K(i,[1,i.shape[0],i.shape[1],i.shape[2]])),A(a.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${a.rank}.`),Wr("avgPool",r,s);const l={x:a},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s};let h=V.runKernel(X$,l,c);return h=vt(h,i.dtype),u?K(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const aO=M({avgPool_:w8});/**
1137 * @license
1138 * Copyright 2020 Google LLC. All Rights Reserved.
1139 * Licensed under the Apache License, Version 2.0 (the "License");
1140 * you may not use this file except in compliance with the License.
1141 * You may obtain a copy of the License at
1142 *
1143 * http://www.apache.org/licenses/LICENSE-2.0
1144 *
1145 * Unless required by applicable law or agreed to in writing, software
1146 * distributed under the License is distributed on an "AS IS" BASIS,
1147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1148 * See the License for the specific language governing permissions and
1149 * limitations under the License.
1150 * =============================================================================
1151 */function b8(t,e,n,r,s,i="NDHWC"){const o=I(t,"x","avgPool3d","float32");let a=o,u=!1;o.rank===4&&(u=!0,a=K(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(a.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${a.rank}.`),A(i==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${i}`),A(typeof n=="number"&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,()=>`Error in avgPool3d: Stride must be > 0, but got '${n}'`),Wr("avgPool3d",r,s);const l={x:a},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s,dataFormat:i};let h=V.runKernel(Y$,l,c);return h=vt(h,a.dtype),u?K(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const _8=M({avgPool3d_:b8});/**
1152 * @license
1153 * Copyright 2020 Google LLC. All Rights Reserved.
1154 * Licensed under the Apache License, Version 2.0 (the "License");
1155 * you may not use this file except in compliance with the License.
1156 * You may obtain a copy of the License at
1157 *
1158 * http://www.apache.org/licenses/LICENSE-2.0
1159 *
1160 * Unless required by applicable law or agreed to in writing, softw
1160are
1161 * distributed under the License is distributed on an "AS IS" BASIS,
1162 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1163 * See the License for the specific language governing permissions and
1164 * limitations under the License.
1165 * =============================================================================
1166 */function S8(t,e=0){A(t.length>=1,()=>"Pass at least one tensor to concat");const n=qf(t,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(i=>{if(i.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor
1167          with dtype ${i.dtype}. `)}),n.length===1)return no(n[0]);const r=n,s={axis:e};return V.runKernel(oI,r,s)}const Jt=M({concat_:S8});/**
1168 * @license
1169 * Copyright 2020 Google LLC. All Rights Reserved.
1170 * Licensed under the Apache License, Version 2.0 (the "License");
1171 * you may not use this file except in compliance with the License.
1172 * You may obtain a copy of the License at
1173 *
1174 * http://www.apache.org/licenses/LICENSE-2.0
1175 *
1176 * Unless required by applicable law or agreed to in writing, software
1177 * distributed under the License is distributed on an "AS IS" BASIS,
1178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1179 * See the License for the specific language governing permissions and
1180 * limitations under the License.
1181 * =============================================================================
1182 */function T8(t,e,n=!1,r=!1){let s=I(t,"a","matMul"),i=I(e,"b","matMul");[s,i]=Tt(s,i);const o={a:s,b:i},a={transposeA:n,transposeB:r};return V.runKernel(Q$,o,a)}const ze=M({matMul_:T8});/**
1183 * @license
1184 * Copyright 2018 Google LLC. All Rights Reserved.
1185 * Licensed under the Apache License, Version 2.0 (the "License");
1186 * you may not use this file except in compliance with the License.
1187 * You may obtain a copy of the License at
1188 *
1189 * http://www.apache.org/licenses/LICENSE-2.0
1190 *
1191 * Unless required by applicable law or agreed to in writing, software
1192 * distributed under the License is distributed on an "AS IS" BASIS,
1193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1194 * See the License for the specific language governing permissions and
1195 * limitations under the License.
1196 * =============================================================================
1197 */function C8(t){const n={x:I(t,"x","sigmoid","float32")};return V.runKernel(YA,n)}const ra=M({sigmoid_:C8});/**
1198 * @license
1199 * Copyright 2018 Google LLC. All Rights Reserved.
1200 * Licensed under the Apache License, Version 2.0 (the "License");
1201 * you may not use this file except in compliance with the License.
1202 * You may obtain a copy of the License at
1203 *
1204 * http://www.apache.org/licenses/LICENSE-2.0
1205 *
1206 * Unless required by applicable law or agreed to in writing, software
1207 * distributed under the License is distributed on an "AS IS" BASIS,
1208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1209 * See the License for the specific language governing permissions and
1210 * limitations under the License.
1211 * =============================================================================
1212 */function N8(t,e,n){const r=I(t,"x","slice","string_or_numeric");if(r.rank===0)throw new Error("Slicing scalar is not possible");const s={x:r},i={begin:e,size:n};return V.runKernel(HA,s,i)}const Ne=M({slice_:N8});/**
1213 * @license
1214 * Copyright 2018 Google LLC. All Rights Reserved.
1215 * Licensed under the Apache License, Version 2.0 (the "License");
1216 * you may not use this file except in compliance with the License.
1217 * You may obtain a copy of the License at
1218 *
1219 * http://www.apache.org/licenses/LICENSE-2.0
1220 *
1221 * Unless required by applicable law or agreed to in writing, software
1222 * distributed under the License is distributed on an "AS IS" BASIS,
1223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1224 * See the License for the specific language governing permissions and
1225 * limitations under the License.
1226 * =============================================================================
1227 */function E8(t){const n={x:I(t,"x","tanh","float32")};return V.runKernel(gR,n)}const V0=M({tanh_:E8});/**
1228 * @license
1229 * Copyright 2020 Google LLC. All Rights Reserved.
1230 * Licensed under the Apache License, Version 2.0 (the "License");
1231 * you may not use this file except in compliance with the License.
1232 * You may obtain a copy of the License at
1233 *
1234 * http://www.apache.org/licenses/LICENSE-2.0
1235 *
1236 * Unless required by applicable law or agreed to in writing, software
1237 * distributed under the License is distributed on an "AS IS" BASIS,
1238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1239 * See the License for the specific language governing permissions and
1240 * limitations under the License.
1241 * =============================================================================
1242 */function k8(t,e,n,r,s,i){const o=I(t,"forgetBias","basicLSTMCell"),a=I(e,"lstmKernel","basicLSTMCell"),u=I(n,"lstmBias","basicLSTMCell"),l=I(r,"data","basicLSTMCell"),c=I(s,"c","basicLSTMCell"),h=I(i,"h","basicLSTMCell"),d=Jt([l,h],1),f=ze(d,a),p=ge(f,u),y=p.shape[0],v=p.shape[1]/4,g=[y,v],x=Ne(p,[0,0],g),w=Ne(p,[0,v],g),_=Ne(p,[0,v*2],g),T=Ne(p,[0,v*3],g),E=ge(re(ra(x),V0(w)),re(c,ra(ge(o,_)))),k=re(V0(E),ra(T));return[E,k]}const $8=M({basicLSTMCell_:k8});/**
1243 * @license
1244 * Copyright 2020 Google LLC. All Rights Reserved.
1245 * Licensed under the Apache License, Version 2.0 (the "License");
1246 * you may not use this file except in compliance with the License.
1247 * You may obtain a copy of the License at
1248 *
1249 * http://www.apache.org/licenses/LICENSE-2.0
1250 *
1251 * Unless required by applicable law or agreed to in writing, software
1252 * distributed under the License is distributed on an "AS IS" BASIS,
1253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254 * See the License for the specific language governing permissions and
1255 * limitations under the License.
1256 * =============================================================================
1257 */function I8(t,e,n){const r=I(t,"x","batchToSpaceND"),s=e.reduce((a,u)=>a*u);A(r.rank>=1+e.length,()=>`input rank is ${r.rank} but should be > than blockShape.length ${e.length}`),A(n.length===e.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length  ${e.length}`),A(r.shape[0]%s===0,()=>`input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${e.join(" * ")} === ${s}`);const i={x:r},o={blockShape:e,crops:n};return V.runKernel(Z$,i,o)}const uO=M({batchToSpaceND_:I8});function A8(t){let e;return t.rank===0||t.rank===1?e=K(t,[1,1,1,t.size]):t.rank===2?e=K(t,[1,1,t.shape[0],t.shape[1]]):t.rank===3?e=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]):e=t,e}/**
1258 * @license
1259 * Copyright 2020 Google LLC. All Rights Reserved.
1260 * Licensed under the Apache License, Version 2.0 (the "License");
1261 * you may not use this file except in compliance with the License.
1262 * You may obtain a copy of the License at
1263 *
1264 * http://www.apache.org/licenses/LICENSE-2.0
1265 *
1266 * Unless required by applicable law or agreed to in writing, software
1267 * distributed under the License is distributed on an "AS IS" BASIS,
1268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1269 * See the License for the specific language governing permissions and
1270 * limitations under the License.
1271 * =============================================================================
1272 */function R8(t,e,n,r,s,i){i==null&&(i=.001);const o=I(t,"x","batchNorm"),a=I(e,"mean","batchNorm"),u=I(n,"variance","batchNorm");let l;s!=null&&(l=I(s,"scale","batchNorm"));let c;r!=null&&(c=I(r,"offset","batchNorm")),A(a.rank===u.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),A(c==null||a.rank===c.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),A(l==null||a.rank===l.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");const d={x:A8(o),scale:l,offset:c,mean:a,variance:u},f={varianceEpsilon:i},p=V.runKernel(LI,d,f);return K(p,o.shape)}const um=M({batchNorm_:R8});function O8(t,e,n,r,s,i){const o=I(t,"x","batchNorm"),a=I(e,"mean","batchNorm"),u=I(n,"variance","batchNorm");let l;s!=null&&(l=I(s,"scale","batchNorm"));let c;return r!=null&&(c=I(r,"offset","batchNorm")),A(o.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${o.rank}.`),A(a.rank===2||a.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${a.rank}.`),A(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${u.rank}.`),l!=null&&A(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${l.rank}.`),c!=null&&A(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`),um(o,a,u,c,l,i)}const D8=M({batchNorm2d_:O8});function P8(t,e,n,r,s,i){const o=I(t,"x","batchNorm"),a=I(e,"mean","batchNorm"),u=I(n,"variance","batchNorm");let l;s!=null&&(l=I(s,"scale","batchNorm"));let c;return r!=null&&(c=I(r,"offset","batchNorm")),A(o.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${o.rank}.`),A(a.rank===3||a.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${a.rank}.`),A(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${u.rank}.`),l!=null&&A(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${l.rank}.`),c!=null&&A(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`),um(o,a,u,c,l,i)}const F8=M({batchNorm3d_:P8});function L8(t,e,n,r,s,i){const o=I(t,"x","batchNorm"),a=I(e,"mean","batchNorm"),u=I(n,"variance","batchNorm");let l;s!=null&&(l=I(s,"scale","batchNorm"));let c;return r!=null&&(c=I(r,"offset","batchNorm")),A(o.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${o.rank}.`),A(a.rank===4||a.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${a.rank}.`),A(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${u.rank}.`),l!=null&&A(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${l.rank}.`),c!=null&&A(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`),um(o,a,u,c,l,i)}const M8=M({batchNorm4d_:L8});/**
1273 * @license
1274 * Copyright 2020 Google LLC. All Rights Reserved.
1275 * Licensed under the Apache License, Version 2.0 (the "License");
1276 * you may not use this file except in compliance with the License.
1277 * You may obtain a copy of the License at
1278 *
1279 * http://www.apache.org/licenses/LICENSE-2.0
1280 *
1281 * Unless required by applicable law or agreed to in writing, software
1282 * distributed under the License is distributed on an "AS IS" BASIS,
1283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1284 * See the License for the specific language governing permissions and
1285 * limitations under the License.
1286 * =============================================================================
1287 */function V8(t,e,n){const r=I(t,"x","bincount"),s=I(e,"weights","bincount");A(r.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`),A(n>=0,()=>`size must be non-negative, but got ${n}.`),A(s.size===r.size||s.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${s.shape}.`);const i={x:r,weights:s},o={size:n};return V.runKernel(J$,i,o)}const lO=M({bincount_:V8});/**
1288 * @license
1289 * Copyright 2023 Google LLC.
1290 * Licensed under the Apache License, Version 2.0 (the "License");
1291 * you may not use this file except in compliance with the License.
1292 * You may obtain a copy of the License at
1293 *
1294 * http://www.apache.org/licenses/LICENSE-2.0
1295 *
1296 * Unless required by applicable law or agreed to in writing, software
1297 * distributed under the License is distributed on an "AS IS" BASIS,
1298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1299 * See the License for the specific language governing permissions and
1300 * limitations under the License.
1301 * =============================================================================
1302 */function B8(t,e){const n=I(t,"x","bitwiseAnd"),r=I(e,"y","bitwiseAnd");if(!xt(n.shape,r.shape))throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${n.shape}, y: ${r.shape}`);if(n.dtype!=="int32"||r.dtype!=="int32")throw new Error(`BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ${n.dtype} and type of y: ${r.dtype}`);const s={a:n,b:r};return V.runKernel(eI,s)}const W8=M({bitwiseAnd_:B8});/**
1303 * @license
1304 * Copyright 2021 Google LLC. All Rights Reserved.
1305 * Licensed under the Apache License, Version 2.0 (the "License");
1306 * you may not use this file except in compliance with the License.
1307 * You may obtain a copy of the License at
1308 *
1309 * http://www.apache.org/licenses/LICENSE-2.0
1310 *
1311 * Unless required by applicable law or agreed to in writing, software
1312 * distributed under the License is distributed on an "AS IS" BASIS,
1313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314 * See the License for the specific language governing permissions and
1315 * limitations under the License.
1316 * =============================================================================
1317 */function U8(t,e){const n=I(t,"s0","broadcastArgs","int32"),r=I(e,"s1","broadcastArgs","int32");if(n.rank!==1)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${n.rank}`);if(r.rank!==1)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${r.rank}`);const s={s0:n,s1:r};return V.runKernel(tI,s)}const z8=M({broadcastArgs_:U8});/**
1318 * @license
1319 * Copyright 2020 Google LLC. All Rights Reserved.
1320 * Licensed under the Apache License, Version 2.0 (the "License");
1321 * you may not use this file except in compliance with the License.
1322 * You may obtain a copy of the License at
1323 *
1324 * http://www.apache.org/licenses/LICENSE-2.0
1325 *
1326 * Unless required by applicable law or agreed to in writing, software
1327 * distributed under the License is distributed on an "AS IS" BASIS,
1328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1329 * See the License for the specific language governing permissions and
1330 * limitations under the License.
1331 * =============================================================================
1332 */function j8(t,e){let n=I(t,"broadcastTo","x");const r=n.shape;if(gr(e),e.length<n.rank)throw new Error(`broadcastTo(): shape.length=${e.length} < input.rank=${n.rank}.`);if(e.length>n.rank){const l=n.shape.slice();for(;l.length<e.length;)l.unshift(1);n=K(n,l)}const s=n.shape,i=Array.from(e);for(let l=e.length-1;l>=0;l--)if(s[l]===e[l])i[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${e}].`);if(i.map((l,c)=>l>1?c:-1).filter(l=>l>=0).length===0)return no(n);const a={x:n},u={reps:i};return V.runKernel(k1,a,u)}const mc=M({broadcastTo_:j8});/**
1333 * @license
1334 * Copyright 2018 Google LLC. All Rights Reserved.
1335 * Licensed under the Apache License, Version 2.0 (the "License");
1336 * you may not use this file except in compliance with the License.
1337 * You may obtain a copy of the License at
1338 *
1339 * http://www.apache.org/licenses/LICENSE-2.0
1340 *
1341 * Unless required by applicable law or agreed to in writing, software
1342 * distributed under the License is distributed on an "AS IS" BASIS,
1343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1344 * See the License for the specific language governing permissions and
1345 * limitations under the License.
1346 * =============================================================================
1347 */function G8(t){const n={x:I(t,"x","ceil","float32")};return V.runKernel(nI,n)}const H8=M({ceil_:G8});/**
1348 * @license
1349 * Copyright 2020 Google LLC. All Rights Reserved.
1350 * Licensed under the Apache License, Version 2.0 (the "License");
1351 * you may not use this file except in compliance with the License.
1352 * You may obtain a copy of the License at
1353 *
1354 * http://www.apache.org/licenses/LICENSE-2.0
1355 *
1356 * Unless required by applicable law or agreed to in writing, software
1357 * distributed under the License is distributed on an "AS IS" BASIS,
1358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1359 * See the License for the specific language governing permissions and
1360 * limitations under the License.
1361 * =============================================================================
1362 */function _h(t,e,n){gr(t),n=n||vh(e);const r={shape:t,value:e,dtype:n};return V.runKernel(OI,{},r)}/**
1363 * @license
1364 * Copyright 2018 Google LLC. All Rights Reserved.
1365 * Licensed under the Apache License, Version 2.0 (the "License");
1366 * you may not use this file except in compliance with the License.
1367 * You may obtain a copy of the License at
1368 *
1369 * http://www.apache.org/licenses/LICENSE-2.0
1370 *
1371 * Unless required by applicable law or agreed to in writing, software
1372 * distributed under the License is distributed on an "AS IS" BASIS,
1373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1374 * See the License for the specific language governing permissions and
1375 * limitations under the License.
1376 * =============================================================================
1377 */function q8(t,e,n){const r=I(t,"x","clipByValue");if(A(e<=n,()=>`Error in clip: min (${e}) must be less than or equal to max (${n}).`),e===n)return _h(r.shape,e,r.dtype);const s={x:r},i={clipValueMin:e,clipValueMax:n};return V.runKernel(rI,s,i)}const cO=M({clipByValue_:q8});function K8(t){return Jt(t,0)}const X8=M({concat1d_:K8});function Y8(t,e){return Jt(t,e)}const Q8=M({concat2d_:Y8});function Z8(t,e){return Jt(t,e)}const J8=M({concat3d_:Z8});function eK(t,e){return Jt(t,e)}const tK=M({concat4d_:eK});/**
1378 * @license
1379 * Copyright 2020 Google LLC. All Rights Reserved.
1380 * Licensed under the Apache License, Version 2.0 (the "License");
1381 * you may not use this file except in compliance with the License.
1382 * You may obtain a copy of the License at
1383 *
1384 * http://www.apache.org/licenses/LICENSE-2.0
1385 *
1386 * Unless required by applicable law or agreed to in writing, software
1387 * distributed under the License is distributed on an "AS IS" BASIS,
1388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389 * See the License for the specific language governing permissions and
1390 * limitations under the License.
1391 * =============================================================================
1392 */function nK(t,e,n,r,s="NHWC",i=[1,1],o){const a=I(t,"x","conv2d","float32"),u=I(e,"filter","conv2d","float32");let l=a,c=!1;a.rank===3&&(c=!0,l=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),A(l.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${l.rank}.`),A(u.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${u.rank}.`),Wr("conv2d",r,o);const h=s==="NHWC"?l.shape[3]:l.shape[1];A(h===u.shape[2],()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${u.shape[2]}.`),A(tr(n,i),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),A(wa(i),()=>"Error in conv2D: Dilated rates should be larger than 0."),A(wa(n),()=>"Error in conv2D: Strides should be larger than 0.");const d={x:l,filter:u},f={strides:n,pad:r,dataFormat:s,dilations:i,dimRoundingMode:o},p=V.runKernel(aI,d,f);return c?K(p,[p.shape[1],p.shape[2],p.shape[3]]):p}const lm=M({conv2d_:nK});function rK(t,e,n,r,s="NWC",i=1,o){const a=I(t,"x","conv1d"),u=I(e,"filter","conv1d");let l=a,c=!1;a.rank===2&&(c=!0,l=K(a,[1,a.shape[0],a.shape[1]])),A(l.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${l.rank}.`),A(u.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${u.rank}.`),Wr("conv1d",r,o),A(l.shape[2]===u.shape[1],()=>`Error in conv1d: depth of input (${l.shape[2]}) must match input depth for filter ${u.shape[1]}.`),A(tr(n,i),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${i}'`),A(wa(i),()=>"Error in conv1D: Dilated rates should be larger than 0."),A(wa(n),()=>"Error in conv1D: Stride should be larger than 0."),A(s==="NWC",()=>`Error in conv1d: got dataFormat of ${s} but only NWC is currently supported.`);const h=K(u,[1,u.shape[0],u.shape[1],u.shape[2]]),d=K(l,[l.shape[0],1,l.shape[1],l.shape[2]]),v=lm(d,h,[1,n],r,"NHWC",[1,i],o);return c?K(v,[v.shape[2],v.shape[3]]):K(v,[v.shape[0],v.shape[2],v.shape[3]])}const sK=M({conv1d_:rK});/**
1393 * @license
1394 * Copyright 2020 Google LLC. All Rights Reserved.
1395 * Licensed under the Apache License, Version 2.0 (the "License");
1396 * you may not use this file except in compliance with the License.
1397 * You may obtain a copy of the License at
1398 *
1399 * http://www.apache.org/licenses/LICENSE-2.0
1400 *
1401 * Unless required by applicable law or agreed to in writing, software
1402 * distributed under the License is distributed on an "AS IS" BASIS,
1403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1404 * See the License for the specific language governing permissions and
1405 * limitations under the License.
1406 * =============================================================================
1407 */function iK(t,e,n,r,s,i="NHWC",o){A(t.length===e.rank,()=>`Length of inShape (${t.length}) and rank of dy (${e.rank}) must match`);let a=t,u=e,l=!1;e.rank===3&&(l=!0,u=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]),a=[1,t[0],t[1],t[2]]),A(a.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${a.length}.`),A(u.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${u.rank}`),A(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);const c=i==="NHWC"?a[3]:a[1],h=i==="NHWC"?u.shape[3]:u.shape[1];A(c===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`),A(h===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${h}) must match output depth for filter ${n.shape[3]}.`),Wr("conv2dDerInput",s,o);const d={dy:u,filter:n},f={strides:r,pad:s,dataFormat:i,dimRoundingMode:o,inputShape:a},p=V.runKernel(lI,d,f);return l?K(p,[p.shape[1],p.shape[2],p.shape[3]]):p}const hO=M({conv2DBackpropInput_:iK});function oK(t,e,n,r,s,i){const o=I(t,"x","conv2dTranspose"),a=I(e,"filter","conv2dTranspose");return hO(n,o,a,r,s,"NHWC",i)}const aK=M({conv2dTranspose_:oK});/**
1408 * @license
1409 * Copyright 2020 Google LLC. All Rights Reserved.
1410 * Licensed under the Apache License, Version 2.0 (the "License");
1411 * you may not use this file except in compliance with the License.
1412 * You may obtain a copy of the License at
1413 *
1414 * http://www.apache.org/licenses/LICENSE-2.0
1415 *
1416 * Unless required by applicable law or agreed to in writing, software
1417 * distributed under the License is distributed on an "AS IS" BASIS,
1418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1419 * See the License for the specific language governing permissions and
1420 * limitations under the License.
1421 * =============================================================================
1422 */function uK(t,e,n,r,s="NDHWC",i=[1,1,1]){const o=I(t,"x","conv3d"),a=I(e,"filter","conv3d");let u=o,l=!1;o.rank===4&&(l=!0,u=K(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(u.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${u.rank}.`),A(a.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${a.rank}.`),A(u.shape[4]===a.shape[3],()=>`Error in conv3d: depth of input (${u.shape[4]}) must match input depth for filter ${a.shape[3]}.`),A(tr(n,i),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),A(s==="NDHWC",()=>`Error in conv3d: got dataFormat of ${s} but only NDHWC is currently supported.`),A(wa(i),()=>"Error in conv3D: Dilated rates should be larger than 0."),A(wa(n),()=>"Error in conv3D: Strides should be larger than 0.");const c={x:u,filter:a},h={strides:n,pad:r,dataFormat:s,dilations:i},d=V.runKernel(cI,c,h);return l?K(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const lK=M({conv3d_:uK});/**
1423 * @license
1424 * Copyright 2020 Google LLC. All Rights Reserved.
1425 * Licensed under the Apache License, Version 2.0 (the "License");
1426 * you may not use this file except in compliance with the License.
1427 * You may obtain a copy of the License at
1428 *
1429 * http://www.apache.org/licenses/LICENSE-2.0
1430 *
1431 * Unless required by applicable law or agreed to in writing, software
1432 * distributed under the License is distributed on an "AS IS" BASIS,
1433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1434 * See the License for the specific language governing permissions and
1435 * limitations under the License.
1436 * =============================================================================
1437 */function cK(t,e,n,r,s){A(t.length===e.rank,()=>`Length of inShape (${t.length}) and rank of dy (${e.rank}) must match`);let i=t,o=e,a=!1;e.rank===4&&(a=!0,o=K(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]),i=[1,t[0],t[1],t[2],t[3]]);const u=i[4],l=o.shape[4];A(i.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${i.length}.`),A(o.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${o.rank}`),A(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}
1437`),A(u===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${u}) must match input depth for filter ${n.shape[3]}.`),A(l===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${l}) must match output depth for filter ${n.shape[4]}.`);const c={dy:o,filter:n},h={pad:s,strides:r,inputShape:i},d=V.runKernel(hI,c,h);return a?K(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const hK=M({conv3DBackpropInput_:cK});function dK(t,e,n,r,s){const i=I(t,"x","conv3dTranspose"),o=I(e,"filter","conv3dTranspose");return hK(n,i,o,r,s)}const fK=M({conv3dTranspose_:dK});/**
1438 * @license
1439 * Copyright 2018 Google LLC. All Rights Reserved.
1440 * Licensed under the Apache License, Version 2.0 (the "License");
1441 * you may not use this file except in compliance with the License.
1442 * You may obtain a copy of the License at
1443 *
1444 * http://www.apache.org/licenses/LICENSE-2.0
1445 *
1446 * Unless required by applicable law or agreed to in writing, software
1447 * distributed under the License is distributed on an "AS IS" BASIS,
1448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1449 * See the License for the specific language governing permissions and
1450 * limitations under the License.
1451 * =============================================================================
1452 */function pK(t){const n={x:I(t,"x","cos","float32")};return V.runKernel(dI,n)}const mK=M({cos_:pK});/**
1453 * @license
1454 * Copyright 2018 Google LLC. All Rights Reserved.
1455 * Licensed under the Apache License, Version 2.0 (the "License");
1456 * you may not use this file except in compliance with the License.
1457 * You may obtain a copy of the License at
1458 *
1459 * http://www.apache.org/licenses/LICENSE-2.0
1460 *
1461 * Unless required by applicable law or agreed to in writing, software
1462 * distributed under the License is distributed on an "AS IS" BASIS,
1463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1464 * See the License for the specific language governing permissions and
1465 * limitations under the License.
1466 * =============================================================================
1467 */function gK(t){const n={x:I(t,"x","cosh","float32")};return V.runKernel(fI,n)}const yK=M({cosh_:gK});/**
1468 * @license
1469 * Copyright 2022 Google LLC. All Rights Reserved.
1470 * Licensed under the Apache License, Version 2.0 (the 'License');
1471 * you may not use this file except in compliance with the License.
1472 * You may obtain a copy of the License at
1473 *
1474 * http://www.apache.org/licenses/LICENSE-2.0
1475 *
1476 * Unless required by applicable law or agreed to in writing, software
1477 * distributed under the License is distributed on an 'AS IS' BASIS,
1478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1479 * See the License for the specific language governing permissions and
1480 * limitations under the License.
1481 * =============================================================================
1482 */function vK(t,e=0,n=!1,r=!1){const i={x:I(t,"x","cumprod")},o={axis:e,exclusive:n,reverse:r};return V.runKernel(pI,i,o)}const xK=M({cumprod_:vK});/**
1483 * @license
1484 * Copyright 2018 Google LLC. All Rights Reserved.
1485 * Licensed under the Apache License, Version 2.0 (the "License");
1486 * you may not use this file except in compliance with the License.
1487 * You may obtain a copy of the License at
1488 *
1489 * http://www.apache.org/licenses/LICENSE-2.0
1490 *
1491 * Unless required by applicable law or agreed to in writing, software
1492 * distributed under the License is distributed on an "AS IS" BASIS,
1493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1494 * See the License for the specific language governing permissions and
1495 * limitations under the License.
1496 * =============================================================================
1497 */function wK(t,e=0,n=!1,r=!1){const i={x:I(t,"x","cumsum")},o={axis:e,exclusive:n,reverse:r};return V.runKernel(mI,i,o)}const bK=M({cumsum_:wK});/**
1498 * @license
1499 * Copyright 2020 Google LLC. All Rights Reserved.
1500 * Licensed under the Apache License, Version 2.0 (the "License");
1501 * you may not use this file except in compliance with the License.
1502 * You may obtain a copy of the License at
1503 *
1504 * http://www.apache.org/licenses/LICENSE-2.0
1505 *
1506 * Unless required by applicable law or agreed to in writing, softw
1506are
1507 * distributed under the License is distributed on an "AS IS" BASIS,
1508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1509 * See the License for the specific language governing permissions and
1510 * limitations under the License.
1511 * =============================================================================
1512 */function _K(t,e,n,r=!1){const s=I(t,"x","denseBincount"),i=I(e,"weights","denseBincount");A(s.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${s.dtype}`),A(s.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${s.rank}.`),A(n>=0,()=>`size must be non-negative, but got ${n}.`),A(i.size===s.size||i.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${s.shape}, weights shape: ${i.shape}.`);const o={x:s,weights:i},a={size:n,binaryOutput:r};return V.runKernel(yI,o,a)}const SK=M({denseBincount_:_K});/**
1513 * @license
1514 * Copyright 2020 Google LLC. All Rights Reserved.
1515 * Licensed under the Apache License, Version 2.0 (the "License");
1516 * you may not use this file except in compliance with the License.
1517 * You may obtain a copy of the License at
1518 *
1519 * http://www.apache.org/licenses/LICENSE-2.0
1520 *
1521 * Unless required by applicable law or agreed to in writing, software
1522 * distributed under the License is distributed on an "AS IS" BASIS,
1523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1524 * See the License for the specific language governing permissions and
1525 * limitations under the License.
1526 * =============================================================================
1527 */function TK(t,e,n="NHWC"){const r=I(t,"x","depthToSpace","float32"),s=n==="NHWC"?r.shape[1]:r.shape[2],i=n==="NHWC"?r.shape[2]:r.shape[3],o=n==="NHWC"?r.shape[3]:r.shape[1];A(e>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${e}`),A(s*e>=0,()=>`Negative dimension size caused by overflow when multiplying
1528    ${s} and ${e}  for depthToSpace with input shape
1529    ${r.shape}`),A(i*e>=0,()=>`Negative dimension size caused by overflow when multiplying
1530    ${i} and ${e} for depthToSpace with input shape
1531        ${r.shape}`),A(o%(e*e)===0,()=>`Dimension size must be evenly divisible by ${e*e} but is ${o} for depthToSpace with input shape ${r.shape}`);const a={x:r},u={blockSize:e,dataFormat:n};return V.runKernel(vI,a,u)}const CK=M({depthToSpace_:TK});/**
1532 * @license
1533 * Copyright 2020 Google LLC. All Rights Reserved.
1534 * Licensed under the Apache License, Version 2.0 (the "License");
1535 * you may not use this file except in compliance with the License.
1536 * You may obtain a copy of the License at
1537 *
1538 * http://www.apache.org/licenses/LICENSE-2.0
1539 *
1540 * Unless required by applicable law or agreed to in writing, software
1541 * distributed under the License is distributed on an "AS IS" BASIS,
1542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1543 * See the License for the specific language governing permissions and
1544 * limitations under the License.
1545 * =============================================================================
1546 */function NK(t,e,n,r,s="NHWC",i=[1,1],o){const a=I(t,"x","depthwiseConv2d","float32"),u=I(e,"filter","depthwiseConv2d","float32");let l=a,c=!1;a.rank===3&&(c=!0,l=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),A(l.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${l.rank}.`),A(u.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${u.rank}.`);const h=s==="NHWC"?l.shape[3]:l.shape[1];A(h===u.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${h}) must match the inChannels dimension in filter ${u.shape[2]}.`),Wr("depthwiseConv2d",r,o);const d={x:l,filter:u},f={strides:n,pad:r,dataFormat:s,dilations:i,dimRoundingMode:o},p=V.runKernel(xI,d,f);return c?K(p,[p.shape[1],p.shape[2],p.shape[3]]):p}const D1=M({depthwiseConv2d_:NK});/**
1547 * @license
1548 * Copyright 2020 Google LLC. All Rights Reserved.
1549 * Licensed under the Apache License, Version 2.0 (the "License");
1550 * you may not use this file except in compliance with the License.
1551 * You may obtain a copy of the License at
1552 *
1553 * http://www.apache.org/licenses/LICENSE-2.0
1554 *
1555 * Unless required by applicable law or agreed to in writing, softw
1555are
1556 * distributed under the License is distributed on an "AS IS" BASIS,
1557 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1558 * See the License for the specific language governing permissions and
1559 * limitations under the License.
1560 * =============================================================================
1561 */function EK(t){const n={x:I(t,"x","diag")};return V.runKernel(_I,n)}const kK=M({diag_:EK});/**
1562 * @license
1563 * Copyright 2020 Google LLC. All Rights Reserved.
1564 * Licensed under the Apache License, Version 2.0 (the "License");
1565 * you may not use this file except in compliance with the License.
1566 * You may obtain a copy of the License at
1567 *
1568 * http://www.apache.org/licenses/LICENSE-2.0
1569 *
1570 * Unless required by applicable law or agreed to in writing, software
1571 * distributed under the License is distributed on an "AS IS" BASIS,
1572 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1573 * See the License for the specific language governing permissions and
1574 * limitations under the License.
1575 * =============================================================================
1576 */function $K(t,e,n,r,s=[1,1],i="NHWC"){const o=I(t,"x","dilation2d"),a=I(e,"filter","dilation2d");A(o.rank===3||o.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${o.rank}.`),A(a.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${a.rank}.`),A(i==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${i}`);let u=o,l=!1;o.rank===3&&(u=K(o,[1,o.shape[0],o.shape[1],o.shape[2]]),l=!0),A(u.shape[3]===a.shape[2],()=>`Error in dilation2d:  input and filter must have the same depth: ${u.shape[3]} vs ${a.shape[2]}`);const c={x:u,filter:a},h={strides:n,pad:r,dilations:s},d=V.runKernel(SI,c,h);return l?K(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const IK=M({dilation2d_:$K});/**
1577 * @license
1578 * Copyright 2017 Google LLC. All Rights Reserved.
1579 * Licensed under the Apache License, Version 2.0 (the "License");
1580 * you may not use this file except in compliance with the License.
1581 * You may obtain a copy of the License at
1582 *
1583 * http://www.apache.org/licenses/LICENSE-2.0
1584 *
1585 * Unless required by applicable law or agreed to in writing, software
1586 * distributed under the License is distributed on an "AS IS" BASIS,
1587 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1588 * See the License for the specific language governing permissions and
1589 * limitations under the License.
1590 * =============================================================================
1591 */function Kf(t,e){const n=t.length,r=[];for(let s=0;s<n;s++){const i=n-1-s,o=t[i]||1;(e[e.length-1-s]||1)>1&&o===1&&r.unshift(i)}return r}function dO(t,e){const n=[];for(let r=0;r<e.length;r++){const s=t[t.length-r-1],i=e.length-r-1,o=e[i];(s==null||s===1&&o>1)&&n.unshift(i)}return n}function Le(t,e){const n=Math.max(t.length,e.length),r=new Array(n);for(let s=0;s<n;s++){let i=t[t.length-s-1];i==null&&(i=1);let o=e[e.length-s-1];if(o==null&&(o=1),i===1)r[n-s-1]=o;else if(o===1)r[n-s-1]=i;else if(i!==o){const a=`Operands could not be broadcast together with shapes ${t} and ${e}.`;throw Error(a)}else r[n-s-1]=i}return r}/**
1592 * @license
1593 * Copyright 2020 Google LLC. All Rights Reserved.
1594 * Licensed under the Apache License, Version 2.0 (the "License");
1595 * you may not use this file except in compliance with the License.
1596 * You may obtain a copy of the License at
1597 *
1598 * http://www.apache.org/licenses/LICENSE-2.0
1599 *
1600 * Unless required by applicable law or agreed to in writing, software
1601 * distributed under the License is distributed on an "AS IS" BASIS,
1602 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1603 * See the License for the specific language governing permissions and
1604 * limitations under the License.
1605 * =============================================================================
1606 */function AK(t,e){let n=I(t,"a","equal","string_or_numeric"),r=I(e,"b","equal","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(kI,s)}const fO=M({equal_:AK});/**
1607 * @license
1608 * Copyright 2020 Google LLC. All Rights Reserved.
1609 * Licensed under the Apache License, Version 2.0 (the "License");
1610 * you may not use this file except in compliance with the License.
1611 * You may obtain a copy of the License at
1612 *
1613 * http://www.apache.org/licenses/LICENSE-2.0
1614 *
1615 * Unless required by applicable law or agreed to in writing, software
1616 * distributed under the License is distributed on an "AS IS" BASIS,
1617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1618 * See the License for the specific language governing permissions and
1619 * limitations under the License.
1620 * =============================================================================
1621 */function RK(t,e,n){const r=I(e,"a","where"),s=I(n,"b","where"),i=I(t,"condition","where","bool"),o=Le(Le(i.shape,r.shape),s.shape),a=mc(i,o),u=mc(r,o),l=mc(s,o),c={condition:a,t:u,e:l};return V.runKernel(jA,c)}const ro=M({where_:RK});/**
1622 * @license
1623 * Copyright 2018 Google LLC. All Rights Reserved.
1624 * Licensed under the Apache License, Version 2.0 (the "License");
1625 * you may not use this file except in compliance with the License.
1626 * You may obtain a copy of the License at
1627 *
1628 * http://www.apache.org/licenses/LICENSE-2.0
1629 *
1630 * Unless required by applicable law or agreed to in writing, software
1631 * distributed under the License is distributed on an "AS IS" BASIS,
1632 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1633 * See the License for the specific language governing permissions and
1634 * limitations under the License.
1635 * =============================================================================
1636 */function OK(t){const n={x:I(t,"x","zerosLike")};return V.runKernel(_R,n)}const cr=M({zerosLike_:OK});/**
1637 * @license
1638 * Copyright 2020 Google LLC. All Rights Reserved.
1639 * Licensed under the Apache License, Version 2.0 (the "License");
1640 * you may not use this file except in compliance with the License.
1641 * You may obtain a copy of the License at
1642 *
1643 * http://www.apache.org/licenses/LICENSE-2.0
1644 *
1645 * Unless required by applicable law or agreed to in writing, software
1646 * distributed under the License is distributed on an "AS IS" BASIS,
1647 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648 * See the License for the specific language governing permissions and
1649 * limitations under the License.
1650 * =============================================================================
1651 */function DK(t,e){let n=I(t,"a","div"),r=I(e,"b","div");[n,r]=Tt(n,r);const s=Ae(n,r),i=cr(s),o=fO(r,i);return ro(o,i,s)}const PK=M({divNoNan_:DK});/**
1652 * @license
1653 * Copyright 2020 Google LLC. All Rights Reserved.
1654 * Licensed under the Apache License, Version 2.0 (the "License");
1655 * you may not use this file except in compliance with the License.
1656 * You may obtain a copy of the License at
1657 *
1658 * http://www.apache.org/licenses/LICENSE-2.0
1659 *
1660 * Unless required by applicable law or agreed to in writing, software
1661 * distributed under the License is distributed on an "AS IS" BASIS,
1662 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1663 * See the License for the specific language governing permissions and
1664 * limitations under the License.
1665 * =============================================================================
1666 */function FK(t,e){const n=I(t,"t1","dot"),r=I(e,"t2","dot");A((n.rank===1||n.rank===2)&&(r.rank===1||r.rank===2),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`);const s=n.rank===1?n.size:n.shape[1],i=r.rank===1?r.size:r.shape[0];if(A(s===i,()=>`Error in dot: inner dimensions of inputs must match, but got ${s} and ${i}.`),n.rank===1&&r.rank===1){const o=K(n,[1,-1]),a=K(r,[-1,1]),u=ze(o,a);return K(u,[])}else if(n.rank===1&&r.rank===2){const o=K(n,[1,-1]),a=K(r,[r.shape[0],r.shape[1]]),u=ze(o,a);return K(u,[u.size])}else if(n.rank===2&&r.rank===1){const o=K(r,[-1,1]),a=ze(n,o);return K(a,[a.size])}else{const o=K(r,[r.shape[0],r.shape[1]]);return ze(n,o)}}const LK=M({dot_:FK});/**
1667 * @license
1668 * Copyright 2021 Google LLC. All Rights Reserved.
1669 * Licensed under the Apache License, Version 2.0 (the "License");
1670 * you may not use this file except in compliance with the License.
1671 * You may obtain a copy of the License at
1672 *
1673 * http://www.apache.org/licenses/LICENSE-2.0
1674 *
1675 * Unless required by applicable law or agreed to in writing, softw
1675are
1676 * distributed under the License is distributed on an "AS IS" BASIS,
1677 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1678 * See the License for the specific language governing permissions and
1679 * limitations under the License.
1680 * =============================================================================
1681 */function MK(t,...e){const n=e.map((s,i)=>I(s,`tensors${i}`,"einsum")),r={equation:t};return V.runKernel(CI,n,r)}const Za=M({einsum_:MK});/**
1682 * @license
1683 * Copyright 2020 Google LLC. All Rights Reserved.
1684 * Licensed under the Apache License, Version 2.0 (the "License");
1685 * you may not use this file except in compliance with the License.
1686 * You may obtain a copy of the License at
1687 *
1688 * http://www.apache.org/licenses/LICENSE-2.0
1689 *
1690 * Unless required by applicable law or agreed to in writing, software
1691 * distributed under the License is distributed on an "AS IS" BASIS,
1692 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1693 * See the License for the specific language governing permissions and
1694 * limitations under the License.
1695 * =============================================================================
1696 */function VK(t){const n={x:I(t,"x","elu","float32")};return V.runKernel(NI,n)}const pO=M({elu_:VK});/**
1697 * @license
1698 * Copyright 2023 Google LLC.
1699 * Licensed under the Apache License, Version 2.0 (the "License");
1700 * you may not use this file except in compliance with the License.
1701 * You may obtain a copy of the License at
1702 *
1703 * http://www.apache.org/licenses/LICENSE-2.0
1704 *
1705 * Unless required by applicable law or agreed to in writing, software
1706 * distributed under the License is distributed on an "AS IS" BASIS,
1707 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1708 * See the License for the specific language governing permissions and
1709 * limitations under the License.
1710 * =============================================================================
1711 */function BK(t,e){const n=I(t,"x","ensureShape","string_or_numeric");if(!r5(n.shape,e))throw new Error(`EnsureShape: Shape of tensor ${n.shape} is not compatible with expected shape ${e}`);return t}const WK=M({ensureShape_:BK});/**
1712 * @license
1713 * Copyright 2018 Google LLC. All Rights Reserved.
1714 * Licensed under the Apache License, Version 2.0 (the "License");
1715 * you may not use this file except in compliance with the License.
1716 * You may obtain a copy of the License at
1717 *
1718 * http://www.apache.org/licenses/LICENSE-2.0
1719 *
1720 * Unless required by applicable law or agreed to in writing, software
1721 * distributed under the License is distributed on an "AS IS" BASIS,
1722 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1723 * See the License for the specific language governing permissions and
1724 * limitations under the License.
1725 * =============================================================================
1726 */function UK(t){let e=I(t,"x","erf");A(e.dtype==="int32"||e.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),e.dtype==="int32"&&(e=vt(e,"float32"));const n={x:e};return V.runKernel(EI,n)}const zK=M({erf_:UK});/**
1727 * @license
1728 * Copyright 2017 Google LLC. All Rights Reserved.
1729 * Licensed under the Apache License, Version 2.0 (the "License");
1730 * you may not use this file except in compliance with the License.
1731 * You may obtain a copy of the License at
1732 *
1733 * http://www.apache.org/licenses/LICENSE-2.0
1734 *
1735 * Unless required by applicable law or agreed to in writing, software
1736 * distributed under the License is distributed on an "AS IS" BASIS,
1737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1738 * See the License for the specific language governing permissions and
1739 * limitations under the License.
1740 * =============================================================================
1741 */function P1(t,e){for(let n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function mO(t,e,n){const r=t.length+e.length,s=[];let i=0,o=0;for(let a=0;a<r;a++)n.indexOf(a)===-1?s.push(t[i++]):s.push(e[o++]);return s}function qs(t,e){const n=[],r=t.length;for(let i=0;i<r;i++)e.indexOf(i)===-1&&n.push(t[i]);const s=e.map(i=>t[i]);return[n,s]}function vr(t,e){const n=e.map(r=>1);return mO(t,n,e)}function ws(t,e,n){A(P1(e,n),()=>`${t} supports only inner-most axes for now. Got axes ${e} and rank-${n} input.`)}function Ur(t,e){if(P1(t,e))return null;const n=[];for(let r=0;r<e;++r)t.indexOf(r)===-1&&n.push(r);return t.forEach(r=>n.push(r)),n}function F1(t){return t.map((e,n)=>[n,e]).sort((e,n)=>e[1]-n[1]).map(e=>e[0])}function zr(t,e){const n=[];for(let r=e-t;r<e;++r)n.push(r);return n}/**
1742 * @license
1743 * Copyright 2020 Google LLC. All Rights Reserved.
1744 * Licensed under the Apache License, Version 2.0 (the "License");
1745 * you may not use this file except in compliance with the License.
1746 * You may obtain a copy of the License at
1747 *
1748 * http://www.apache.org/licenses/LICENSE-2.0
1749 *
1750 * Unless required by applicable law or agreed to in writing, software
1751 * distributed under the License is distributed on an "AS IS" BASIS,
1752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1753 * See the License for the specific language governing permissions and
1754 * limitations under the License.
1755 * =============================================================================
1756 */function jK(t,e=null,n=!1){const s={x:I(t,"x","max")},i={reductionIndices:e,keepDims:n};return V.runKernel(rA,s,i)}const Au=M({max_:jK});/**
1757 * @license
1758 * Copyright 2020 Google Inc. All Rights Reserved.
1759 * Licensed under the Apache License, Version 2.0 (the "License");
1760 * you may not use this file except in compliance with the License.
1761 * You may obtain a copy of the License at
1762 *
1763 * http://www.apache.org/licenses/LICENSE-2.0
1764 *
1765 * Unless required by applicable law or agreed to in writing, software
1766 * distributed under the License is distributed on an "AS IS" BASIS,
1767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1768 * See the License for the specific language governing permissions and
1769 * limitations under the License.
1770 * =============================================================================
1771 */function GK(t,e=null,n=!1){const s={x:I(t,"x","min")},i={axis:e,keepDims:n};return V.runKernel(lA,s,i)}const B0=M({min_:GK});/**
1772 * @license
1773 * Copyright 2020 Google LLC. All Rights Reserved.
1774 * Licensed under the Apache License, Version 2.0 (the "License");
1775 * you may not use this file except in compliance with the License.
1776 * You may obtain a copy of the License at
1777 *
1778 * http://www.apache.org/licenses/LICENSE-2.0
1779 *
1780 * Unless required by applicable law or agreed to in writing, software
1781 * distributed under the License is distributed on an "AS IS" BASIS,
1782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1783 * See the License for the specific language governing permissions and
1784 * limitations under the License.
1785 * =============================================================================
1786 */function HK(t,e){let n=I(t,"base","pow"),r=I(e,"exp","pow");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(TA,s)}const zc=M({pow_:HK});/**
1787 * @license
1788 * Copyright 2018 Google LLC. All Rights Reserved.
1789 * Licensed under the Apache License, Version 2.0 (the "License");
1790 * you may not use this file except in compliance with the License.
1791 * You may obtain a copy of the License at
1792 *
1793 * http://www.apache.org/licenses/LICENSE-2.0
1794 *
1795 * Unless required by applicable law or agreed to in writing, software
1796 * distributed under the License is distributed on an "AS IS" BASIS,
1797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1798 * See the License for the specific language governing permissions and
1799 * limitations under the License.
1800 * =============================================================================
1801 */function De(t,e){if((Br(t)&&e!=="string"||Array.isArray(t))&&e!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(e==="string"&&Br(t)&&!(t instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return To(t,[],[],e)}/**
1802 * @license
1803 * Copyright 2018 Google LLC. All Rights Reserved.
1804 * Licensed under the Apache License, Version 2.0 (the "License");
1805 * you may not use this file except in compliance with the License.
1806 * You may obtain a copy of the License at
1807 *
1808 * http://www.apache.org/licenses/LICENSE-2.0
1809 *
1810 * Unless required by applicable law or agreed to in writing, software
1811 * distributed under the License is distributed on an "AS IS" BASIS,
1812 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1813 * See the License for the specific language governing permissions and
1814 * limitations under the License.
1815 * =============================================================================
1816 */function qK(t){const n={x:I(t,"x","sqrt","float32")};return V.runKernel(ZA,n)}const yi=M({sqrt_:qK});/**
1817 * @license
1818 * Copyright 2019 Google LLC. All Rights Reserved.
1819 * Licensed under the Apache License, Version 2.0 (the "License");
1820 * you may not use this file except in compliance with the License.
1821 * You may obtain a copy of the License at
1822 *
1823 * http://www.apache.org/licenses/LICENSE-2.0
1824 *
1825 * Unless required by applicable law or agreed to in writing, software
1826 * distributed under the License is distributed on an "AS IS" BASIS,
1827 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1828 * See the License for the specific language governing permissions and
1829 * limitations under the License.
1830 * =============================================================================
1831 */function KK(t){const e=I(t,"x","square"),n={};return V.runKernel("Square",{x:e},n)}const us=M({square_:KK});/**
1832 * @license
1833 * Copyright 2018 Google LLC. All Rights Reserved.
1834 * Licensed under the Apache License, Version 2.0 (the "License");
1835 * you may not use this file except in compliance with the License.
1836 * You may obtain a copy of the License at
1837 *
1838 * http://www.apache.org/licenses/LICENSE-2.0
1839 *
1840 * Unless required by applicable law or agreed to in writing, software
1841 * distributed under the License is distributed on an "AS IS" BASIS,
1842 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1843 * See the License for the specific language governing permissions and
1844 * limitations under the License.
1845 * =============================================================================
1846 */function XK(t,e=null,n=!1){let r=I(t,"x","sum");r.dtype==="bool"&&(r=vt(r,"int32"));const s={x:r},i={axis:e,keepDims:n};return V.runKernel(JA,s,i)}const et=M({sum_:XK});/**
1847 * @license
1848 * Copyright 2018 Google LLC. All Rights Reserved.
1849 * Licensed under the Apache License, Version 2.0 (the "License");
1850 * you may not use this file except in compliance with the License.
1851 * You may obtain a copy of the License at
1852 *
1853 * http://www.apache.org/licenses/LICENSE-2.0
1854 *
1855 * Unless required by applicable law or agreed to in writing, software
1856 * distributed under the License is distributed on an "AS IS" BASIS,
1857 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1858 * See the License for the specific language governing permissions and
1859 * limitations under the License.
1860 * =============================================================================
1861 */function YK(t,e="euclidean",n=null,r=!1){t=I(t,"x","norm");const s=gO(t,e,n);let i=s.shape;if(r){const o=Gt(n,t.shape);i=vr(s.shape,o)}return K(s,i)}function gO(t,e,n=null){if(t.rank===0)return rr(t);if(t.rank!==1&&n===null)return gO(K(t,[-1]),e,n);if(t.rank===1||typeof n=="number"||Array.isArray(n)&&n.length===1){if(e===1)return et(rr(t),n);if(e===1/0)return Au(rr(t),n);if(e===-1/0)return B0(rr(t),n);if(e==="euclidean"||e===2)return yi(et(zc(rr(t),De(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${e}`)}if(Array.isArray(n)&&n.length===2){if(e===1)return Au(et(rr(t),n[0]),n[1]-1);if(e===1/0)return Au(et(rr(t),n[1]),n[0]);if(e===-1/0)return B0(et(rr(t),n[1]),n[0]);if(e==="fro"||e==="euclidean")return yi(et(us(t),n));throw new Error(`Error in norm: invalid ord value: ${e}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}const cm=M({norm_:YK});/**
1862 * @license
1863 * Copyright 2022 Google LLC. All Rights Reserved.
1864 * Licensed under the Apache License, Version 2.0 (the "License");
1865 * you may not use this file except in compliance with the License.
1866 * You may obtain a copy of the License at
1867 *
1868 * http://www.apache.org/licenses/LICENSE-2.0
1869 *
1870 * Unless required by applicable law or agreed to in writing, software
1871 * distributed under the License is distributed on an "AS IS" BASIS,
1872 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1873 * See the License for the specific language governing permissions and
1874 * limitations under the License.
1875 * =============================================================================
1876 */function QK(t,e=null,n=!1){return cm(t,"euclidean",e,n)}const ZK=M({euclideanNorm_:QK});/**
1877 * @license
1878 * Copyright 2018 Google LLC. All Rights Reserved.
1879 * Licensed under the Apache License, Version 2.0 (the "License");
1880 * you may not use this file except in compliance with the License.
1881 * You may obtain a copy of the License at
1882 *
1883 * http://www.apache.org/licenses/LICENSE-2.0
1884 *
1885 * Unless required by applicable law or agreed to in writing, softw
1885are
1886 * distributed under the License is distributed on an "AS IS" BASIS,
1887 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1888 * See the License for the specific language governing permissions and
1889 * limitations under the License.
1890 * =============================================================================
1891 */function JK(t){const n={x:I(t,"x","exp")};return V.runKernel($I,n)}const vi=M({exp_:JK});/**
1892 * @license
1893 * Copyright 2020 Google LLC. All Rights Reserved.
1894 * Licensed under the Apache License, Version 2.0 (the "License");
1895 * you may not use this file except in compliance with the License.
1896 * You may obtain a copy of the License at
1897 *
1898 * http://www.apache.org/licenses/LICENSE-2.0
1899 *
1900 * Unless required by applicable law or agreed to in writing, software
1901 * distributed under the License is distributed on an "AS IS" BASIS,
1902 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1903 * See the License for the specific language governing permissions and
1904 * limitations under the License.
1905 * =============================================================================
1906 */function eX(t,e=0){const n=I(t,"x","expandDims","string_or_numeric");A(e<=n.rank,()=>"Axis must be <= rank of the tensor");const r={input:n},s={dim:e};return V.runKernel(II,r,s)}const ks=M({expandDims_:eX});/**
1907 * @license
1908 * Copyright 2018 Google LLC. All Rights Reserved.
1909 * Licensed under the Apache License, Version 2.0 (the "License");
1910 * you may not use this file except in compliance with the License.
1911 * You may obtain a copy of the License at
1912 *
1913 * http://www.apache.org/licenses/LICENSE-2.0
1914 *
1915 * Unless required by applicable law or agreed to in writing, software
1916 * distributed under the License is distributed on an "AS IS" BASIS,
1917 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1918 * See the License for the specific language governing permissions and
1919 * limitations under the License.
1920 * =============================================================================
1921 */function tX(t){const n={x:I(t,"x","expm1")};return V.runKernel(AI,n)}const nX=M({expm1_:tX});/**
1922 * @license
1923 * Copyright 2020 Google LLC. All Rights Reserved.
1924 * Licensed under the Apache License, Version 2.0 (the "License");
1925 * you may not use this file except in compliance with the License.
1926 * You may obtain a copy of the License at
1927 *
1928 * http://www.apache.org/licenses/LICENSE-2.0
1929 *
1930 * Unless required by applicable law or agreed to in writing, software
1931 * distributed under the License is distributed on an "AS IS" BASIS,
1932 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1933 * See the License for the specific language governing permissions and
1934 * limitations under the License.
1935 * =============================================================================
1936 */function rX(t,e){const n=I(t,"x","tile","string_or_numeric");A(n.rank===e.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${e}.`);const r={x:n},s={reps:e};return V.runKernel(k1,r,s)}const gc=M({tile_:rX});/**
1937 * @license
1938 * Copyright 2020 Google LLC. All Rights Reserved.
1939 * Licensed under the Apache License, Version 2.0 (the "License");
1940 * you may not use this file except in compliance with the License.
1941 * You may obtain a copy of the License at
1942 *
1943 * http://www.apache.org/licenses/LICENSE-2.0
1944 *
1945 * Unless required by applicable law or agreed to in writing, software
1946 * distributed under the License is distributed on an "AS IS" BASIS,
1947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1948 * See the License for the specific language governing permissions and
1949 * limitations under the License.
1950 * =============================================================================
1951 */function sX(t,e,n,r="float32"){e==null&&(e=t);const s=wt([t,e],r),i=t<=e?t:e;for(let a=0;a<i;++a)s.set(1,a,a);const o=K(s.toTensor(),[t,e]);if(n==null)return o;if(n.length===1)return gc(ks(o,0),[n[0],1,1]);if(n.length===2)return gc(ks(ks(o,0),0),[n[0],n[1],1,1]);
vendor: 4,640 bytes, lines 1951-2029
1951if(n.length===3)return gc(ks(ks(ks(o,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`)}const yO=M({eye_:sX});/**
1952 * @license
1953 * Copyright 2018 Google LLC. All Rights Reserved.
1954 * Licensed under the Apache License, Version 2.0 (the "License");
1955 * you may not use this file except in compliance with the License.
1956 * You may obtain a copy of the License at
1957 *
1958 * http://www.apache.org/licenses/LICENSE-2.0
1959 *
1960 * Unless required by applicable law or agreed to in writing, software
1961 * distributed under the License is distributed on an "AS IS" BASIS,
1962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1963 * See the License for the specific language governing permissions and
1964 * limitations under the License.
1965 * =============================================================================
1966 */function iX(t){const n={x:I(t,"x","floor","float32")};return V.runKernel(PI,n)}const vO=M({floor_:iX});/**
1967 * @license
1968 * Copyright 2018 Google LLC. All Rights Reserved.
1969 * Licensed under the Apache License, Version 2.0 (the "License");
1970 * you may not use this file except in compliance with the License.
1971 * You may obtain a copy of the License at
1972 *
1973 * http://www.apache.org/licenses/LICENSE-2.0
1974 *
1975 * Unless required by applicable law or agreed to in writing, software
1976 * distributed under the License is distributed on an "AS IS" BASIS,
1977 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1978 * See the License for the specific language governing permissions and
1979 * limitations under the License.
1980 * =============================================================================
1981 */function oX(t,e,n=0,r=0){const s=I(t,"x","gather"),i=I(e,"indices","gather","int32"),o={x:s,indices:i},a={axis:n,batchDims:r};return V.runKernel(MI,o,a)}const xO=M({gather_:oX});/**
1982 * @license
1983 * Copyright 2020 Google LLC. All Rights Reserved.
1984 * Licensed under the Apache License, Version 2.0 (the "License");
1985 * you may not use this file except in compliance with the License.
1986 * You may obtain a copy of the License at
1987 *
1988 * http://www.apache.org/licenses/LICENSE-2.0
1989 *
1990 * Unless required by applicable law or agreed to in writing, software
1991 * distributed under the License is distributed on an "AS IS" BASIS,
1992 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1993 * See the License for the specific language governing permissions and
1994 * limitations under the License.
1995 * =============================================================================
1996 */function aX(t,e){let n=I(t,"a","greater","string_or_numeric"),r=I(e,"b","greater","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(BI,s)}const hm=M({greater_:aX});/**
1997 * @license
1998 * Copyright 2020 Google LLC. All Rights Reserved.
1999 * Licensed under the Apache License, Version 2.0 (the "License");
2000 * you may not use this file except in compliance with the License.
2001 * You may obtain a copy of the License at
2002 *
2003 * http://www.apache.org/licenses/LICENSE-2.0
2004 *
2005 * Unless required by applicable law or agreed to in writing, software
2006 * distributed under the License is distributed on an "AS IS" BASIS,
2007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2008 * See the License for the specific language governing permissions and
2009 * limitations under the License.
2010 * =============================================================================
2011 */function uX(t,e){let n=I(t,"a","greaterEqual","string_or_numeric"),r=I(e,"b","greaterEqual","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(WI,s)}const wO=M({greaterEqual_:uX});/**
2012 * @license
2013 * Copyright 2020 Google LLC. All Rights Reserved.
2014 * Licensed under the Apache License, Version 2.0 (the "License");
2015 * you may not use this file except in compliance with the License.
2016 * You may obtain a copy of the License at
2017 *
2018 * http://www.apache.org/licenses/LICENSE-2.0
2019 *
2020 * Unless required by applicable law or agreed to in writing, software
2021 * distributed under the License is distributed on an "AS IS" BASIS,
2022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2023 * See the License for the specific language governing permissions and
2024 * limitations under the License.
2025 * =============================================================================
2026 */function lX(t){const n={input:I(t,"input","imag")};return V.runKernel(zI,n)}const dm=M({imag_:lX});/**
2027 * @license
2028 * Copyright 2018 Google LLC. All Rights Reserved.
2029 * Licensed under the Apache License, Version 2.0 (the "License");
2030 * you may not use this file except in compliance with the License.
2031 * You may obtain a copy of the License at
2032 *
2033 * http://www.apache.org/licenses/LICENSE-2.0
2034 *
2035 * Unless required by applicable law or agreed to in writing, software
2036 * distributed under the License is distributed on an "AS IS" BASIS,
2037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2038 * See the License for the specific language governing permissions and
2039 * limitations under the License.
2040 * =============================================================================
2041 */function cX(t){const n={x:I(t,"x","isFinite")};return V.runKernel(jI,n)}const hX=M({isFinite_:cX});/**
2042 * @license
2043 * Copyright 2018 Google LLC. All Rights Reserved.
2044 * Licensed under the Apache License, Version 2.0 (the "License");
2045 * you may not use this file except in compliance with the License.
2046 * You may obtain a copy of the License at
2047 *
2048 * http://www.apache.org/licenses/LICENSE-2.0
2049 *
2050 * Unless required by applicable law or agreed to in writing, software
2051 * distributed under the License is distributed on an "AS IS" BASIS,
2052 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2053 * See the License for the specific language governing permissions and
2054 * limitations under the License.
2055 * =============================================================================
2056 */function dX(t){const n={x:I(t,"x","isInf")};return V.runKernel(GI,n)}const fX=M({isInf_:dX});/**
2057 * @license
2058 * Copyright 2018 Google LLC. All Rights Reserved.
2059 * Licensed under the Apache License, Version 2.0 (the "License");
2060 * you may not use this file except in compliance with the License.
2061 * You may obtain a copy of the License at
2062 *
2063 * http://www.apache.org/licenses/LICENSE-2.0
2064 *
2065 * Unless required by applicable law or agreed to in writing, software
2066 * distributed under the License is distributed on an "AS IS" BASIS,
2067 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2068 * See the License for the specific language governing permissions and
2069 * limitations under the License.
2070 * =============================================================================
2071 */function pX(t){const n={x:I(t,"x","isNaN")};return V.runKernel(HI,n)}const mX=M({isNaN_:pX});/**
2072 * @license
2073 * Copyright 2020 Google LLC. All Rights Reserved.
2074 * Licensed under the Apache License, Version 2.0 (the "License");
2075 * you may not use this file except in compliance with the License.
2076 * You may obtain a copy of the License at
2077 *
2078 * http://www.apache.org/licenses/LICENSE-2.0
2079 *
2080 * Unless required by applicable law or agreed to in writing, software
2081 * distributed under the License is distributed on an "AS IS" BASIS,
2082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2083 * See the License for the specific language governing permissions and
2084 * limitations under the License.
2085 * =============================================================================
2086 */function gX(t,e=.2){const r={x:I(t,"x","leakyRelu")},s={alpha:e};return V.runKernel(qI,r,s)}const bO=M({leakyRelu_:gX});/**
2087 * @license
2088 * Copyright 2020 Google LLC. All Rights Reserved.
2089 * Licensed under the Apache License, Version 2.0 (the "License");
2090 * you may not use this file except in compliance with the License.
2091 * You may obtain a copy of the License at
2092 *
2093 * http://www.apache.org/licenses/LICENSE-2.0
2094 *
2095 * Unless required by applicable law or agreed to in writing, software
2096 * distributed under the License is distributed on an "AS IS" BASIS,
2097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2098 * See the License for the specific language governing permissions and
2099 * limitations under the License.
2100 * =============================================================================
2101 */function yX(t,e){let n=I(t,"a","less","string_or_numeric"),r=I(e,"b","less","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(KI,s)}const W0=M({less_:yX});/**
2102 * @license
2103 * Copyright 2020 Google LLC. All Rights Reserved.
2104 * Licensed under the Apache License, Version 2.0 (the "License");
2105 * you may not use this file except in compliance with the License.
2106 * You may obtain a copy of the License at
2107 *
2108 * http://www.apache.org/licenses/LICENSE-2.0
2109 *
2110 * Unless required by applicable law or agreed to in writing, software
2111 * distributed under the License is distributed on an "AS IS" BASIS,
2112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2113 * See the License for the specific language governing permissions and
2114 * limitations under the License.
2115 * =============================================================================
2116 */function vX(t,e){let n=I(t,"a","lessEqual","string_or_numeric"),r=I(e,"b","lessEqual","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(XI,s)}const L1=M({lessEqual_:vX});/**
2117 * @license
2118 * Copyright 2018 Google LLC. All Rights Reserved.
2119 * Licensed under the Apache License, Version 2.0 (the "License");
2120 * you may not use this file except in compliance with the License.
2121 * You may obtain a copy of the License at
2122 *
2123 * http://www.apache.org/licenses/LICENSE-2.0
2124 *
2125 * Unless required by applicable law or agreed to in writing, software
2126 * distributed under the License is distributed on an "AS IS" BASIS,
2127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2128 * See the License for the specific language governing permissions and
2129 * limitations under the License.
2130 * =============================================================================
2131 */function xX(t,e,n){if(n<=0)throw new Error("The number of values should be positive.");const r={start:t,stop:e,num:n};return V.runKernel(YI,{},r)}/**
2132 * @license
2133 * Copyright 2020 Google LLC. All Rights Reserved.
2134 * Licensed under the Apache License, Version 2.0 (the "License");
2135 * you may not use this file except in compliance with the License.
2136 * You may obtain a copy of the License at
2137 *
2138 * http://www.apache.org/licenses/LICENSE-2.0
2139 *
2140 * Unless required by applicable law or agreed to in writing, software
2141 * distributed under the License is distributed on an "AS IS" BASIS,
2142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2143 * See the License for the specific language governing permissions and
2144 * limitations under the License.
2145 * =============================================================================
2146 */function wX(t,e=5,n=1,r=1,s=.5){const i=I(t,"x","localResponseNormalization");A(i.rank===4||i.rank===3,()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got
2147               rank ${i.rank}.`),A(Xu(e),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${e}.`);let o=i,a=!1;i.rank===3&&(a=!0,o=K(i,[1,i.shape[0],i.shape[1],i.shape[2]]));const u={x:o},l={depthRadius:e,bias:n,alpha:r,beta:s},c=V.runKernel(nA,u,l);return a?K(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const bX=M({localResponseNormalization_:wX});/**
2148 * @license
2149 * Copyright 2018 Google LLC. All Rights Reserved.
2150 * Licensed under the Apache License, Version 2.0 (the "License");
2151 * you may not use this file except in compliance with the License.
2152 * You may obtain a copy of the License at
2153 *
2154 * http://www.apache.org/licenses/LICENSE-2.0
2155 *
2156 * Unless required by applicable law or agreed to in writing, software
2157 * distributed under the License is distributed on an "AS IS" BASIS,
2158 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2159 * See the License for the specific language governing permissions and
2160 * limitations under the License.
2161 * =============================================================================
2162 */function _X(t){const n={x:I(t,"x","log","float32")};return V.runKernel(QI,n)}const jc=M({log_:_X});/**
2163 * @license
2164 * Copyright 2018 Google LLC. All Rights Reserved.
2165 * Licensed under the Apache License, Version 2.0 (the "License");
2166 * you may not use this file except in compliance with the License.
2167 * You may obtain a copy of the License at
2168 *
2169 * http://www.apache.org/licenses/LICENSE-2.0
2170 *
2171 * Unless required by applicable law or agreed to in writing, software
2172 * distributed under the License is distributed on an "AS IS" BASIS,
2173 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2174 * See the License for the specific language governing permissions and
2175 * limitations under the License.
2176 * =============================================================================
2177 */function SX(t){const n={x:I(t,"x","log1p")};return V.runKernel(ZI,n)}const _O=M({log1p_:SX});/**
2178 * @license
2179 * Copyright 2018 Google LLC. All Rights Reserved.
2180 * Licensed under the Apache License, Version 2.0 (the "License");
2181 * you may not use this file except in compliance with the License.
2182 * You may obtain a copy of the License at
2183 *
2184 * http://www.apache.org/licenses/LICENSE-2.0
2185 *
2186 * Unless required by applicable law or agreed to in writing, software
2187 * distributed under the License is distributed on an "AS IS" BASIS,
2188 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2189 * See the License for the specific language governing permissions and
2190 * limitations under the License.
2191 * =============================================================================
2192 */function TX(t,e){A(x0(t),()=>"The f passed in variableGrads(f) must be a function"),A(e==null||Array.isArray(e)&&e.every(l=>l instanceof Hf),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const n=e!=null;if(!n){e=[];for(const l in V.registeredVariables)e.push(V.registeredVariables[l])}const r=n?e.filter(l=>!l.trainable):null,s=e.length;e=e.filter(l=>l.trainable),A(e.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${s} variables is trainable.`);const i=!0,{value:o,grads:a}=V.gradients(t,e,null,i);A(a.some(l=>l!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),A(o.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${o.rank} tensor`);const u={};return e.forEach((l,c)=>{a[c]!=null&&(u[l.name]=a[c])}),r!=null&&r.forEach(l=>u[l.name]=null),{value:o,grads:u}}function xi(t){return V.customGrad(t)}/**
2193 * @license
2194 * Copyright 2018 Google LLC. All Rights Reserved.
2195 * Licensed under the Apache License, Version 2.0 (the "License");
2196 * you may not use this file except in compliance with the License.
2197 * You may obtain a copy of the License at
2198 *
2199 * http://www.apache.org/licenses/LICENSE-2.0
2200 *
2201 * Unless required by applicable law or agreed to in writing, software
2202 * distributed under the License is distributed on an "AS IS" BASIS,
2203 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2204 * See the License for the specific language governing permissions and
2205 * limitations under the License.
2206 * =============================================================================
2207 */function CX(t){const n={x:I(t,"x","neg")};return V.runKernel(mA,n)}const Bs=M({neg_:CX});/**
2208 * @license
2209 * Copyright 2018 Google LLC. All Rights Reserved.
2210 * Licensed under the Apache License, Version 2.0 (the "License");
2211 * you may not use this file except in compliance with the License.
2212 * You may obtain a copy of the License at
2213 *
2214 * http://www.apache.org/licenses/LICENSE-2.0
2215 *
2216 * Unless required by applicable law or agreed to in writing, software
2217 * distributed under the License is distributed on an "AS IS" BASIS,
2218 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2219 * See the License for the specific language governing permissions and
2220 * limitations under the License.
2221 * =============================================================================
2222 */function NX(t){const n={x:I(t,"x","softplus")};return V.runKernel(QA,n)}const SO=M({softplus_:NX});/**
2223 * @license
2224 * Copyright 2018 Google LLC. All Rights Reserved.
2225 * Licensed under the Apache License, Version 2.0 (the "License");
2226 * you may not use this file except in compliance with the License.
2227 * You may obtain a copy of the License at
2228 *
2229 * http://www.apache.org/licenses/LICENSE-2.0
2230 *
2231 * Unless required by applicable law or agreed to in writing, software
2232 * distributed under the License is distributed on an "AS IS" BASIS,
2233 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2234 * See the License for the specific language governing permissions and
2235 * limitations under the License.
2236 * =============================================================================
2237 */function EX(t){const e=I(t,"x","logSigmoid");return xi(r=>({value:Bs(SO(Bs(r))),gradFunc:o=>re(o,ra(Bs(r)))}))(e)}const kX=M({logSigmoid_:EX});/**
2238 * @license
2239 * Copyright 2020 Google LLC. All Rights Reserved.
2240 * Licensed under the Apache License, Version 2.0 (the "License");
2241 * you may not use this file except in compliance with the License.
2242 * You may obtain a copy of the License at
2243 *
2244 * http://www.apache.org/licenses/LICENSE-2.0
2245 *
2246 * Unless required by applicable law or agreed to in writing, software
2247 * distributed under the License is distributed on an "AS IS" BASIS,
2248 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2249 * See the License for the specific language governing permissions and
2250 * limitations under the License.
2251 * =============================================================================
2252 */function $X(t,e){let n=I(t,"a","sub"),r=I(e,"b","sub");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(pR,s)}const Ee=M({sub_:$X});/**
2253 * @license
2254 * Copyright 2020 Google Inc. All Rights Reserved.
2255 * Licensed under the Apache License, Version 2.0 (the "License");
2256 * you may not use this file except in compliance with the License.
2257 * You may obtain a copy of the License at
2258 *
2259 * http://www.apache.org/licenses/LICENSE-2.0
2260 *
2261 * Unless required by applicable law or agreed to in writing, software
2262 * distributed under the License is distributed on an "AS IS" BASIS,
2263 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2264 * See the License for the specific language governing permissions and
2265 * limitations under the License.
2266 * =============================================================================
2267 */function IX(t,e=-1){const n=I(t,"logits","logSoftmax");if(e===-1&&(e=n.rank-1),e!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${e}`);return xi((s,i)=>{const a=Au(s,e,!0),u=Ee(s,a),l=Ee(vt(u,"float32"),jc(et(vi(u),e,!0)));return i([l]),{value:l,gradFunc:(h,d)=>{const[f]=d,p=!0,y=vi(f);return Ee(h,re(et(h,e,p),y))}}})(n)}const AX=M({logSoftmax_:IX});/**
2268 * @license
2269 * Copyright 2020 Google LLC. All Rights Reserved.
2270 * Licensed under the Apache License, Version 2.0 (the "License");
2271 * you may not use this file except in compliance with the License.
2272 * You may obtain a copy of the License at
2273 *
2274 * http://www.apache.org/licenses/LICENSE-2.0
2275 *
2276 * Unless required by applicable law or agreed to in writing, software
2277 * distributed under the License is distributed on an "AS IS" BASIS,
2278 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2279 * See the License for the specific language governing permissions and
2280 * limitations under the License.
2281 * =============================================================================
2282 */function RX(t,e=null,n=!1){const r=I(t,"x","logSumExp"),s=Gt(e,r.shape),i=Au(r,s,!0),o=Ee(r,i),a=vi(o),u=et(a,s),l=jc(u),c=ge(K(i,l.shape),l);if(n){const h=vr(c.shape,s);return K(c,h)}return c}const TO=M({logSumExp_:RX});/**
2283 * @license
2284 * Copyright 2020 Google LLC. All Rights Reserved.
2285 * Licensed under the Apache License, Version 2.0 (the "License");
2286 * you may not use this file except in compliance with the License.
2287 * You may obtain a copy of the License at
2288 *
2289 * http://www.apache.org/licenses/LICENSE-2.0
2290 *
2291 * Unless required by applicable law or agreed to in writing, software
2292 * distributed under the License is distributed on an "AS IS" BASIS,
2293 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2294 * See the License for the specific language governing permissions and
2295 * limitations under the License.
2296 * =============================================================================
2297 */function OX(t,e){const n=I(t,"a","logicalAnd","bool"),r=I(e,"b","logicalAnd","bool");Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(JI,s)}const Xf=M({logicalAnd_:OX});/**
2298 * @license
2299 * Copyright 2020 Google LLC. All Rights Reserved.
2300 * Licensed under the Apache License, Version 2.0 (the "License");
2301 * you may not use this file except in compliance with the License.
2302 * You may obtain a copy of the License at
2303 *
2304 * http://www.apache.org/licenses/LICENSE-2.0
2305 *
2306 * Unless required by applicable law or agreed to in writing, software
2307 * distributed under the License is distributed on an "AS IS" BASIS,
2308 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2309 * See the License for the specific language governing permissions and
2310 * limitations under the License.
2311 * =============================================================================
2312 */function DX(t){const n={x:I(t,"x","logicalNot","bool")};return V.runKernel(eA,n)}
vendor: 4,278 bytes, lines 2312-2381
2312const CO=M({logicalNot_:DX});/**
2313 * @license
2314 * Copyright 2020 Google LLC. All Rights Reserved.
2315 * Licensed under the Apache License, Version 2.0 (the "License");
2316 * you may not use this file except in compliance with the License.
2317 * You may obtain a copy of the License at
2318 *
2319 * http://www.apache.org/licenses/LICENSE-2.0
2320 *
2321 * Unless required by applicable law or agreed to in writing, software
2322 * distributed under the License is distributed on an "AS IS" BASIS,
2323 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2324 * See the License for the specific language governing permissions and
2325 * limitations under the License.
2326 * =============================================================================
2327 */function PX(t,e){const n=I(t,"a","logicalOr","bool"),r=I(e,"b","logicalOr","bool");Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(tA,s)}const NO=M({logicalOr_:PX});/**
2328 * @license
2329 * Copyright 2020 Google LLC. All Rights Reserved.
2330 * Licensed under the Apache License, Version 2.0 (the "License");
2331 * you may not use this file except in compliance with the License.
2332 * You may obtain a copy of the License at
2333 *
2334 * http://www.apache.org/licenses/LICENSE-2.0
2335 *
2336 * Unless required by applicable law or agreed to in writing, software
2337 * distributed under the License is distributed on an "AS IS" BASIS,
2338 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2339 * See the License for the specific language governing permissions and
2340 * limitations under the License.
2341 * =============================================================================
2342 */function FX(t,e){const n=I(t,"a","logicalXor","bool"),r=I(e,"b","logicalXor","bool");return Le(n.shape,r.shape),Xf(NO(t,e),CO(Xf(t,e)))}const LX=M({logicalXor_:FX});/**
2343 * @license
2344 * Copyright 2022 Google LLC. All Rights Reserved.
2345 * Licensed under the Apache License, Version 2.0 (the "License");
2346 * you may not use this file except in compliance with the License.
2347 * You may obtain a copy of the License at
2348 *
2349 * http://www.apache.org/licenses/LICENSE-2.0
2350 *
2351 * Unless required by applicable law or agreed to in writing, software
2352 * distributed under the License is distributed on an "AS IS" BASIS,
2353 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2354 * See the License for the specific language governing permissions and
2355 * limitations under the License.
2356 * =============================================================================
2357 */const pd=2147483648;function MX(t,e,n="left"){const r=I(t,"sortedSequence","searchSorted"),s=I(e,"values","searchSorted"),i=r.shape[r.shape.length-1],o=s.shape[s.shape.length-1],a=K(r,[-1,i]),u=K(s,[-1,o]);if(a.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(a.shape[0]!==u.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(ne(u.shape)>=pd)throw new Error(`values tensor size must less than ${pd}`);if(a.shape[1]>=pd)throw new Error(`trailing dim_size must less than ${pd} for int32 output type, was ${a.shape[1]}`);const l={sortedSequence:a,values:u},c={side:n};return V.runKernel(zA,l,c)}const M1=M({searchSorted_:MX});/**
2358 * @license
2359 * Copyright 2022 Google LLC. All Rights Reserved.
2360 * Licensed under the Apache License, Version 2.0 (the "License");
2361 * you may not use this file except in compliance with the License.
2362 * You may obtain a copy of the License at
2363 *
2364 * http://www.apache.org/licenses/LICENSE-2.0
2365 *
2366 * Unless required by applicable law or agreed to in writing, software
2367 * distributed under the License is distributed on an "AS IS" BASIS,
2368 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2369 * See the License for the specific language governing permissions and
2370 * limitations under the License.
2371 * =============================================================================
2372 */function VX(t,e){return M1(t,e,"left")}/**
2373 * @license
2374 * Copyright 2020 Google LLC. All Rights Reserved.
2375 * Licensed under the Apache License, Version 2.0 (the "License");
2376 * you may not use this file except in compliance with the License.
2377 * You may obtain a copy of the License at
2378 *
2379 * http://www.apache.org/licenses/LICENSE-2.0
2380 *
2381 * Unless required by applicable law or agreed to in writing, softw
2381are
2382 * distributed under the License is distributed on an "AS IS" BASIS,
2383 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2384 * See the License for the specific language governing permissions and
2385 * limitations under the License.
2386 * =============================================================================
2387 */function BX(t,e,n,r,s){const i=I(t,"x","maxPool"),o=1;let a=i,u=!1;i.rank===3&&(u=!0,a=K(i,[1,i.shape[0],i.shape[1],i.shape[2]])),A(a.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.rank}.`),A(tr(n,o),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${o}'`),Wr("maxPool",r,s);const l={x:a},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s},h=V.runKernel(iA,l,c);return u?K(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const EO=M({maxPool_:BX});/**
2388 * @license
2389 * Copyright 2020 Google LLC. All Rights Reserved.
2390 * Licensed under the Apache License, Version 2.0 (the "License");
2391 * you may not use this file except in compliance with the License.
2392 * You may obtain a copy of the License at
2393 *
2394 * http://www.apache.org/licenses/LICENSE-2.0
2395 *
2396 * Unless required by applicable law or agreed to in writing, software
2397 * distributed under the License is distributed on an "AS IS" BASIS,
2398 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2399 * See the License for the specific language governing permissions and
2400 * limitations under the License.
2401 * =============================================================================
2402 */function WX(t,e=[1,1,1],n,r,s,i="NDHWC"){const o=I(t,"x","maxPool3d");let a=o,u=!1;o.rank===4&&(u=!0,a=K(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(a.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${a.rank}.`),A(i==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${i}`),Wr("maxPool3d",r,s);const l={x:a},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s,dataFormat:i},h=V.runKernel(oA,l,c);return u?K(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const UX=M({maxPool3d_:WX});/**
2403 * @license
2404 * Copyright 2018 Google LLC. All Rights Reserved.
2405 * Licensed under the Apache License, Version 2.0 (the "License");
2406 * you may not use this file except in compliance with the License.
2407 * You may obtain a copy of the License at
2408 *
2409 * http://www.apache.org/licenses/LICENSE-2.0
2410 *
2411 * Unless required by applicable law or agreed to in writing, software
2412 * distributed under the License is distributed on an "AS IS" BASIS,
2413 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2414 * See the License for the specific language governing permissions and
2415 * limitations under the License.
2416 * =============================================================================
2417 */function zX(t,e,n,r,s=!1){const o={x:I(t,"x","maxPoolWithArgmax")},a={filterSize:e,strides:n,pad:r,includeBatchInIndex:s},u=V.runKernel(aA,o,a);return{result:u[0],indexes:u[1]}}const jX=M({maxPoolWithArgmax_:zX});/**
2418 * @license
2419 * Copyright 2020 Google LLC. All Rights Reserved.
2420 * Licensed under the Apache License, Version 2.0 (the "License");
2421 * you may not use this file except in compliance with the License.
2422 * You may obtain a copy of the License at
2423 *
2424 * http://www.apache.org/licenses/LICENSE-2.0
2425 *
2426 * Unless required by applicable law or agreed to in writing, software
2427 * distributed under the License is distributed on an "AS IS" BASIS,
2428 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2429 * See the License for the specific language governing permissions and
2430 * limitations under the License.
2431 * =============================================================================
2432 */function GX(t,e){let n=I(t,"a","maximum"),r=I(e,"b","maximum");[n,r]=Tt(n,r),n.dtype==="bool"&&(n=vt(n,"int32"),r=vt(r,"int32")),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(sA,s)}const kO=M({maximum_:GX});/**
2433 * @license
2434 * Copyright 2020 Google Inc. All Rights Reserved.
2435 * Licensed under the Apache License, Version 2.0 (the "License");
2436 * you may not use this file except in compliance with the License.
2437 * You may obtain a copy of the License at
2438 *
2439 * http://www.apache.org/licenses/LICENSE-2.0
2440 *
2441 * Unless required by applicable law or agreed to in writing, softw
2441are
2442 * distributed under the License is distributed on an "AS IS" BASIS,
2443 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2444 * See the License for the specific language governing permissions and
2445 * limitations under the License.
2446 * =============================================================================
2447 */function HX(t,e=null,n=!1){const s={x:I(t,"x","mean")},i={axis:e,keepDims:n};return V.runKernel(uA,s,i)}const Yf=M({mean_:HX});/**
2448 * @license
2449 * Copyright 2018 Google LLC. All Rights Reserved.
2450 * Licensed under the Apache License, Version 2.0 (the "License");
2451 * you may not use this file except in compliance with the License.
2452 * You may obtain a copy of the License at
2453 *
2454 * http://www.apache.org/licenses/LICENSE-2.0
2455 *
2456 * Unless required by applicable law or agreed to in writing, software
2457 * distributed under the License is distributed on an "AS IS" BASIS,
2458 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2459 * See the License for the specific language governing permissions and
2460 * limitations under the License.
2461 * =============================================================================
2462 */function ba(t,e="float32"){if(gr(t),e==="complex64"){const r=ba(t,"float32"),s=ba(t,"float32");return po(r,s)}const n=fo(ne(t),e);return V.makeTensor(n,t,e)}/**
2463 * @license
2464 * Copyright 2018 Google LLC. All Rights Reserved.
2465 * Licensed under the Apache License, Version 2.0 (the "License");
2466 * you may not use this file except in compliance with the License.
2467 * You may obtain a copy of the License at
2468 *
2469 * http://www.apache.org/licenses/LICENSE-2.0
2470 *
2471 * Unless required by applicable law or agreed to in writing, software
2472 * distributed under the License is distributed on an "AS IS" BASIS,
2473 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2474 * See the License for the specific language governing permissions and
2475 * limitations under the License.
2476 * =============================================================================
2477 */function Xo(t,e="float32"){if(gr(t),e==="complex64"){const r=Xo(t,"float32"),s=ba(t,"float32");return po(r,s)}const n=O$(ne(t),e);return V.makeTensor(n,t,e)}/**
2478 * @license
2479 * Copyright 2021 Google LLC. All Rights Reserved.
2480 * Licensed under the Apache License, Version 2.0 (the "License");
2481 * you may not use this file except in compliance with the License.
2482 * You may obtain a copy of the License at
2483 *
2484 * http://www.apache.org/licenses/LICENSE-2.0
2485 *
2486 * Unless required by applicable law or agreed to in writing, software
2487 * distributed under the License is distributed on an "AS IS" BASIS,
2488 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2489 * See the License for the specific language governing permissions and
2490 * limitations under the License.
2491 * =============================================================================
2492 */function qX(t,e,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(t===void 0)return[];let r=I(t,"x","meshgrid",t instanceof Lt?t.dtype:"float32");if(e===void 0)return[r];let s=I(e,"y","meshgrid",e instanceof Lt?e.dtype:"float32");const i=ne(r.shape),o=ne(s.shape);return n==="xy"?(r=K(r,[1,-1]),s=K(s,[-1,1]),[ze(Xo([o,1],r.dtype),r),ze(s,Xo([1,i],s.dtype))]):(r=K(r,[-1,1]),s=K(s,[1,-1]),[ze(r,Xo([1,o],r.dtype)),ze(Xo([i,1],s.dtype),s)])}/**
2493 * @license
2494 * Copyright 2020 Google LLC. All Rights Reserved.
2495 * Licensed under the Apache License, Version 2.0 (the "License");
2496 * you may not use this file except in compliance with the License.
2497 * You may obtain a copy of the License at
2498 *
2499 * http://www.apache.org/licenses/LICENSE-2.0
2500 *
2501 * Unless required by applicable law or agreed to in writing, software
2502 * distributed under the License is distributed on an "AS IS" BASIS,
2503 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2504 * See the License for the specific language governing permissions and
2505 * limitations under the License.
2506 * =============================================================================
2507 */function KX(t,e){let n=I(t,"a","minimum"),r=I(e,"b","minimum");[n,r]=Tt(n,r),n.dtype==="bool"&&(n=vt(n,"int32"),r=vt(r,"int32")),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(cA,s)}const Qf=M({minimum_:KX});/**
2508 * @license
2509 * Copyright 2020 Google LLC. All Rights Reserved.
2510 * Licensed under the Apache License, Version 2.0 (the "License");
2511 * you may not use this file except in compliance with the License.
2512 * You may obtain a copy of the License at
2513 *
2514 * http://www.apache.org/licenses/LICENSE-2.0
2515 *
2516 * Unless required by applicable law or agreed to in writing, software
2517 * distributed under the License is distributed on an "AS IS" BASIS,
2518 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2519 * See the License for the specific language governing permissions and
2520 * limitations under the License.
2521 * =============================================================================
2522 */function XX(t,e,n){A(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);const r=I(t,"x","mirrorPad");if(r.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");A(e.length===r.rank,()=>`Padding doesn't match input. Must be ${r.rank}. Got ${e.length}.`);const s=n==="reflect"?1:0;for(let a=0;a<r.rank;a++)A(e[a].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),A(e[a][0]>=0&&e[a][0]<=r.shape[a]-s&&e[a][1]>=0&&e[a][1]<=r.shape[a]-s,()=>`Padding in dimension ${a} cannot be greater than or equal to ${r.shape[a]-s} or less than 0 for input of shape ${r.shape}`);const i={paddings:e,mode:n},o={x:r};return V.runKernel(hA,o,i)}const YX=M({mirrorPad_:XX});/**
2523 * @license
2524 * Copyright 2020 Google LLC. All Rights Reserved.
2525 * Licensed under the Apache License, Version 2.0 (the "License");
2526 * you may not use this file except in compliance with the License.
2527 * You may obtain a copy of the License at
2528 *
2529 * http://www.apache.org/licenses/LICENSE-2.0
2530 *
2531 * Unless required by applicable law or agreed to in writing, software
2532 * distributed under the License is distributed on an "AS IS" BASIS,
2533 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2534 * See the License for the specific language governing permissions and
2535 * limitations under the License.
2536 * =============================================================================
2537 */function QX(t,e){let n=I(t,"a","mod"),r=I(e,"b","mod");[n,r]=Tt(n,r);const s={a:n,b:r};return V.runKernel(dA,s)}const ZX=M({mod_:QX});/**
2538 * @license
2539 * Copyright 2020 Google LLC. All Rights Reserved.
2540 * Licensed under the Apache License, Version 2.0 (the "License");
2541 * you may not use this file except in compliance with the License.
2542 * You may obtain a copy of the License at
2543 *
2544 * http://www.apache.org/licenses/LICENSE-2.0
2545 *
2546 * Unless required by applicable law or agreed to in writing, software
2547 * distributed under the License is distributed on an "AS IS" BASIS,
2548 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2549 * See the License for the specific language governing permissions and
2550 * limitations under the License.
2551 * =============================================================================
2552 */function JX(t,e=null,n=!1){t=I(t,"x","moments");const r=Gt(e,t.shape),s=Yf(t,r,n);let i=s.shape;n||(i=vr(s.shape,r));const o=us(Ee(vt(t,"float32"),K(s,i))),a=Yf(o,r,n);return{mean:s,variance:a}}const e7=M({moments_:JX});function t7(t,e,n,r){const s=I(e,"data","multiRNNCell"),i=qf(n,"c","multiRNNCell"),o=qf(r,"h","multiRNNCell");let a=s;const u=[];for(let h=0;h<t.length;h++){const d=t[h](a,i[h],o[h]);u.push(d[0]),u.push(d[1]),a=d[1]}const l=[],c=[];for(let h=0;h<u.length;h+=2)l.push(u[h]),c.push(u[h+1]);return[l,c]}const n7=M({multiRNNCell_:t7});/**
2553 * @license
2554 * Copyright 2020 Google LLC. All Rights Reserved.
2555 * Licensed under the Apache License, Version 2.0 (the "License");
2556 * you may not use this file except in compliance with the License.
2557 * You may obtain a copy of the License at
2558 *
2559 * http://www.apache.org/licenses/LICENSE-2.0
2560 *
2561 * Unless required by applicable law or agreed to in writing, software
2562 * distributed under the License is distributed on an "AS IS" BASIS,
2563 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2564 * See the License for the specific language governing permissions and
2565 * limitations under the License.
2566 * =============================================================================
2567 */function r7(t,e,n,r=!1){const s=I(t,"logits","multinomial"),i=s.size,o=s.rank;if(i<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${i}.`);if(o>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${o}`);n=n||Math.random();const u={logits:o===1?K(s,[1,-1]):s},l={numSamples:e,seed:n,normalized:r},c=V.runKernel(fA,u,l);return o===1?K(c,[c.size]):c}const s7=M({multinomial_:r7});/**
2568 * @license
2569 * Copyright 2020 Google LLC. All Rights Reserved.
2570 * Licensed under the Apache License, Version 2.0 (the "License");
2571 * you may not use this file except in compliance with the License.
2572 * You may obtain a copy of the License at
2573 *
2574 * http://www.apache.org/licenses/LICENSE-2.0
2575 *
2576 * Unless required by applicable law or agreed to in writing, software
2577 * distributed under the License is distributed on an "AS IS" BASIS,
2578 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2579 * See the License for the specific language governing permissions and
2580 * limitations under the License.
2581 * =============================================================================
2582 */function i7(t,e){let n=I(t,"a","notEqual","string_or_numeric"),r=I(e,"b","notEqual","string_or_numeric");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r};return V.runKernel(gA,s)}const $O=M({notEqual_:i7});/**
2583 * @license
2584 * Copyright 2020 Google LLC. All Rights Reserved.
2585 * Licensed under the Apache License, Version 2.0 (the "License");
2586 * you may not use this file except in compliance with the License.
2587 * You may obtain a copy of the License at
2588 *
2589 * http://www.apache.org/licenses/LICENSE-2.0
2590 *
2591 * Unless required by applicable law or agreed to in writing, software
2592 * distributed under the License is distributed on an "AS IS" BASIS,
2593 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2594 * See the License for the specific language governing permissions and
2595 * limitations under the License.
2596 * =============================================================================
2597 */function o7(t,e,n=1,r=0,s="int32"){if(e<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${e}`);const o={indices:I(t,"indices","oneHot","int32")},a={dtype:s,depth:e,onValue:n,offValue:r};return V.runKernel(bA,o,a)}const a7=M({oneHot_:o7});/**
2598 * @license
2599 * Copyright 2018 Google LLC. All Rights Reserved.
2600 * Licensed under the Apache License, Version 2.0 (the "License");
2601 * you may not use this file except in compliance with the License.
2602 * You may obtain a copy of the License at
2603 *
2604 * http://www.apache.org/licenses/LICENSE-2.0
2605 *
2606 * Unless required by applicable law or agreed to in writing, software
2607 * distributed under the License is distributed on an "AS IS" BASIS,
2608 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2609 * See the License for the specific language governing permissions and
2610 * limitations under the License.
2611 * =============================================================================
2612 */function u7(t){const n={x:I(t,"x","onesLike")};return V.runKernel(wA,n)}const l7=M({onesLike_:u7});function c7(t,e){const n=I(t,"v1","outerProduct"),r=I(e,"v2","outerProduct");A(n.rank===1&&r.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`);const s=K(n,[-1,1]),i=K(r,[1,-1]);return ze(s,i)}const h7=M({outerProduct_:c7});/**
2613 * @license
2614 * Copyright 2020 Google LLC. All Rights Reserved.
2615 * Licensed under the Apache License, Version 2.0 (the "License");
2616 * you may not use this file except in compliance with the License.
2617 * You may obtain a copy of the License at
2618 *
2619 * http://www.apache.org/licenses/LICENSE-2.0
2620 *
2621 * Unless required by applicable law or agreed to in writing, software
2622 * distributed under the License is distributed on an "AS IS" BASIS,
2623 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2624 * See the License for the specific language governing permissions and
2625 * limitations under the License.
2626 * =============================================================================
2627 */function d7(t,e,n=0){const r=I(t,"x","pad");if(r.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const s={paddings:e,constantValue:n},i={x:r};return V.runKernel(SA,i,s)}const Sh=M({pad_:d7});function f7(t,e,n=0){return A(e.length===2,()=>"Invalid number of paddings. Must be length of 2."),Sh(t,[e],n)}const p7=M({pad1d_:f7});function m7(t,e,n=0){return A(e.length===2&&e[0].length===2&&e[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Sh(t,e,n)}const g7=M({pad2d_:m7});function y7(t,e,n=0){return A(e.length===3&&e[0].length===2&&e[1].length===2&&e[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Sh(t,e,n)}const v7=M({pad3d_:y7});function x7(t,e,n=0){return A(e.length===4&&e[0].length===2&&e[1].length===2&&e[2].length===2&&e[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Sh(t,e,n)}const w7=M({pad4d_:x7});/**
2628 * @license
2629 * Copyright 2020 Google LLC. All Rights Reserved.
2630 * Licensed under the Apache License, Version 2.0 (the "License");
2631 * you may not use this file except in compliance with the License.
2632 * You may obtain a copy of the License at
2633 *
2634 * http://www.apache.org/licenses/LICENSE-2.0
2635 *
2636 * Unless required by applicable law or agreed to in writing, software
2637 * distributed under the License is distributed on an "AS IS" BASIS,
2638 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2639 * See the License for the specific language governing permissions and
2640 * limitations under the License.
2641 * =============================================================================
2642 */function b7(t,e,n){const r=I(t,"x","spaceToBatchND");A(r.rank>=1+e.length,()=>`input rank ${r.rank} should be > than [blockShape] ${e.length}`),A(n.length===e.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${e.length}`),A(r.shape.reduce((o,a,u)=>u>0&&u<=e.length?o&&(a+n[u-1][0]+n[u-1][1])%e[u-1]===0:o,!0),()=>`input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${e.toString()}`);const s={x:r},i={blockShape:e,paddings:n};return V.runKernel(eR,s,i)}const IO=M({spaceToBatchND_:b7});/**
2643 * @license
2644 * Copyright 2018 Google LLC. All Rights Reserved.
2645 * Licensed under the Apache License, Version 2.0 (the "License");
2646 * you may not use this file except in compliance with the License.
2647 * You may obtain a copy of the License at
2648 *
2649 * http://www.apache.org/licenses/LICENSE-2.0
2650 *
2651 * Unless required by applicable law or agreed to in writing, software
2652 * distributed under the License is distributed on an "AS IS" BASIS,
2653 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2654 * See the License for the specific language governing permissions and
2655 * limitations under the License.
2656 * =============================================================================
2657 */function _7(t,e,n,r,s,i,o){s==null&&(s=[1,1]),i==null&&(i=1),r===0&&(r="valid");const a=I(t,"x","maxPool");let u=a,l=!1;a.rank===3&&(l=!0,u=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),A(tr(i,s),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${i} and dilations '${s}'`);const c=Da(u.shape,e,i,s,r),h=[c.dilationHeight,c.dilationWidth];let d;r==="same"?d=T7([c.filterHeight,c.filterWidth],h):d=[[0,0],[0,0]];const f=h[0]===1&&h[1]===1,[p,y]=S7([c.inHeight,c.inWidth],h,d),v=f?r:"valid",g=f?u:IO(u,h,p),w=(n==="avg"?()=>aO(g,e,i,v,o):()=>EO(g,e,i,v,o))(),_=f?w:uO(w,h,y);return l?K(_,[_.shape[1],_.shape[2],_.shape[3]]):_}function S7(t,e,n){const r=n.map(c=>c[0]),s=n.map(c=>c[1]),i=t.concat(r,s),o=e.map((c,h)=>(c-i[h]%c)%c),a=s.map((c,h)=>c+o[h]),u=e.map((c,h)=>[r[h],a[h]]),l=e.map((c,h)=>[0,o[h]]);return[u,l]}function T7(t,e){const r=t.map((o,a)=>o+(o-1)*(e[a]-1)).map(o=>o-1),s=r.map(o=>Math.floor(o/2)),i=r.map((o,a)=>o-s[a]);return r.map((o,a)=>[s[a],i[a]])}const C7=M({pool_:_7});/**
2658 * @license
2659 * Copyright 2020 Google LLC. All Rights Reserved.
2660 * Licensed under the Apache License, Version 2.0 (the "License");
2661 * you may not use this file except in compliance with the License.
2662 * You may obtain a copy of the License at
2663 *
2664 * http://www.apache.org/licenses/LICENSE-2.0
2665 *
2666 * Unless required by applicable law or agreed to in writing, software
2667 * distributed under the License is distributed on an "AS IS" BASIS,
2668 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2669 * See the License for the specific language governing permissions and
2670 * limitations under the License.
2671 * =============================================================================
2672 */function N7(t,e){const n=I(t,"x","prelu"),r=I(e,"alpha","prelu"),s={x:n,alpha:r};return V.runKernel(CA,s)}const AO=M({prelu_:N7});/**
2673 * @license
2674 * Copyright 2020 Google LLC. All Rights Reserved.
2675 * Licensed under the Apache License, Version 2.0 (the "License");
2676 * you may not use this file except in compliance with the License.
2677 * You may obtain a copy of the License at
2678 *
2679 * http://www.apache.org/licenses/LICENSE-2.0
2680 *
2681 * Unless required by applicable law or agreed to in writing, software
2682 * distributed under the License is distributed on an "AS IS" BASIS,
2683 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2684 * See the License for the specific language governing permissions and
2685 * limitations under the License.
2686 * =============================================================================
2687 */function E7(t,e=null,n=!1){let r=I(t,"x","prod");r.dtype==="bool"&&(r=vt(r,"int32"));const s={x:r},i={axis:e,keepDims:n};return V.runKernel(NA,s,i)}const k7=M({prod_:E7});/**
2688 * @license
2689 * Copyright 2022 Google LLC. All Rights Reserved.
2690 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 7,763 bytes, lines 2691-2747
2691 * you may not use this file except in compliance with the License.
2692 * You may obtain a copy of the License at
2693 *
2694 * http://www.apache.org/licenses/LICENSE-2.0
2695 *
2696 * Unless required by applicable law or agreed to in writing, software
2697 * distributed under the License is distributed on an "AS IS" BASIS,
2698 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2699 * See the License for the specific language governing permissions and
2700 * limitations under the License.
2701 * =============================================================================
2702 */function $7(t,e,n,r){const s=t.map((c,h)=>I(c,`tensors${h}`,"raggedGather","int32")),i=I(e,"paramsDenseValues","raggedGather"),o=I(n,"indices","raggedGather","int32"),a={paramsNestedSplits:s,paramsDenseValues:i,indices:o},u={outputRaggedRank:r},l=V.runKernel(EA,a,u);return{outputNestedSplits:l.slice(0,l.length-1),outputDenseValues:l[l.length-1]}}const I7=M({raggedGather_:$7});/**
2703 * @license
2704 * Copyright 2022 Google LLC.
2705 * Licensed under the Apache License, Version 2.0 (the "License");
2706 * you may not use this file except in compliance with the License.
2707 * You may obtain a copy of the License at
2708 *
2709 * http://www.apache.org/licenses/LICENSE-2.0
2710 *
2711 * Unless required by applicable law or agreed to in writing, software
2712 * distributed under the License is distributed on an "AS IS" BASIS,
2713 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2714 * See the License for the specific language governing permissions and
2715 * limitations under the License.
2716 * =============================================================================
2717 */function A7(t,e,n){const r=I(t,"starts","raggedRange"),s=I(e,"limits","raggedRange",r.dtype),i=I(n,"deltas","raggedRange",r.dtype),o={starts:r,limits:s,deltas:i},a=V.runKernel(kA,o);return{rtNestedSplits:a[0],rtDenseValues:a[1]}}const R7=M({raggedRange_:A7});/**
2718 * @license
2719 * Copyright 2022 Google LLC. All Rights Reserved.
2720 * Licensed under the Apache License, Version 2.0 (the "License");
2721 * you may not use this file except in compliance with the License.
2722 * You may obtain a copy of the License at
2723 *
2724 * http://www.apache.org/licenses/LICENSE-2.0
2725 *
2726 * Unless required by applicable law or agreed to in writing, software
2727 * distributed under the License is distributed on an "AS IS" BASIS,
2728 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2729 * See the License for the specific language governing permissions and
2730 * limitations under the License.
2731 * =============================================================================
2732 */function O7(t,e,n,r,s){const i=I(t,"shape","raggedTensorToTensor","int32"),o=I(e,"values","raggedTensorToTensor"),a=I(n,"defaultValue","raggedTensorToTensor",o.dtype),u=r.map((h,d)=>I(h,`tensors${d}`,"raggedTensorToTensor","int32")),l={shape:i,values:o,defaultValue:a,rowPartitionTensors:u},c={rowPartitionTypes:s};return V.runKernel($A,l,c)}const D7=M({raggedTensorToTensor_:O7});/**
2733 * @license
2734 * Copyright 2020 Google LLC. All Rights Reserved.
2735 * Licensed under the Apache License, Version 2.0 (the "License");
2736 * you may not use this file except in compliance with the License.
2737 * You may obtain a copy of the License at
2738 *
2739 * http://www.apache.org/licenses/LICENSE-2.0
2740 *
2741 * Unless required by applicable law or agreed to in writing, software
2742 * distributed under the License is distributed on an "AS IS" BASIS,
2743 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2744 * See the License for the specific language governing permissions and
2745 * limitations under the License.
2746 * =============================================================================
2747 */function P7(t,e,n){gr(t);const r=ne(t);let s=null;if(n==null||n==="float32")s=new Float32Array(r);else if(n==="int32")s=new Int32Array(r);else if(n==="bool")s=new Uint8Array(r);else throw new Error(`Unknown data type ${n}`);for(let i=0;i<r;i++)s[i]=e();return V.makeTensor(s,t,n)}const F7=M({rand_:P7});var V1={exports:{}};V1.exports;(function(t){(function(e,n,r){function s(u){var l=this,c=a();l.next=function(){var h=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=h-(l.c=h|0)},l.c=1,l.s0=c(" "),l.s1=c(" "),l.s2=c(" "),l.s0-=c(u),l.s0<0&&(l.s0+=1),l.s1-=c(u),l.s1<0&&(l.s1+=1),l.s2-=c(u),l.s2<0&&(l.s2+=1),c=null}function i(u,l){return l.c=u.c,l.s0=u.s0,l.s1=u.s1,l.s2=u.s2,l}function o(u,l){var c=new s(u),h=l&&l.state,d=c.next;return d.int32=function(){return c.next()*4294967296|0},d.double=function(){return d()+(d()*2097152|0)*11102230246251565e-32},d.quick=d,h&&(typeof h=="object"&&i(h,c),d.state=function(){return i(c,{})}),d}function a(){var u=4022871197,l=function(c){c=String(c);for(var h=0;h<c.length;h++){u+=c.charCodeAt(h);var d=.02519603282416938*u;u=d>>>0,d-=u,d*=u,u=d>>>0,d-=u,u+=d*4294967296}return(u>>>0)*23283064365386963e-26};return l}n&&n.exports?n.exports=o:this.alea=o})(Rs,t)})(V1);var L7=V1.exports,B1={exports:{}};B1.exports;(function(t){(function(e,n,r){function s(a){var u=this,l="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var h=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^h^h>>>8},a===(a|0)?u.x=a:l+=a;for(var c=0;c<l.length+64;c++)u.x^=l.charCodeAt(c)|0,u.next()}function i(a,u){return u.x=a.x,u.y=a.y,u.z=a.z,u.w=a.w,u}function o(a,u){var l=new s(a),c=u&&u.state,h=function(){return(l.next()>>>0)/4294967296};return h.double=function(){do var d=l.next()>>>11,f=(l.next()>>>0)/4294967296,p=(d+f)/(1<<21);while(p===0);return p},h.int32=l.next,h.quick=h,c&&(typeof c=="object"&&i(c,l),h.state=function(){return i(l,{})}),h}n&&n.exports?n.exports=o:this.xor128=o})(Rs,t)})(B1);var M7=B1.exports,W1={exports:{}};W1.exports;(function(t){(function(e,n,r){function s(a){var u=this,l="";u.next=function(){var h=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(h^h<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,a===(a|0)?u.x=a:l+=a;for(var c=0;c<l.length+64;c++)u.x^=l.charCodeAt(c)|0,c==l.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function i(a,u){return u.x=a.x,u.y=a.y,u.z=a.z,u.w=a.w,u.v=a.v,u.d=a.d,u}function o(a,u){var l=new s(a),c=u&&u.state,h=function(){return(l.next()>>>0)/4294967296};return h.double=function(){do var d=l.next()>>>11,f=(l.next()>>>0)/4294967296,p=(d+f)/(1<<21);while(p===0);return p},h.int32=l.next,h.quick=h,c&&(typeof c=="object"&&i(c,l),h.state=function(){return i(l,{})}),h}n&&n.exports?n.exports=o:this.xorwow=o})(Rs,t)})(W1);var V7=W1.exports,U1={exports:{}};U1.exports;(function(t){(function(e,n,r){function s(a){var u=this;u.next=function(){var c=u.x,h=u.i,d,f;return d=c[h],d^=d>>>7,f=d^d<<24,d=c[h+1&7],f^=d^d>>>10,d=c[h+3&7],f^=d^d>>>3,d=c[h+4&7],f^=d^d<<7,d=c[h+7&7],d=d^d<<13,f^=d^d<<9,c[h]=f,u.i=h+1&7,f};function l(c,h){var d,f=[];if(h===(h|0))f[0]=h;else for(h=""+h,d=0;d<h.length;++d)f[d&7]=f[d&7]<<15^h.charCodeAt(d)+f[d+1&7]<<13;for(;f.length<8;)f.push(0);for(d=0;d<8&&f[d]===0;++d);for(d==8?f[7]=-1:f[d],c.x=f,c.i=0,d=256;d>0;--d)c.next()}l(u,a)}function i(a,u){return u.x=a.x.slice(),u.i=a.i,u}function o(a,u){a==null&&(a=+new Date);var l=new s(a),c=u&&u.state,h=function(){return(l.next()>>>0)/4294967296};return h.double=function(){do var d=l.next()>>>11,f=(l.next()>>>0)/4294967296,p=(d+f)/(1<<21);while(p===0);return p},h.int32=l.next,h.quick=h,c&&(c.x&&i(c,l),h.state=function(){return i(l,{})}),h}n&&n.exports?n.exports=o:this.xorshift7=o})(Rs,t)})(U1);var B7=U1.exports,z1={exports:{}};z1.exports;(function(t){(function(e,n,r){function s(a){var u=this;u.next=function(){var c=u.w,h=u.X,d=u.i,f,p;return u.w=c=c+1640531527|0,p=h[d+34&127],f=h[d=d+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,p=h[d]=p^f,u.i=d,p+(c^c>>>16)|0};function l(c,h){var d,f,p,y,v,g=[],x=128;for(h===(h|0)?(f=h,h=null):(h=h+"\0",f=0,x=Math.max(x,h.length)),p=0,y=-32;y<x;
vendor: 5,932 bytes, lines 2747-2762
2747++y)h&&(f^=h.charCodeAt((y+32)%h.length)),y===0&&(v=f),f^=f<<10,f^=f>>>15,f^=f<<4,f^=f>>>13,y>=0&&(v=v+1640531527|0,d=g[y&127]^=f+v,p=d==0?p+1:0);for(p>=128&&(g[(h&&h.length||0)&127]=-1),p=127,y=4*128;y>0;--y)f=g[p+34&127],d=g[p=p+1&127],f^=f<<13,d^=d<<17,f^=f>>>15,d^=d>>>12,g[p]=f^d;c.w=v,c.X=g,c.i=p}l(u,a)}function i(a,u){return u.i=a.i,u.w=a.w,u.X=a.X.slice(),u}function o(a,u){a==null&&(a=+new Date);var l=new s(a),c=u&&u.state,h=function(){return(l.next()>>>0)/4294967296};return h.double=function(){do var d=l.next()>>>11,f=(l.next()>>>0)/4294967296,p=(d+f)/(1<<21);while(p===0);return p},h.int32=l.next,h.quick=h,c&&(c.X&&i(c,l),h.state=function(){return i(l,{})}),h}n&&n.exports?n.exports=o:this.xor4096=o})(Rs,t)})(z1);var W7=z1.exports,j1={exports:{}};j1.exports;(function(t){(function(e,n,r){function s(a){var u=this,l="";u.next=function(){var h=u.b,d=u.c,f=u.d,p=u.a;return h=h<<25^h>>>7^d,d=d-f|0,f=f<<24^f>>>8^p,p=p-h|0,u.b=h=h<<20^h>>>12^d,u.c=d=d-f|0,u.d=f<<16^d>>>16^p,u.a=p-h|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,a===Math.floor(a)?(u.a=a/4294967296|0,u.b=a|0):l+=a;for(var c=0;c<l.length+20;c++)u.b^=l.charCodeAt(c)|0,u.next()}function i(a,u){return u.a=a.a,u.b=a.b,u.c=a.c,u.d=a.d,u}function o(a,u){var l=new s(a),c=u&&u.state,h=function(){return(l.next()>>>0)/4294967296};return h.double=function(){do var d=l.next()>>>11,f=(l.next()>>>0)/4294967296,p=(d+f)/(1<<21);while(p===0);return p},h.int32=l.next,h.quick=h,c&&(typeof c=="object"&&i(c,l),h.state=function(){return i(l,{})}),h}n&&n.exports?n.exports=o:this.tychei=o})(Rs,t)})(j1);var U7=j1.exports,RO={exports:{}};const z7={},j7=Object.freeze(Object.defineProperty({__proto__:null,default:z7},Symbol.toStringTag,{value:"Module"})),G7=qF(j7);(function(t){(function(e,n,r){var s=256,i=6,o=52,a="random",u=r.pow(s,i),l=r.pow(2,o),c=l*2,h=s-1,d;function f(_,T,E){var k=[];T=T==!0?{entropy:!0}:T||{};var N=g(v(T.entropy?[_,w(n)]:_??x(),3),k),O=new p(k),R=function(){for(var L=O.g(i),W=u,G=0;L<l;)L=(L+G)*s,W*=s,G=O.g(1);for(;L>=c;)L/=2,W/=2,G>>>=1;return(L+G)/W};return R.int32=function(){return O.g(4)|0},R.quick=function(){return O.g(4)/4294967296},R.double=R,g(w(O.S),n),(T.pass||E||function(L,W,G,H){return H&&(H.S&&y(H,O),L.state=function(){return y(O,{})}),G?(r[a]=L,W):L})(R,N,"global"in T?T.global:this==r,T.state)}function p(_){var T,E=_.length,k=this,N=0,O=k.i=k.j=0,R=k.S=[];for(E||(_=[E++]);N<s;)R[N]=N++;for(N=0;N<s;N++)R[N]=R[O=h&O+_[N%E]+(T=R[N])],R[O]=T;(k.g=function(L){for(var W,G=0,H=k.i,X=k.j,Q=k.S;L--;)W=Q[H=h&H+1],G=G*s+Q[h&(Q[H]=Q[X=h&X+W])+(Q[X]=W)];return k.i=H,k.j=X,G})(s)}function y(_,T){return T.i=_.i,T.j=_.j,T.S=_.S.slice(),T}function v(_,T){var E=[],k=typeof _,N;if(T&&k=="object")for(N in _)try{E.push(v(_[N],T-1))}catch{}return E.length?E:k=="string"?_:_+"\0"}function g(_,T){for(var E=_+"",k,N=0;N<E.length;)T[h&N]=h&(k^=T[h&N]*19)+E.charCodeAt(N++);return w(T)}function x(){try{var _;return d&&(_=d.randomBytes)?_=_(s):(_=new Uint8Array(s),(e.crypto||e.msCrypto).getRandomValues(_)),w(_)}catch{var T=e.navigator,E=T&&T.plugins;return[+new Date,e,E,e.screen,w(n)]}}function w(_){return String.fromCharCode.apply(0,_)}if(g(r.random(),n),t.exports){t.exports=f;try{d=G7}catch{}}else r["seed"+a]=f})(typeof self<"u"?self:Rs,[],Math)})(RO);var H7=RO.exports,q7=L7,K7=M7,X7=V7,Y7=B7,Q7=W7,Z7=U7,Pa=H7;Pa.alea=q7;Pa.xor128=K7;Pa.xorwow=X7;Pa.xorshift7=Y7;Pa.xor4096=Q7;Pa.tychei=Z7;var G1=Pa;/**
2748 * @license
2749 * Copyright 2018 Google LLC. All Rights Reserved.
2750 * Licensed under the Apache License, Version 2.0 (the "License");
2751 * you may not use this file except in compliance with the License.
2752 * You may obtain a copy of the License at
2753 *
2754 * http://www.apache.org/licenses/LICENSE-2.0
2755 *
2756 * Unless required by applicable law or agreed to in writing, software
2757 * distributed under the License is distributed on an "AS IS" BASIS,
2758 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2759 * See the License for the specific language governing permissions and
2760 * limitations under the License.
2761 * =============================================================================
2762 */class H1{constructor(e,n,r,s,i){this.mean=e,this.stdDev=n,this.dtype=r,this.nextVal=NaN,this.truncated=s,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);const o=i||Math.random();this.random=G1.alea(o.toString())}nextValue(){if(!isNaN(this.nextVal)){const s=this.nextVal;return this.nextVal=NaN,s}let e,n,r=!1;for(;!r;){let s,i,o;do s=2*this.random()-1,i=2*this.random()-1,o=s*s+i*i;while(o>=1||o===0);const a=Math.sqrt(-2*Math.log(o)/o);e=this.mean+this.stdDev*s*a,n=this.mean+this.stdDev*i*a,(!this.truncated||this.isValidTruncated(e))&&(r=!0)}return(!this.truncated||this.isValidTruncated(n))&&(this.nextVal=this.convertValue(n)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class J7{constructor(e,n,r,s){this.alpha=e,this.beta=1/n,this.dtype=r;const i=s||Math.random();this.randu=G1.alea(i.toString()),this.randn=new H1(0,1,r,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,n,r,s,i,o;for(;;){do s=this.randn.nextValue(),o=1+this.c*s;while(o<=0);if(o*=o*o,e=s*s,n=1-.331*e*e,r=.5*e+this.d*(1-o+Math.log(o)),i=this.randu(),i<n||Math.log(i)<r)break}return o=1/this.beta*this.d*o,this.alpha<1&&(o*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(o)}convertValue(e){return this.dtype==="float32"?e:Math.round(e)}}class e9{constructor(e=0,n=1,r,s){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=n-e,this.dtype=r,s==null&&(s=Math.random()),typeof s=="number"&&(s=s.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${n} <= 1 and dtype is not float`);this.random=G1.alea(s)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}
2762nextValue(){return this.convertValue(this.min+this.range*this.random())}}/**
2763 * @license
2764 * Copyright 2020 Google LLC. All Rights Reserved.
2765 * Licensed under the Apache License, Version 2.0 (the "License");
2766 * you may not use this file except in compliance with the License.
2767 * You may obtain a copy of the License at
2768 *
2769 * http://www.apache.org/licenses/LICENSE-2.0
2770 *
2771 * Unless required by applicable law or agreed to in writing, software
2772 * distributed under the License is distributed on an "AS IS" BASIS,
2773 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2774 * See the License for the specific language governing permissions and
2775 * limitations under the License.
2776 * =============================================================================
2777 */function t9(t,e,n=1,r="float32",s){if(gr(t),n==null&&(n=1),r==null&&(r="float32"),r!=="float32"&&r!=="int32")throw new Error(`Unsupported data type ${r}`);const i=new J7(e,n,r,s),o=wt(t,r);for(let a=0;a<o.values.length;a++)o.values[a]=i.nextValue();return o.toTensor()}const n9=M({randomGamma_:t9});/**
2778 * @license
2779 * Copyright 2020 Google LLC. All Rights Reserved.
2780 * Licensed under the Apache License, Version 2.0 (the "License");
2781 * you may not use this file except in compliance with the License.
2782 * You may obtain a copy of the License at
2783 *
2784 * http://www.apache.org/licenses/LICENSE-2.0
2785 *
2786 * Unless required by applicable law or agreed to in writing, software
2787 * distributed under the License is distributed on an "AS IS" BASIS,
2788 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2789 * See the License for the specific language governing permissions and
2790 * limitations under the License.
2791 * =============================================================================
2792 */function r9(t,e=0,n=1,r,s){if(gr(t),r!=null&&r==="bool")throw new Error(`Unsupported data type ${r}`);const i=new H1(e,n,r,!1,s),o=wt(t,r);for(let a=0;a<o.values.length;a++)o.values[a]=i.nextValue();return o.toTensor()}const OO=M({randomNormal_:r9});/**
2793 * @license
2794 * Copyright 2022 Google LLC. All Rights Reserved.
2795 * Licensed under the Apache License, Version 2.0 (the "License");
2796 * you may not use this file except in compliance with the License.
2797 * You may obtain a copy of the License at
2798 *
2799 * http://www.apache.org/licenses/LICENSE-2.0
2800 *
2801 * Unless required by applicable law or agreed to in writing, software
2802 * distributed under the License is distributed on an "AS IS" BASIS,
2803 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2804 * See the License for the specific language governing permissions and
2805 * limitations under the License.
2806 * =============================================================================
2807 */function s9(t,e,n){if(e!=null&&e==="bool")throw new Error(`Unsupported data type ${e}`);return OO(t,0,1,e,n)}const i9=M({randomStandardNormal_:s9});/**
2808 * @license
2809 * Copyright 2020 Google LLC. All Rights Reserved.
2810 * Licensed under the Apache License, Version 2.0 (the "License");
2811 * you may not use this file except in compliance with the License.
2812 * You may obtain a copy of the License at
2813 *
2814 * http://www.apache.org/licenses/LICENSE-2.0
2815 *
2816 * Unless required by applicable law or agreed to in writing, software
2817 * distributed under the License is distributed on an "AS IS" BASIS,
2818 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2819 * See the License for the specific language governing permissions and
2820 * limitations under the License.
2821 * =============================================================================
2822 */function o9(t,e=0,n=1,r="float32",s){gr(t);const i=wt(t,r),o=new e9(e,n,null,s);for(let a=0;a<i.values.length;a++)i.values[a]=o.nextValue();return i.toTensor()}const q1=M({randomUniform_:o9});/**
2823 * @license
2824 * Copyright 2023 Google LLC.
2825 * Licensed under the Apache License, Version 2.0 (the "License");
2826 * you may not use this file except in compliance with the License.
2827 * You may obtain a copy of the License at
2828 *
2829 * http://www.apache.org/licenses/LICENSE-2.0
2830 *
2831 * Unless required by applicable law or agreed to in writing, softw
2831are
2832 * distributed under the License is distributed on an "AS IS" BASIS,
2833 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2834 * See the License for the specific language governing permissions and
2835 * limitations under the License.
2836 * =============================================================================
2837 */function a9(t,e,n,r){return q1(t,e,n,"int32",r)}const u9=M({randomUniformInt_:a9});/**
2838 * @license
2839 * Copyright 2018 Google LLC. All Rights Reserved.
2840 * Licensed under the Apache License, Version 2.0 (the "License");
2841 * you may not use this file except in compliance with the License.
2842 * You may obtain a copy of the License at
2843 *
2844 * http://www.apache.org/licenses/LICENSE-2.0
2845 *
2846 * Unless required by applicable law or agreed to in writing, software
2847 * distributed under the License is distributed on an "AS IS" BASIS,
2848 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2849 * See the License for the specific language governing permissions and
2850 * limitations under the License.
2851 * =============================================================================
2852 */function Gc(t,e,n=1,r="float32"){if(n===0)throw new Error("Cannot have a step of zero");const s={start:t,stop:e,step:n,dtype:r};return V.runKernel(IA,{},s)}/**
2853 * @license
2854 * Copyright 2020 Google LLC. All Rights Reserved.
2855 * Licensed under the Apache License, Version 2.0 (the "License");
2856 * you may not use this file except in compliance with the License.
2857 * You may obtain a copy of the License at
2858 *
2859 * http://www.apache.org/licenses/LICENSE-2.0
2860 *
2861 * Unless required by applicable law or agreed to in writing, software
2862 * distributed under the License is distributed on an "AS IS" BASIS,
2863 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2864 * See the License for the specific language governing permissions and
2865 * limitations under the License.
2866 * =============================================================================
2867 */function l9(t){const n={input:I(t,"input","real")};return V.runKernel(AA,n)}const Hc=M({real_:l9});/**
2868 * @license
2869 * Copyright 2018 Google LLC. All Rights Reserved.
2870 * Licensed under the Apache License, Version 2.0 (the "License");
2871 * you may not use this file except in compliance with the License.
2872 * You may obtain a copy of the License at
2873 *
2874 * http://www.apache.org/licenses/LICENSE-2.0
2875 *
2876 * Unless required by applicable law or agreed to in writing, software
2877 * distributed under the License is distributed on an "AS IS" BASIS,
2878 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2879 * See the License for the specific language governing permissions and
2880 * limitations under the License.
2881 * =============================================================================
2882 */function c9(t){const n={x:I(t,"x","reciprocal")};return V.runKernel(RA,n)}const h9=M({reciprocal_:c9});/**
2883 * @license
2884 * Copyright 2020 Google LLC. All Rights Reserved.
2885 * Licensed under the Apache License, Version 2.0 (the "License");
2886 * you may not use this file except in compliance with the License.
2887 * You may obtain a copy of the License at
2888 *
2889 * http://www.apache.org/licenses/LICENSE-2.0
2890 *
2891 * Unless required by applicable law or agreed to in writing, software
2892 * distributed under the License is distributed on an "AS IS" BASIS,
2893 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2894 * See the License for the specific language governing permissions and
2895 * limitations under the License.
2896 * =============================================================================
2897 */function d9(t){const n={x:I(t,"x","relu")};return V.runKernel(OA,n)}const fm=M({relu_:d9});/**
2898 * @license
2899 * Copyright 2020 Google LLC. All Rights Reserved.
2900 * Licensed under the Apache License, Version 2.0 (the "License");
2901 * you may not use this file except in compliance with the License.
2902 * You may obtain a copy of the License at
2903 *
2904 * http://www.apache.org/licenses/LICENSE-2.0
2905 *
2906 * Unless required by applicable law or agreed to in writing, software
2907 * distributed under the License is distributed on an "AS IS" BASIS,
2908 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2909 * See the License for the specific language governing permissions and
2910 * limitations under the License.
2911 * =============================================================================
2912 */function f9(t){const n={x:I(t,"x","relu6")};return V.runKernel(LA,n)}const DO=M({relu6_:f9});/**
2913 * @license
2914 * Copyright 2018 Google LLC. All Rights Reserved.
2915 * Licensed under the Apache License, Version 2.0 (the "License");
2916 * you may not use this file except in compliance with the License.
2917 * You may obtain a copy of the License at
2918 *
2919 * http://www.apache.org/licenses/LICENSE-2.0
2920 *
2921 * Unless required by applicable law or agreed to in writing, software
2922 * distributed under the License is distributed on an "AS IS" BASIS,
2923 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2924 * See the License for the specific language governing permissions and
2925 * limitations under the License.
2926 * =============================================================================
2927 */function p9(t,e){const r={x:I(t,"x","reverse")},s={dims:e};return V.runKernel(MA,r,s)}const _a=M({reverse_:p9});/**
2928 * @license
2929 * Copyright 2020 Google LLC. All Rights Reserved.
2930 * Licensed under the Apache License, Version 2.0 (the "License");
2931 * you may not use this file except in compliance with the License.
2932 * You may obtain a copy of the License at
2933 *
2934 * http://www.apache.org/licenses/LICENSE-2.0
2935 *
2936 * Unless required by applicable law or agreed to in writing, software
2937 * distributed under the License is distributed on an "AS IS" BASIS,
2938 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2939 * See the License for the specific language governing permissions and
2940 * limitations under the License.
2941 * =============================================================================
2942 */function m9(t){const e=I(t,"x","reverse");return A(e.rank===1,()=>`Error in reverse1D: x must be rank 1 but got rank ${e.rank}.`),_a(e,0)}const g9=M({reverse1d_:m9});/**
2943 * @license
2944 * Copyright 2020 Google LLC. All Rights Reserved.
2945 * Licensed under the Apache License, Version 2.0 (the "License");
2946 * you may not use this file except in compliance with the License.
2947 * You may obtain a copy of the License at
2948 *
2949 * http://www.apache.org/licenses/LICENSE-2.0
2950 *
2951 * Unless required by applicable law or agreed to in writing, software
2952 * distributed under the License is distributed on an "AS IS" BASIS,
2953 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2954 * See the License for the specific language governing permissions and
2955 * limitations under the License.
2956 * =============================================================================
2957 */function y9(t,e){const n=I(t,"x","reverse");return A(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),_a(n,e)}const v9=M({reverse2d_:y9});/**
2958 * @license
2959 * Copyright 2020 Google LLC. All Rights Reserved.
2960 * Licensed under the Apache License, Version 2.0 (the "License");
2961 * you may not use this file except in compliance with the License.
2962 * You may obtain a copy of the License at
2963 *
2964 * http://www.apache.org/licenses/LICENSE-2.0
2965 *
2966 * Unless required by applicable law or agreed to in writing, software
2967 * distributed under the License is distributed on an "AS IS" BASIS,
2968 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2969 * See the License for the specific language governing permissions and
2970 * limitations under the License.
2971 * =============================================================================
2972 */function x9(t,e){const n=I(t,"x","reverse");return A(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),_a(n,e)}const w9=M({reverse3d_:x9});/**
2973 * @license
2974 * Copyright 2020 Google LLC. All Rights Reserved.
2975 * Licensed under the Apache License, Version 2.0 (the "License");
2976 * you may not use this file except in compliance with the License.
2977 * You may obtain a copy of the License at
2978 *
2979 * http://www.apache.org/licenses/LICENSE-2.0
2980 *
2981 * Unless required by applicable law or agreed to in writing, software
2982 * distributed under the License is distributed on an "AS IS" BASIS,
2983 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2984 * See the License for the specific language governing permissions and
2985 * limitations under the License.
2986 * =============================================================================
2987 */function b9(t,e){const n=I(t,"x","reverse");return A(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}
2987.`),_a(n,e)}const _9=M({reverse4d_:b9});/**
2988 * @license
2989 * Copyright 2018 Google LLC. All Rights Reserved.
2990 * Licensed under the Apache License, Version 2.0 (the "License");
2991 * you may not use this file except in compliance with the License.
2992 * You may obtain a copy of the License at
2993 *
2994 * http://www.apache.org/licenses/LICENSE-2.0
2995 *
2996 * Unless required by applicable law or agreed to in writing, software
2997 * distributed under the License is distributed on an "AS IS" BASIS,
2998 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2999 * See the License for the specific language governing permissions and
3000 * limitations under the License.
3001 * =============================================================================
3002 */function S9(t){const n={x:I(t,"x","round")};return V.runKernel(VA,n)}const PO=M({round_:S9});/**
3003 * @license
3004 * Copyright 2018 Google LLC. All Rights Reserved.
3005 * Licensed under the Apache License, Version 2.0 (the "License");
3006 * you may not use this file except in compliance with the License.
3007 * You may obtain a copy of the License at
3008 *
3009 * http://www.apache.org/licenses/LICENSE-2.0
3010 *
3011 * Unless required by applicable law or agreed to in writing, software
3012 * distributed under the License is distributed on an "AS IS" BASIS,
3013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3014 * See the License for the specific language governing permissions and
3015 * limitations under the License.
3016 * =============================================================================
3017 */function T9(t){const n={x:I(t,"x","rsqrt","float32")};return V.runKernel(BA,n)}const C9=M({rsqrt_:T9});/**
3018 * @license
3019 * Copyright 2020 Google LLC. All Rights Reserved.
3020 * Licensed under the Apache License, Version 2.0 (the "License");
3021 * you may not use this file except in compliance with the License.
3022 * You may obtain a copy of the License at
3023 *
3024 * http://www.apache.org/licenses/LICENSE-2.0
3025 *
3026 * Unless required by applicable law or agreed to in writing, software
3027 * distributed under the License is distributed on an "AS IS" BASIS,
3028 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3029 * See the License for the specific language governing permissions and
3030 * limitations under the License.
3031 * =============================================================================
3032 */function N9(t){const n={x:I(t,"x","selu")};return V.runKernel(GA,n)}const E9=M({selu_:N9});function k9(t,e,n,r,s,i=[1,1],o="NHWC"){const a=I(t,"x","separableConv2d"),u=I(e,"depthwiseFilter","separableConv2d"),l=I(n,"pointwiseFilter","separableConv2d");let c=a,h=!1;if(a.rank===3&&(h=!0,c=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),o==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");A(c.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`),A(u.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${u.rank}.`),A(l.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${u.rank}.`),A(l.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got ${l.shape[0]}.`),A(l.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${l.shape[1]}.`);const d=u.shape[2],f=u.shape[3];A(l.shape[2]===d*f,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${d*f}, but got ${l.shape[2]}.`);const p=D1(c,u,r,s,o,i),v=lm(p,l,1,"valid",o);return h?K(v,[v.shape[1],v.shape[2],v.shape[3]]):v}const $9=M({separableConv2d_:k9});/**
3033 * @license
3034 * Copyright 2020 Google Inc. All Rights Reserved.
3035 * Licensed under the Apache License, Version 2.0 (the "License");
3036 * you may not use this file except in compliance with the License.
3037 * You may obtain a copy of the License at
3038 *
3039 * http://www.apache.org/licenses/LICENSE-2.0
3040 *
3041 * Unless required by applicable law or agreed to in writing, software
3042 * distributed under the License is distributed on an "AS IS" BASIS,
3043 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3044 * See the License for the specific language governing permissions and
3045 * limitations under the License.
3046 * =============================================================================
3047 */async function I9(t,e){const n=I(t,"x","setdiff1d"),r=I(e,"y","setdiff1d");A(n.dtype===r.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`),A(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),A(r.rank===1,()=>`y should be 1D tensor, but got y (${r.shape}).`);const s=await n.data(),i=await r.data(),o=new Set(i);let a=0;for(let c=0;c<s.length;c++)o.has(s[c])||a++;const u=new Zu([a],n.dtype),l=new Zu([a],"int32");for(let c=0,h=0;c<s.length;c++)o.has(s[c])||(u.values[h]=s[c],l.values[h]=c,h++);return[u.toTensor(),l.toTensor()]}const A9=I9;/**
3048 * @license
3049 * Copyright 2018 Google LLC. All Rights Reserved.
3050 * Licensed under the Apache License, Version 2.0 (the "License");
3051 * you may not use this file except in compliance with the License.
3052 * You may obtain a copy of the License at
3053 *
3054 * http://www.apache.org/licenses/LICENSE-2.0
3055 *
3056 * Unless required by applicable law or agreed to in writing, software
3057 * distributed under the License is distributed on an "AS IS" BASIS,
3058 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3059 * See the License for the specific language governing permissions and
3060 * limitations under the License.
3061 * =============================================================================
3062 */function R9(t){const n={x:I(t,"x","sign")};return V.runKernel(XA,n)}const O9=M({sign_:R9});/**
3063 * @license
3064 * Copyright 2018 Google LLC. All Rights Reserved.
3065 * Licensed under the Apache License, Version 2.0 (the "License");
3066 * you may not use this file except in compliance with the License.
3067 * You may obtain a copy of the License at
3068 *
3069 * http://www.apache.org/licenses/LICENSE-2.0
3070 *
3071 * Unless required by applicable law or agreed to in writing, software
3072 * distributed under the License is distributed on an "AS IS" BASIS,
3073 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3074 * See the License for the specific language governing permissions and
3075 * limitations under the License.
3076 * =============================================================================
3077 */function D9(t){const n={x:I(t,"x","sin","float32")};return V.runKernel(qA,n)}const P9=M({sin_:D9});/**
3078 * @license
3079 * Copyright 2018 Google LLC. All Rights Reserved.
3080 * Licensed under the Apache License, Version 2.0 (the "License");
3081 * you may not use this file except in compliance with the License.
3082 * You may obtain a copy of the License at
3083 *
3084 * http://www.apache.org/licenses/LICENSE-2.0
3085 *
3086 * Unless required by applicable law or agreed to in writing, software
3087 * distributed under the License is distributed on an "AS IS" BASIS,
3088 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3089 * See the License for the specific language governing permissions and
3090 * limitations under the License.
3091 * =============================================================================
3092 */function F9(t){const n={x:I(t,"x","sinh")};return V.runKernel(KA,n)}const L9=M({sinh_:F9});/**
3093 * @license
3094 * Copyright 2018 Google LLC. All Rights Reserved.
3095 * Licensed under the Apache License, Version 2.0 (the "License");
3096 * you may not use this file except in compliance with the License.
3097 * You may obtain a copy of the License at
3098 *
3099 * http://www.apache.org/licenses/LICENSE-2.0
3100 *
3101 * Unless required by applicable law or agreed to in writing, software
3102 * distributed under the License is distributed on an "AS IS" BASIS,
3103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3104 * See the License for the specific language governing permissions and
3105 * limitations under the License.
3106 * =============================================================================
3107 */function M9(t,e,n){const r=I(t,"x","slice1d");return A(r.rank===1,()=>`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`),Ne(r,[e],[n])}const V9=M({slice1d_:M9});/**
3108 * @license
3109 * Copyright 2018 Google LLC. All Rights Reserved.
3110 * Licensed under the Apache License, Version 2.0 (the "License");
3111 * you may not use this file except in compliance with the License.
3112 * You may obtain a copy of the License at
3113 *
3114 * http://www.apache.org/licenses/LICENSE-2.0
3115 *
3116 * Unless required by applicable law or agreed to in writing, software
3117 * distributed under the License is distributed on an "AS IS" BASIS,
3118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3119 * See the License for the specific language governing permissions and
3120 * limitations under the License.
3121 * =============================================================================
3122 */function B9(t,e,n){const r=I(t,"x","slice2d");return A(r.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`),Ne(r,e,n)}const W9=M({slice2d_:B9});/**
3123 * @license
3124 * Copyright 2018 Google LLC. All Rights Reserved.
3125 * Licensed under the Apache License, Version 2.0 (the "License");
3126 * you may not use this file except in compliance with the License.
3127 * You may obtain a copy of the License at
3128 *
3129 * http://www.apache.org/licenses/LICENSE-2.0
3130 *
3131 * Unless required by applicable law or agreed to in writing, software
3132 * distributed under the License is distributed on an "AS IS" BASIS,
3133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3134 * See the License for the specific language governing permissions and
3135 * limitations under the License.
3136 * =============================================================================
3137 */function U9(t,e,n){const r=I(t,"x","slice3d");return A(r.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`),Ne(r,e,n)}const z9=M({slice3d_:U9});/**
3138 * @license
3139 * Copyright 2018 Google LLC. All Rights Reserved.
3140 * Licensed under the Apache License, Version 2.0 (the "License");
3141 * you may not use this file except in compliance with the License.
3142 * You may obtain a copy of the License at
3143 *
3144 * http://www.apache.org/licenses/LICENSE-2.0
3145 *
3146 * Unless required by applicable law or agreed to in writing, software
3147 * distributed under the License is distributed on an "AS IS" BASIS,
3148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3149 * See the License for the specific language governing permissions and
3150 * limitations under the License.
3151 * =============================================================================
3152 */function j9(t,e,n){const r=I(t,"x","slice4d");return A(r.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`),Ne(r,e,n)}const G9=M({slice4d_:j9});/**
3153 * @license
3154 * Copyright 2018 Google LLC. All Rights Reserved.
3155 * Licensed under the Apache License, Version 2.0 (the "License");
3156 * you may not use this file except in compliance with the License.
3157 * You may obtain a copy of the License at
3158 *
3159 * http://www.apache.org/licenses/LICENSE-2.0
3160 *
3161 * Unless required by applicable law or agreed to in writing, software
3162 * distributed under the License is distributed on an "AS IS" BASIS,
3163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3164 * See the License for the specific language governing permissions and
3165 * limitations under the License.
3166 * =============================================================================
3167 */function H9(t,e=-1){const n=I(t,"logits","softmax","float32");if(e===-1&&(e=n.rank-1),e!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${e}`);const r={logits:n},s={dim:e};return V.runKernel(nR,r,s)}const q9=M({softmax_:H9});/**
3168 * @license
3169 * Copyright 2020 Google LLC. All Rights Reserved.
3170 * Licensed under the Apache License, Version 2.0 (the "License");
3171 * you may not use this file except in compliance with the License.
3172 * You may obtain a copy of the License at
3173 *
3174 * http://www.apache.org/licenses/LICENSE-2.0
3175 *
3176 * Unless required by applicable law or agreed to in writing, software
3177 * distributed under the License is distributed on an "AS IS" BASIS,
3178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3179 * See the License for the specific language governing permissions and
3180 * limitations under the License.
3181 * =============================================================================
3182 */function K9(t){A(t.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${t.dtype}.`);const e={input:t};return V.runKernel(RI,e)}const K1=M({fft_:K9});/**
3183 * @license
3184 * Copyright 2020 Google LLC. All Rights Reserved.
3185 * Licensed under the Apache License, Version 2.0 (the "License");
3186 * you may not use this file except in compliance with the License.
3187 * You may obtain a copy of the License at
3188 *
3189 * http://www.apache.org/licenses/LICENSE-2.0
3190 *
3191 * Unless required by applicable law or agreed to in writing, software
3192 * distributed under the License is distributed on an "AS IS" BASIS,
3193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3194 * See the License for the specific language governing permissions and
3195 * limitations under the License.
3196 * =============================================================================
3197 */function X9(t){A(t.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${t.dtype}.`);const e={input:t};return V.runKernel(UI,e)}const Zf=M({ifft_:X9});/**
3198 * @license
3199 * Copyright 2018 Google LLC. All Rights Reserved.
3200 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 4,183 bytes, lines 3201-3260
3201 * you may not use this file except in compliance with the License.
3202 * You may obtain a copy of the License at
3203 *
3204 * http://www.apache.org/licenses/LICENSE-2.0
3205 *
3206 * Unless required by applicable law or agreed to in writing, software
3207 * distributed under the License is distributed on an "AS IS" BASIS,
3208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3209 * See the License for the specific language governing permissions and
3210 * limitations under the License.
3211 * =============================================================================
3212 */function Y9(t){const e=t.shape[t.shape.length-1],n=t.size/e;let r;if(e<=2){const s=K(t,[n,e]);r=Zf(s)}else{const s=[n,2*(e-1)],i=K(Hc(t),[n,e]),o=K(dm(t),[n,e]),a=_a(Ne(i,[0,1],[n,e-2]),1),u=re(_a(Ne(o,[0,1],[n,e-2]),1),De(-1)),l=Jt([i,a],1),c=Jt([o,u],1),h=K(po(l,c),[s[0],s[1]]);r=Zf(h)}if(r=Hc(r),t.rank===3&&t.shape[0]!==0){const s=r,i=t.shape[0];r=K(r,[i,r.shape[0]/i,r.shape[1]]),s.dispose()}return r}const FO=M({irfft_:Y9});/**
3213 * @license
3214 * Copyright 2020 Google LLC. All Rights Reserved.
3215 * Licensed under the Apache License, Version 2.0 (the "License");
3216 * you may not use this file except in compliance with the License.
3217 * You may obtain a copy of the License at
3218 *
3219 * http://www.apache.org/licenses/LICENSE-2.0
3220 *
3221 * Unless required by applicable law or agreed to in writing, software
3222 * distributed under the License is distributed on an "AS IS" BASIS,
3223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3224 * See the License for the specific language governing permissions and
3225 * limitations under the License.
3226 * =============================================================================
3227 */function Q9(t,e,n=0){const s={x:I(t,"x","split")},i={numOrSizeSplits:e,axis:n};return V.runKernel(tR,s,i)}const qc=M({split_:Q9});/**
3228 * @license
3229 * Copyright 2018 Google LLC. All Rights Reserved.
3230 * Licensed under the Apache License, Version 2.0 (the "License");
3231 * you may not use this file except in compliance with the License.
3232 * You may obtain a copy of the License at
3233 *
3234 * http://www.apache.org/licenses/LICENSE-2.0
3235 *
3236 * Unless required by applicable law or agreed to in writing, software
3237 * distributed under the License is distributed on an "AS IS" BASIS,
3238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3239 * See the License for the specific language governing permissions and
3240 * limitations under the License.
3241 * =============================================================================
3242 */function Z9(t,e){A(t.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${t.dtype}`);let n=t.shape[t.shape.length-1];const r=t.size/n;let s;if(e!=null&&e<n){const p=t.shape.map(v=>0),y=t.shape.map(v=>v);y[t.shape.length-1]=e,s=Ne(t,p,y),n=e}else if(e!=null&&e>n){const p=t.shape.map(y=>y);p[t.shape.length-1]=e-n,s=Jt([t,ba(p)],t.shape.length-1),n=e}else s=t;const i=cr(s),o=K(po(s,i),[r,n]),a=K1(o),u=Math.floor(n/2)+1,l=Hc(a),c=dm(a),h=qc(l,[u,n-u],l.shape.length-1),d=qc(c,[u,n-u],c.shape.length-1),f=s.shape.slice();return f[s.shape.length-1]=u,K(po(h[0],d[0]),f)}const X1=M({rfft_:Z9});/**
3243 * @license
3244 * Copyright 2020 Google LLC. All Rights Reserved.
3245 * Licensed under the Apache License, Version 2.0 (the "License");
3246 * you may not use this file except in compliance with the License.
3247 * You may obtain a copy of the License at
3248 *
3249 * http://www.apache.org/licenses/LICENSE-2.0
3250 *
3251 * Unless required by applicable law or agreed to in writing, software
3252 * distributed under the License is distributed on an "AS IS" BASIS,
3253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3254 * See the License for the specific language governing permissions and
3255 * limitations under the License.
3256 * =============================================================================
3257 */function J9(t,e){let n=I(t,"a","squaredDifference"),r=I(e,"b","squaredDifference");[n,r]=Tt(n,r),Le(n.shape,r.shape);const s={a:n,b:r},i={};return V.runKernel(uR,s,i)}const LO=M({squaredDifference_:J9});/**
3258 * @license
3259 * Copyright 2020 Google LLC. All Rights Reserved.
3260 * Licensed under the Apache License, Version 2.0 (the "License");
3261 * you may not use this file except in compliance with the License.
3262 * You may obtain a copy of the License at
3263 *
3264 * http://www.apache.org/licenses/LICENSE-2.0
3265 *
3266 * Unless required by applicable law or agreed to in writing, software
3267 * distributed under the License is distributed on an "AS IS" BASIS,
3268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3269 * See the License for the specific language governing permissions and
3270 * limitations under the License.
3271 * =============================================================================
3272 */function eY(t,e){const n=I(t,"x","squeeze","string_or_numeric");return K(n,_o(n.shape,e).newShape)}const Ht=M({squeeze_:eY});/**
3273 * @license
3274 * Copyright 2020 Google LLC. All Rights Reserved.
3275 * Licensed under the Apache License, Version 2.0 (the "License");
3276 * you may not use this file except in compliance with the License.
3277 * You may obtain a copy of the License at
3278 *
3279 * http://www.apache.org/licenses/LICENSE-2.0
3280 *
3281 * Unless required by applicable law or agreed to in writing, software
3282 * distributed under the License is distributed on an "AS IS" BASIS,
3283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3284 * See the License for the specific language governing permissions and
3285 * limitations under the License.
3286 * =============================================================================
3287 */function tY(t,e=0){const n=qf(t,"tensors","stack","string_or_numeric");A(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&A(e<=n[0].rank,()=>"Axis must be <= rank of the tensor");const r=n,s={axis:e};return V.runKernel(_A,r,s)}const wi=M({stack_:tY});/**
3288 * @license
3289 * Copyright 2018 Google LLC. All Rights Reserved.
3290 * Licensed under the Apache License, Version 2.0 (the "License");
3291 * you may not use this file except in compliance with the License.
3292 * You may obtain a copy of the License at
3293 *
3294 * http://www.apache.org/licenses/LICENSE-2.0
3295 *
3296 * Unless required by applicable law or agreed to in writing, software
3297 * distributed under the License is distributed on an "AS IS" BASIS,
3298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3299 * See the License for the specific language governing permissions and
3300 * limitations under the License.
3301 * =============================================================================
3302 */function nY(t,e=0){const r={x:I(t,"x","step")},s={alpha:e};return V.runKernel(SR,r,s)}const MO=M({step_:nY});/**
3303 * @license
3304 * Copyright 2018 Google LLC. All Rights Reserved.
3305 * Licensed under the Apache License, Version 2.0 (the "License");
3306 * you may not use this file except in compliance with the License.
3307 * You may obtain a copy of the License at
3308 *
3309 * http://www.apache.org/licenses/LICENSE-2.0
3310 *
3311 * Unless required by applicable law or agreed to in writing, software
3312 * distributed under the License is distributed on an "AS IS" BASIS,
3313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3314 * See the License for the specific language governing permissions and
3315 * limitations under the License.
3316 * =============================================================================
3317 */function rY(t,e,n,r,s=0,i=0,o=0,a=0,u=0){const c={x:I(t,"x","stridedSlice","string_or_numeric")},h={begin:e,end:n,strides:r,beginMask:s,endMask:i,ellipsisMask:o,newAxisMask:a,shrinkAxisMask:u};return V.runKernel(cR,c,h)}const sY=M({stridedSlice_:rY});/**
3318 * @license
3319 * Copyright 2018 Google LLC. All Rights Reserved.
3320 * Licensed under the Apache License, Version 2.0 (the "License");
3321 * you may not use this file except in compliance with the License.
3322 * You may obtain a copy of the License at
3323 *
3324 * http://www.apache.org/licenses/LICENSE-2.0
3325 *
3326 * Unless required by applicable law or agreed to in writing, software
3327 * distributed under the License is distributed on an "AS IS" BASIS,
3328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3329 * See the License for the specific language governing permissions and
3330 * limitations under the License.
3331 * =============================================================================
3332 */function iY(t){const n={x:I(t,"x","tan","float32")};return V.runKernel(mR,n)}const oY=M({tan_:iY});/**
3333 * @license
3334 * Copyright 2018 Google LLC. All Rights Reserved.
3335 * Licensed under the Apache License, Version 2.0 (the "License");
3336 * you may not use this file except in compliance with the License.
3337 * You may obtain a copy of the License at
3338 *
3339 * http://www.apache.org/licenses/LICENSE-2.0
3340 *
3341 * Unless required by applicable law or agreed to in writing, software
3342 * distributed under the License is distributed on an "AS IS" BASIS,
3343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3344 * See the License for the specific language governing permissions and
3345 * limitations under the License.
3346 * =============================================================================
3347 */function un(t,e){pl(t);const n=So(t,e);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return To(t,null,n,e)}/**
3348 * @license
3349 * Copyright 2018 Google LLC. All Rights Reserved.
3350 * Licensed under the Apache License, Version 2.0 (the "License");
3351 * you may not use this file except in compliance with the License.
3352 * You may obtain a copy of the License at
3353 *
3354 * http://www.apache.org/licenses/LICENSE-2.0
3355 *
3356 * Unless required by applicable law or agreed to in writing, software
3357 * distributed under the License is distributed on an "AS IS" BASIS,
3358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3359 * See the License for the specific language governing permissions and
3360 * limitations under the License.
3361 * =============================================================================
3362 */function sa(t,e,n){if(pl(t),e!=null&&e.length!==2)throw new Error("tensor2d() requires shape to have two numbers");const r=So(t,n);if(r.length!==2&&r.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return To(t,e,r,n)}/**
3363 * @license
3364 * Copyright 2018 Google LLC. All Rights Reserved.
3365 * Licensed under the Apache License, Version 2.0 (the "License");
3366 * you may not use this file except in compliance with the License.
3367 * You may obtain a copy of the License at
3368 *
3369 * http://www.apache.org/licenses/LICENSE-2.0
3370 *
3371 * Unless required by applicable law or agreed to in writing, software
3372 * distributed under the License is distributed on an "AS IS" BASIS,
3373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3374 * See the License for the specific language governing permissions and
3375 * limitations under the License.
3376 * =============================================================================
3377 */function VO(t,e,n){if(pl(t),e!=null&&e.length!==3)throw new Error("tensor3d() requires shape to have three numbers");const r=So(t,n);if(r.length!==3&&r.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return To(t,e,r,n)}/**
3378 * @license
3379 * Copyright 2018 Google LLC. All Rights Reserved.
3380 * Licensed under the Apache License, Version 2.0 (the "License");
3381 * you may not use this file except in compliance with the License.
3382 * You may obtain a copy of the License at
3383 *
3384 * http://www.apache.org/licenses/LICENSE-2.0
3385 *
3386 * Unless required by applicable law or agreed to in writing, software
3387 * distributed under the License is distributed on an "AS IS" BASIS,
3388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3389 * See the License for the specific language governing permissions and
3390 * limitations under the License.
3391 * =============================================================================
3392 */function aY(t,e,n){if(pl(t),e!=null&&e.length!==4)throw new Error("tensor4d() requires shape to have four numbers");const r=So(t,n);if(r.length!==4&&r.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return To(t,e,r,n)}/**
3393 * @license
3394 * Copyright 2018 Google LLC. All Rights Reserved.
3395 * Licensed under the Apache License, Version 2.0 (the "License");
3396 * you may not use this file except in compliance with the License.
3397 * You may obtain a copy of the License at
3398 *
3399 * http://www.apache.org/licenses/LICENSE-2.0
3400 *
3401 * Unless required by applicable law or agreed to in writing, software
3402 * distributed under the License is distributed on an "AS IS" BASIS,
3403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3404 * See the License for the specific language governing permissions and
3405 * limitations under the License.
3406 * =============================================================================
3407 */function uY(t,e,n){if(pl(t),e!=null&&e.length!==5)throw new Error("tensor5d() requires shape to have five numbers");const r=So(t,n);if(r.length!==5&&r.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return To(t,e,r,n)}/**
3408 * @license
3409 * Copyright 2018 Google LLC. All Rights Reserved.
3410 * Licensed under the Apache License, Version 2.0 (the "License");
3411 * you may not use this file except in compliance with the License.
3412 * You may obtain a copy of the License at
3413 *
3414 * http://www.apache.org/licenses/LICENSE-2.0
3415 *
3416 * Unless required by applicable law or agreed to in writing, software
3417 * distributed under the License is distributed on an "AS IS" BASIS,
3418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3419 * See the License for the specific language governing permissions and
3420 * limitations under the License.
3421 * =============================================================================
3422 */function lY(t,e,n){if(pl(t),e!=null&&e.length!==6)throw new Error("tensor6d() requires shape to have six numbers");const r=So(t,n);if(r.length!==6&&r.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return e=e||r,To(t,e,r,n)}function BO(t,e,n){const r=e.rank>1?e.shape[e.rank-1]:1,s=e.rank>1?e.rank-1:1,i=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${e.shape}, shape: ${t}, sliceDim: ${r}, and batchDim: ${s}.`;if(n.rank<s)throw new Error(i+` update.rank < ${s}. `);if(t.length<r+(n.rank-s))throw new Error(i+` Output shape length < ${r+(n.rank-s)}`);if(n.rank!==s+t.length-r)throw new Error(i+` update.rank != ${s+t.length-r}`);for(let o=0;o<s;++o)if(n.shape[o]!==e.shape[o])throw new Error(i+` updates.shape[${o}] (${n.shape[o]}) != indices.shape[${o}] (${e.shape[o]}).`);for(let o=0;o<n.rank-s;++o)if(n.shape[o+s]!==t[o+r])throw new Error(i+` updates.shape[${o+s}] (${n.shape[o+s]}) != shape[${o+s}] (${t[o+s]})`)}function Y1(t,e,n){if(e.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${e.rank}.`);if(t.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.dtype!=="int32")throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${e.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(n.length===0){if(e.size===0)throw new Error(`Indices specified for empty output. indices shape: ${e.shape}`);if(t.size===0)throw new Error(`Updates specified for empty output. updates shape: ${t.shape}`)}BO(n,e,t)}function pm(t,e,n){const r=e.shape.length,s=r>1?e.shape[r-1]:1,i=n.length;let o=1;for(let h=s;h<i;++h)o*=n[h];const a=s<1?1:s,u=ne(e.shape)/a,l=[...Zt(n.slice(0,s)),1],c=ne(n);return{sliceRank:s,numUpdates:u,sliceSize:o,strides:l,outputSize:c}}/**
3423 * @license
3424 * Copyright 2022 Google LLC. All Rights Reserved.
3425 * Licensed under the Apache License, Version 2.0 (the "License");
3426 * you may not use this file except in compliance with the License.
3427 * You may obtain a copy of the License at
3428 *
3429 * http://www.apache.org/licenses/LICENSE-2.0
3430 *
3431 * Unless required by applicable law or agreed to in writing, softw
3431are
3432 * distributed under the License is distributed on an "AS IS" BASIS,
3433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3434 * See the License for the specific language governing permissions and
3435 * limitations under the License.
3436 * =============================================================================
3437 */function cY(t,e,n){const r=I(t,"tensor","tensorScatterupdate"),s=I(e,"indices","tensorScatterupdate","int32"),i=I(n,"updates","tensorScatterupdate");if(Y1(i,s,r.shape),r.dtype!==i.dtype)throw new Error(`tensor and updates must have the same dtype, instead they are ${r.dtype} and ${i.dtype}.`);const o={tensor:r,indices:s,updates:i},a={};return V.runKernel(UA,o,a)}const hY=M({tensorScatterUpdate_:cY});/**
3438 * @license
3439 * Copyright 2018 Google LLC. All Rights Reserved.
3440 * Licensed under the Apache License, Version 2.0 (the "License");
3441 * you may not use this file except in compliance with the License.
3442 * You may obtain a copy of the License at
3443 *
3444 * http://www.apache.org/licenses/LICENSE-2.0
3445 *
3446 * Unless required by applicable law or agreed to in writing, software
3447 * distributed under the License is distributed on an "AS IS" BASIS,
3448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3449 * See the License for the specific language governing permissions and
3450 * limitations under the License.
3451 * =============================================================================
3452 */function dY(t,e=1,n=!0){const r=I(t,"x","topk");
vendor: 4,339 bytes, lines 3452-3515
3452if(r.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");const s=r.shape[r.shape.length-1];if(e<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${e}`);if(e>s)throw new Error(`'k' passed to topk() must be <= the last dimension (${s}) but got ${e}`);const i={x:r},o={k:e,sorted:n},[a,u]=V.runKernel(yR,i,o);return{values:a,indices:u}}const fY=M({topk_:dY});/**
3453 * @license
3454 * Copyright 2020 Google LLC. All Rights Reserved.
3455 * Licensed under the Apache License, Version 2.0 (the "License");
3456 * you may not use this file except in compliance with the License.
3457 * You may obtain a copy of the License at
3458 *
3459 * http://www.apache.org/licenses/LICENSE-2.0
3460 *
3461 * Unless required by applicable law or agreed to in writing, software
3462 * distributed under the License is distributed on an "AS IS" BASIS,
3463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3464 * See the License for the specific language governing permissions and
3465 * limitations under the License.
3466 * =============================================================================
3467 */function pY(t,e=0,n=1,r,s){if(gr(t),r!=null&&r==="bool")throw new Error("Unsupported data type $ { dtype }");const i=new H1(e,n,r,!0,s),o=wt(t,r);for(let a=0;a<o.values.length;a++)o.values[a]=i.nextValue();return o.toTensor()}const mY=M({truncatedNormal_:pY});/**
3468 * @license
3469 * Copyright 2020 Google LLC. All Rights Reserved.
3470 * Licensed under the Apache License, Version 2.0 (the "License");
3471 * you may not use this file except in compliance with the License.
3472 * You may obtain a copy of the License at
3473 *
3474 * http://www.apache.org/licenses/LICENSE-2.0
3475 *
3476 * Unless required by applicable law or agreed to in writing, software
3477 * distributed under the License is distributed on an "AS IS" BASIS,
3478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3479 * See the License for the specific language governing permissions and
3480 * limitations under the License.
3481 * =============================================================================
3482 */function gY(t,e=0){const n=I(t,"x","unique","string_or_numeric");A(n.rank>0,()=>"The input tensor must be at least 1D");const r={x:n},s={axis:e},[i,o]=V.runKernel(xR,r,s);return{values:i,indices:o}}const yY=M({unique_:gY});/**
3483 * @license
3484 * Copyright 2020 Google LLC. All Rights Reserved.
3485 * Licensed under the Apache License, Version 2.0 (the "License");
3486 * you may not use this file except in compliance with the License.
3487 * You may obtain a copy of the License at
3488 *
3489 * http://www.apache.org/licenses/LICENSE-2.0
3490 *
3491 * Unless required by applicable law or agreed to in writing, software
3492 * distributed under the License is distributed on an "AS IS" BASIS,
3493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3494 * See the License for the specific language governing permissions and
3495 * limitations under the License.
3496 * =============================================================================
3497 */function vY(t,e,n){const r=I(t,"x","unsortedSegmentSum"),s=I(e,"segmentIds","unsortedSegmentSum","int32");A(Xu(n),()=>"numSegments must be of dtype int");const i={x:r,segmentIds:s},o={numSegments:n};return V.runKernel(bR,i,o)}const xY=M({unsortedSegmentSum_:vY});/**
3498 * @license
3499 * Copyright 2020 Google LLC. All Rights Reserved.
3500 * Licensed under the Apache License, Version 2.0 (the "License");
3501 * you may not use this file except in compliance with the License.
3502 * You may obtain a copy of the License at
3503 *
3504 * http://www.apache.org/licenses/LICENSE-2.0
3505 *
3506 * Unless required by applicable law or agreed to in writing, software
3507 * distributed under the License is distributed on an "AS IS" BASIS,
3508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3509 * See the License for the specific language governing permissions and
3510 * limitations under the License.
3511 * =============================================================================
3512 */function wY(t,e=0){const n=I(t,"x","unstack","string_or_numeric");A(e>=-n.shape.length&&e<n.shape.length,()=>`Axis = ${e} is not in [-${n.shape.length}, ${n.shape.length})`);const r={value:n},s={axis:e};return V.runKernel(wR,r,s)}const Fa=M({unstack_:wY});/**
3513 * @license
3514 * Copyright 2022 Google LLC. All Rights Reserved.
3515 * Licensed under the Apache License, Version 2.0 (the "License");
3516 * you may not use this file except in compliance with the License.
3517 * You may obtain a copy of the License at
3518 *
3519 * http://www.apache.org/licenses/LICENSE-2.0
3520 *
3521 * Unless required by applicable law or agreed to in writing, software
3522 * distributed under the License is distributed on an "AS IS" BASIS,
3523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3524 * See the License for the specific language governing permissions and
3525 * limitations under the License.
3526 * =============================================================================
3527 */function bY(t,e){return M1(t,e,"right")}/**
3528 * @license
3529 * Copyright 2018 Google LLC. All Rights Reserved.
3530 * Licensed under the Apache License, Version 2.0 (the "License");
3531 * you may not use this file except in compliance with the License.
3532 * You may obtain a copy of the License at
3533 *
3534 * http://www.apache.org/licenses/LICENSE-2.0
3535 *
3536 * Unless required by applicable law or agreed to in writing, software
3537 * distributed under the License is distributed on an "AS IS" BASIS,
3538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3539 * See the License for the specific language governing permissions and
3540 * limitations under the License.
3541 * =============================================================================
3542 */function _Y(t,e=!0,n,r){return V.makeVariable(t,e,n,r)}/**
3543 * @license
3544 * Copyright 2018 Google LLC. All Rights Reserved.
3545 * Licensed under the Apache License, Version 2.0 (the "License");
3546 * you may not use this file except in compliance with the License.
3547 * You may obtain a copy of the License at
3548 *
3549 * http://www.apache.org/licenses/LICENSE-2.0
3550 *
3551 * Unless required by applicable law or agreed to in writing, software
3552 * distributed under the License is distributed on an "AS IS" BASIS,
3553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3554 * See the License for the specific language governing permissions and
3555 * limitations under the License.
3556 * =============================================================================
3557 */function WO(t,e){const n=[];for(let i=0;i<e.length;i++)e[i]&&n.push(i);const r=wt(t,"int32"),s=wt([n.length,t.length],"int32");for(let i=0;i<n.length;i++){const o=r.indexToLoc(n[i]),a=i*t.length;s.values.set(o,a)}return s.toTensor()}/**
3558 * @license
3559 * Copyright 2020 Google LLC. All Rights Reserved.
3560 * Licensed under the Apache License, Version 2.0 (the "License");
3561 * you may not use this file except in compliance with the License.
3562 * You may obtain a copy of the License at
3563 *
3564 * http://www.apache.org/licenses/LICENSE-2.0
3565 *
3566 * Unless required by applicable law or agreed to in writing, software
3567 * distributed under the License is distributed on an "AS IS" BASIS,
3568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3569 * See the License for the specific language governing permissions and
3570 * limitations under the License.
3571 * =============================================================================
3572 */async function SY(t){const e=I(t,"condition","whereAsync","bool"),n=await e.data(),r=WO(e.shape,n);return t!==e&&e.dispose(),r}const UO=SY;/**
3573 * @license
3574 * Copyright 2018 Google LLC. All Rights Reserved.
3575 * Licensed under the Apache License, Version 2.0 (the "License");
3576 * you may not use this file except in compliance with the License.
3577 * You may obtain a copy of the License at
3578 *
3579 * http://www.apache.org/licenses/LICENSE-2.0
3580 *
3581 * Unless required by applicable law or agreed to in writing, software
3582 * distributed under the License is distributed on an "AS IS" BASIS,
3583 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3584 * See the License for the specific language governing permissions and
3585 * limitations under the License.
3586 * =============================================================================
3587 */async function TY(t,e,n){const r=I(t,"tensor","boolMask"),s=I(e,"mask","boolMask","bool"),i=n??0,o=s.rank,a=r.shape;A(o>0,()=>"mask cannot be scalar"),mr(a.slice(i,i+o),s.shape,"mask's shape must match the first K dimensions of tensor's shape,");let u=1;for(let y=i;y<i+o;y++)u*=a[y];const l=a.slice(0,i).concat([u],a.slice(i+o)),c=K(r,l),h=K(s,[-1]),d=await UO(h),f=Ht(d,[1]),p=xO(c,f,i);return t!==r&&r.dispose(),e!==s&&s.dispose(),f.dispose(),c.dispose(),h.dispose(),d.dispose(),p}const CY=TY;/**
3588 * @license
3589 * Copyright 2018 Google LLC. All Rights Reserved.
3590 * Licensed under the Apache License, Version 2.0 (the "License");
3591 * you may not use this file except in compliance with the License.
3592 * You may obtain a copy of the License at
3593 *
3594 * http://www.apache.org/licenses/LICENSE-2.0
3595 *
3596 * Unless required by applicable law or agreed to in writing, software
3597 * distributed under the License is distributed on an "AS IS" BASIS,
3598 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3599 * See the License for the specific language governing permissions and
3600 * limitations under the License.
3601 * =============================================================================
3602 */function NY(t,e,n){const r=I(t,"x","transpose");if(e==null&&(e=r.shape.map((o,a)=>a).reverse()),A(r.rank===e.length,()=>`Error in transpose: rank of input ${r.rank} must match length of perm ${e}.`),e.forEach(o=>{A(o>=0&&o<r.rank,()=>`All entries in 'perm' must be between 0 and ${r.rank-1} but got ${e}`)}),r.rank<=1)return r.clone();const s={x:r},i={perm:e};return r.dtype==="complex64"?$e(()=>{let o=Hc(r),a=dm(r);return o=V.runKernel(jd,{x:o},i),a=V.runKernel(jd,{x:a},i),n&&(a=Bs(a)),po(o,a)}):V.runKernel(jd,s,i)}const U0=M({transpose_:NY});/**
3603 * @license
3604 * Copyright 2018 Google LLC. All Rights Reserved.
3605 * Licensed under the Apache License, Version 2.0 (the "License");
3606 * you may not use this file except in compliance with the License.
3607 * You may obtain a copy of the License at
3608 *
3609 * http://www.apache.org/licenses/LICENSE-2.0
3610 *
3611 * Unless required by applicable law or agreed to in writing, software
3612 * distributed under the License is distributed on an "AS IS" BASIS,
3613 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3614 * See the License for the specific language governing permissions and
3615 * limitations under the License.
3616 * =============================================================================
3617 */function EY(t,e,n,r,s=!0){const i=I(t,"v","movingAverage"),o=I(e,"x","movingAverage"),a=I(n,"decay","movingAverage");K5(i,o),A(xt(i.shape,o.shape),()=>"Shape mismatch in v and x");const u=De(1),l=Ee(u,a);let c=re(Ee(o,i),l);if(s){A(r!=null,()=>"When using zeroDebias: true, step is required.");const h=I(r,"step","movingAverage");c=Ae(c,Ee(u,zc(a,h)))}return ge(i,c)}const kY=M({movingAverage_:EY});/**
3618 * @license
3619 * Copyright 2018 Google LLC. All Rights Reserved.
3620 * Licensed under the Apache License, Version 2.0 (the "License");
3621 * you may not use this file except in compliance with the License.
3622 * You may obtain a copy of the License at
3623 *
3624 * http://www.apache.org/licenses/LICENSE-2.0
3625 *
3626 * Unless required by applicable law or agreed to in writing, software
3627 * distributed under the License is distributed on an "AS IS" BASIS,
3628 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3629 * See the License for the specific language governing permissions and
3630 * limitations under the License.
3631 * =============================================================================
3632 */function $Y(t,e,n){gr(n);const r=I(t,"indices","scatterND","int32"),s=I(e,"updates","scatterND");Y1(s,r,n);const i={indices:r,updates:s},o={shape:n};return V.runKernel(WA,i,o)}const IY=M({scatterND_:$Y});function AY(t,e,n,r){if(t.dtype!=="int32")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}.`);const s=t.rank>0?t.shape[0]:1,i=t.rank>1?t.shape[1]:1;if(n.length!==i)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${i}.`);const o=e.size;if(!(e.rank===0||e.rank===1&&o===s))throw new Error(`sparseValues has incorrect shape ${e.shape}, should be [] or [${s}]`);if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}/**
3633 * @license
3634 * Copyright 2018 Google LLC. All Rights Reserved.
3635 * Licensed under the Apache License, Version 2.0 (the "License");
3636 * you may not use this file except in compliance with the License.
3637 * You may obtain a copy of the License at
3638 *
3639 * http://www.apache.org/licenses/LICENSE-2.0
3640 *
3641 * Unless required by applicable law or agreed to in writing, softw
3641are
3642 * distributed under the License is distributed on an "AS IS" BASIS,
3643 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3644 * See the License for the specific language governing permissions and
3645 * limitations under the License.
3646 * =============================================================================
3647 */function RY(t,e,n,r=0){gr(n);const s=I(t,"sparseIndices","sparseToDense","int32"),i=I(e,"sparseValues","sparseToDense","string_or_numeric"),o=I(r,"defaultValue","sparseToDense",i.dtype);AY(s,i,n,o);const a={sparseIndices:s,sparseValues:i,defaultValue:o},u={outputShape:n};return V.runKernel(aR,a,u)}const OY=M({sparseToDense_:RY});/**
3648 * @license
3649 * Copyright 2018 Google LLC. All Rights Reserved.
3650 * Licensed under the Apache License, Version 2.0 (the "License");
3651 * you may not use this file except in compliance with the License.
3652 * You may obtain a copy of the License at
3653 *
3654 * http://www.apache.org/licenses/LICENSE-2.0
3655 *
3656 * Unless required by applicable law or agreed to in writing, software
3657 * distributed under the License is distributed on an "AS IS" BASIS,
3658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3659 * See the License for the specific language governing permissions and
3660 * limitations under the License.
3661 * =============================================================================
3662 */function DY(t,e){const n=I(e,"indices","gatherND","int32"),s={params:I(t,"x","gatherND","string_or_numeric"),indices:n};return V.runKernel(VI,s)}const PY=M({gatherND_:DY});/**
3663 * @license
3664 * Copyright 2019 Google LLC. All Rights Reserved.
3665 * Licensed under the Apache License, Version 2.0 (the "License");
3666 * you may not use this file except in compliance with the License.
3667 * You may obtain a copy of the License at
3668 *
3669 * http://www.apache.org/licenses/LICENSE-2.0
3670 *
3671 * Unless required by applicable law or agreed to in writing, software
3672 * distributed under the License is distributed on an "AS IS" BASIS,
3673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3674 * See the License for the specific language governing permissions and
3675 * limitations under the License.
3676 * =============================================================================
3677 */function FY(t,e){if(e==null)return t.shape.slice();if(xt(t.shape,e))return e;if(t.shape.length===e.length){const n=[];for(let r=0;r<t.shape.length;r++)e[r]==null&&t.shape[r]!=null?n.push(t.shape[r]):n.push(e[r]);return n}return e}/**
3678 * @license
3679 * Copyright 2018 Google LLC. All Rights Reserved.
3680 * Licensed under the Apache License, Version 2.0 (the "License");
3681 * you may not use this file except in compliance with the License.
3682 * You may obtain a copy of the License at
3683 *
3684 * http://www.apache.org/licenses/LICENSE-2.0
3685 *
3686 * Unless required by applicable law or agreed to in writing, software
3687 * distributed under the License is distributed on an "AS IS" BASIS,
3688 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3689 * See the License for the specific language governing permissions and
3690 * limitations under the License.
3691 * =============================================================================
3692 */function LY(t,e,n,r){const s=I(t,"x","dropout");if(A(s.dtype==="float32",()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${s.dtype} tensor instead.`),A(e>=0&&e<1,()=>`rate must be a float in the range [0, 1), but got ${e}.`),e===0)return t instanceof Lt?s.clone():s;const i=FY(s,n),o=1-e,a=Ae(vO(ge(q1(i,0,1,"float32",r),o)),o);return re(s,a)}const MY=M({dropout_:LY});/**
3693 * @license
3694 * Copyright 2019 Google LLC. All Rights Reserved.
3695 * Licensed under the Apache License, Version 2.0 (the "License");
3696 * you may not use this file except in compliance with the License.
3697 * You may obtain a copy of the License at
3698 *
3699 * http://www.apache.org/licenses/LICENSE-2.0
3700 *
3701 * Unless required by applicable law or agreed to in writing, software
3702 * distributed under the License is distributed on an "AS IS" BASIS,
3703 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3704 * See the License for the specific language governing permissions and
3705 * limitations under the License.
3706 * =============================================================================
3707 */function zO(t){return Math.floor(Math.pow(2,Math.ceil(Math.log(t)/Math.log(2))))}function Q1(t,e,n){const r=1-t%2,s=new Float32Array(t);for(let i=0;i<t;++i){const o=2*Math.PI*i/(t+r-1);s[i]=e-n*Math.cos(o)}return un(s,"float32")}/**
3708 * @license
3709 * Copyright 2019 Google LLC. All Rights Reserved.
3710 * Licensed under the Apache License, Version 2.0 (the "License");
3711 * you may not use this file except in compliance with the License.
3712 * You may obtain a copy of the License at
3713 *
3714 * http://www.apache.org/licenses/LICENSE-2.0
3715 *
3716 * Unless required by applicable law or agreed to in writing, software
3717 * distributed under the License is distributed on an "AS IS" BASIS,
3718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3719 * See the License for the specific language governing permissions and
3720 * limitations under the License.
3721 * =============================================================================
3722 */async function VY(t,e,n=1){const r=I(t,"predictions","inTopK"),s=I(e,"targets","inTopK");A(r.rank>1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${r.rank}`),A(r.rank-1===s.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${r.rank} and targets rank ${s.rank}`),mr(r.shape.slice(0,r.shape.length-1),s.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const i=r.shape[r.shape.length-1];A(n>0&&n<=i,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${i}), but got ${n}`);const o=await r.data(),a=await s.data(),[u,l]=[o.length/i,i],c=ho("bool",u);for(let h=0;h<u;h++){const d=h*l,f=o.subarray(d,d+l),p=[];for(let y=0;y<f.length;y++)p.push({value:f[y],index:y});p.sort((y,v)=>v.value-y.value),c[h]=0;for(let y=0;y<n;y++)if(p[y].index===a[h]){c[h]=1;break}}return t!==r&&r.dispose(),e!==s&&s.dispose(),Vs(c,s.shape,"bool")}const BY=VY;/**
3723 * @license
3724 * Copyright 2020 Google LLC. All Rights Reserved.
3725 * Licensed under the Apache License, Version 2.0 (the "License");
3726 * you may not use this file except in compliance with the License.
3727 * You may obtain a copy of the License at
3728 *
3729 * http://www.apache.org/licenses/LICENSE-2.0
3730 *
3731 * Unless required by applicable law or agreed to in writing, software
3732 * distributed under the License is distributed on an "AS IS" BASIS,
3733 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3734 * See the License for the specific language governing permissions and
3735 * limitations under the License.
3736 * =============================================================================
3737 */function WY(t,e,n,r,s,i="NHWC",o){let a=t;t.rank===3&&(a=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u=e;u.rank===3&&(u=K(e,[1,e.shape[0],e.shape[1],e.shape[2]])),A(a.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${a.shape}.`),A(u.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${u.shape}.`),A(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);const l=i==="NHWC"?a.shape[3]:a.shape[1],c=i==="NHWC"?u.shape[3]:u.shape[1];A(l===n[2],()=>`Error in conv2dDerFilter: depth of input ${l}) must match input depth in filter (${n[2]}.`),A(c===n[3],()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}).`),Wr("conv2dDerFilter",s,o);const h={x:a,dy:u},d={strides:r,pad:s,dataFormat:i,dimRoundingMode:o,filterShape:n};return V.runKernel(uI,h,d)}const UY=M({conv2DBackpropFilter_:WY});/**
3738 * @license
3739 * Copyright 2019 Google LLC. All Rights Reserved.
3740 * Licensed under the Apache License, Version 2.0 (the "License");
3741 * you may not use this file except in compliance with the License.
3742 * You may obtain a copy of the License at
3743 *
3744 * http://www.apache.org/licenses/LICENSE-2.0
3745 *
3746 * Unless required by applicable law or agreed to in writing, software
3747 * distributed under the License is distributed on an "AS IS" BASIS,
3748 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3749 * See the License for the specific language governing permissions and
3750 * limitations under the License.
3751 * =============================================================================
3752 */function mm(t,e,n){if(n==null||n==="linear")return t;if(n==="relu")return re(t,MO(e));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function gm(t,e){let n=e;const r=dO(t.shape,e.shape);return r.length>0&&(n=et(n,r)),K(n,t.shape)}function ym(t,e,n,r){if(e==="linear")return t;if(e==="relu")return fm(t);if(e==="elu")return pO(t);if(e==="relu6")return DO(t);if(e==="prelu")return AO(t,n);if(e==="leakyrelu")return bO(t,r);
vendor: 8,650 bytes, lines 3752-3815
3752if(e==="sigmoid")return ra(t);throw new Error(`Unknown fused activation ${e}.`)}const vm=(t,e)=>!(t>0)||e==="linear";/**
3753 * @license
3754 * Copyright 2019 Google LLC. All Rights Reserved.
3755 * Licensed under the Apache License, Version 2.0 (the "License");
3756 * you may not use this file except in compliance with the License.
3757 * You may obtain a copy of the License at
3758 *
3759 * http://www.apache.org/licenses/LICENSE-2.0
3760 *
3761 * Unless required by applicable law or agreed to in writing, software
3762 * distributed under the License is distributed on an "AS IS" BASIS,
3763 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3764 * See the License for the specific language governing permissions and
3765 * limitations under the License.
3766 * =============================================================================
3767 */function zY({x:t,filter:e,strides:n,pad:r,dataFormat:s="NHWC",dilations:i=[1,1],dimRoundingMode:o,bias:a,activation:u="linear",preluActivationWeights:l,leakyreluAlpha:c}){if(u=u||"linear",vm(V.state.gradientDepth,u)===!1){A(s==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${s} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let E=lm(t,e,n,r,s,i,o);return a!=null&&(E=ge(E,a)),ym(E,u,l,c)}const h=I(t,"x","conv2d","float32"),d=I(e,"filter","conv2d","float32");let f=h,p=!1;h.rank===3&&(p=!0,f=K(h,[1,h.shape[0],h.shape[1],h.shape[2]])),A(f.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${f.rank}.`),A(d.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${d.rank}.`),Wr("fused conv2d",r,o);const y=s==="NHWC"?f.shape[3]:f.shape[1];A(d.shape[2]===y,()=>`Error in conv2d: depth of input (${y}) must match input depth for filter ${d.shape[2]}.`),A(tr(n,i),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);const v=yr(f.shape,d.shape,n,i,r,o);let g;a!=null&&(g=I(a,"bias","fused conv2d"),[g]=Tt(g,h),s==="NHWC"?Le(v.outShape,g.shape):(A(g.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${g.shape.length}.`),A(g.shape.length===0||g.shape[0]===v.outChannels||g.shape[0]===1,()=>`Error in fused conv2d: bias shape (${g.shape}) is not compatible with the number of output channels (${v.outChannels})`)));let x;if(l!=null){const E=l.shape;if(A(E.length<=1||E.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${E.length}.`),E.length===1)A(E[0]===1||E[0]===v.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${E}) is not compatible with the number of output channels (${v.outChannels}).`);else if(E.length===3)try{Le(E,v.outShape)}catch{const N=`Error in fused conv2d: PReLU activation weights (${E}) is not compatible with the output shape of the conv2d (${v.outShape}).`;throw Error(N)}x=I(l,"prelu weights","fused conv2d")}const w=(E,k)=>{A(s==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${s} but only NHWC is currently supported.`);const[N,O,R,L]=k,W=mm(E,R,u);A(Uc(i),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${i}'`);const G=hO(O.shape,W,N,n,r),H=UY(O,W,N.shape,n,r),X=[G,H];if(L!=null){const Q=gm(L,W);X.push(Q)}return X},_={x:f,filter:d,bias:g,preluActivationWeights:x},T={strides:n,pad:r,dataFormat:s,dilations:i,dimRoundingMode:o,activation:u,leakyreluAlpha:c};return a==null?xi((k,N,O)=>{let R=V.runKernel(C0,_,T);return O([N,k,R]),p&&(R=K(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:w}})(f,d):xi((k,N,O,R)=>{let L=V.runKernel(C0,_,T);return R([N,k,L,O]),p&&(L=K(L,[L.shape[1],L.shape[2],L.shape[3]])),{value:L,gradFunc:w}})(f,d,g)}const jY=M({fusedConv2d_:zY});/**
3768 * @license
3769 * Copyright 2020 Google LLC. All Rights Reserved.
3770 * Licensed under the Apache License, Version 2.0 (the "License");
3771 * you may not use this file except in compliance with the License.
3772 * You may obtain a copy of the License at
3773 *
3774 * http://www.apache.org/licenses/LICENSE-2.0
3775 *
3776 * Unless required by applicable law or agreed to in writing, software
3777 * distributed under the License is distributed on an "AS IS" BASIS,
3778 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3779 * See the License for the specific language governing permissions and
3780 * limitations under the License.
3781 * =============================================================================
3782 */function GY(t,e,n,r,s,i=[1,1],o){let a=t;t.rank===3&&(a=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let u=e;u.rank===3&&(u=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const l={x:a,dy:u},c={strides:r,pad:s,dimRoundingMode:o,dilations:i,filterShape:n};return V.runKernel(wI,l,c)}const HY=M({depthwiseConv2dNativeBackpropFilter_:GY});/**
3783 * @license
3784 * Copyright 2020 Google LLC. All Rights Reserved.
3785 * Licensed under the Apache License, Version 2.0 (the "License");
3786 * you may not use this file except in compliance with the License.
3787 * You may obtain a copy of the License at
3788 *
3789 * http://www.apache.org/licenses/LICENSE-2.0
3790 *
3791 * Unless required by applicable law or agreed to in writing, software
3792 * distributed under the License is distributed on an "AS IS" BASIS,
3793 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3794 * See the License for the specific language governing permissions and
3795 * limitations under the License.
3796 * =============================================================================
3797 */function qY(t,e,n,r,s,i=[1,1],o){let a=e,u=!1;e.rank===3&&(u=!0,a=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const l={dy:a,filter:n},c={strides:r,pad:s,dimRoundingMode:o,dilations:i,inputShape:t},h=V.runKernel(bI,l,c);return u?K(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const KY=M({depthwiseConv2dNativeBackpropInput_:qY});/**
3798 * @license
3799 * Copyright 2019 Google LLC. All Rights Reserved.
3800 * Licensed under the Apache License, Version 2.0 (the "License");
3801 * you may not use this file except in compliance with the License.
3802 * You may obtain a copy of the License at
3803 *
3804 * http://www.apache.org/licenses/LICENSE-2.0
3805 *
3806 * Unless required by applicable law or agreed to in writing, software
3807 * distributed under the License is distributed on an "AS IS" BASIS,
3808 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3809 * See the License for the specific language governing permissions and
3810 * limitations under the License.
3811 * =============================================================================
3812 */function XY({x:t,filter:e,strides:n,pad:r,dataFormat:s="NHWC",dilations:i=[1,1],dimRoundingMode:o,bias:a,activation:u="linear",preluActivationWeights:l,leakyreluAlpha:c}){if(vm(V.state.gradientDepth,u)===!1){let T=D1(t,e,n,r,s,i,o);return a!=null&&(T=ge(T,a)),ym(T,u,l,c)}const h=I(t,"x","depthwiseConv2d","float32"),d=I(e,"filter","depthwiseConv2d","float32");let f=h,p=!1;h.rank===3&&(p=!0,f=K(h,[1,h.shape[0],h.shape[1],h.shape[2]])),A(f.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${f.rank}.`),A(d.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${d.rank}.`),A(f.shape[3]===d.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${f.shape[3]}) must match the inChannels dimension in filter ${d.shape[2]}.`),i==null&&(i=[1,1]),A(tr(n,i),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),Wr("fused depthwiseConv2d",r,o);const y=yr(f.shape,d.shape,n,i,r,o,!0);let v;a!=null&&(v=I(a,"bias","fused conv2d"),[v]=Tt(v,h),Le(y.outShape,v.shape));let g;l!=null&&(g=I(l,"prelu weights","fused depthwiseConv2d"));const x=(T,E)=>{A(Uc(i),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${i}'`);const[k,N,O,R]=E,L=mm(T,O,u),W=KY(N.shape,L,k,n,r,i,o),G=HY(N,L,k.shape,n,r,i,o);if(R!=null){const H=gm(v,L);return[W,G,H]}return[W,G]},w={x:f,filter:d,bias:v,preluActivationWeights:g},_={strides:n,pad:r,dataFormat:s,dilations:i,dimRoundingMode:o,activation:u,leakyreluAlpha:c};return a==null?xi((E,k,N)=>{let O=V.runKernel(N0,w,_);return N([k,E,O]),p&&(O=K(O,[O.shape[1],O.shape[2],O.shape[3]])),{value:O,gradFunc:x}})(f,d):xi((E,k,N,O)=>{let R=V.runKernel(N0,w,_);return O([k,E,R,N]),p&&(R=K(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:x}})(f,d,v)}const YY=M({fusedDepthwiseConv2d_:XY});/**
3813 * @license
3814 * Copyright 2019 Google LLC. All Rights Reserved.
3815 * Licensed under the Apache License, Version 2.0 (the "License");
3816 * you may not use this file except in compliance with the License.
3817 * You may obtain a copy of the License at
3818 *
3819 * http://www.apache.org/licenses/LICENSE-2.0
3820 *
3821 * Unless required by applicable law or agreed to in writing, software
3822 * distributed under the License is distributed on an "AS IS" BASIS,
3823 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3824 * See the License for the specific language governing permissions and
3825 * limitations under the License.
3826 * =============================================================================
3827 */function QY({a:t,b:e,transposeA:n=!1,transposeB:r=!1,bias:s,activation:i="linear",preluActivationWeights:o,leakyreluAlpha:a=.2}){if(vm(V.state.gradientDepth,i)===!1){let L=ze(t,e,n,r);return s!=null&&(L=ge(L,s)),ym(L,i,o,a)}let u=I(t,"a","fused matMul"),l=I(e,"b","fused matMul");[u,l]=Tt(u,l);const c=n?u.shape[u.rank-2]:u.shape[u.rank-1],h=r?l.shape[l.rank-1]:l.shape[l.rank-2],d=n?u.shape[u.rank-1]:u.shape[u.rank-2],f=r?l.shape[l.rank-2]:l.shape[l.rank-1],p=u.shape.slice(0,-2),y=l.shape.slice(0,-2),v=ne(p),g=ne(y);A(c===h,()=>`Error in fused matMul: inner shapes (${c}) and (${h}) of Tensors with shapes ${u.shape} and ${l.shape} and transposeA=${n} and transposeB=${r} must match.`);const w=Le(u.shape.slice(0,-2),l.shape.slice(0,-2)).concat([d,f]),_=n?K(u,[v,c,d]):K(u,[v,d,c]),T=r?K(l,[g,f,h]):K(l,[g,h,f]);let E;s!=null&&(E=I(s,"bias","fused matMul"),[E]=Tt(E,u),Le(w,E.shape));let k;o!=null&&(k=I(o,"prelu weights","fused matMul"));const N=(L,W)=>{const[G,H,X,Q]=W,Y=mm(K(L,X.shape),X,i);let j,q;if(!n&&!r?(j=ze(Y,H,!1,!0),q=ze(G,Y,!0,!1)):!n&&r?(j=ze(Y,H,!1,!1),q=ze(Y,G,!0,!1)):n&&!r?(j=ze(H,Y,!1,!0),q=ze(G,Y,!1,!1)):(j=ze(H,Y,!0,!0),q=ze(Y,G,!0,!0)),s!=null){const Z=gm(Q,Y);return[j,q,Z]}else return[j,q]},O={a:_,b:T,bias:E,preluActivationWeights:k},R={transposeA:n,transposeB:r,activation:i,leakyreluAlpha:a};return s==null?xi((W,G,H)=>{const X=V.runKernel(T0,O,R);return H([W,G,X]),{value:K(X,w),gradFunc:N}})(_,T):xi((W,G,H,X)=>{const Q=V.runKernel(T0,O,R);return X([W,G,Q,H]),{value:K(Q,w),gradFunc:N}})(_,T,E)}const ZY=M({fusedMatMul_:QY});/**
3828 * @license
3829 * Copyright 2019 Google LLC. All Rights Reserved.
3830 * Licensed under the Apache License, Version 2.0 (the "License");
3831 * you may not use this file except in compliance with the License.
3832 * You may obtain a copy of the License at
3833 *
3834 * http://www.apache.org/licenses/LICENSE-2.0
3835 *
3836 * Unless required by applicable law or agreed to in writing, software
3837 * distributed under the License is distributed on an "AS IS" BASIS,
3838 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3839 * See the License for the specific language governing permissions and
3840 * limitations under the License.
3841 * =============================================================================
3842 */const JY=Object.freeze(Object.defineProperty({__proto__:null,conv2d:jY,depthwiseConv2d:YY,matMul:ZY},Symbol.toStringTag,{value:"Module"}));/**
3843 * @license
3844 * Copyright 2019 Google LLC. All Rights Reserved.
3845 * Licensed under the Apache License, Version 2.0 (the "License");
3846 * you may not use this file except in compliance with the License.
3847 * You may obtain a copy of the License at
3848 *
3849 * http://www.apache.org/licenses/LICENSE-2.0
3850 *
3851 * Unless required by applicable law or agreed to in writing, software
3852 * distributed under the License is distributed on an "AS IS" BASIS,
3853 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3854 * See the License for the specific language governing permissions and
3855 * limitations under the License.
3856 * =============================================================================
3857 */function eQ(t){return Q1(t,.54,.46)}const tQ=M({hammingWindow_:eQ});/**
3858 * @license
3859 * Copyright 2019 Google LLC. All Rights Reserved.
3860 * Licensed under the Apache License, Version 2.0 (the "License");
3861 * you may not use this file except in compliance with the License.
3862 * You may obtain a copy of the License at
3863 *
3864 * http://www.apache.org/licenses/LICENSE-2.0
3865 *
3866 * Unless required by applicable law or agreed to in writing, softw
3866are
3867 * distributed under the License is distributed on an "AS IS" BASIS,
3868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3869 * See the License for the specific language governing permissions and
3870 * limitations under the License.
3871 * =============================================================================
3872 */function nQ(t){return Q1(t,.5,.5)}const jO=M({hannWindow_:nQ});/**
3873 * @license
3874 * Copyright 2019 Google LLC. All Rights Reserved.
3875 * Licensed under the Apache License, Version 2.0 (the "License");
3876 * you may not use this file except in compliance with the License.
3877 * You may obtain a copy of the License at
3878 *
3879 * http://www.apache.org/licenses/LICENSE-2.0
3880 *
3881 * Unless required by applicable law or agreed to in writing, software
3882 * distributed under the License is distributed on an "AS IS" BASIS,
3883 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3884 * See the License for the specific language governing permissions and
3885 * limitations under the License.
3886 * =============================================================================
3887 */function rQ(t,e,n,r=!1,s=0){let i=0;const o=[];for(;i+e<=t.size;)o.push(Ne(t,i,e)),i+=n;if(r)for(;i<t.size;){const a=i+e-t.size,u=Jt([Ne(t,i,e-a),_h([a],s)]);o.push(u),i+=n}return o.length===0?sa([],[0,e]):K(Jt(o),[o.length,e])}const GO=M({frame_:rQ});/**
3888 * @license
3889 * Copyright 2019 Google LLC. All Rights Reserved.
3890 * Licensed under the Apache License, Version 2.0 (the "License");
3891 * you may not use this file except in compliance with the License.
3892 * You may obtain a copy of the License at
3893 *
3894 * http://www.apache.org/licenses/LICENSE-2.0
3895 *
3896 * Unless required by applicable law or agreed to in writing, software
3897 * distributed under the License is distributed on an "AS IS" BASIS,
3898 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3899 * See the License for the specific language governing permissions and
3900 * limitations under the License.
3901 * =============================================================================
3902 */function sQ(t,e,n,r,s=jO){r==null&&(r=zO(e));const i=GO(t,e,n),o=re(i,s(e));return X1(o,r)}const iQ=M({stft_:sQ});/**
3903 * @license
3904 * Copyright 2020 Google LLC. All Rights Reserved.
3905 * Licensed under the Apache License, Version 2.0 (the "License");
3906 * you may not use this file except in compliance with the License.
3907 * You may obtain a copy of the License at
3908 *
3909 * http://www.apache.org/licenses/LICENSE-2.0
3910 *
3911 * Unless required by applicable law or agreed to in writing, software
3912 * distributed under the License is distributed on an "AS IS" BASIS,
3913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3914 * See the License for the specific language governing permissions and
3915 * limitations under the License.
3916 * =============================================================================
3917 */function oQ(t,e,n,r,s="bilinear",i=0){const o=I(t,"image","cropAndResize"),a=I(e,"boxes","cropAndResize","float32"),u=I(n,"boxInd","cropAndResize","int32"),l=a.shape[0];A(o.rank===4,()=>`Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`),A(a.rank===2&&a.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${l},4] but had shape ${a.shape}.`),A(u.rank===1&&u.shape[0]===l,()=>`Error in cropAndResize: boxInd must be have size [${l}] but had shape ${a.shape}.`),A(r.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`),A(r[0]>=1&&r[1]>=1,()=>`cropSize must be atleast [1,1], but was ${r}`),A(s==="bilinear"||s==="nearest",()=>`method must be bilinear or nearest, but was ${s}`);const c={image:o,boxes:a,boxInd:u},h={method:s,extrapolationValue:i,cropSize:r};return V.runKernel(gI,c,h)}const aQ=M({cropAndResize_:oQ});/**
3918 * @license
3919 * Copyright 2020 Google LLC. All Rights Reserved.
3920 * Licensed under the Apache License, Version 2.0 (the "License");
3921 * you may not use this file except in compliance with the License.
3922 * You may obtain a copy of the License at
3923 *
3924 * http://www.apache.org/licenses/LICENSE-2.0
3925 *
3926 * Unless required by applicable law or agreed to in writing, softw
3926are
3927 * distributed under the License is distributed on an "AS IS" BASIS,
3928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3929 * See the License for the specific language governing permissions and
3930 * limitations under the License.
3931 * =============================================================================
3932 */function uQ(t){const e=I(t,"image","flipLeftRight","float32");A(e.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${e.rank}.`);const n={image:e};return V.runKernel(DI,n,{})}const lQ=M({flipLeftRight_:uQ});/**
3933 * @license
3934 * Copyright 2021 Google LLC. All Rights Reserved.
3935 * Licensed under the Apache License, Version 2.0 (the "License");
3936 * you may not use this file except in compliance with the License.
3937 * You may obtain a copy of the License at
3938 *
3939 * http://www.apache.org/licenses/LICENSE-2.0
3940 *
3941 * Unless required by applicable law or agreed to in writing, software
3942 * distributed under the License is distributed on an "AS IS" BASIS,
3943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3944 * See the License for the specific language governing permissions and
3945 * limitations under the License.
3946 * =============================================================================
3947 */function cQ(t){const e=I(t,"image","grayscaleToRGB"),n=e.rank-1,r=e.shape[n];A(e.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${e.rank}.`),A(r===1,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${r}.`);const s=new Array(e.rank);return s.fill(1,0,n),s[n]=3,gc(e,s)}const hQ=M({grayscaleToRGB_:cQ});/**
3948 * @license
3949 * Copyright 2023 Google LLC.
3950 * Licensed under the Apache License, Version 2.0 (the "License");
3951 * you may not use this file except in compliance with the License.
3952 * You may obtain a copy of the License at
3953 *
3954 * http://www.apache.org/licenses/LICENSE-2.0
3955 *
3956 * Unless required by applicable law or agreed to in writing, software
3957 * distributed under the License is distributed on an "AS IS" BASIS,
3958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3959 * See the License for the specific language governing permissions and
3960 * limitations under the License.
3961 * =============================================================================
3962 */function dQ(t){const e=I(t,"image","RGBToGrayscale"),n=e.rank-1,r=e.shape[n];A(e.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${e.rank}.`),A(r===3,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${r}.`);const s=e.dtype,i=vt(e,"float32"),o=un([.2989,.587,.114]);let a;switch(e.rank){case 2:a=Za("ij,j->i",i,o);break;case 3:a=Za("ijk,k->ij",i,o);break;case 4:a=Za("ijkl,l->ijk",i,o);break;case 5:a=Za("ijklm,m->ijkl",i,o);break;case 6:a=Za("ijklmn,n->ijklm",i,o);break;default:throw new Error("Not a valid tensor rank.")}return a=ks(a,-1),vt(a,s)}const fQ=M({rgbToGrayscale_:dQ});/**
3963 * @license
3964 * Copyright 2020 Google LLC. All Rights Reserved.
3965 * Licensed under the Apache License, Version 2.0 (the "License");
3966 * you may not use this file except in compliance with the License.
3967 * You may obtain a copy of the License at
3968 *
3969 * http://www.apache.org/licenses/LICENSE-2.0
3970 *
3971 * Unless required by applicable law or agreed to in writing, software
3972 * distributed under the License is distributed on an "AS IS" BASIS,
3973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3974 * See the License for the specific language governing permissions and
3975 * limitations under the License.
3976 * =============================================================================
3977 */function pQ(t,e,n=0,r=.5){const s=I(t,"image","rotateWithOffset","float32");A(s.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${s.rank}.`);const i={image:s},o={radians:e,fillValue:n,center:r};return V.runKernel(TR,i,o)}const mQ=M({rotateWithOffset_:pQ});/**
3978 * @license
3979 * Copyright 2020 Google LLC. All Rights Reserved.
3980 * Licensed under the Apache License, Version 2.0 (the "License");
3981 * you may not use this file except in compliance with the License.
3982 * You may obtain a copy of the License at
3983 *
3984 * http://www.apache.org/licenses/LICENSE-2.0
3985 *
3986 * Unless required by applicable law or agreed to in writing, software
3987 * distributed under the License is distributed on an "AS IS" BASIS,
3988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3989 * See the License for the specific language governing permissions and
3990 * limitations under the License.
3991 * =============================================================================
3992 */function yl(t,e,n,r,s,i){r==null&&(r=.5),s==null&&(s=Number.NEGATIVE_INFINITY),i==null&&(i=0);const o=t.shape[0];return n=Math.min(n,o),A(0<=r&&r<=1,()=>`iouThreshold must be in [0, 1], but was '${r}'`),A(t.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${t.rank}'`),A(t.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${t.shape[1]}`),A(e.rank===1,()=>"scores must be a 1D tensor"),A(e.shape[0]===o,()=>`scores has incompatible shape with boxes. Expected ${o}, but was ${e.shape[0]}`),A(0<=i&&i<=1,()=>`softNmsSigma must be in [0, 1], but was '${i}'`),{maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:i}}/**
3993 * @license
3994 * Copyright 2020 Google LLC. All Rights Reserved.
3995 * Licensed under the Apache License, Version 2.0 (the "License");
3996 * you may not use this file except in compliance with the License.
3997 * You may obtain a copy of the License at
3998 *
3999 * http://www.apache.org/licenses/LICENSE-2.0
4000 *
4001 * Unless required by applicable law or agreed to in writing, software
4002 * distributed under the License is distributed on an "AS IS" BASIS,
4003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4004 * See the License for the specific language governing permissions and
4005 * limitations under the License.
4006 * =============================================================================
4007 */function gQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY){const i=I(t,"boxes","nonMaxSuppression","float32"),o=I(e,"scores","nonMaxSuppression","float32"),a=yl(i,o,n,r,s);n=a.maxOutputSize,r=a.iouThreshold,s=a.scoreThreshold;const u={maxOutputSize:n,iouThreshold:r,scoreThreshold:s};return V.runKernel(yA,{boxes:i,scores:o},u)}const yQ=M({nonMaxSuppression_:gQ});/**
4008 * @license
4009 * Copyright 2019 Google LLC. All Rights Reserved.
4010 * Licensed under the Apache License, Version 2.0 (the "License");
4011 * you may not use this file except in compliance with the License.
4012 * You may obtain a copy of the License at
4013 *
4014 * http://www.apache.org/licenses/LICENSE-2.0
4015 *
4016 * Unless required by applicable law or agreed to in writing, software
4017 * distributed under the License is distributed on an "AS IS" BASIS,
4018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4019 * See the License for the specific language governing permissions and
4020 * limitations under the License.
4021 * =============================================================================
4022 */function vQ(t,e,n){const r=xQ(t,e,n),s=r<0?-(r+1):r;t.splice(s,0,e)}function xQ(t,e,n){return bQ(t,e,n||wQ)}function wQ(t,e){return t>e?1:t<e?-1:0}function bQ(t,e,n){let r=0,s=t.length,i=0,o=!1;for(;r<s;){i=r+(s-r>>>1);const a=n(e,t[i]);a>0?r=i+1:(s=i,o=!a)}return o?r:-r-1}/**
4023 * @license
4024 * Copyright 2020 Google LLC. All Rights Reserved.
4025 * Licensed under the Apache License, Version 2.0 (the "License");
4026 * you may not use this file except in compliance with the License.
4027 * You may obtain a copy of the License at
4028 *
4029 * http://www.apache.org/licenses/LICENSE-2.0
4030 *
4031 * Unless required by applicable law or agreed to in writing, software
4032 * distributed under the License is distributed on an "AS IS" BASIS,
4033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4034 * See the License for the specific language governing permissions and
4035 * limitations under the License.
4036 * =============================================================================
4037 */function HO(t,e,n,r,s){return Z1(t,e,n,r,s,0)}function qO(t,e,n,r,s,i){return Z1(t,e,n,r,s,0,!1,i,!0)}function KO(t,e,n,r,s,i){return Z1(t,e,n,r,s,i,!0)}function Z1(t,e,n,r,s,i,o=!1,a=!1,u=!1){const l=[];for(let v=0;v<e.length;v++)e[v]>s&&l.push({score:e[v],boxIndex:v,suppressBeginIndex:0});l.sort(bT);const c=i>0?-.5/i:0,h=[],d=[];for(;h.length<n&&l.length>0;){const v=l.pop(),{score:g,boxIndex:x,suppressBeginIndex:w}=v;if(g<s)break;let _=!1;for(let T=h.length-1;T>=w;--T){const E=_Q(t,x,h[T]);if(E>=r){_=!0;break}if(v.score=v.score*SQ(r,c,E),v.score<=s)break}v.suppressBeginIndex=h.length,_||(v.score===g?(h.push(x),d.push(v.score)):v.score>s&&vQ(l,v,bT))}const f=h.length,p=n-f;a&&p>0&&(h.push(...new Array(p).fill(0)),d.push(...new Array(p).fill(0)));const y={selectedIndices:h};return o&&(y.selectedScores=d),u&&(y.validOutputs=f),y}function _Q(t,e,n){const r=t.subarray(e*4,e*4+4),s=t.subarray(n*4,n*4+4),i=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),a=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),l=Math.min(s[0],s[2]),c=Math.min(s[1],s[3]),h=Math.max(s[0],s[2]),d=Math.max(s[1],s[3]),f=(a-i)*(u-o),p=(h-l)*(d-c);if(f<=0||p<=0)return 0;const y=Math.max(i,l),v=Math.max(o,c),g=Math.min(a,h),x=Math.min(u,d),w=Math.max(g-y,0)*Math.max(x-v,0);return w/(f+p-w)}function SQ(t,e,n){const r=Math.exp(e*n*n);return n<=t?r:0}function bT(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}/**
4038 * @license
4039 * Copyright 2020 Google LLC. All Rights Reserved.
4040 * Licensed under the Apache License, Version 2.0 (the "License");
4041 * you may not use this file except in compliance with the License.
4042 * You may obtain a copy of the License at
4043 *
4044 * http://www.apache.org/licenses/LICENSE-2.0
4045 *
4046 * Unless required by applicable law or agreed to in writing, software
4047 * distributed under the License is distributed on an "AS IS" BASIS,
4048 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4049 * See the License for the specific language governing permissions and
4050 * limitations under the License.
4051 * =============================================================================
4052 */async function TQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY){const i=I(t,"boxes","nonMaxSuppressionAsync"),o=I(e,"scores","nonMaxSuppressionAsync"),a=yl(i,o,n,r,s);n=a.maxOutputSize,r=a.iouThreshold,s=a.scoreThreshold;const u=await Promise.all([i.data(),o.data()]),l=u[0],c=u[1],{selectedIndices:h}=HO(l,c,n,r,s);return i!==t&&i.dispose(),o!==e&&o.dispose(),un(h,"int32")}const CQ=TQ;/**
4053 * @license
4054 * Copyright 2020 Google LLC. All Rights Reserved.
4055 * Licensed under the Apache License, Version 2.0 (the "License");
4056 * you may not use this file except in compliance with the License.
4057 * You may obtain a copy of the License at
4058 *
4059 * http://www.apache.org/licenses/LICENSE-2.0
4060 *
4061 * Unless required by applicable law or agreed to in writing, software
4062 * distributed under the License is distributed on an "AS IS" BASIS,
4063 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4064 * See the License for the specific language governing permissions and
4065 * limitations under the License.
4066 * =============================================================================
4067 */function NQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,i=0){const o=I(t,"boxes","nonMaxSuppression"),a=I(e,"scores","nonMaxSuppression"),u=yl(o,a,n,r,s,i);n=u.maxOutputSize,r=u.iouThreshold,s=u.scoreThreshold,i=u.softNmsSigma;const l={boxes:o,scores:a},c={maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:i},h=V.runKernel(xA,l,c);return{selectedIndices:h[0],selectedScores:h[1]}}const EQ=M({nonMaxSuppressionWithScore_:NQ});/**
4068 * @license
4069 * Copyright 2020 Google LLC. All Rights Reserved.
4070 * Licensed under the Apache License, Version 2.0 (the "License");
4071 * you may not use this file except in compliance with the License.
4072 * You may obtain a copy of the License at
4073 *
4074 * http://www.apache.org/licenses/LICENSE-2.0
4075 *
4076 * Unless required by applicable law or agreed to in writing, software
4077 * distributed under the License is distributed on an "AS IS" BASIS,
4078 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4079 * See the License for the specific language governing permissions and
4080 * limitations under the License.
4081 * =============================================================================
4082 */async function kQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,i=0){const o=I(t,"boxes","nonMaxSuppressionAsync"),a=I(e,"scores","nonMaxSuppressionAsync"),u=yl(o,a,n,r,s,i);n=u.maxOutputSize,r=u.iouThreshold,s=u.scoreThreshold,i=u.softNmsSigma;const l=await Promise.all([o.data(),a.data()]),c=l[0],h=l[1],{selectedIndices:d,selectedScores:f}=KO(c,h,n,r,s,i);return o!==t&&o.dispose(),a!==e&&a.dispose(),{selectedIndices:un(d,"int32"),selectedScores:un(f)}}const $Q=kQ;/**
4083 * @license
4084 * Copyright 2020 Google LLC. All Rights Reserved.
4085 * Licensed under the Apache License, Version 2.0 (the "License");
4086 * you may not use this file except in compliance with the License.
4087 * You may obtain a copy of the License at
4088 *
4089 * http://www.apache.org/licenses/LICENSE-2.0
4090 *
4091 * Unless required by applicable law or agreed to in writing, software
4092 * distributed under the License is distributed on an "AS IS" BASIS,
4093 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4094 * See the License for the specific language governing permissions and
4095 * limitations under the License.
4096 * =============================================================================
4097 */function IQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,i=!1){const o=I(t,"boxes","nonMaxSuppression"),a=I(e,"scores","nonMaxSuppression"),u=yl(o,a,n,r,s,null),l=u.maxOutputSize,c=u.iouThreshold,h=u.scoreThreshold,d={boxes:o,scores:a},f={maxOutputSize:l,iouThreshold:c,scoreThreshold:h,padToMaxOutputSize:i},p=V.runKernel(vA,d,f);return{selectedIndices:p[0],validOutputs:p[1]}}const AQ=M({nonMaxSuppressionPadded_:IQ});/**
4098 * @license
4099 * Copyright 2020 Google LLC. All Rights Reserved.
4100 * Licensed under the Apache License, Version 2.0 (the "License");
4101 * you may not use this file except in compliance with the License.
4102 * You may obtain a copy of the License at
4103 *
4104 * http://www.apache.org/licenses/LICENSE-2.0
4105 *
4106 * Unless required by applicable law or agreed to in writing, software
4107 * distributed under the License is distributed on an "AS IS" BASIS,
4108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4109 * See the License for the specific language governing permissions and
4110 * limitations under the License.
4111 * =============================================================================
4112 */async function RQ(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,i=!1){const o=I(t,"boxes","nonMaxSuppressionAsync"),a=I(e,"scores","nonMaxSuppressionAsync"),u=yl(o,a,n,r,s,null),l=u.maxOutputSize,c=u.iouThreshold,h=u.scoreThreshold,[d,f]=await Promise.all([o.data(),a.data()]),{selectedIndices:p,validOutputs:y}=qO(d,f,l,c,h,i);return o!==t&&o.dispose(),a!==e&&a.dispose(),{selectedIndices:un(p,"int32"),validOutputs:De(y,"int32")}}const OQ=RQ;/**
4113 * @license
4114 * Copyright 2020 Google LLC. All Rights Reserved.
4115 * Licensed under the Apache License, Version 2.0 (the "License");
4116 * you may not use this file except in compliance with the License.
4117 * You may obtain a copy of the License at
4118 *
4119 * http://www.apache.org/licenses/LICENSE-2.0
4120 *
4121 * Unless required by applicable law or agreed to in writing, software
4122 * distributed under the License is distributed on an "AS IS" BASIS,
4123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4124 * See the License for the specific language governing permissions and
4125 * limitations under the License.
4126 * =============================================================================
4127 */function DQ(t,e,n=!1,r=!1){const s=I(t,"images","resizeBilinear");A(s.rank===3||s.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${s.rank}.`),A(e.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${e}.`),A(r===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let i=s,o=!1;s.rank===3&&(o=!0,i=K(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const a={images:i},u={alignCorners:n,halfPixelCenters:r,size:e},l=V.runKernel(FA,a,u);return o?K(l,[l.shape[1],l.shape[2],l.shape[3]]):l}const PQ=M({resizeBilinear_:DQ});/**
4128 * @license
4129 * Copyright 2020 Google LLC. All Rights Reserved.
4130 * Licensed under the Apache License, Version 2.0 (the "License");
4131 * you may not use this file except in compliance with the License.
4132 * You may obtain a copy of the License at
4133 *
4134 * http://www.apache.org/licenses/LICENSE-2.0
4135 *
4136 * Unless required by applicable law or agreed to in writing, software
4137 * distributed under the License is distributed on an "AS IS" BASIS,
4138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4139 * See the License for the specific language governing permissions and
4140 * limitations under the License.
4141 * =============================================================================
4142 */function FQ(t,e,n=!1,r=!1){const s=I(t,"images","resizeNearestNeighbor");A(s.rank===3||s.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${s.rank}.`),A(e.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${e}.`),A(s.dtype==="float32"||s.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),A(r===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let i=s,o=!1;s.rank===3&&(o=!0,i=K(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const a={images:i},u={alignCorners:n,halfPixelCenters:r,size:e},l=V.runKernel(PA,a,u);return o?K(l,[l.shape[1],l.shape[2],l.shape[3]]):l}const LQ=M({resizeNearestNeighbor_:FQ});/**
4143 * @license
4144 * Copyright 2021 Google LLC. All Rights Reserved.
4145 * Licensed under the Apache License, Version 2.0 (the "License");
4146 * you may not use this file except in compliance with the License.
4147 * You may obtain a copy of the License at
4148 *
4149 * https://www.apache.org/licenses/LICENSE-2.0
4150 *
4151 * Unless required by applicable law or agreed to in writing, softw
4151are
4152 * distributed under the License is distributed on an "AS IS" BASIS,
4153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4154 * See the License for the specific language governing permissions and
4155 * limitations under the License.
4156 * =============================================================================
4157 */function MQ(t,e="binary",n=!1,r=.5){const s=I(t,"image","threshold"),i=.2989,o=.587,a=.114,u=s.shape[0]*s.shape[1];let l=re(un([r]),255),c,h,d,f;if(A(s.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${s.rank}.`),A(s.shape[2]===3||s.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${s.shape[2]}.`),A(s.dtype==="int32"||s.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${s.dtype}.`),A(e==="otsu"||e==="binary",()=>`Method must be binary or otsu, but was ${e}`),s.shape[2]===3){[c,h,d]=qc(s,[1,1,1],-1);const v=re(c,i),g=re(h,o),x=re(d,a);f=ge(ge(v,g),x)}else f=t;if(e==="otsu"){const v=lO(vt(PO(f),"int32"),Vs([]),256);l=VQ(v,u)}const p=n?L1(f,l):hm(f,l);return vt(re(p,255),"int32")}function VQ(t,e){let n=un([-1]),r=un([0]),s=un([0]),i,o,a,u,l,c;for(let h=0;h<t.size-1;h++){i=Ne(t,0,h+1),o=Ne(t,h+1),l=Ae(et(i),e),c=Ae(et(o),e);const d=et(re(i,Gc(0,i.size)));a=Ae(d,et(i));const f=_h(o.shape,i.size),p=ge(Gc(0,o.size),f),y=re(o,p);u=Ae(et(y),et(o));const v=Ee(a,u),g=Ee(a,u),x=re(l,c);s=re(re(x,v),g);const w=hm(s,r);r=ro(w,s,r),n=ro(w,un([h]),n)}return n}const BQ=M({threshold_:MQ});/**
4158 * @license
4159 * Copyright 2021 Google LLC. All Rights Reserved.
4160 * Licensed under the Apache License, Version 2.0 (the "License");
4161 * you may not use this file except in compliance with the License.
4162 * You may obtain a copy of the License at
4163 *
4164 * http://www.apache.org/licenses/LICENSE-2.0
4165 *
4166 * Unless required by applicable law or agreed to in writing, software
4167 * distributed under the License is distributed on an "AS IS" BASIS,
4168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4169 * See the License for the specific language governing permissions and
4170 * limitations under the License.
4171 * =============================================================================
4172 */function WQ(t,e,n="nearest",r="constant",s=0,i){const o=I(t,"image","transform","float32"),a=I(e,"transforms","transform","float32");A(o.rank===4,()=>`Error in transform: image must be rank 4,but got rank ${o.rank}.`),A(a.rank===2&&(a.shape[0]===o.shape[0]||a.shape[0]===1)&&a.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),A(i==null||i.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${i}.`);const u={image:o,transforms:a},l={interpolation:n,fillMode:r,fillValue:s,outputShape:i};return V.runKernel(vR,u,l)}const UQ=M({transform_:WQ});/**
4173 * @license
4174 * Copyright 2020 Google LLC. All Rights Reserved.
4175 * Licensed under the Apache License, Version 2.0 (the "License");
4176 * you may not use this file except in compliance with the License.
4177 * You may obtain a copy of the License at
4178 *
4179 * http://www.apache.org/licenses/LICENSE-2.0
4180 *
4181 * Unless required by applicable law or agreed to in writing, software
4182 * distributed under the License is distributed on an "AS IS" BASIS,
4183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4184 * See the License for the specific language governing permissions and
4185 * limitations under the License.
4186 * =============================================================================
4187 */function zQ(t,e,n){const r=I(t,"a","bandPart");A(r.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${r.rank}.`);const s=r.shape,[i,o]=r.shape.slice(-2);let a,u;typeof e=="number"?(A(e%1===0,()=>`bandPart(): numLower must be an integer, got ${e}.`),A(e<=i,()=>`bandPart(): numLower (${e}) must not be greater than the number of rows (${i}).`),a=I(e<0?i:e,"numLower","bandPart")):(A(e.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),a=ro(W0(e,0),i,Qf(e,i))),typeof n=="number"?(A(n%1===0,()=>`bandPart(): numUpper must be an integer, got ${n}.`),A(n<=o,()=>`bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`),u=I(n<0?o:n,"numUpper","bandPart")):(A(n.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),u=ro(W0(n,0),o,Qf(n,o)));const l=K(Gc(0,i,1,"int32"),[-1,1]),c=Gc(0,o,1,"int32"),h=Ee(l,c),d=Xf(L1(h,a),wO(h,Bs(u))),f=ba([i,o],r.dtype);return K(wi(Fa(K(r,[-1,i,o])).map(p=>ro(d,p,f))),s)}const jQ=M({bandPart_:zQ});/**
4188 * @license
4189 * Copyright 2020 Google LLC. All Rights Reserved.
4190 * Licensed under the Apache License, Version 2.0 (the "License");
4191 * you may not use this file except in compliance with the License.
4192 * You may obtain a copy of the License at
4193 *
4194 * http://www.apache.org/licenses/LICENSE-2.0
4195 *
4196 * Unless required by applicable law or agreed to in writing, software
4197 * distributed under the License is distributed on an "AS IS" BASIS,
4198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4199 * See the License for the specific language governing permissions and
4200 * limitations under the License.
4201 * =============================================================================
4202 */function GQ(t){let e;if(Array.isArray(t)){e=!1,A(t!=null&&t.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");const s=t[0].shape[0];for(let i=1;i<t.length;++i)A(t[i].shape[0]===s,()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${t[i].shape[0]} vs. ${s})`)}else e=!0,t=qc(t,t.shape[0],0).map(s=>Ht(s,[0]));A(t.length<=t[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${t.length}) exceeds number of dimensions (${t[0].shape[0]}).`);const n=[],r=t;for(let s=0;s<t.length;++s)n.push(V.tidy(()=>{let i=r[s];if(s>0)for(let o=0;o<s;++o){const a=re(et(re(n[o],i)),n[o]);i=Ee(i,a)}return Ae(i,cm(i,"euclidean"))}));return e?wi(n,0):n}const HQ=M({gramSchmidt_:GQ});/**
4203 * @license
4204 * Copyright 2020 Google LLC. All Rights Reserved.
4205 * Licensed under the Apache License, Version 2.0 (the "License");
4206 * you may not use this file except in compliance with the License.
4207 * You may obtain a copy of the License at
4208 *
4209 * http://www.apache.org/licenses/LICENSE-2.0
4210 *
4211 * Unless required by applicable law or agreed to in writing, software
4212 * distributed under the License is distributed on an "AS IS" BASIS,
4213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4214 * See the License for the specific language governing permissions and
4215 * limitations under the License.
4216 * =============================================================================
4217 */function qQ(t,e=!1){if(A(t.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${t.rank}`),t.rank===2)return _T(t,e);{const n=t.shape.slice(0,t.shape.length-2).reduce((u,l)=>u*l),r=Fa(K(t,[n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0),s=[],i=[];r.forEach(u=>{const[l,c]=_T(u,e);s.push(l),i.push(c)});const o=K(wi(s,0),t.shape),a=K(wi(i,0),t.shape);return[o,a]}}function _T(t,e=!1){return V.tidy(()=>{A(t.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${t.shape.length}D Tensor.`);const n=t.shape[0],r=t.shape[1];let s=yO(n),i=no(t);const o=sa([[1]],[1,1]);let a=no(o);const u=n>=r?r:n;for(let l=0;l<u;++l){const c=i,h=a,d=s;[a,i,s]=V.tidy(()=>{const f=Ne(i,[l,l],[n-l,1]),p=cm(f),y=Ne(i,[l,l],[1,1]),v=ro(hm(y,0),sa([[-1]]),sa([[1]])),g=Ee(y,re(v,p)),x=Ae(f,g);x.shape[0]===1?a=no(o):a=Jt([o,Ne(x,[1,0],[x.shape[0]-1,x.shape[1]])],0);const w=Bs(Ae(ze(v,g),p)),_=Ne(i,[l,0],[n-l,r]),T=re(w,a),E=U0(a);if(l===0)i=Ee(_,ze(T,ze(E,_)));else{const O=Ee(_,ze(T,ze(E,_)));i=Jt([Ne(i,[0,0],[l,r]),O],0)}const k=U0(T),N=Ne(s,[0,l],[n,s.shape[1]-l]);if(l===0)s=Ee(N,ze(ze(N,a),k));else{const O=Ee(N,ze(ze(N,a),k));s=Jt([Ne(s,[0,0],[n,l]),O],1)}return[a,i,s]}),mt([c,h,d])}return!e&&n>r&&(s=Ne(s,[0,0],[n,r]),i=Ne(i,[0,0],[r,r])),[s,i]})}const KQ=M({qr_:qQ});/**
4218 * @license
4219 * Copyright 2020 Google LLC. All Rights Reserved.
4220 * Licensed under the Apache License, Version 2.0 (the "License");
4221 * you may not use this file except in compliance with the License.
4222 * You may obtain a copy of the License at
4223 *
4224 * http://www.apache.org/licenses/LICENSE-2.0
4225 *
4226 * Unless required by applicable law or agreed to in writing, software
4227 * distributed under the License is distributed on an "AS IS" BASIS,
4228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4229 * See the License for the specific language governing permissions and
4230 * limitations under the License.
4231 * =============================================================================
4232 */var In;(function(t){t[t.NONE=0]="NONE",t[t.MEAN=1]="MEAN",t[t.SUM=2]="SUM",t[t.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(In||(In={}));function XQ(t,e,n=In.SUM_BY_NONZERO_WEIGHTS){const r=I(t,"losses","computeWeightedLoss");let s=null;e!=null&&(s=I(e,"weights","computeWeightedLoss"));const i=s==null?r:re(r,s);if(n===In.NONE)return i;if(n===In.SUM)return et(i);if(n===In.MEAN){if(s==null)return Yf(i);{const o=r.size/s.size,a=Ae(et(i),et(s));return o>1?Ae(a,De(o)):a}}if(n===In.SUM_BY_NONZERO_WEIGHTS){if(s==null)return Ae(et(i),De(r.size));{const o=re(s,Xo(r.shape)),a=vt(et($O(o,De(0))),"float32");return Ae(et(i),a)}}throw Error(`Unknown reduction: ${n}`)}const Ci=M({computeWeightedLoss_:XQ});/**
4233 * @license
4234 * Copyright 2020 Google LLC. All Rights Reserved.
4235 * Licensed under the Apache License, Version 2.0 (the "License");
4236 * you may not use this file except in compliance with the License.
4237 * You may obtain a copy of the License at
4238 *
4239 * http://www.apache.org/licenses/LICENSE-2.0
4240 *
4241 * Unless required by applicable law or agreed to in writing, software
4242 * distributed under the License is distributed on an "AS IS" BASIS,
4243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4244 * See the License for the specific language governing permissions and
4245 * limitations under the License.
4246 * =============================================================================
4247 */function YQ(t,e,n,r=In.SUM_BY_NONZERO_WEIGHTS){const s=I(t,"labels","absoluteDifference"),i=I(e,"predictions","absoluteDifference");let o=null;n!=null&&(o=I(n,"weights","absoluteDifference")),mr(s.shape,i.shape,"Error in absoluteDifference: ");const a=rr(Ee(s,i));return Ci(a,o,r)}const QQ=M({absoluteDifference_:YQ});function ZQ(t,e,n,r,s=In.SUM_BY_NONZERO_WEIGHTS){const i=I(t,"labels","cosineDistance"),o=I(e,"predictions","cosineDistance");let a=null;r!=null&&(a=I(r,"weights","cosineDistance")),mr(i.shape,o.shape,"Error in cosineDistance: ");const u=De(1),l=Ee(u,et(re(i,o),n,!0));return Ci(l,a,s)}const JQ=M({cosineDistance_:ZQ});function eZ(t,e,n,r=In.SUM_BY_NONZERO_WEIGHTS){let s=I(t,"labels","hingeLoss");const i=I(e,"predictions","hingeLoss");let o=null;n!=null&&(o=I(n,"weights","hingeLoss")),mr(s.shape,i.shape,"Error in hingeLoss: ");const a=De(1);s=Ee(re(De(2),s),a);const u=fm(Ee(a,re(s,i)));return Ci(u,o,r)}const tZ=M({hingeLoss_:eZ});/**
4248 * @license
4249 * Copyright 2020 Google LLC. All Rights Reserved.
4250 * Licensed under the Apache License, Version 2.0 (the "License");
4251 * you may not use this file except in compliance with the License.
4252 * You may obtain a copy of the License at
4253 *
4254 * http://www.apache.org/licenses/LICENSE-2.0
4255 *
4256 * Unless required by applicable law or agreed to in writing, software
4257 * distributed under the License is distributed on an "AS IS" BASIS,
4258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4259 * See the License for the specific language governing permissions and
4260 * limitations under the License.
4261 * =============================================================================
4262 */function nZ(t,e,n,r=1,s=In.SUM_BY_NONZERO_WEIGHTS){const i=I(t,"labels","huberLoss"),o=I(e,"predictions","huberLoss");let a=null;n!=null&&(a=I(n,"weights","huberLoss")),mr(i.shape,o.shape,"Error in huberLoss: ");const u=De(r),l=rr(Ee(o,i)),c=Qf(l,u),h=Ee(l,c),d=ge(re(De(.5),us(c)),re(u,h));return Ci(d,a,s)}const rZ=M({huberLoss_:nZ});/**
4263 * @license
4264 * Copyright 2020 Google LLC. All Rights Reserved.
4265 * Licensed under the Apache License, Version 2.0 (the "License");
4266 * you may not use this file except in compliance with the License.
4267 * You may obtain a copy of the License at
4268 *
4269 * http://www.apache.org/licenses/LICENSE-2.0
4270 *
4271 * Unless required by applicable law or agreed to in writing, software
4272 * distributed under the License is distributed on an "AS IS" BASIS,
4273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4274 * See the License for the specific language governing permissions and
4275 * limitations under the License.
4276 * =============================================================================
4277 */function sZ(t,e,n,r=1e-7,s=In.SUM_BY_NONZERO_WEIGHTS){const i=I(t,"labels","logLoss"),o=I(e,"predictions","logLoss");let a=null;n!=null&&(a=I(n,"weights","logLoss")),mr(i.shape,o.shape,"Error in logLoss: ");const u=De(1),l=De(r),c=Bs(re(i,jc(ge(o,l)))),h=re(Ee(u,i),jc(ge(Ee(u,o),l))),d=Ee(c,h);return Ci(d,a,s)}const iZ=M({logLoss_:sZ});/**
4278 * @license
4279 * Copyright 2020 Google LLC. All Rights Reserved.
4280 * Licensed under the Apache License, Version 2.0 (the "License");
4281 * you may not use this file except in compliance with the License.
4282 * You may obtain a copy of the License at
4283 *
4284 * http://www.apache.org/licenses/LICENSE-2.0
4285 *
4286 * Unless required by applicable law or agreed to in writing, software
4287 * distributed under the License is distributed on an "AS IS" BASIS,
4288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4289 * See the License for the specific language governing permissions and
4290 * limitations under the License.
4291 * =============================================================================
4292 */function oZ(t,e,n,r=In.SUM_BY_NONZERO_WEIGHTS){const s=I(t,"labels","meanSquaredError"),i=I(e,"predictions","meanSquaredError");let o=null;n!=null&&(o=I(n,"weights","meanSquaredError")),mr(s.shape,i.shape,"Error in meanSquaredError: ");const a=LO(s,i);return Ci(a,o,r)}const aZ=M({meanSquaredError_:oZ});/**
4293 * @license
4294 * Copyright 2020 Google LLC. All Rights Reserved.
4295 * Licensed under the Apache License, Version 2.0 (the "License");
4296 * you may not use this file except in compliance with the License.
4297 * You may obtain a copy of the License at
4298 *
4299 * http://www.apache.org/licenses/LICENSE-2.0
4300 *
4301 * Unless required by applicable law or agreed to in writing, software
4302 * distributed under the License is distributed on an "AS IS" BASIS,
4303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4304 * See the License for the specific language governing permissions and
4305 * limitations under the License.
4306 * =============================================================================
4307 */function uZ(t,e){const n=I(t,"labels","sigmoidCrossEntropyWithLogits"),r=I(e,"logits","sigmoidCrossEntropyWithLogits");mr(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");const s=fm(r),i=re(r,n),o=_O(vi(Bs(rr(r))));return ge(Ee(s,i),o)}function lZ(t,e,n,r=0,s=In.SUM_BY_NONZERO_WEIGHTS){let i=I(t,"multiClassLabels","sigmoidCrossEntropy");const o=I(e,"logits","sigmoidCrossEntropy");let a=null;if(n!=null&&(a=I(n,"weights","sigmoidCrossEntropy")),mr(i.shape,o.shape,"Error in sigmoidCrossEntropy: "),r>0){const l=De(r),c=De(1),h=De(.5);i=ge(re(i,Ee(c,l)),re(h,l))}const u=uZ(i,o);return Ci(u,a,s)}const cZ=M({sigmoidCrossEntropy_:lZ});/**
4308 * @license
4309 * Copyright 2020 Google LLC. All Rights Reserved.
4310 * Licensed under the Apache License, Version 2.0 (the "License");
4311 * you may not use this file except in compliance with the License.
4312 * You may obtain a copy of the License at
4313 *
4314 * http://www.apache.org/licenses/LICENSE-2.0
4315 *
4316 * Unless required by applicable law or agreed to in writing, software
4317 * distributed under the License is distributed on an "AS IS" BASIS,
4318 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4319 * See the License for the specific language governing permissions and
4320 * limitations under the License.
4321 * =============================================================================
4322 */function hZ(t,e,n=-1){if(n===-1&&(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 xi((s,i,o)=>{const u=TO(i,[n],!0),l=Ee(vt(i,"float32"),u);o([s,l]);const c=Bs(re(l,s));return{value:et(c,[n]),gradFunc:(f,p)=>{const[y,v]=p,g=vr(f.shape,[n]);return[re(K(f,g),Ee(vt(y,"float32"),vi(v))),re(K(f,g),Ee(vi(v),vt(y,"float32")))]}}})(t,e)}function dZ(t,e,n,r=0,s=In.SUM_BY_NONZERO_WEIGHTS){let i=I(t,"onehotLabels","softmaxCrossEntropy");const o=I(e,"logits","softmaxCrossEntropy");let a=null;if(n!=null&&(a=I(n,"weights","softmaxCrossEntropy")),mr(i.shape,o.shape,"Error in softmaxCrossEntropy: "),r>0){const l=De(r),c=De(1),h=De(i.shape[1]);i=ge(re(i,Ee(c,l)),Ae(l,h))}const u=hZ(i,o);return Ci(u,a,s)}const fZ=M({softmaxCrossEntropy_:dZ});/**
4323 * @license
4324 * Copyright 2021 Google LLC. All Rights Reserved.
4325 * Licensed under the Apache License, Version 2.0 (the "License");
4326 * you may not use this file except in compliance with the License.
4327 * You may obtain a copy of the License at
4328 *
4329 * http://www.apache.org/licenses/LICENSE-2.0
4330 *
4331 * Unless required by applicable law or agreed to in writing, software
4332 * distributed under the License is distributed on an "AS IS" BASIS,
4333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4334 * See the License for the specific language governing permissions and
4335 * limitations under the License.
4336 * =============================================================================
4337 */function pZ(t,e,n,r){const s=I(t,"indices","sparseFillEmptyRows","int32"),i=I(e,"values","sparseFillEmptyRows"),o=I(n,"denseShape","sparseFillEmptyRows","int32"),a=I(r,"defaultValue","sparseFillEmptyRows",i.dtype);if(s.rank!==2)throw new Error(`Indices should be Tensor2D but received shape
4338        ${s.shape}`);if(i.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${i.shape}`);if(o.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${o.shape}`);if(a.rank!==0)throw new Error(`Default value should be a scalar but received shape ${a.shape}`);const u={indices:s,values:i,denseShape:o,defaultValue:a},l=V.runKernel(rR,u);return{outputIndices:l[0],outputValues:l[1],emptyRowIndicator:l[2],reverseIndexMap:l[3]}}const mZ=M({sparseFillEmptyRows_:pZ});/**
4339 * @license
4340 * Copyright 2021 Google LLC. All Rights Reserved.
4341 * Licensed under the Apache License, Version 2.0 (the "License");
4342 * you may not use this file except in compliance with the License.
4343 * You may obtain a copy of the License at
4344 *
4345 * http://www.apache.org/licenses/LICENSE-2.0
4346 *
4347 * Unless required by applicable law or agreed to in writing, software
4348 * distributed under the License is distributed on an "AS IS" BASIS,
4349 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4350 * See the License for the specific language governing permissions and
4351 * limitations under the License.
4352 * =============================================================================
4353 */function gZ(t,e,n){const r=I(t,"inputIndices","sparseReshape","int32"),s=I(e,"inputShape","sparseReshape","int32"),i=I(n,"newShape","sparseReshape","int32");if(r.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape
4354        ${r.shape}`);if(s.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${i.shape}`);const o={inputIndices:r,inputShape:s,newShape:i},a=V.runKernel(sR,o);return{outputIndices:a[0],outputShape:a[1]}}const yZ=M({sparseReshape_:gZ});/**
4355 * @license
4356 * Copyright 2021 Google LLC. All Rights Reserved.
4357 * Licensed under the Apache License, Version 2.0 (the "License");
4358 * you may not use this file except in compliance with the License.
4359 * You may obtain a copy of the License at
4360 *
4361 * http://www.apache.org/licenses/LICENSE-2.0
4362 *
4363 * Unless required by applicable law or agreed to in writing, software
4364 * distributed under the License is distributed on an "AS IS" BASIS,
4365 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4366 * See the License for the specific language governing permissions and
4367 * limitations under the License.
4368 * =============================================================================
4369 */function vZ(t,e,n){const r=I(t,"data","sparseSegmentMean"),s=I(e,"indices","sparseSegmentMean","int32"),i=I(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
4370          ${s.shape}`);if(i.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
4371          ${i.shape}`);const o={data:r,indices:s,segmentIds:i};return V.runKernel(iR,o)}const xZ=M({sparseSegmentMean_:vZ});/**
4372 * @license
4373 * Copyright 2021 Google LLC. All Rights Reserved.
4374 * Licensed under the Apache License, Version 2.0 (the "License");
4375 * you may not use this file except in compliance with the License.
4376 * You may obtain a copy of the License at
4377 *
4378 * http://www.apache.org/licenses/LICENSE-2.0
4379 *
4380 * Unless required by applicable law or agreed to in writing, software
4381 * distributed under the License is distributed on an "AS IS" BASIS,
4382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4383 * See the License for the specific language governing permissions and
4384 * limitations under the License.
4385 * =============================================================================
4386 */function wZ(t,e,n){const r=I(t,"data","sparseSegmentSum"),s=I(e,"indices","sparseSegmentSum","int32"),i=I(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
4387         ${s.shape}`);if(i.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
4388         ${i.shape}`);const o={data:r,indices:s,segmentIds:i};return V.runKernel(oR,o)}const bZ=M({sparseSegmentSum_:wZ});/**
4389 * @license
4390 * Copyright 2021 Google LLC. All Rights Reserved.
4391 * Licensed under the Apache License, Version 2.0 (the "License");
4392 * you may not use this file except in compliance with the License.
4393 * You may obtain a copy of the License at
4394 *
4395 * http://www.apache.org/licenses/LICENSE-2.0
4396 *
4397 * Unless required by applicable law or agreed to in writing, software
4398 * distributed under the License is distributed on an "AS IS" BASIS,
4399 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4400 * See the License for the specific language governing permissions and
4401 * limitations under the License.
4402 * =============================================================================
4403 */function _Z(t,e,n,r,s,i,o,a){const u=I(t,"data","stringNGrams","string");if(u.dtype!=="string")throw new Error("Data must be of datatype string");if(u.shape.length!==1)throw new Error(`Data must be a vector, saw: ${u.shape}`);const l=I(e,"dataSplits","stringNGrams");if(l.dtype!=="int32")throw new Error("Data splits must be of datatype int32");const c={separator:n,nGramWidths:r,leftPad:s,rightPad:i,padWidth:o,preserveShortSequences:a},h={data:u,dataSplits:l},d=V.runKernel(hR,h,c);return{nGrams:d[0],nGramsSplits:d[1]}}const SZ=M({stringNGrams_:_Z});/**
4404 * @license
4405 * Copyright 2021 Google LLC. All Rights Reserved.
4406 * Licensed under the Apache License, Version 2.0 (the "License");
4407 * you may not use this file except in compliance with the License.
4408 * You may obtain a copy of the License at
4409 *
4410 * http://www.apache.org/licenses/LICENSE-2.0
4411 *
4412 * Unless required by applicable law or agreed to in writing, software
4413 * distributed under the License is distributed on an "AS IS" BASIS,
4414 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4415 * See the License for the specific language governing permissions and
4416 * limitations under the License.
4417 * =============================================================================
4418 */function TZ(t,e,n=!0){const r=I(t,"input","stringSplit","string"),s=I(e,"delimiter","stringSplit","string");if(r.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${r.shape}`);if(s.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${s.shape}`);const i={skipEmpty:n},o={input:r,delimiter:s},a=V.runKernel(dR,o,i);return{indices:a[0],values:a[1],shape:a[2]}}const CZ=M({stringSplit_:TZ});/**
4419 * @license
4420 * Copyright 2021 Google LLC. All Rights Reserved.
4421 * Licensed under the Apache License, Version 2.0 (the "License");
4422 * you may not use this file except in compliance with the License.
4423 * You may obtain a copy of the License at
4424 *
4425 * http://www.apache.org/licenses/LICENSE-2.0
4426 *
4427 * Unless required by applicable law or agreed to in writing, software
4428 * distributed under the License is distributed on an "AS IS" BASIS,
4429 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4430 * See the License for the specific language governing permissions and
4431 * limitations under the License.
4432 * =============================================================================
4433 */function NZ(t,e){const n=I(t,"input","stringToHashBucketFast","string"),r={numBuckets:e};if(e<=0)throw new Error("Number of buckets must be at least 1");const s={input:n};return V.runKernel(fR,s,r)}const EZ=M({stringToHashBucketFast_:NZ});/**
4434 * @license
4435 * Copyright 2023 Google LLC.
4436 * Licensed under the Apache License, Version 2.0 (the "License");
4437 * you may not use this file except in compliance with the License.
4438 * You may obtain a copy of the License at
4439 *
4440 * http://www.apache.org/licenses/LICENSE-2.0
4441 *
4442 * Unless required by applicable law or agreed to in writing, software
4443 * distributed under the License is distributed on an "AS IS" BASIS,
4444 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4445 * See the License for the specific language governing permissions and
4446 * limitations under the License.
4447 * =============================================================================
4448 */function kZ(t,e,n,r=!0){const s=I(t,"input","staticRegexReplace","string"),i={pattern:e,rewrite:n,replaceGlobal:r};return V.runKernel(lR,{x:s},i)}const $Z=M({staticRegexReplace_:kZ});/**
4449 * @license
4450 * Copyright 2020 Google LLC. All Rights Reserved.
4451 * Licensed under the Apache License, Version 2.0 (the "License");
4452 * you may not use this file except in compliance with the License.
4453 * You may obtain a copy of the License at
4454 *
4455 * http://www.apache.org/licenses/LICENSE-2.0
4456 *
4457 * Unless required by applicable law or agreed to in writing, software
4458 * distributed under the License is distributed on an "AS IS" BASIS,
4459 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4460 * See the License for the specific language governing permissions and
4461 * limitations under the License.
4462 * =============================================================================
4463 */const IZ={fft:K1,ifft:Zf,rfft:X1,irfft:FO},AZ={hammingWindow:tQ,hannWindow:jO,frame:GO,stft:iQ},xm={flipLeftRight:lQ,grayscaleToRGB:hQ,resizeNearestNeighbor:LQ,resizeBilinear:PQ,rgbToGrayscale:fQ,rotateWithOffset:mQ,cropAndResize:aQ,nonMaxSuppression:yQ,nonMaxSuppressionAsync:CQ,nonMaxSuppressionWithScore:EQ,nonMaxSuppressionWithScoreAsync:$Q,nonMaxSuppressionPadded:AQ,nonMaxSuppressionPaddedAsync:OQ,threshold:BQ,transform:UQ},RZ={bandPart:jQ,gramSchmidt:HQ,qr:KQ},OZ={absoluteDifference:QQ,computeWeightedLoss:Ci,cosineDistance:JQ,hingeLoss:tZ,huberLoss:rZ,logLoss:iZ,meanSquaredError:aZ,sigmoidCrossEntropy:cZ,softmaxCrossEntropy:fZ},DZ={sparseFillEmptyRows:mZ,sparseReshape:yZ,sparseSegmentMean:xZ,sparseSegmentSum:bZ},PZ={stringNGrams:SZ,stringSplit:CZ,stringToHashBucketFast:EZ,staticRegexReplace:$Z};/**
4464 * @license
4465 * Copyright 2018 Google LLC. All Rights Reserved.
4466 * Licensed under the Apache License, Version 2.0 (the "License");
4467 * you may not use this file except in compliance with the License.
4468 * You may obtain a copy of the License at
4469 *
4470 * http://www.apache.org/licenses/LICENSE-2.0
4471 *
4472 * Unless required by applicable law or agreed to in writing, software
4473 * distributed under the License is distributed on an "AS IS" BASIS,
4474 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4475 * See the License for the specific language governing permissions and
4476 * limitations under the License.
4477 * =============================================================================
4478 */const FZ=new Map,LZ=new Map;class MZ{getClassName(){return this.constructor.className}static fromConfig(e,n){return new e(n)}}class Mo{constructor(){this.classNameMap={}}static getMap(){return Mo.instance==null&&(Mo.instance=new Mo),Mo.instance}static register(e){Mo.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function VZ(t,e,n){A(t.className!=null,()=>"Class being registered does not have the static className property defined."),A(typeof t.className=="string",()=>"className is required to be a string, but got type "+typeof t.className),A(t.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof e>"u"&&(e="Custom"),typeof n>"u"&&(n=t.className);const r=n,s=e+">"+r;return Mo.register(t),FZ.set(s,t),LZ.set(t,s),t}/**
4479 * @license
4480 * Copyright 2018 Google LLC. All Rights Reserved.
4481 * Licensed under the Apache License, Version 2.0 (the "License");
4482 * you may not use this file except in compliance with the License.
4483 * You may obtain a copy of the License at
4484 *
4485 * http://www.apache.org/licenses/LICENSE-2.0
4486 *
4487 * Unless required by applicable law or agreed to in writing, software
4488 * distributed under the License is distributed on an "AS IS" BASIS,
4489 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4490 * See the License for the specific language governing permissions and
4491 * limitations under the License.
4492 * =============================================================================
4493 */class La extends MZ{minimize(e,n=!1,r){const{value:s,grads:i}=this.computeGradients(e,r);if(r!=null){const o=r.map(a=>({name:a.name,tensor:i[a.name]}));this.applyGradients(o)}else this.applyGradients(i);return mt(i),n?s:(s.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,n){return TX(e,n)}dispose(){this.iterations_!=null&&mt(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:De(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(La,Symbol.hasInstance,{value:t=>t.minimize!=null&&t.computeGradients!=null&&t.applyGradients!=null});/**
4494 * @license
4495 * Copyright 2018 Google LLC. All Rights Reserved.
4496 * Licensed under the Apache License, Version 2.0 (the "License");
4497 * you may not use this file except in compliance with the License.
4498 * You may obtain a copy of the License at
4499 *
4500 * http://www.apache.org/licenses/LICENSE-2.0
4501 *
4502 * Unless required by applicable law or agreed to in writing, software
4503 * distributed under the License is distributed on an "AS IS" BASIS,
4504 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4505 * See the License for the specific language governing permissions and
4506 * limitations under the License.
4507 * =============================================================================
4508 */class BZ extends La{static get className(){return"Adadelta"}constructor(e,n,r=null){super(),this.learningRate=e,this.rho=n,this.epsilon=r,this.accumulatedGrads=[],this.accumulatedUpdates=[],r==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(r=>
vendor: 9,165 bytes, lines 4508-4556
4508r.name):Object.keys(e)).forEach((r,s)=>{const i=V.registeredVariables[r],o=!1;this.accumulatedGrads[s]==null&&(this.accumulatedGrads[s]={originalName:`${r}/accum_grad`,variable:$e(()=>cr(i).variable(o))}),this.accumulatedUpdates[s]==null&&(this.accumulatedUpdates[s]={originalName:`${r}/accum_var`,variable:$e(()=>cr(i).variable(o))});const a=Array.isArray(e)?e[s].tensor:e[r];if(a==null)return;const u=this.accumulatedGrads[s].variable,l=this.accumulatedUpdates[s].variable;$e(()=>{const c=ge(re(u,this.rho),re(us(a),1-this.rho)),h=re(Ae(yi(ge(l,this.epsilon)),yi(ge(u,this.epsilon))),a),d=ge(re(l,this.rho),re(us(h),1-this.rho));u.assign(c),l.assign(d);const f=ge(re(h,-this.learningRate),i);i.assign(f)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(mt(this.accumulatedGrads.map(e=>e.variable)),mt(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=e.length/2,r=!1;this.accumulatedGrads=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedUpdates=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,n){return new e(n.learningRate,n.rho,n.epsilon)}}/**
4509 * @license
4510 * Copyright 2018 Google LLC. All Rights Reserved.
4511 * Licensed under the Apache License, Version 2.0 (the "License");
4512 * you may not use this file except in compliance with the License.
4513 * You may obtain a copy of the License at
4514 *
4515 * http://www.apache.org/licenses/LICENSE-2.0
4516 *
4517 * Unless required by applicable law or agreed to in writing, software
4518 * distributed under the License is distributed on an "AS IS" BASIS,
4519 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4520 * See the License for the specific language governing permissions and
4521 * limitations under the License.
4522 * =============================================================================
4523 */class WZ extends La{static get className(){return"Adagrad"}constructor(e,n=.1){super(),this.learningRate=e,this.initialAccumulatorValue=n,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const i=V.registeredVariables[r];this.accumulatedGrads[s]==null&&(this.accumulatedGrads[s]={originalName:`${r}/accumulator`,variable:$e(()=>_h(i.shape,this.initialAccumulatorValue).variable(!1))});const o=Array.isArray(e)?e[s].tensor:e[r];if(o==null)return;const a=this.accumulatedGrads[s].variable;$e(()=>{const u=ge(a,us(o));a.assign(u);const l=ge(re(Ae(o,yi(ge(u,V.backend.epsilon()))),-this.learningRate),i);i.assign(l)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&mt(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=!1;this.accumulatedGrads=e.map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,n){return new e(n.learningRate,n.initialAccumulatorValue)}}/**
4524 * @license
4525 * Copyright 2018 Google LLC. All Rights Reserved.
4526 * Licensed under the Apache License, Version 2.0 (the "License");
4527 * you may not use this file except in compliance with the License.
4528 * You may obtain a copy of the License at
4529 *
4530 * http://www.apache.org/licenses/LICENSE-2.0
4531 *
4532 * Unless required by applicable law or agreed to in writing, software
4533 * distributed under the License is distributed on an "AS IS" BASIS,
4534 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4535 * See the License for the specific language governing permissions and
4536 * limitations under the License.
4537 * =============================================================================
4538 */class UZ extends La{static get className(){return"Adam"}constructor(e,n,r,s=null){super(),this.learningRate=e,this.beta1=n,this.beta2=r,this.epsilon=s,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],$e(()=>{this.accBeta1=De(n).variable(),this.accBeta2=De(r).variable()}),s==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){const n=Array.isArray(e)?e.map(r=>r.name):Object.keys(e);$e(()=>{const r=Ee(1,this.accBeta1),s=Ee(1,this.accBeta2);n.forEach((i,o)=>{const a=V.registeredVariables[i],u=!1;this.accumulatedFirstMoment[o]==null&&(this.accumulatedFirstMoment[o]={originalName:`${i}/m`,variable:$e(()=>cr(a).variable(u))}),this.accumulatedSecondMoment[o]==null&&(this.accumulatedSecondMoment[o]={originalName:`${i}/v`,variable:$e(()=>cr(a).variable(u))});const l=Array.isArray(e)?e[o].tensor:e[i];if(l==null)return;const c=this.accumulatedFirstMoment[o].variable,h=this.accumulatedSecondMoment[o].variable,d=ge(re(c,this.beta1),re(l,1-this.beta1)),f=ge(re(h,this.beta2),re(us(l),1-this.beta2)),p=Ae(d,r),y=Ae(f,s);c.assign(d),h.assign(f);const v=ge(re(Ae(p,ge(yi(y),this.epsilon)),-this.learningRate),a);a.assign(v)}),this.accBeta1.assign(re(this.accBeta1,this.beta1)),this.accBeta2.assign(re(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&mt(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&mt(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable})))}async setWeights(e){e=await this.extractIterations(e),$e(()=>{this.accBeta1.assign(zc(this.beta1,this.iterations_+1)),this.accBeta2.assign(zc(this.beta2,this.iterations_+1))});const n=e.length/2,r=!1;this.accumulatedFirstMoment=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedSecondMoment=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,n){return new e(n.learningRate,n.beta1,n.beta2,n.epsilon)}}/**
4539 * @license
4540 * Copyright 2018 Google LLC. All Rights Reserved.
4541 * Licensed under the Apache License, Version 2.0 (the "License");
4542 * you may not use this file except in compliance with the License.
4543 * You may obtain a copy of the License at
4544 *
4545 * http://www.apache.org/licenses/LICENSE-2.0
4546 *
4547 * Unless required by applicable law or agreed to in writing, software
4548 * distributed under the License is distributed on an "AS IS" BASIS,
4549 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4550 * See the License for the specific language governing permissions and
4551 * limitations under the License.
4552 * =============================================================================
4553 */class zZ extends La{static get className(){return"Adamax"}constructor(e,n,r,s=null,i=0){super(),this.learningRate=e,this.beta1=n,this.beta2=r,this.epsilon=s,this.decay=i,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],$e(()=>{this.iteration=De(0).variable(),this.accBeta1=De(n).variable()}),s==null&&(this.epsilon=V.backend.epsilon())}applyGradients(e){const n=Array.isArray(e)?e.map(r=>r.name):Object.keys(e);$e(()=>{const r=Ee(1,this.accBeta1),s=Ae(-this.learningRate,ge(re(this.iteration,this.decay),1));n.forEach((i,o)=>{const a=V.registeredVariables[i],u=!1;this.accumulatedFirstMoment[o]==null&&(this.accumulatedFirstMoment[o]={originalName:`${i}/m`,variable:cr(a).variable(u)}),this.accumulatedWeightedInfNorm[o]==null&&(this.accumulatedWeightedInfNorm[o]={originalName:`${i}/v`,variable:cr(a).variable(u)});const l=Array.isArray(e)?e[o].tensor:e[i];if(l==null)return;const c=this.accumulatedFirstMoment[o].variable,h=this.accumulatedWeightedInfNorm[o].variable,d=ge(re(c,this.beta1),re(l,1-this.beta1)),f=re(h,this.beta2),p=rr(l),y=kO(f,p);c.assign(d),h.assign(y);const v=ge(re(Ae(s,r),Ae(d,ge(y,this.epsilon))),a);a.assign(v)}),this.iteration.assign(ge(this.iteration,1)),this.accBeta1.assign(re(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&mt(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&mt(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,n){return new e(n.learningRate,n.beta1,n.beta2,n.epsilon,n.decay)}}/**
4554 * @license
4555 * Copyright 2018 Google LLC. All Rights Reserved.
4556 * Licensed under the Apache License, Version 2.0 (the "License");
4557 * you may not use this file except in compliance with the License.
4558 * You may obtain a copy of the License at
4559 *
4560 * http://www.apache.org/licenses/LICENSE-2.0
4561 *
4562 * Unless required by applicable law or agreed to in writing, software
4563 * distributed under the License is distributed on an "AS IS" BASIS,
4564 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4565 * See the License for the specific language governing permissions and
4566 * limitations under the License.
4567 * =============================================================================
4568 */class XO extends La{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const i=Array.isArray(e)?e[s].tensor:e[r];if(i==null)return;const o=V.registeredVariables[r];$e(()=>{const a=ge(re(this.c,i),o);o.assign(a)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Is(De(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,n){return new e(n.learningRate)}}/**
4569 * @license
4570 * Copyright 2018 Google LLC. All Rights Reserved.
4571 * Licensed under the Apache License, Version 2.0 (the "License");
4572 * you may not use this file except in compliance with the License.
4573 * You may obtain a copy of the License at
4574 *
4575 * http://www.apache.org/licenses/LICENSE-2.0
4576 *
4577 * Unless required by applicable law or agreed to in writing, software
4578 * distributed under the License is distributed on an "AS IS" BASIS,
4579 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4580 * See the License for the specific language governing permissions and
4581 * limitations under the License.
4582 * =============================================================================
4583 */class jZ extends XO{static get className(){return"Momentum"}constructor(e,n,r=!1){super(e),this.learningRate=e,this.momentum=n,this.useNesterov=r,this.accumulations=[],this.m=De(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const i=V.registeredVariables[r];this.accumulations[s]==null&&(this.accumulations[s]={originalName:`${r}/momentum`,variable:$e(()=>cr(i).variable(!1))});const o=this.accumulations[s].variable,a=Array.isArray(e)?e[s].tensor:e[r];a!=null&&$e(()=>{let u;const l=ge(re(this.m,o),a);this.useNesterov?u=ge(re(this.c,ge(a,re(l,this.m))),i):u=ge(re(this.c,l),i),o.assign(l),i.assign(u)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&mt(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=!1;this.accumulations=e.map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,n){return new e(n.learningRate,n.momentum,n.useNesterov)}}/**
4584 * @license
4585 * Copyright 2018 Google LLC. All Rights Reserved.
4586 * Licensed under the Apache License, Version 2.0 (the "License");
4587 * you may not use this file except in compliance with the License.
4588 * You may obtain a copy of the License at
4589 *
4590 * http://www.apache.org/licenses/LICENSE-2.0
4591 *
4592 * Unless required by applicable law or agreed to in writing, software
4593 * distributed under the License is distributed on an "AS IS" BASIS,
4594 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4595 * See the License for the specific language governing permissions and
4596 * limitations under the License.
4597 * =============================================================================
4598 */class GZ extends La{static get className(){return"RMSProp"}constructor(e,n=.9,r=0,s=null,i=!1){if(super(),this.learningRate=e,this.decay=n,this.momentum=r,this.epsilon=s,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=i,s==null&&(this.epsilon=V.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}
vendor: 5,446 bytes, lines 4598-4628
4598applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const i=V.registeredVariables[r],o=!1;this.accumulatedMeanSquares[s]==null&&(this.accumulatedMeanSquares[s]={originalName:`${r}/rms`,variable:$e(()=>cr(i).variable(o))}),this.accumulatedMoments[s]==null&&(this.accumulatedMoments[s]={originalName:`${r}/momentum`,variable:$e(()=>cr(i).variable(o))}),this.accumulatedMeanGrads[s]==null&&this.centered&&(this.accumulatedMeanGrads[s]={originalName:`${r}/mg`,variable:$e(()=>cr(i).variable(o))});const a=Array.isArray(e)?e[s].tensor:e[r];if(a==null)return;const u=this.accumulatedMeanSquares[s].variable,l=this.accumulatedMoments[s].variable;$e(()=>{const c=ge(re(u,this.decay),re(us(a),1-this.decay));if(this.centered){const h=this.accumulatedMeanGrads[s].variable,d=ge(re(h,this.decay),re(a,1-this.decay)),f=Ae(re(a,this.learningRate),yi(Ee(c,ge(us(d),this.epsilon)))),p=ge(re(l,this.momentum),f);u.assign(c),h.assign(d),l.assign(p);const y=Ee(i,p);i.assign(y)}else{const h=ge(re(u,this.decay),re(us(a),1-this.decay)),d=ge(re(l,this.momentum),Ae(re(a,this.learningRate),yi(ge(h,this.epsilon))));u.assign(h),l.assign(d);const f=Ee(i,d);i.assign(f)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&mt(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&mt(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&mt(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=this.centered?e.length/3:e.length/2,r=!1;this.accumulatedMeanSquares=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedMoments=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.centered&&(this.accumulatedMeanGrads=e.slice(n*2,n*3).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,n){return new e(n.learningRate,n.decay,n.momentum,n.epsilon,n.centered)}}/**
4599 * @license
4600 * Copyright 2022 Google LLC.
4601 * Licensed under the Apache License, Version 2.0 (the "License");
4602 * you may not use this file except in compliance with the License.
4603 * You may obtain a copy of the License at
4604 *
4605 * http://www.apache.org/licenses/LICENSE-2.0
4606 *
4607 * Unless required by applicable law or agreed to in writing, software
4608 * distributed under the License is distributed on an "AS IS" BASIS,
4609 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4610 * See the License for the specific language governing permissions and
4611 * limitations under the License.
4612 * =============================================================================
4613 */const HZ=[BZ,WZ,UZ,zZ,jZ,GZ,XO];function qZ(){for(const t of HZ)VZ(t)}/**
4614 * @license
4615 * Copyright 2018 Google LLC. All Rights Reserved.
4616 * Licensed under the Apache License, Version 2.0 (the "License");
4617 * you may not use this file except in compliance with the License.
4618 * You may obtain a copy of the License at
4619 *
4620 * http://www.apache.org/licenses/LICENSE-2.0
4621 *
4622 * Unless required by applicable law or agreed to in writing, software
4623 * distributed under the License is distributed on an "AS IS" BASIS,
4624 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4625 * See the License for the specific language governing permissions and
4626 * limitations under the License.
4627 * =============================================================================
4628 */const KZ="model",XZ=".json",YZ=".weights.bin";function ST(t){return new Promise(e=>setTimeout(e)).then(t)}class Sa{constructor(e){if(!U().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Sa.URL_SCHEME)&&(e=e.slice(Sa.URL_SCHEME.length)),(e==null||e.length===0)&&(e=KZ),this.modelJsonFileName=e+XZ,this.weightDataFileName=e+YZ}async save(e){if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");const n=xs.join(e.weightData),r=window.URL.createObjectURL(new Blob([n],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const s=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],i=XR(e,s),o=window.URL.createObjectURL(new Blob([JSON.stringify(i)],{type:"application/json"})),a=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(a.download=this.modelJsonFileName,a.href=o,await ST(()=>a.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){const u=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;u.download=this.weightDataFileName,u.href=r,await ST(()=>u.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:xh(e)}}}}Sa.URL_SCHEME="downloads://";class QZ{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.jsonFile=e[0],this.weightsFiles=e.slice(1)}
4628async load(){return new Promise((e,n)=>{const r=new FileReader;r.onload=s=>{const i=JSON.parse(s.target.result),o=i.modelTopology;if(o==null){n(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));return}if(i.weightsManifest==null){n(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));return}if(this.weightsFiles.length===0){e({modelTopology:o});return}const u=R1(i,l=>this.loadWeights(l));e(u)},r.onerror=s=>n(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(this.jsonFile)})}loadWeights(e){const n=[],r=[];for(const o of e)n.push(...o.weights),r.push(...o.paths);const s=this.checkManifestAndWeightFiles(e),i=r.map(o=>this.loadWeightsFile(o,s[o]));return Promise.all(i).then(o=>[n,o])}loadWeightsFile(e,n){return new Promise((r,s)=>{const i=new FileReader;i.onload=o=>{const a=o.target.result;r(a)},i.onerror=o=>s(`Failed to weights data from file of path '${e}'.`),i.readAsArrayBuffer(n)})}checkManifestAndWeightFiles(e){const n=[],r=this.weightsFiles.map(i=>wT(i.name)),s={};for(const i of e)i.paths.forEach(o=>{const a=wT(o);if(n.indexOf(a)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${a}'`);if(n.push(a),r.indexOf(a)===-1)throw new Error(`Weight file with basename '${a}' is not provided.`);s[o]=this.weightsFiles[r.indexOf(a)]});if(n.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return s}}const ZZ=t=>U().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Sa.URL_SCHEME)?JZ(t.slice(Sa.URL_SCHEME.length)):null;ft.registerSaveRouter(ZZ);function JZ(t="model"){return new Sa(t)}function eJ(t){return new QZ(t)}/**
4629 * @license
4630 * Copyright 2019 Google LLC. All Rights Reserved.
4631 * Licensed under the Apache License, Version 2.0 (the "License");
4632 * you may not use this file except in compliance with the License.
4633 * You may obtain a copy of the License at
4634 *
4635 * http://www.apache.org/licenses/LICENSE-2.0
4636 *
4637 * Unless required by applicable law or agreed to in writing, software
4638 * distributed under the License is distributed on an "AS IS" BASIS,
4639 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4640 * See the License for the specific language governing permissions and
4641 * limitations under the License.
4642 * =============================================================================
4643 */function TT(t,e,n,r){o(t),n=n??0,r=r??1,a(n,r);let s=0;const i=u=>(u.then(l=>{const c=n+ ++s/t.length*(r-n);return e(c),l}),u);function o(u){A(u!=null&&Array.isArray(u)&&u.length>0,()=>"promises must be a none empty array")}function a(u,l){A(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${u}`),A(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${l}`),A(l>=u,()=>`startFraction must be no more than endFraction, but got startFraction ${u} and endFraction ${l}`)}return Promise.all(t.map(i))}/**
4644 * @license
4645 * Copyright 2018 Google LLC. All Rights Reserved.
4646 * Licensed under the Apache License, Version 2.0 (the "License");
4647 * you may not use this file except in compliance with the License.
4648 * You may obtain a copy of the License at
4649 *
4650 * http://www.apache.org/licenses/LICENSE-2.0
4651 *
4652 * Unless required by applicable law or agreed to in writing, software
4653 * distributed under the License is distributed on an "AS IS" BASIS,
4654 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4655 * See the License for the specific language governing permissions and
4656 * limitations under the License.
4657 * =============================================================================
4658 */async function YO(t,e){e==null&&(e={});const n=e.fetchFunc==null?U().platform.fetch:e.fetchFunc,r=t.map(h=>n(h,e.requestInit,{isBinary:!0})),a=(e.onProgress==null?await Promise.all(r):await TT(r,e.onProgress,0,.5)).map(h=>h.arrayBuffer());return e.onProgress==null?await Promise.all(a):await TT(a,e.onProgress,.5,1)}function tJ(t,e){var n;const r=e.fetchFunc==null?U().platform.fetch:e.fetchFunc;let s=0,i;return(n=e.onProgress)===null||n===void 0||n.call(e,0),new ReadableStream({pull:async o=>{for(var a;s<t.length;){i||(i=(await r(t[s],e.requestInit,{isBinary:!0})).body.getReader());const{done:u,value:l}=await i.read();if(u){s++,i=void 0,(a=e.onProgress)===null||a===void 0||a.call(e,s/t.length);continue}o.enqueue(l);return}o.close()}})}async function nJ(t,e="",n,r){return QO(o=>YO(o,{requestInit:r}))(t,e,n)}function QO(t){return async(e,n="",r)=>{const s=e.map(()=>!1),i={},o=r!=null?r.map(()=>!1):[],a=[];if(e.forEach((f,p)=>{let y=0;
4658f.weights.forEach(v=>{const g="quantization"in v?v.quantization.dtype:v.dtype,x=ya[g]*ne(v.shape),w=()=>{s[p]=!0,i[p]==null&&(i[p]=[]),i[p].push({manifestEntry:v,groupOffset:y,sizeBytes:x})};r!=null?r.forEach((_,T)=>{_===v.name&&(w(),o[T]=!0)}):w(),a.push(v.name),y+=x})}),!o.every(f=>f)){const f=r.filter((p,y)=>!o[y]);throw new Error(`Could not find weights in manifest with names: ${f.join(", ")}. 
4659Manifest JSON has weights with names: ${a.join(", ")}.`)}const u=s.reduce((f,p,y)=>(p&&f.push(y),f),[]),l=[];u.forEach(f=>{e[f].paths.forEach(p=>{const y=n+(n.endsWith("/")?"":"/")+p;l.push(y)})});const c=await t(l),h={};let d=0;return u.forEach(f=>{const p=e[f].paths.length,y=new xs(c.slice(d,d+p));i[f].forEach(g=>{const x=y.slice(g.groupOffset,g.groupOffset+g.sizeBytes),w=HR(x,[g.manifestEntry]);for(const _ in w)h[_]=w[_]}),d+=p}),h}}/**
4660 * @license
4661 * Copyright 2018 Google LLC. All Rights Reserved.
4662 * Licensed under the Apache License, Version 2.0 (the "License");
4663 * you may not use this file except in compliance with the License.
4664 * You may obtain a copy of the License at
4665 *
4666 * http://www.apache.org/licenses/LICENSE-2.0
4667 *
4668 * Unless required by applicable law or agreed to in writing, software
4669 * distributed under the License is distributed on an "AS IS" BASIS,
4670 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4671 * See the License for the specific language governing permissions and
4672 * limitations under the License.
4673 * =============================================================================
4674 */const rJ="application/octet-stream",sJ="application/json";class J1{constructor(e,n){if(this.DEFAULT_METHOD="POST",n==null&&(n={}),this.weightPathPrefix=n.weightPathPrefix,this.weightUrlConverter=n.weightUrlConverter,n.fetchFunc!=null?(A(typeof n.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=n.fetchFunc):this.fetch=U().platform.fetch,A(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&A(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,n.requestInit!=null&&n.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=n.requestInit||{},this.loadOptions=n}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const n=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);n.body=new FormData;const r=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],s=XR(e,r);if(n.body.append("model.json",new Blob([JSON.stringify(s)],{type:sJ}),"model.json"),e.weightData!=null){const o=xs.join(e.weightData);n.body.append("model.weights.bin",new Blob([o],{type:rJ}),"model.weights.bin")}const i=await this.fetch(this.path,n);if(i.ok)return{modelArtifactsInfo:xh(e),responses:[i]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${i.status}.`)}async loadModelJSON(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let n;try{n=await e.json()}catch{let o=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?o+=" 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.":o+=" Please make sure the server is serving valid JSON for this request.",new Error(o)}const r=n.modelTopology,s=n.weightsManifest;if(r==null&&s==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return n}async load(){if(this.loadOptions.streamWeights)return this.loadStream();const e=await this.loadModelJSON();return R1(e,n=>this.loadWeights(n))}async loadStream(){const e=await this.loadModelJSON(),n=await this.getWeightUrls(e.weightsManifest),r=D0(e.weightsManifest),s=()=>tJ(n,this.loadOptions);return Object.assign(Object.assign({},e),{weightSpecs:r,getWeightStream:s})}async getWeightUrls(e){const n=Array.isArray(this.path)?this.path[1]:this.path,[r,s]=iJ(n),i=this.weightPathPrefix||r,o=[],a=[];for(const u of e)for(const l of u.paths)this.weightUrlConverter!=null?a.push(this.weightUrlConverter(l)):o.push(i+l+s);return this.weightUrlConverter&&o.push(...await Promise.all(a)),o}async loadWeights(e){const n=await this.getWeightUrls(e),r=D0(e),s=await YO(n,this.loadOptions);return[r,s]}}J1.URL_SCHEME_REGEX=/^https?:\/\//;function iJ(t){const e=t.lastIndexOf("/"),n=t.lastIndexOf("?"),r=t.substring(0,e),s=n>e?t.substring(n):"";return[r+"/",s]}function z0(t){return t.match(J1.URL_SCHEME_REGEX)!=null}const ZO=(t,e)=>{if(typeof fetch>"u"&&(e==null||e.fetchFunc==null))return null;{let n=!0;if(Array.isArray(t)?n=t.every(r=>z0(r)):n=z0(t),n)return ew(t,e)}return null};ft.registerSaveRouter(ZO);ft.registerLoadRouter(ZO);function ew(t,e){return new J1(t,e)}function oJ(t,e){return ew(t,e)}/**
4675 * @license
4676 * Copyright 2018 Google LLC. All Rights Reserved.
4677 * Licensed under the Apache License, Version 2.0 (the "License");
4678 * you may not use this file except in compliance with the License.
4679 * You may obtain a copy of the License at
4680 *
4681 * http://www.apache.org/licenses/LICENSE-2.0
4682 *
4683 * Unless required by applicable law or agreed to in writing, software
4684 * distributed under the License is distributed on an "AS IS" BASIS,
4685 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4686 * See the License for the specific language governing permissions and
4687 * limitations under the License.
4688 * =============================================================================
4689 */class Lg{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class JO{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class aJ{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=n=>Promise.resolve(e.save(n)))}}function uJ(t,e,n,r){const s=arguments;return new aJ(eD(...s))}function eD(t,e,n,r){return arguments.length===1?t.modelTopology!=null||t.weightSpecs!=null?new Lg(t):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Lg({modelTopology:t})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Lg({modelTopology:t,weightSpecs:e,weightData:n,trainingConfig:r}))}function lJ(t){return new JO(t)}function cJ(t){return new JO(t)}/**
4690 * @license
4691 * Copyright 2018 Google LLC. All Rights Reserved.
4692 * Licensed under the Apache License, Version 2.0 (the "License");
4693 * you may not use this file except in compliance with the License.
4694 * You may obtain a copy of the License at
4695 *
4696 * http://www.apache.org/licenses/LICENSE-2.0
4697 *
4698 * Unless required by applicable law or agreed to in writing, software
4699 * distributed under the License is distributed on an "AS IS" BASIS,
4700 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4701 * See the License for the specific language governing permissions and
4702 * limitations under the License.
4703 * =============================================================================
4704 */const tD=Object.freeze(Object.defineProperty({__proto__:null,CompositeArrayBuffer:xs,browserFiles:eJ,browserHTTPRequest:oJ,concatenateArrayBuffers:cq,copyModel:Rq,decodeWeights:HR,decodeWeightsStream:KR,encodeWeights:sq,fromMemory:uJ,fromMemorySync:eD,getLoadHandlers:vq,getModelArtifactsForJSON:R1,getModelArtifactsForJSONSync:YR,getModelArtifactsInfoForJSON:xh,getSaveHandlers:yq,getWeightSpecs:D0,http:ew,isHTTPScheme:z0,listModels:Iq,loadWeights:nJ,moveModel:Oq,registerLoadRouter:gq,registerSaveRouter:mq,removeModel:Aq,weightsLoaderFactory:QO,withSaveHandler:lJ,withSaveHandlerSync:cJ},Symbol.toStringTag,{value:"Module"}));/**
4705 * @license
4706 * Copyright 2019 Google LLC. All Rights Reserved.
4707 * Licensed under the Apache License, Version 2.0 (the "License");
4708 * you may not use this file except in compliance with the License.
4709 * You may obtain a copy of the License at
4710 *
4711 * http://www.apache.org/licenses/LICENSE-2.0
4712 *
4713 * Unless required by applicable law or agreed to in writing, software
4714 * distributed under the License is distributed on an "AS IS" BASIS,
4715 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4716 * See the License for the specific language governing permissions and
4717 * limitations under the License.
4718 * =============================================================================
4719 */let Io;function hJ(t,e=3){if(e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(t==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1;if(t.data instanceof Uint8Array)n=!0;else if(typeof ImageData<"u"&&t instanceof ImageData)r=!0;else if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)s=!0;else if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement)i=!0;else if(t.getContext!=null)o=!0;else if(typeof ImageBitmap<"u"&&t instanceof ImageBitmap)a=!0;else 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}`);if(E0(S0,V.backendName)!=null){const p={pixels:t},y={numChannels:e};return V.runKernel(S0,p,y)}const[l,c]=s?[t.videoWidth,t.videoHeight]:[t.width,t.height];let h;if(o)h=t.getContext("2d").getImageData(0,0,l,c).data;else if(r||n)h=t.data;else if(i||s||a){if(Io==null)if(typeof document>"u")if(typeof OffscreenCanvas<"u"&&typeof OffscreenCanvasRenderingContext2D<"u")Io=new OffscreenCanvas(1,1).getContext("2d");else throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");else Io=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});Io.canvas.width=l,Io.canvas.height=c,Io.drawImage(t,0,0,l,c),h=Io.getImageData(0,0,l,c).data}let d;if(e===4)d=new Int32Array(h);else{const p=l*c;d=new Int32Array(p*e);for(let y=0;y<p;y++)for(let v=0;v<e;++v)d[y*e+v]=h[y*4+v]}return VO(d,[c,l,e],"int32")}
vendor: 11,633 bytes, lines 4719-4767
4719function dJ(t){if(t.rank!==2&&t.rank!==3)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${t.rank}.`);const e=t.rank===2?1:t.shape[2];if(e>4||e===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${e}`);if(t.dtype!=="float32"&&t.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${t.dtype}. Please use float32 or int32 tensors.`)}async function fJ(t,e){let n=I(t,"img","toPixels");if(!(t instanceof Lt)){const l=n;n=vt(l,"int32"),l.dispose()}dJ(n);const[r,s]=n.shape.slice(0,2),i=n.rank===2?1:n.shape[2],o=await n.data(),a=n.dtype==="float32"?255:1,u=new Uint8ClampedArray(s*r*4);for(let l=0;l<r*s;++l){const c=[0,0,0,255];for(let d=0;d<i;d++){const f=o[l*i+d];if(n.dtype==="float32"){if(f<0||f>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${f}.`)}else if(n.dtype==="int32"&&(f<0||f>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${f}.`);i===1?(c[0]=f*a,c[1]=f*a,c[2]=f*a):c[d]=f*a}const h=l*4;u[h+0]=Math.round(c[0]),u[h+1]=Math.round(c[1]),u[h+2]=Math.round(c[2]),u[h+3]=Math.round(c[3])}return n!==t&&n.dispose(),u}const pJ=M({fromPixels_:hJ});function nD(t,e){const n=t.shape.length,r=e.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(r<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);if(e.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.shape[r-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${e.shape[r-1]} vs. ${n}`);if(ne(t.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${t.shape}.`);const s=e.shape,i=s[s.length-1];let o=1;for(let h=0;h<s.length-1;++h)o*=s[h];const a=t.shape,u=s.slice();u.pop();let l=1;for(let h=i;h<n;++h)l*=a[h],u.push(a[h]);const c=[...Zt(t.shape).map(h=>h/l),1].slice(0,i);return[u,o,l,c]}/**
4720 * @license
4721 * Copyright 2021 Google LLC. All Rights Reserved.
4722 * Licensed under the Apache License, Version 2.0 (the "License");
4723 * you may not use this file except in compliance with the License.
4724 * You may obtain a copy of the License at
4725 *
4726 * http://www.apache.org/licenses/LICENSE-2.0
4727 *
4728 * Unless required by applicable law or agreed to in writing, software
4729 * distributed under the License is distributed on an "AS IS" BASIS,
4730 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4731 * See the License for the specific language governing permissions and
4732 * limitations under the License.
4733 * =============================================================================
4734 */const j0=-2,mJ=-1;function rD(t,e,n){const r=t.shape.length;A(r===e.length,()=>`Error in slice${r}D: Length of begin ${e} must match the rank of the array (${r}).`),A(r===n.length,()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`);for(let s=0;s<r;++s)A(e[s]+n[s]<=t.shape[s],()=>`Error in slice${r}D: begin[${s}] + size[${s}] (${e[s]+n[s]}) would overflow input.shape[${s}] (${t.shape[s]})`)}function gJ(t){const e=[];let n=0;for(;t>0;)t&1&&e.push(n),t/=2,n++;return e}function sD(t,e,n){const r=[];for(let s=0;s<t.length;s++)r[s]=Math.ceil((e[s]-t[s])/n[s]);return r}function iD(t,e,n,r){const s=[...t];for(let i=s.length;i<r.length;i++)s.push(1);for(let i=0;i<n;i++)i===0?s[e]=1:(s.splice(e,0,1),s.pop());return s}function oD(t,e,n){return n<=t?n:n-(e-1)}function aD(t,e){const n=[];for(let r=0;r<t;r++)n.push(e+r);return n}function yJ(t,e,n,r,s,i,o,a,u){const l=t.length;let c=new Array(l),h=new Array(l),d=new Array(l);if(e.length&&n>0){const f=e[0],p=n+1;c=uD(o,f,p,r,t),h=lD(a,f,p,s,t),d=iD(i,f,p,t)}else for(let f=0;f<l;f++)c[f]=hD(o,r,i,t,f,u),h[f]=dD(a,s,i,t,f,u),d[f]=cD(i,f,u);return{begin:c,end:h,strides:d}}function uD(t,e,n,r,s){const i=[...s],o=aD(n,e);for(let a=0;a<i.length;a++)if(o.indexOf(a)>-1)i[a]=0;else{const u=oD(e,n,a);let l=r[u];t&1<<u&&(l=0),i[a]=l}return i}function lD(t,e,n,r,s){const i=[...s],o=aD(n,e);for(let a=0;a<i.length;a++)if(o.indexOf(a)>-1)i[a]=Number.MAX_SAFE_INTEGER;else{const u=oD(e,n,a);let l=r[u];t&1<<u&&(l=Number.MAX_SAFE_INTEGER),i[a]=l}for(let a=0;a<i.length;a++){const u=s[a];i[a]<0&&(i[a]+=u),i[a]=Uf(0,i[a],s[a])}return i}function cD(t,e,n){let r=t[e];return(n&1<<e||r==null)&&(r=1),r}function hD(t,e,n,r,s,i){let o=e[s];const a=n[s]||1;(t&1<<s||i&1<<s||o==null)&&(a>0?o=Number.MIN_SAFE_INTEGER:o=Number.MAX_SAFE_INTEGER);const u=r[s];return o<0&&(o+=u),o=Uf(0,o,u-1),o}function dD(t,e,n,r,s,i){let o=e[s];const a=n[s]||1;(t&1<<s||i&1<<s||o==null)&&(a>0?o=Number.MAX_SAFE_INTEGER:o=Number.MIN_SAFE_INTEGER);const u=r[s];return o<0&&(o+=u),a>0?o=Uf(0,o,u):o=Uf(-1,o,u-1),o}function tw(t,e,n){let r=n.length;for(let s=0;s<n.length;s++)if(n[s]>1){r=s;break}for(let s=r+1;s<n.length;s++)if(e[s]>0||n[s]!==t[s])return!1;return!0}function nw(t,e){let n=t.length>0?t[t.length-1]:1;for(let r=0;r<t.length-1;r++)n+=t[r]*e[r];return n}function fD(t,e,n){let r;const s=t.shape.length;typeof e=="number"?r=[e,...new Array(s-1).fill(0)]:e.length<s?r=e.concat(new Array(s-e.length).fill(0)):r=e.slice(),r.forEach(o=>{A(o!==-1,()=>"slice() does not support negative begin indexing.")});let i;return n==null?i=new Array(s).fill(-1):typeof n=="number"?i=[n,...new Array(s-1).fill(-1)]:n.length<s?i=n.concat(new Array(s-n.length).fill(-1)):i=n,i=i.map((o,a)=>o>=0?o:(A(o===-1,()=>`Negative size values should be exactly -1 but got ${o} for the slice() size at index ${a}.`),t.shape[a]-r[a])),[r,i]}function pD(t,e,n,r,s,i,o,a,u){let l;if(r==null?(l=new Array(e.length),l.fill(1)):l=r,o!=null&&o&o-1)throw new Error("Multiple ellipses in slice is not allowed.");let c=!1;const h={dims:l.length,numAddAxisAfterEllipsis:0,begin:e.slice(),end:n.slice(),strides:l.slice(),beginMask:s,endMask:i,ellipsisMask:o,newAxisMask:a,shrinkAxisMask:u};for(let w=0;w<h.dims;w++)c&&1<<w&a&&h.numAddAxisAfterEllipsis++,1<<w&o&&(c=!0);c||(h.ellipsisMask|=1<<h.dims,h.dims++);const d={dims:t.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};vJ(h,d);let f=!0,p=!0,y=!0;const v=[],g=[];for(let w=0;w<t.length;++w){if(d.strides[w]===0)throw Error(`strides[${w}] must be non-zero`);const _=!!(d.shrinkAxisMask&1<<w),T=t[w];if(T===-1){v.push(_?1:-1);continue}const E=[d.beginMask&1<<w,d.endMask&1<<w],k=[d.strides[w]>0?0:-1,d.strides[w]>0?T:T-1];if(_&&d.strides[w]<=0)throw Error("only stride 1 allowed on non-range indexing.");y=y&&d.strides[w]===1;const N=!!(d.beginMask&1<<w&&d.endMask&1<<w);if(d.beginValid&&d.endValid){if(_){const W=d.begin[w]<0?T+d.begin[w]:d.begin[w];if(d.begin[w]=W,d.end[w]=d.begin[w]+1,W<0||W>=T)throw Error(`slice index ${d.begin[w]} of dimension ${w} out of bounds.`)}else d.begin[w]=CT(d.begin[w],0,d.strides[w],T,E,k),d.end[w]=CT(d.end[w],1,d.strides[w],T,E,k);const L=d.strides[w]===1&&d.begin[w]===0&&d.end[w]===T;f=f&&L,p=p&&(w===0&&d.strides[w]===1||L)}else f=f&&d.strides[w]===1&&N,p=p&&(w===0&&d.strides[w]===1||N);let O,R=!1;if(d.beginValid&&d.endValid?(O=d.end[w]-d.begin[w],R=!0):_?(O=1,R=!0):N&&T>=0&&(d.strides[w]<0?O=-T:O=T,R=!0),R){let L;O===0||O<0!=d.strides[w]<0?L=0:L=Math.trunc(O/d.strides[w])+(O%d.strides[w]!==0?1:0),v.push(L)}else v.push(-1)}for(let w=0;w<d.finalShapeGatherIndices.length;++w){const _=d.finalShapeGatherIndices[w];_>=0?g.push(v[_]):_===j0&&g.push(1)}return{finalShapeSparse:g.filter((w,_)=>d.finalShapeGatherIndices[_]!==j0),finalShape:g,isIdentity:f,sliceDim0:p,isSimpleSlice:y,begin:d.begin,end:d.end,strides:d.strides}}function vJ(t,e){e.beginMask=0,e.endMask=0,e.shrinkAxisMask=0;let n=0;e.beginValid=t.begin!=null,e.endValid=t.end!=null,e.begin=new Array(e.dims),e.end=new Array(e.dims),e.strides=new Array(e.dims),e.finalShapeGatherIndices=[],e.finalShapeGatherIndicesSparse=[],e.inputShapeGatherIndicesSparse=new Array(e.dims);for(let r=0;r<t.dims;r++)if(1<<r&t.ellipsisMask){const s=Math.min(e.dims-(t.dims-r)+1+t.numAddAxisAfterEllipsis,e.dims);for(;n<s;n++)e.begin[n]=0,e.end[n]=0,e.strides[n]=1,e.beginMask|=1<<n,e.endMask|=1<<n,e.finalShapeGatherIndices.push(n),e.finalShapeGatherIndicesSparse.push(-1),e.inputShapeGatherIndicesSparse[n]=r}else if(1<<r&t.newAxisMask)e.finalShapeGatherIndices.push(j0),e.finalShapeGatherIndicesSparse.push(-1);else{if(n===e.begin.length)throw Error(`Index out of range using input dim ${n}; input has only ${e.dims} dims, ${e.begin.length}.`);t.begin!=null&&(e.begin[n]=t.begin[r]),t.end!=null&&(e.end[n]=t.end[r]),e.strides[n]=t.strides[r],t.beginMask&1<<r&&(e.beginMask|=1<<n),t.endMask&1<<r&&(e.endMask|=1<<n),t.shrinkAxisMask&1<<r?(e.finalShapeGatherIndices.push(mJ),e.finalShapeGatherIndicesSparse.push(-1),e.shrinkAxisMask|=1<<n):(e.finalShapeGatherIndices.push(n),e.finalShapeGatherIndicesSparse.push(r)),e.inputShapeGatherIndicesSparse[n]=r,n++}}function CT(t,e,n,r,s,i){if(s[e])return n>0?i[e]:i[e+1&1];{const o=t<0?r+t:t;return o<i[0]?i[0]:o>i[1]?i[1]:o}}const xJ=Object.freeze(Object.defineProperty({__proto__:null,assertParamsValid:rD,computeFlatOffset:nw,computeOutShape:sD,getNormalizedAxes:yJ,isSliceContinous:tw,maskToAxes:gJ,parseSliceParams:fD,sliceInfo:pD,startForAxis:hD,startIndicesWithElidedDims:uD,stopForAxis:dD,stopIndicesWithElidedDims:lD,stridesForAxis:cD,stridesWithElidedDims:iD},Symbol.toStringTag,{value:"Module"}));/**
4735 * @license
4736 * Copyright 2017 Google LLC. All Rights Reserved.
4737 * Licensed under the Apache License, Version 2.0 (the "License");
4738 * you may not use this file except in compliance with the License.
4739 * You may obtain a copy of the License at
4740 *
4741 * http://www.apache.org/licenses/LICENSE-2.0
4742 *
4743 * Unless required by applicable law or agreed to in writing, software
4744 * distributed under the License is distributed on an "AS IS" BASIS,
4745 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4746 * See the License for the specific language governing permissions and
4747 * limitations under the License.
4748 * =============================================================================
4749 */const wJ=typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:t=>t();function bJ(){return new Promise(t=>wJ(()=>t()))}/**
4750 * @license
4751 * Copyright 2017 Google LLC. All Rights Reserved.
4752 * Licensed under the Apache License, Version 2.0 (the "License");
4753 * you may not use this file except in compliance with the License.
4754 * You may obtain a copy of the License at
4755 *
4756 * http://www.apache.org/licenses/LICENSE-2.0
4757 *
4758 * Unless required by applicable law or agreed to in writing, software
4759 * distributed under the License is distributed on an "AS IS" BASIS,
4760 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4761 * See the License for the specific language governing permissions and
4762 * limitations under the License.
4763 * =============================================================================
4764 */function mD(t,e){const n=t[0].length;t.forEach((s,i)=>{A(s.length===n,()=>`Error in concat${n}D: rank of tensors[${i}] must be the same as the rank of the rest (${n})`)}),A(e>=0&&e<n,()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`);const r=t[0];t.forEach((s,i)=>{for(let o=0;o<n;o++)A(o===e||s[o]===r[o],()=>`Error in concat${n}D: Shape of tensors[${i}] (${s}) does not match the shape of the rest (${r}) along the non-concatenated axis ${i}.`)})}function Ta(t,e){const n=t[0].slice();for(let r=1;r<t.length;r++)n[e]+=t[r][e];return n}/**
4765 * @license
4766 * Copyright 2022 Google LLC. All Rights Reserved.
4767 * Licensed under the Apache License, Version 2.0 (the "License");
4768 * you may not use this file except in compliance with the License.
4769 * You may obtain a copy of the License at
4770 *
4771 * http://www.apache.org/licenses/LICENSE-2.0
4772 *
4773 * Unless required by applicable law or agreed to in writing, software
4774 * distributed under the License is distributed on an "AS IS" BASIS,
4775 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4776 * See the License for the specific language governing permissions and
4777 * limitations under the License.
4778 * =============================================================================
4779 */var ns;(function(t){t[t.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",t[t.VALUE_ROWIDS=1]="VALUE_ROWIDS",t[t.ROW_LENGTHS=2]="ROW_LENGTHS",t[t.ROW_SPLITS=3]="ROW_SPLITS",t[t.ROW_LIMITS=4]="ROW_LIMITS",t[t.ROW_STARTS=5]="ROW_STARTS"})(ns||(ns={}));function gD(t,e,n){let r=new Array;if(n==null&&e==null)return r;if(e==null)for(;r.length<t+n.length;)r.push(-1);else r=e.slice();if(n==null)return r;if(t+n.length!==r.length)throw new Error(`rt input.shape and shape=${e} are incompatible: rt input.rank = ${t+n.length}, but shape.rank = ${r.length}`);for(let s=1;s<n.length;++s){const i=n[s],o=r[r.length-n.length+s],a=r[o];if(i>=0)if(a>=0){if(a!==i)throw new Error(`rt input.shape and shape=${e} are incompatible: rt input.shape[${s+t}] = ${i} but shape[${s+t}] = ${a}`)}else r[o]=i}return r}function yD(t){const e={FIRST_DIM_SIZE:ns.FIRST_DIM_SIZE,VALUE_ROWIDS:ns.VALUE_ROWIDS,ROW_LENGTHS:ns.ROW_LENGTHS,ROW_SPLITS:ns.ROW_SPLITS,ROW_LIMITS:ns.ROW_LIMITS,ROW_STARTS:ns.ROW_STARTS},n=[];for(const r of t)if(r in e)n.push(e[r]);else break;return n}function vD(t){return t.length===0?0:t[0]===ns.FIRST_DIM_SIZE?t.length-1:t.length}function xD(t,e){if(t==null||e==null)return;const n=t.length,r=e.length;if(n>=r)throw new Error(`defaultValue.shape=${t} and ragged tensor flatValues.shape=${e}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${r})`);for(let s=0;s<Math.min(n,r-1);++s){const i=t[s],o=e[s+1];if(i>=0&&o>=0&&i!==1&&i!==o)throw new Error(`defaultValue.shape=${t}, and ragged tensor input flatValues.shape=${e} are incompatible: defaultValue.shape[${s-t.length}] = ${i} but ragged tensor input.flatValues.shape[${s-t.length}] = ${o}`)}}/**
4780 * @license
4781 * Copyright 2017 Google LLC. All Rights Reserved.
4782 * Licensed under the Apache License, Version 2.0 (the "License");
4783 * you may not use this file except in compliance with the License.
4784 * You may obtain a copy of the License at
4785 *
4786 * http://www.apache.org/licenses/LICENSE-2.0
4787 *
4788 * Unless required by applicable law or agreed to in writing, software
4789 * distributed under the License is distributed on an "AS IS" BASIS,
4790 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4791 * See the License for the specific language governing permissions and
4792 * limitations under the License.
4793 * =============================================================================
4794 */const rw=30;function wm(t){return t<=rw?t:w0(t,Math.floor(Math.sqrt(t)))}/**
4795 * @license
4796 * Copyright 2020 Google LLC. All Rights Reserved.
4797 * Licensed under the Apache License, Version 2.0 (the "License");
4798 * you may not use this file except in compliance with the License.
4799 * You may obtain a copy of the License at
4800 *
4801 * http://www.apache.org/licenses/LICENSE-2.0
4802 *
4803 * Unless required by applicable law or agreed to in writing, software
4804 * distributed under the License is distributed on an "AS IS" BASIS,
4805 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4806 * See the License for the specific language governing permissions and
4807 * limitations under the License.
4808 * =============================================================================
4809 */function wD(t,e,n){const r=n*(typeof t=="number"?t:t[0]),s=e*(typeof t=="number"?t:t[1]);return[r,s]}/**
4810 * @license
4811 * Copyright 2018 Google LLC. All Rights Reserved.
4812 * Licensed under the Apache License, Version 2.0 (the "License");
4813 * you may not use this file except in compliance with the License.
4814 * You may obtain a copy of the License at
4815 *
4816 * http://www.apache.org/licenses/LICENSE-2.0
4817 *
4818 * Unless required by applicable law or agreed to in writing, softw
vendor: 8,838 bytes, lines 4818-4900
4818are
4819 * distributed under the License is distributed on an "AS IS" BASIS,
4820 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4821 * See the License for the specific language governing permissions and
4822 * limitations under the License.
4823 * =============================================================================
4824 */function sw(t,e,n,r=!0){let s=[];if(r)s=s.concat(e.slice(0)),s.push(t[0]/n),s=s.concat(t.slice(1));else{s=s.concat(t[0]);const i=e.length;for(let o=0;o<i;++o)s=s.concat([t[o+1]/e[o],e[o]]);s=s.concat(t.slice(i+1))}return s}function iw(t,e,n=!0){const r=[];if(n){r.push(e);for(let s=e+1;s<t;++s)s<=2*e?(r.push(s),r.push(s-(e+1))):r.push(s)}else{const s=[],i=[];for(let o=1;o<t;++o)o>=e*2+1||o%2===1?i.push(o):s.push(o);r.push(...s),r.push(0),r.push(...i)}return r}function ow(t,e,n,r=!0){const s=[];r?s.push(t[0]/n):s.push(t[0]*n);for(let i=1;i<t.length;++i)i<=e.length?r?s.push(e[i-1]*t[i]):s.push(t[i]/e[i-1]):s.push(t[i]);return s}function bD(t,e){const n=[0];for(let r=0;r<e;++r)n.push(t[r][0]);return n}function _D(t,e,n){const r=t.slice(0,1);for(let s=0;s<n;++s)r.push(t[s+1]-e[s][0]-e[s][1]);return r}/**
4825 * @license
4826 * Copyright 2018 Google LLC. All Rights Reserved.
4827 * Licensed under the Apache License, Version 2.0 (the "License");
4828 * you may not use this file except in compliance with the License.
4829 * You may obtain a copy of the License at
4830 *
4831 * http://www.apache.org/licenses/LICENSE-2.0
4832 *
4833 * Unless required by applicable law or agreed to in writing, software
4834 * distributed under the License is distributed on an "AS IS" BASIS,
4835 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4836 * See the License for the specific language governing permissions and
4837 * limitations under the License.
4838 * =============================================================================
4839 */const SD=1.7580993408473768,TD=1.0507009873554805;/**
4840 * @license
4841 * Copyright 2018 Google LLC. All Rights Reserved.
4842 * Licensed under the Apache License, Version 2.0 (the "License");
4843 * you may not use this file except in compliance with the License.
4844 * You may obtain a copy of the License at
4845 *
4846 * http://www.apache.org/licenses/LICENSE-2.0
4847 *
4848 * Unless required by applicable law or agreed to in writing, software
4849 * distributed under the License is distributed on an "AS IS" BASIS,
4850 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4851 * See the License for the specific language governing permissions and
4852 * limitations under the License.
4853 * =============================================================================
4854 */const CD=.3275911,ND=.254829592,ED=-.284496736,kD=1.421413741,$D=-1.453152027,ID=1.061405429;/**
4855 * @license
4856 * Copyright 2018 Google LLC. All Rights Reserved.
4857 * Licensed under the Apache License, Version 2.0 (the "License");
4858 * you may not use this file except in compliance with the License.
4859 * You may obtain a copy of the License at
4860 *
4861 * http://www.apache.org/licenses/LICENSE-2.0
4862 *
4863 * Unless required by applicable law or agreed to in writing, software
4864 * distributed under the License is distributed on an "AS IS" BASIS,
4865 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4866 * See the License for the specific language governing permissions and
4867 * limitations under the License.
4868 * =============================================================================
4869 */function G0(t,e){if(t.length!==e.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${t.length}, imag: ${e.length}.`);const n=new Float32Array(t.length*2);for(let r=0;r<n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n}function _J(t){const e=new Float32Array(t.length/2),n=new Float32Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}}function SJ(t){const e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e);for(let s=0;s<t.length;s+=4)n[Math.floor(s/4)]=t[s],r[Math.floor(s/4)]=t[s+1];return{real:n,imag:r}}function TJ(t){const e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e);for(let s=2;s<t.length;s+=4)n[Math.floor(s/4)]=t[s],r[Math.floor(s/4)]=t[s+1];return{real:n,imag:r}}function CJ(t,e){const n=t[e*2],r=t[e*2+1];return{real:n,imag:r}}function NJ(t,e,n,r){t[r*2]=e,t[r*2+1]=n}function EJ(t,e){const n=new Float32Array(t/2),r=new Float32Array(t/2);for(let s=0;s<Math.ceil(t/2);s++){const i=(e?2:-2)*Math.PI*(s/t);n[s]=Math.cos(i),r[s]=Math.sin(i)}return{real:n,imag:r}}function kJ(t,e,n){const r=(n?2:-2)*Math.PI*(t/e),s=Math.cos(r),i=Math.sin(r);return{real:s,imag:i}}/**
4870 * @license
4871 * Copyright 2021 Google LLC. All Rights Reserved.
4872 * Licensed under the Apache License, Version 2.0 (the "License");
4873 * you may not use this file except in compliance with the License.
4874 * You may obtain a copy of the License at
4875 *
4876 * http://www.apache.org/licenses/LICENSE-2.0
4877 *
4878 * Unless required by applicable law or agreed to in writing, software
4879 * distributed under the License is distributed on an "AS IS" BASIS,
4880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4881 * See the License for the specific language governing permissions and
4882 * limitations under the License.
4883 * =============================================================================
4884 */const Mg="->",$J=/->/g,NT=",",ET="...";function AD(t,e){t=t.replace(/\s/g,"");const n=(t.length-t.replace($J,"").length)/Mg.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${Mg}").`);const[r,s]=t.split(Mg);A(r.indexOf(ET)===-1,()=>`The ellipsis notation ("${ET}") is not supported yet.`);const i=r.split(NT),o=i.length;if(e!==o)throw new Error(`Expected ${o} input tensors, received ${e}`);if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const a=[];for(let d=0;d<s.length;++d){const f=s[d];if(!i.some(p=>p.indexOf(f)!==-1))throw new Error(`Output subscripts contain the label ${f} not present in the input subscripts.`);a.indexOf(f)===-1&&a.push(f)}for(let d=0;d<r.length;++d){const f=r[d];a.indexOf(f)===-1&&f!==NT&&a.push(f)}const u=new Array(i.length);for(let d=0;d<o;++d){if(new Set(i[d].split("")).size!==i[d].length)throw new Error(`Found duplicate axes in input component ${i[d]}. Support for duplicate axes in input is not implemented yet.`);u[d]=[];for(let f=0;f<i[d].length;++f)u[d].push(a.indexOf(i[d][f]))}const l=a.length,c=s.length,h=[];for(let d=c;d<l;++d)h.push(d);return{allDims:a,summedDims:h,idDims:u}}function RD(t,e){let n=new Array(t);n.fill(-1);for(let s=0;s<e.length;++s)n[e[s]]=s;const r=[];for(let s=0;s<t;++s)n[s]===-1&&r.push(s);return n=n.filter(s=>s!==-1),{permutationIndices:n,expandDims:r}}function OD(t,e,n){const r=new Array(t);for(let s=0;s<n.length;++s){const i=n[s].shape;for(let o=0;o<e[s].length;++o)r[e[s][o]]===void 0?r[e[s][o]]=i[o]:A(r[e[s][o]]===i[o],()=>`Expected dimension ${r[e[s][o]]} at axis ${o} of input shaped ${JSON.stringify(i)}, but got dimension ${i[o]}`)}}function DD(t,e){const n=t,r=[];let s=0;t.length===0&&n.push(-1),s=t.length+1;for(let o=0;o<s;++o)r.push([]);const i=[];for(let o=0;o<n.length;++o){const a=n[o],u=IJ(e,a);for(const l of u)i.indexOf(l)===-1&&(r[o].push(l),i.push(l))}return{path:n,steps:r}}function PD(t){return t.every((e,n)=>e===n)}function IJ(t,e){const n=[];for(let r=0;r<t.length;++r)(t[r].length===0||t[r].indexOf(e)!==-1||e===-1)&&n.push(r);return n}function FD(t,e,n=0){let r=[];if(typeof e=="number")A(t.shape[n]%e===0,()=>"Number of splits must evenly divide the axis."),r=new Array(e).fill(t.shape[n]/e);else{const s=e.reduce((o,a)=>(a===-1&&(o+=1),o),0);A(s<=1,()=>"There should be only one negative value in split array.");const i=e.indexOf(-1);if(i!==-1){const o=e.reduce((a,u)=>u>0?a+u:a);e[i]=t.shape[n]-o}A(t.shape[n]===e.reduce((o,a)=>o+a),()=>"The sum of sizes must match the size of the axis dimension."),r=e}return r}/**
4885 * @license
4886 * Copyright 2021 Google LLC. All Rights Reserved.
4887 * Licensed under the Apache License, Version 2.0 (the "License");
4888 * you may not use this file except in compliance with the License.
4889 * You may obtain a copy of the License at
4890 *
4891 * http://www.apache.org/licenses/LICENSE-2.0
4892 *
4893 * Unless required by applicable law or agreed to in writing, software
4894 * distributed under the License is distributed on an "AS IS" BASIS,
4895 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4896 * See the License for the specific language governing permissions and
4897 * limitations under the License.
4898 * =============================================================================
4899 */function LD(t){return`Received SparseTensor with denseShape[0] = 0 but
4900  indices.shape[0] = ${t}`}function MD(t,e){return`indices(${t}, 0) is invalid: ${e} < 0`}function VD(t,e,n){return`indices(${t}
4900, 0) is invalid: ${e} >= ${n}`}/**
4901 * @license
4902 * Copyright 2021 Google LLC. All Rights Reserved.
4903 * Licensed under the Apache License, Version 2.0 (the "License");
4904 * you may not use this file except in compliance with the License.
4905 * You may obtain a copy of the License at
4906 *
4907 * http://www.apache.org/licenses/LICENSE-2.0
4908 *
4909 * Unless required by applicable law or agreed to in writing, software
4910 * distributed under the License is distributed on an "AS IS" BASIS,
4911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4912 * See the License for the specific language governing permissions and
4913 * limitations under the License.
4914 * =============================================================================
4915 */function BD(t,e){return`only one output dimension may be -1, not both ${t} and ${e}`}function WD(t,e){return`size ${t} must be non-negative, not ${e}`}function UD(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function zD(t,e){const n=ne(t),r=ne(e);return`Input to reshape is a SparseTensor with ${n}
4916  dense values, but the requested shape requires a multiple of ${r}. inputShape=${t} outputShape= ${e}`}function jD(t,e){const n=ne(t),r=ne(e);return`Input to reshape is a tensor with ${n} dense values, but the requested shape has ${r}. inputShape=${t} outputShape=${e}`}/**
4917 * @license
4918 * Copyright 2021 Google LLC. All Rights Reserved.
4919 * Licensed under the Apache License, Version 2.0 (the "License");
4920 * you may not use this file except in compliance with the License.
4921 * You may obtain a copy of the License at
4922 *
4923 * http://www.apache.org/licenses/LICENSE-2.0
4924 *
4925 * Unless required by applicable law or agreed to in writing, software
4926 * distributed under the License is distributed on an "AS IS" BASIS,
4927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4928 * See the License for the specific language governing permissions and
4929 * limitations under the License.
4930 * =============================================================================
4931 */function H0(){return"segment ids must be >= 0"}function GD(){return"segment ids are not increasing"}function HD(t,e){return`Segment id ${t} out of range [0, ${e}), possibly because segmentIds input is not sorted.`}function qD(t,e,n){return`Bad: indices[${t}] == ${e} out of range [0, ${n})`}/**
4932 * @license
4933 * Copyright 2018 Google LLC. All Rights Reserved.
4934 * Licensed under the Apache License, Version 2.0 (the "License");
4935 * you may not use this file except in compliance with the License.
4936 * You may obtain a copy of the License at
4937 *
4938 * http://www.apache.org/licenses/LICENSE-2.0
4939 *
4940 * Unless required by applicable law or agreed to in writing, software
4941 * distributed under the License is distributed on an "AS IS" BASIS,
4942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4943 * See the License for the specific language governing permissions and
4944 * limitations under the License.
4945 * =============================================================================
4946 */function KD(t,e){let n=!1,r;for(t<=rw?(r=t,n=!0):r=w0(t,Math.floor(Math.sqrt(t)));!n;)r>e||r===t?n=!0:r=w0(t,r+1);return r}function XD(t,e,n){const r=[],s=t.length;for(let i=0;i<s;i++)i!==e?r.push(t[i]):r.push(n);return r}function YD(t,e,n,r){const s=e.shape.length,i=t.shape.length;if(r!==0&&(r<-s||r>s))throw new Error(`Expect batchDims in the range of [-${s}, ${s}], but got ${r}`);if(r<0&&(r+=s),r>i)throw new Error(`batchDims (${r}) must be less than rank(x) (
4947    ${i}).`);if(n<r)throw new Error(`batchDims (${r}) must be less than or equal to axis (${n}).`);for(let h=0;h<r;++h)if(t.shape[h]!==e.shape[h])throw new Error(`x.shape[${h}]: ${t.shape[h]} should be equal to indices.shape[${h}]: ${e.shape[h]}.`);const o=t.shape[n],a=[];let u=1,l=1,c=1;for(let h=0;h<r;++h)a.push(t.shape[h]),u*=t.shape[h];for(let h=r;h<n;h++)a.push(t.shape[h]),l*=t.shape[h];for(let h=r;h<s;h++)a.push(e.shape[h]);for(let h=n+1;h<i;h++)a.push(t.shape[h]),c*=t.shape[h];return{batchSize:u,sliceSize:c,outerSize:l,dimSize:o,outputShape:a}}const AJ=Object.freeze(Object.defineProperty({__proto__:null,collectGatherOpShapeInfo:YD,computeOutShape:XD,segOpComputeOptimalWindowSize:KD},Symbol.toStringTag,{value:"Module"}));/**
4948 * @license
4949 * Copyright 2018 Google LLC. All Rights Reserved.
4950 * Licensed under the Apache License, Version 2.0 (the "License");
4951 * you may not use this file except in compliance with the License.
4952 * You may obtain a copy of the License at
4953 *
4954 * http://www.apache.org/licenses/LICENSE-2.0
4955 *
4956 * Unless required by applicable law or agreed to in writing, software
4957 * distributed under the License is distributed on an "AS IS" BASIS,
4958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4959 * See the License for the specific language governing permissions and
4960 * limitations under the License.
4961 * =============================================================================
4962 */function el(t){try{return t.map(e=>Qu(e))}catch(e){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`)}}function QD(t){return t.map(e=>na(e))}const RJ=Object.freeze(Object.defineProperty({__proto__:null,ERF_A1:ND,ERF_A2:ED,ERF_A3:kD,ERF_A4:$D,ERF_A5:ID,ERF_P:CD,PARALLELIZE_THRESHOLD:rw,get RowPartitionType(){return ns},SELU_SCALE:TD,SELU_SCALEALPHA:SD,applyActivation:ym,assertAndGetBroadcastShape:Le,assertAxesAreInnerMostDims:ws,assertParamsConsistent:mD,assignToTypedArray:NJ,axesAreInnerMostDims:P1,calculateShapes:pm,checkEinsumDimSizes:OD,checkPadOnDimRoundingMode:Wr,combineLocations:mO,combineRaggedTensorToTensorShapes:gD,complexWithEvenIndex:SJ,complexWithOddIndex:TJ,computeConv2DInfo:yr,computeConv3DInfo:bh,computeDefaultPad:O1,computeDilation2DInfo:oO,computeOptimalWindowSize:wm,computeOutAndReduceShapes:qs,computeOutShape:Ta,computePool2DInfo:Da,computePool3DInfo:wh,convertConv2DDataFormat:gl,decodeEinsumEquation:AD,eitherStridesOrDilationsAreOne:tr,expandShapeToKeepDim:vr,exponent:kJ,exponents:EJ,fromStringArrayToUint8:QD,fromUint8ToStringArray:el,getAxesPermutation:Ur,getBroadcastDims:Kf,getComplexWithIndex:CJ,getEinsumComputePath:DD,getEinsumPermutation:RD,getFusedBiasGradient:gm,getFusedDyActivation:mm,getImageCenter:wD,getInnerMostAxes:zr,getPermuted:iw,getRaggedRank:vD,getReductionAxes:dO,getReshaped:sw,getReshapedPermuted:ow,getRowPartitionTypesHelper:yD,getSliceBeginCoords:bD,getSliceSize:_D,getSparseFillEmptyRowsIndicesDenseShapeMismatch:LD,getSparseFillEmptyRowsNegativeIndexErrorMessage:MD,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:VD,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:UD,getSparseReshapeInputOutputMismatchErrorMessage:jD,getSparseReshapeInputOutputMultipleErrorMessage:zD,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:BD,getSparseReshapeNegativeOutputDimErrorMessage:WD,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:qD,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:H0,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:GD,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:HD,getUndoAxesPermutation:F1,isIdentityPermutation:PD,log:E5,mergeRealAndImagArrays:G0,prepareAndValidate:nD,prepareSplitSize:FD,segment_util:AJ,shouldFuse:vm,slice_util:xJ,splitRealAndImagArrays:_J,stridesOrDilationsArePositive:wa,tupleValuesAreOne:Uc,upcastType:zs,validateDefaultValueShape:xD,validateInput:Y1,validateUpdateShape:BO,warn:ss},Symbol.toStringTag,{value:"Module"}));/**
4963 * @license
4964 * Copyright 2017 Google LLC. All Rights Reserved.
4965 * Licensed under the Apache License, Version 2.0 (the "License");
4966 * you may not use this file except in compliance with the License.
4967 * You may obtain a copy of the License at
4968 *
4969 * http://www.apache.org/licenses/LICENSE-2.0
4970 *
4971 * Unless required by applicable law or agreed to in writing, software
4972 * distributed under the License is distributed on an "AS IS" BASIS,
4973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4974 * See the License for the specific language governing permissions and
4975 * limitations under the License.
4976 * =============================================================================
4977 */qZ();/**
4978 * @license
4979 * Copyright 2021 Google LLC. All Rights Reserved.
4980 * Licensed under the Apache License, Version 2.0 (the "License");
4981 * you may not use this file except in compliance with the License.
4982 * You may obtain a copy of the License at
4983 *
4984 * http://www.apache.org/licenses/LICENSE-2.0
4985 *
4986 * Unless required by applicable law or agreed to in writing, softw
4986are
4987 * distributed under the License is distributed on an "AS IS" BASIS,
4988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4989 * See the License for the specific language governing permissions and
4990 * limitations under the License.
4991 * =============================================================================
4992 */const OJ=U();OJ.registerFlag("KEEP_INTERMEDIATE_TENSORS",()=>!1,t=>{t&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")});/**
4993 * @license
4994 * Copyright 2019 Google LLC. All Rights Reserved.
4995 * Licensed under the Apache License, Version 2.0 (the "License");
4996 * you may not use this file except in compliance with the License.
4997 * You may obtain a copy of the License at
4998 *
4999 * http://www.apache.org/licenses/LICENSE-2.0
5000 *
5001 * Unless required by applicable law or agreed to in writing, software
5002 * distributed under the License is distributed on an "AS IS" BASIS,
5003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5004 * See the License for the specific language governing permissions and
5005 * limitations under the License.
5006 *
5007 * =============================================================================
5008 */var Wn;(function(t){t[t.DT_INVALID=0]="DT_INVALID",t[t.DT_FLOAT=1]="DT_FLOAT",t[t.DT_DOUBLE=2]="DT_DOUBLE",t[t.DT_INT32=3]="DT_INT32",t[t.DT_UINT8=4]="DT_UINT8",t[t.DT_INT16=5]="DT_INT16",t[t.DT_INT8=6]="DT_INT8",t[t.DT_STRING=7]="DT_STRING",t[t.DT_COMPLEX64=8]="DT_COMPLEX64",t[t.DT_INT64=9]="DT_INT64",t[t.DT_BOOL=10]="DT_BOOL",t[t.DT_QINT8=11]="DT_QINT8",t[t.DT_QUINT8=12]="DT_QUINT8",t[t.DT_QINT32=13]="DT_QINT32",t[t.DT_BFLOAT16=14]="DT_BFLOAT16",t[t.DT_QINT16=15]="DT_QINT16",t[t.DT_QUINT16=16]="DT_QUINT16",t[t.DT_UINT16=17]="DT_UINT16",t[t.DT_COMPLEX128=18]="DT_COMPLEX128",t[t.DT_HALF=19]="DT_HALF",t[t.DT_RESOURCE=20]="DT_RESOURCE",t[t.DT_VARIANT=21]="DT_VARIANT",t[t.DT_UINT32=22]="DT_UINT32",t[t.DT_UINT64=23]="DT_UINT64",t[t.DT_FLOAT_REF=101]="DT_FLOAT_REF",t[t.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",t[t.DT_INT32_REF=103]="DT_INT32_REF",t[t.DT_UINT8_REF=104]="DT_UINT8_REF",t[t.DT_INT16_REF=105]="DT_INT16_REF",t[t.DT_INT8_REF=106]="DT_INT8_REF",t[t.DT_STRING_REF=107]="DT_STRING_REF",t[t.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",t[t.DT_INT64_REF=109]="DT_INT64_REF",t[t.DT_BOOL_REF=110]="DT_BOOL_REF",t[t.DT_QINT8_REF=111]="DT_QINT8_REF",t[t.DT_QUINT8_REF=112]="DT_QUINT8_REF",t[t.DT_QINT32_REF=113]="DT_QINT32_REF",t[t.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",t[t.DT_QINT16_REF=115]="DT_QINT16_REF",t[t.DT_QUINT16_REF=116]="DT_QUINT16_REF",t[t.DT_UINT16_REF=117]="DT_UINT16_REF",t[t.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",t[t.DT_HALF_REF=119]="DT_HALF_REF",t[t.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",t[t.DT_VARIANT_REF=121]="DT_VARIANT_REF",t[t.DT_UINT32_REF=122]="DT_UINT32_REF",t[t.DT_UINT64_REF=123]="DT_UINT64_REF"})(Wn||(Wn={}));var kT;(function(t){(function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"})(t.CheckpointFormatVersion||(t.CheckpointFormatVersion={}))})(kT||(kT={}));/**
5009 * @license
5010 * Copyright 2019 Google LLC. All Rights Reserved.
5011 * Licensed under the Apache License, Version 2.0 (the "License");
5012 * you may not use this file except in compliance with the License.
5013 * You may obtain a copy of the License at
5014 *
5015 * http://www.apache.org/licenses/LICENSE-2.0
5016 *
5017 * Unless required by applicable law or agreed to in writing, software
5018 * distributed under the License is distributed on an "AS IS" BASIS,
5019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5020 * See the License for the specific language governing permissions and
5021 * limitations under the License.
5022 * =============================================================================
5023 */const DJ={};function ZD(t){return DJ[t]}/**
5024 * @license
5025 * Copyright 2018 Google LLC. All Rights Reserved.
5026 * Licensed under the Apache License, Version 2.0 (the "License");
5027 * you may not use this file except in compliance with the License.
5028 * You may obtain a copy of the License at
5029 *
5030 * http://www.apache.org/licenses/LICENSE-2.0
5031 *
5032 * Unless required by applicable law or agreed to in writing, softw
5032are
5033 * distributed under the License is distributed on an "AS IS" BASIS,
5034 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5035 * See the License for the specific language governing permissions and
5036 * limitations under the License.
5037 * =============================================================================
5038 */function S(t,e,n,r,s){const i=e.inputParams[t];if(i&&i.inputIndexStart!==void 0){const a=i.inputIndexStart,u=i.inputIndexEnd===0?void 0:i.inputIndexEnd===void 0?a+1:i.inputIndexEnd,l=a<0?e.inputNames.length+a:a;if(i.type==="tensor")return Kt(e.inputNames[l],n,r,s);if(i.type==="tensors"){const d=e.inputs.slice(a,u);return e.inputNames.slice(a,u).filter((p,y)=>{var v;return((v=d[y])===null||v===void 0?void 0:v.op)!=="NoOp"}).map(p=>Kt(p,n,r,s))}const c=Kt(e.inputNames[l],n,r,s),h=c.dataSync();return i.type==="number"?h[0]:b0(c.shape,h)}const o=e.attrParams[t];return o&&o.value}function Kt(t,e,n,r){const[s,i]=Un(t,n);if(r!=null){const a=r.getHashTableHandleByName(s);if(a!=null)return a}const o=n.currentContextIds.find(a=>!!e[Jf(s,a)]);return o!==void 0?e[Jf(s,o)][i]:void 0}function $T(t,e,n){return e[Jf(t,n.currentContextId)]}function Js(t,e){const[n,r,s]=Un(t,e);return[Jf(n,e&&e.currentContextId),r,s]}function Jf(t,e){return e?`${t}-${e}`:t}function Un(t,e){if(t==="")return["",0,void 0];const n=e!=null&&e.parseNodeNameCache!=null;if(n){const i=e.parseNodeNameCache.get(t);if(i!=null)return i}const r=t.split(":");let s;if(r.length===1)s=[t,0,void 0];else{const i=r[0],o=r.length===3?r[1]:void 0,a=Number(r[r.length-1]);s=[i,a,o]}return n&&e.parseNodeNameCache.set(t,s),s}function qd(t,e,n){let r=S("pad",t,e,n);if(r==="explicit"){r=S("explicitPaddings",t,e,n);const s=[[0,0],[0,0],[0,0],[0,0]];for(let i=0;i<4;i++)s[i][0]=r[i*2],s[i][1]=r[i*2+1];return s}return r}function ei(t){return t.kept?t:no(t)}/**
5039 * @license
5040 * Copyright 2023 Google LLC. All Rights Reserved.
5041 * Licensed under the Apache License, Version 2.0 (the "License");
5042 * you may not use this file except in compliance with the License.
5043 * You may obtain a copy of the License at
5044 *
5045 * http://www.apache.org/licenses/LICENSE-2.0
5046 *
5047 * Unless required by applicable law or agreed to in writing, software
5048 * distributed under the License is distributed on an "AS IS" BASIS,
5049 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5050 * See the License for the specific language governing permissions and
5051 * limitations under the License.
5052 * =============================================================================
5053 */const PJ=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
5053]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],FJ=Object.freeze(Object.defineProperty({__proto__:null,json:PJ},Symbol.toStringTag,{value:"Module"}));/**
5054 * @license
5055 * Copyright 2023 Google LLC. All Rights Reserved.
5056 * Licensed under the Apache License, Version 2.0 (the "License");
5057 * you may not use this file except in compliance with the License.
5058 * You may obtain a copy of the License at
5059 *
5060 * http://www.apache.org/licenses/LICENSE-2.0
5061 *
5062 * Unless required by applicable law or agreed to in writing, software
5063 * distributed under the License is distributed on an "AS IS" BASIS,
5064 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5065 * See the License for the specific language governing permissions and
5066 * limitations under the License.
5067 * =============================================================================
5068 */const LJ=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
5068]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
5068]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],MJ=Object.freeze(Object.defineProperty({__proto__:null,json:LJ},Symbol.toStringTag,{value:"Module"}));/**
5069 * @license
5070 * Copyright 2023 Google LLC. All Rights Reserved.
5071 * Licensed under the Apache License, Version 2.0 (the "License");
5072 * you may not use this file except in compliance with the License.
5073 * You may obtain a copy of the License at
5074 *
5075 * http://www.apache.org/licenses/LICENSE-2.0
5076 *
5077 * Unless required by applicable law or agreed to in writing, software
5078 * distributed under the License is distributed on an "AS IS" BASIS,
5079 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5080 * See the License for the specific language governing permissions and
5081 * limitations under the License.
5082 * =============================================================================
5083 */const VJ
vendor: 7,590 bytes, line 5083
5083=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}],
5083BJ=Object.freeze(Object.defineProperty({__proto__:null,json:VJ},Symbol.toStringTag,{value:"Module"}));/**
5084 * @license
5085 * Copyright 2023 Google LLC. All Rights Reserved.
5086 * Licensed under the Apache License, Version 2.0 (the "License");
5087 * you may not use this file except in compliance with the License.
5088 * You may obtain a copy of the License at
5089 *
5090 * http://www.apache.org/licenses/LICENSE-2.0
5091 *
5092 * Unless required by applicable law or agreed to in writing, software
5093 * distributed under the License is distributed on an "AS IS" BASIS,
5094 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5095 * See the License for the specific language governing permissions and
5096 * limitations under the License.
5097 * =============================================================================
5098 */const WJ=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
vendor: 4,262 bytes, lines 5098-5101
5098,{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],UJ=Object.freeze(Object.defineProperty({__proto__:null,json:WJ},Symbol.toStringTag,{value:"Module"}));/**
5099 * @license
5100 * Copyright 2023 Google LLC. All Rights Reserved.
5101 * Licensed under the Apache License, Version 2.0 (the "License");
5102 * you may not use this file except in compliance with the License.
5103 * You may obtain a copy of the License at
5104 *
5105 * http://www.apache.org/licenses/LICENSE-2.0
5106 *
5107 * Unless required by applicable law or agreed to in writing, software
5108 * distributed under the License is distributed on an "AS IS" BASIS,
5109 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5110 * See the License for the specific language governing permissions and
5111 * limitations under the License.
5112 * =============================================================================
5113 */const zJ=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],jJ=Object.freeze(Object.defineProperty({__proto__:null,json:zJ},Symbol.toStringTag,{value:"Module"}));/**
5114 * @license
5115 * Copyright 2023 Google LLC. All Rights Reserved.
5116 * Licensed under the Apache License, Version 2.0 (the "License");
5117 * you may not use this file except in compliance with the License.
5118 * You may obtain a copy of the License at
5119 *
5120 * http://www.apache.org/licenses/LICENSE-2.0
5121 *
5122 * Unless required by applicable law or agreed to in writing, software
5123 * distributed under the License is distributed on an "AS IS" BASIS,
5124 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5125 * See the License for the specific language governing permissions and
5126 * limitations under the License.
5127 * =============================================================================
5128 */const GJ=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],HJ=Object.freeze(Object.defineProperty({__proto__:null,json:GJ},Symbol.toStringTag,{value:"Module"}));/**
5129 * @license
5130 * Copyright 2023 Google LLC. All Rights Reserved.
5131 * Licensed under the Apache License, Version 2.0 (the "License");
5132 * you may not use this file except in compliance with the License.
5133 * You may obtain a copy of the License at
5134 *
5135 * http://www.apache.org/licenses/LICENSE-2.0
5136 *
5137 * Unless required by applicable law or agreed to in writing, software
5138 * distributed under the License is distributed on an "AS IS" BASIS,
5139 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5140 * See the License for the specific language governing permissions and
5141 * limitations under the License.
5142 * =============================================================================
5143 */const qJ=[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],KJ=Object.freeze(Object.defineProperty({__proto__:null,json:qJ},Symbol.toStringTag,{value:"Module"}));/**
5144 * @license
5145 * Copyright 2023 Google LLC. All Rights Reserved.
5146 * Licensed under the Apache License, Version 2.0 (the "License");
5147 * you may not use this file except in compliance with the License.
5148 * You may obtain a copy of the License at
5149 *
5150 * http://www.apache.org/licenses/LICENSE-2.0
5151 *
5152 * Unless required by applicable law or agreed to in writing, softw
5152are
5153 * distributed under the License is distributed on an "AS IS" BASIS,
5154 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5155 * See the License for the specific language governing permissions and
5156 * limitations under the License.
5157 * =============================================================================
5158 */const XJ=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],YJ=Object.freeze(Object.defineProperty({__proto__:null,json:XJ},Symbol.toStringTag,{value:"Module"}));/**
5159 * @license
5160 * Copyright 2023 Google LLC. All Rights Reserved.
5161 * Licensed under the Apache License, Version 2.0 (the "License");
5162 * you may not use this file except in compliance with the License.
5163 * You may obtain a copy of the License at
5164 *
5165 * http://www.apache.org/licenses/LICENSE-2.0
5166 *
5167 * Unless required by applicable law or agreed to in writing, software
5168 * distributed under the License is distributed on an "AS IS" BASIS,
5169 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5170 * See the License for the specific language governing permissions and
5171 * limitations under the License.
5172 * =============================================================================
5173 */const QJ=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}
5173],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],ZJ=Object.freeze(Object.defineProperty({__proto__:null,json:QJ},Symbol.toStringTag,{value:"Module"}));/**
5174 * @license
5175 * Copyright 2023 Google LLC. All Rights Reserved.
5176 * Licensed under the Apache License, Version 2.0 (the "License");
5177 * you may not use this file except in compliance with the License.
5178 * You may obtain a copy of the License at
5179 *
5180 * http://www.apache.org/licenses/LICENSE-2.0
5181 *
5182 * Unless required by applicable law or agreed to in writing, software
5183 * distributed under the License is distributed on an "AS IS" BASIS,
5184 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5185 * See the License for the specific language governing permissions and
5186 * limitations under the License.
5187 * =============================================================================
5188 */const JJ=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}],eee=Object.freeze(Object.defineProperty({__proto__:null,json:JJ},Symbol.toStringTag,{value:"Module"}));/**
5189 * @license
5190 * Copyright 2023 Google LLC. All Rights Reserved.
5191 * Licensed under the Apache License, Version 2.0 (the "License");
5192 * you may not use this file except in compliance with the License.
5193 * You may obtain a copy of the License at
5194 *
5195 * http://www.apache.org/licenses/LICENSE-2.0
5196 *
5197 * Unless required by applicable law or agreed to in writing, software
5198 * distributed under the License is distributed on an "AS IS" BASIS,
5199 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5200 * See the License for the specific language governing permissions and
5201 * limitations under the License.
5202 * =============================================================================
5203 */const tee=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
5203]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}],nee=Object.freeze(Object.defineProperty({__proto__:null,json:tee},Symbol.toStringTag,{value:"Module"}));/**
5204 * @license
5205 * Copyright 2023 Google LLC. All Rights Reserved.
5206 * Licensed under the Apache License, Version 2.0 (the "License");
5207 * you may not use this file except in compliance with the License.
5208 * You may obtain a copy of the License at
5209 *
5210 * http://www.apache.org/licenses/LICENSE-2.0
5211 *
5212 * Unless required by applicable law or agreed to in writing, software
5213 * distributed under the License is distributed on an "AS IS" BASIS,
5214 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5215 * See the License for the specific language governing permissions and
5216 * limitations under the License.
5217 * =============================================================================
5218 */const ree=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
vendor: 15,959 bytes, lines 5218-5311
5218]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}],see=Object.freeze(Object.defineProperty({__proto__:null,json:ree},Symbol.toStringTag,{value:"Module"}));/**
5219 * @license
5220 * Copyright 2023 Google LLC. All Rights Reserved.
5221 * Licensed under the Apache License, Version 2.0 (the "License");
5222 * you may not use this file except in compliance with the License.
5223 * You may obtain a copy of the License at
5224 *
5225 * http://www.apache.org/licenses/LICENSE-2.0
5226 *
5227 * Unless required by applicable law or agreed to in writing, software
5228 * distributed under the License is distributed on an "AS IS" BASIS,
5229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5230 * See the License for the specific language governing permissions and
5231 * limitations under the License.
5232 * =============================================================================
5233 */const iee=[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}],oee=Object.freeze(Object.defineProperty({__proto__:null,json:iee},Symbol.toStringTag,{value:"Module"}));/**
5234 * @license
5235 * Copyright 2023 Google LLC. All Rights Reserved.
5236 * Licensed under the Apache License, Version 2.0 (the "License");
5237 * you may not use this file except in compliance with the License.
5238 * You may obtain a copy of the License at
5239 *
5240 * http://www.apache.org/licenses/LICENSE-2.0
5241 *
5242 * Unless required by applicable law or agreed to in writing, software
5243 * distributed under the License is distributed on an "AS IS" BASIS,
5244 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5245 * See the License for the specific language governing permissions and
5246 * limitations under the License.
5247 * =============================================================================
5248 */const aee=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],uee=Object.freeze(Object.defineProperty({__proto__:null,json:aee},Symbol.toStringTag,{value:"Module"}));/**
5249 * @license
5250 * Copyright 2023 Google LLC. All Rights Reserved.
5251 * Licensed under the Apache License, Version 2.0 (the "License");
5252 * you may not use this file except in compliance with the License.
5253 * You may obtain a copy of the License at
5254 *
5255 * http://www.apache.org/licenses/LICENSE-2.0
5256 *
5257 * Unless required by applicable law or agreed to in writing, software
5258 * distributed under the License is distributed on an "AS IS" BASIS,
5259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5260 * See the License for the specific language governing permissions and
5261 * limitations under the License.
5262 * =============================================================================
5263 */const lee=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],cee=Object.freeze(Object.defineProperty({__proto__:null,json:lee},Symbol.toStringTag,{value:"Module"}));/**
5264 * @license
5265 * Copyright 2023 Google LLC. All Rights Reserved.
5266 * Licensed under the Apache License, Version 2.0 (the "License");
5267 * you may not use this file except in compliance with the License.
5268 * You may obtain a copy of the License at
5269 *
5270 * http://www.apache.org/licenses/LICENSE-2.0
5271 *
5272 * Unless required by applicable law or agreed to in writing, software
5273 * distributed under the License is distributed on an "AS IS" BASIS,
5274 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5275 * See the License for the specific language governing permissions and
5276 * limitations under the License.
5277 * =============================================================================
5278 */const hee=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],dee=Object.freeze(Object.defineProperty({__proto__:null,json:hee},Symbol.toStringTag,{value:"Module"}));/**
5279 * @license
5280 * Copyright 2023 Google LLC. All Rights Reserved.
5281 * Licensed under the Apache License, Version 2.0 (the "License");
5282 * you may not use this file except in compliance with the License.
5283 * You may obtain a copy of the License at
5284 *
5285 * http://www.apache.org/licenses/LICENSE-2.0
5286 *
5287 * Unless required by applicable law or agreed to in writing, software
5288 * distributed under the License is distributed on an "AS IS" BASIS,
5289 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5290 * See the License for the specific language governing permissions and
5291 * limitations under the License.
5292 * =============================================================================
5293 */const fee=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],pee=Object.freeze(Object.defineProperty({__proto__:null,json:fee},Symbol.toStringTag,{value:"Module"}));/**
5294 * @license
5295 * Copyright 2023 Google LLC. All Rights Reserved.
5296 * Licensed under the Apache License, Version 2.0 (the "License");
5297 * you may not use this file except in compliance with the License.
5298 * You may obtain a copy of the License at
5299 *
5300 * http://www.apache.org/licenses/LICENSE-2.0
5301 *
5302 * Unless required by applicable law or agreed to in writing, software
5303 * distributed under the License is distributed on an "AS IS" BASIS,
5304 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5305 * See the License for the specific language governing permissions and
5306 * limitations under the License.
5307 * =============================================================================
5308 */const mee=[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],gee=Object.freeze(Object.defineProperty({__proto__:null,json:mee},Symbol.toStringTag,{value:"Module"}));/**
5309 * @license
5310 * Copyright 2023 Google LLC. All Rights Reserved.
5311 * Licensed under the Apache License, Version 2.0 (the "License");
5312 * you may not use this file except in compliance with the License.
5313 * You may obtain a copy of the License at
5314 *
5315 * http://www.apache.org/licenses/LICENSE-2.0
5316 *
5317 * Unless required by applicable law or agreed to in writing, software
5318 * distributed under the License is distributed on an "AS IS" BASIS,
5319 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5320 * See the License for the specific language governing permissions and
5321 * limitations under the License.
5322 * =============================================================================
5323 */const yee=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}],vee=Object.freeze(Object.defineProperty({__proto__:null,json:yee},Symbol.toStringTag,{value:"Module"}));/**
5324 * @license
5325 * Copyright 2018 Google LLC. All Rights Reserved.
5326 * Licensed under the Apache License, Version 2.0 (the "License");
5327 * you may not use this file except in compliance with the License.
5328 * You may obtain a copy of the License at
5329 *
5330 * http://www.apache.org/licenses/LICENSE-2.0
5331 *
5332 * Unless required by applicable law or agreed to in writing, software
5333 * distributed under the License is distributed on an "AS IS" BASIS,
5334 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5335 * See the License for the specific language governing permissions and
5336 * limitations under the License.
5337 * =============================================================================
5338 */class IT{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[FJ,MJ,BJ,UJ,jJ,HJ,KJ,YJ,ZJ,eee,nee,see,oee,uee,cee,dee,pee,gee,vee],n=[].concat(...e.map(r=>r.json));this.opMappers=n.reduce((r,s)=>(r[s.tfOpName]=s,r),{})}transformGraph(e,n={}){const r=e.node,s=[],i=[],o=[],a=r.reduce((y,v)=>(y[v.name]=this.mapNode(v),v.op.startsWith("Placeholder")?s.push(y[v.name]):v.op==="Const"?i.push(y[v.name]):(v.input==null||v.input.length===0)&&o.push(y[v.name]),y),{});let u=[];const l=[];let c={},h={};n!=null&&(c=this.mapSignatureEntries(n.inputs),h=this.mapSignatureEntries(n.outputs));const d=Object.keys(a);d.forEach(y=>{const v=a[y];
5338v.inputNames.forEach((g,x)=>{const[w,,_]=Js(g),T=a[w];if(T.outputs!=null){const E=T.outputs.indexOf(_);if(E!==-1){const k=`${w}:${E}`;v.inputNames[x]=k}}v.inputs.push(T),T.children.push(v)})}),Object.keys(h).length===0?d.forEach(y=>{const v=a[y];v.children.length===0&&l.push(v)}):Object.keys(h).forEach(y=>{const[v]=Js(y),g=a[v];g!=null&&(g.signatureKey=h[y],l.push(g))}),Object.keys(c).length>0?Object.keys(c).forEach(y=>{const[v]=Js(y),g=a[v];g&&(g.signatureKey=c[y],u.push(g))}):u=s;let f={};e.library!=null&&e.library.function!=null&&(f=e.library.function.reduce((y,v)=>(y[v.signature.name]=this.mapFunction(v),y),{}));const p={nodes:a,inputs:u,outputs:l,weights:i,placeholders:s,signature:n,functions:f};return o.length>0&&(p.initNodes=o),p}mapSignatureEntries(e){return Object.keys(e||{}).reduce((n,r)=>(n[e[r].name]=r,n),{})}mapNode(e){const n=ZD(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});const r={name:e.name,op:e.op,category:n.category,inputNames:(e.input||[]).map(s=>s.startsWith("^")?s.slice(1):s),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:n.outputs};return n.inputs!=null&&(r.inputParams=n.inputs.reduce((s,i)=>(s[i.name]={type:i.type,inputIndexStart:i.start,inputIndexEnd:i.end},s),{})),n.attrs!=null&&(r.attrParams=n.attrs.reduce((s,i)=>{const o=i.type;let a;switch(i.type){case"string":a=q0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=q0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"string[]":a=ev(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=ev(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"number":a=X0(e.attr,i.tfName,i.defaultValue||0),a===void 0&&i.tfDeprecatedName&&(a=X0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"number[]":a=J0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=J0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"bool":a=K0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=K0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"bool[]":a=nv(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=nv(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"shape":a=Z0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=Z0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"shape[]":a=tv(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=tv(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"dtype":a=Y0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=Y0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"dtype[]":a=Q0(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=Q0(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"func":a=AT(e.attr,i.tfName,i.defaultValue),a===void 0&&i.tfDeprecatedName&&(a=AT(e.attr,i.tfDeprecatedName,i.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${i.type} for op: ${e.op}`)}return s[i.name]={value:a,type:o},s},{})),r}mapFunction(e){const n=e.nodeDef,r=[],s=[];let i={};n!=null&&(i=n.reduce((h,d)=>(h[d.name]=this.mapNode(d),d.op==="Const"&&s.push(h[d.name]),h),{}));const o=[],a=[];e.signature.inputArg.forEach(h=>{const[d]=Js(h.name),f={name:d,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:aw(h.type),type:"dtype"}},children:[]};f.signatureKey=h.name,o.push(f),i[d]=f}
vendor: 4,313 bytes, lines 5338-5356
5338),Object.keys(i).forEach(h=>{const d=i[h];d.inputNames.forEach((f,p)=>{const[y,,v]=Js(f),g=i[y];if(g.outputs!=null){const x=g.outputs.indexOf(v);if(x!==-1){const w=`${y}:${x}`;d.inputNames[p]=w}}d.inputs.push(g),g.children.push(d)})});const l=e.ret;e.signature.outputArg.forEach(h=>{const[d,f]=Js(l[h.name]),p=i[d];p!=null&&(p.defaultOutput=f,a.push(p))});const c=this.mapArgsToSignature(e);return{nodes:i,inputs:o,outputs:a,weights:s,placeholders:r,signature:c}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((n,r)=>(n[r.name]=this.mapArgToTensorInfo(r),n),{}),outputs:e.signature.outputArg.reduce((n,r)=>(n[r.name]=this.mapArgToTensorInfo(r,e.ret),n),{})}}mapArgToTensorInfo(e,n){let r=e.name;return n!=null&&(r=n[r]),{name:r,dtype:e.type}}}function xee(t){const e=U().global;if(typeof e.atob<"u")return e.atob(t);if(typeof Buffer<"u")return new Buffer(t,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function JD(t,e){const n=Array.isArray(t)?String.fromCharCode.apply(null,t):xee(t);return e?n:n.toLowerCase()}function q0(t,e,n,r=!1){const s=t[e];return s!=null?JD(s.s,r):n}function K0(t,e,n){const r=t[e];return r?r.b:n}function X0(t,e,n){const r=t[e]||{},s=r.i!=null?r.i:r.f!=null?r.f:n;return typeof s=="number"?s:parseInt(s,10)}function aw(t){switch(typeof t=="string"&&(t=Wn[t]),t){case Wn.DT_FLOAT:case Wn.DT_HALF:return"float32";case Wn.DT_INT32:case Wn.DT_INT64:case Wn.DT_INT8:case Wn.DT_UINT8:return"int32";case Wn.DT_BOOL:return"bool";case Wn.DT_DOUBLE:return"float32";case Wn.DT_STRING:return"string";case Wn.DT_COMPLEX64:case Wn.DT_COMPLEX128:return"complex64";default:return null}}function AT(t,e,n){const r=t[e];return r&&r.func?r.func.name:n}function Y0(t,e,n){const r=t[e];return r&&r.type?aw(r.type):n}function Q0(t,e,n){const r=t[e];return r&&r.list&&r.list.type?r.list.type.map(s=>aw(s)):n}function eP(t){if(!t.unknownRank)return t.dim!=null?t.dim.map(e=>typeof e.size=="number"?e.size:parseInt(e.size,10)):[]}function Z0(t,e,n){const r=t[e];return r&&r.shape?eP(r.shape):n}function J0(t,e,n){const r=t[e];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map(s=>typeof s=="number"?s:parseInt(s,10)):n}function ev(t,e,n,r=!1){const s=t[e];return s&&s.list&&s.list.s?s.list.s.map(i=>JD(i,r)):n}function tv(t,e,n){const r=t[e];return r&&r.list&&r.list.shape?r.list.shape.map(s=>eP(s)):n}function nv(t,e,n){const r=t[e];return r&&r.list&&r.list.b?r.list.b:n}/**
5339 * @license
5340 * Copyright 2019 Google LLC. All Rights Reserved.
5341 * Licensed under the Apache License, Version 2.0 (the "License");
5342 * you may not use this file except in compliance with the License.
5343 * You may obtain a copy of the License at
5344 *
5345 * http://www.apache.org/licenses/LICENSE-2.0
5346 *
5347 * Unless required by applicable law or agreed to in writing, software
5348 * distributed under the License is distributed on an "AS IS" BASIS,
5349 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5350 * See the License for the specific language governing permissions and
5351 * limitations under the License.
5352 * =============================================================================
5353 */class wee{constructor(e,n,r){this.node=e,this.tensorMap=n,this.context=r,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(s=>this.getInput(s)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((s,i)=>(s[i]=this.getAttr(i),s),{}))}getInput(e){return Kt(e,this.tensorMap,this.context)}getAttr(e,n){const r=this.node.rawAttrs[e];if(r.tensor!=null)return Kt(e,this.tensorMap,this.context);if(r.i!=null||r.f!=null)return X0(this.node.rawAttrs,e,n);if(r.s!=null)return q0(this.node.rawAttrs,e,n);if(r.b!=null)return K0(this.node.rawAttrs,e,n);if(r.shape!=null)return Z0(this.node.rawAttrs,e,n);if(r.type!=null)return Y0(this.node.rawAttrs,e,n);if(r.list!=null){if(r.list.i!=null||r.list.f!=null)return J0(this.node.rawAttrs,e,n);if(r.list.s!=null)return ev(this.node.rawAttrs,e,n);if(r.list.shape!=null)return tv(this.node.rawAttrs,e,n);if(r.list.b!=null)return nv(this.node.rawAttrs,e,n);if(r.list.type!=null)return Q0(this.node.rawAttrs,e,n)}return n}}/**
5354 * @license
5355 * Copyright 2020 Google LLC. All Rights Reserved.
5356 * Licensed under the Apache License, Version 2.0 (the "License");
5357 * you may not use this file except in compliance with the License.
5358 * You may obtain a copy of the License at
5359 *
5360 * http://www.apache.org/licenses/LICENSE-2.0
5361 *
5362 * Unless required by applicable law or agreed to in writing, software
5363 * distributed under the License is distributed on an "AS IS" BASIS,
5364 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5365 * See the License for the specific language governing permissions and
5366 * limitations under the License.
5367 * =============================================================================
5368 */const en=Object.freeze(Object.defineProperty({__proto__:null,OP_SCOPE_SUFFIX:GR,abs:rr,acos:Hq,acosh:Kq,add:ge,addN:Yq,all:Zq,any:e8,argMax:n8,argMin:s8,asin:o8,asinh:u8,atan:c8,atan2:d8,atanh:p8,avgPool:aO,avgPool3d:_8,basicLSTMCell:$8,batchNorm:um,batchNorm2d:D8,batchNorm3d:F8,batchNorm4d:M8,batchToSpaceND:uO,bincount:lO,bitwiseAnd:W8,booleanMaskAsync:CY,broadcastArgs:z8,broadcastTo:mc,buffer:wt,cast:vt,ceil:H8,clipByValue:cO,clone:no,complex:po,concat:Jt,concat1d:X8,concat2d:Q8,concat3d:J8,concat4d:tK,conv1d:sK,conv2d:lm,conv2dTranspose:aK,conv3d:lK,conv3dTranspose:fK,cos:mK,cosh:yK,cosineWindow:Q1,cumprod:xK,cumsum:bK,denseBincount:SK,depthToSpace:CK,depthwiseConv2d:D1,diag:kK,dilation2d:IK,div:Ae,divNoNan:PK,dot:LK,dropout:MY,einsum:Za,elu:pO,enclosingPowerOfTwo:zO,ensureShape:WK,equal:fO,erf:zK,euclideanNorm:ZK,exp:vi,expandDims:ks,expm1:nX,eye:yO,fft:K1,fill:_h,floor:vO,floorDiv:iO,fused:JY,gather:xO,gatherND:PY,greater:hm,greaterEqual:wO,ifft:Zf,imag:dm,image:xm,inTopKAsync:BY,irfft:FO,isFinite:hX,isInf:fX,isNaN:mX,leakyRelu:bO,less:W0,lessEqual:L1,linalg:RZ,linspace:xX,localResponseNormalization:bX,log:jc,log1p:_O,logSigmoid:kX,logSoftmax:AX,logSumExp:TO,logicalAnd:Xf,logicalNot:CO,logicalOr:NO,logicalXor:LX,losses:OZ,lowerBound:VX,matMul:ze,max:Au,maxPool:EO,maxPool3d:UX,maxPoolWithArgmax:jX,maximum:kO,mean:Yf,meshgrid:qX,min:B0,minimum:Qf,mirrorPad:YX,mod:ZX,moments:e7,movingAverage:kY,mul:re,multiRNNCell:n7,multinomial:s7,neg:Bs,norm:cm,notEqual:$O,oneHot:a7,ones:Xo,onesLike:l7,op:M,outerProduct:h7,pad:Sh,pad1d:p7,pad2d:g7,pad3d:v7,pad4d:w7,pool:C7,pow:zc,prelu:AO,print:sO,prod:k7,raggedGather:I7,raggedRange:R7,raggedTensorToTensor:D7,rand:F7,randomGamma:n9,randomNormal:OO,randomStandardNormal:i9,randomUniform:q1,randomUniformInt:u9,range:Gc,real:Hc,reciprocal:h9,relu:fm,relu6:DO,reshape:K,reverse:_a,reverse1d:g9,reverse2d:v9,reverse3d:w9,reverse4d:_9,rfft:X1,round:PO,rsqrt:C9,scalar:De,scatterND:IY,searchSorted:M1,selu:E9,separableConv2d:$9,setdiff1dAsync:A9,sigmoid:ra,sign:O9,signal:AZ,sin:P9,sinh:L9,slice:Ne,slice1d:V9,slice2d:W9,slice3d:z9,slice4d:G9,softmax:q9,softplus:SO,spaceToBatchND:IO,sparse:DZ,sparseToDense:OY,spectral:IZ,split:qc,sqrt:yi,square:us,squaredDifference:LO,squeeze:Ht,stack:wi,step:MO,stridedSlice:sY,string:PZ,sub:Ee,sum:et,tan:oY,tanh:V0,tensor:Vs,tensor1d:un,tensor2d:sa,tensor3d:VO,tensor4d:aY,tensor5d:uY,tensor6d:lY,tensorScatterUpdate:hY,tile:gc,topk:fY,transpose:U0,truncatedNormal:mY,unique:yY,unsortedSegmentSum:xY,unstack:Fa,upperBound:bY,variable:_Y,where:ro,whereAsync:UO,zeros:ba,zerosLike:cr},Symbol.toStringTag,{value:"Module"}));/**
5369 * @license
5370 * Copyright 2018 Google LLC. All Rights Reserved.
5371 * Licensed under the Apache License, Version 2.0 (the "License");
5372 * you may not use this file except in compliance with the License.
5373 * You may obtain a copy of the License at
5374 *
5375 * http://www.apache.org/licenses/LICENSE-2.0
5376 *
5377 * Unless required by applicable law or agreed to in writing, software
5378 * distributed under the License is distributed on an "AS IS" BASIS,
5379 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5380 * See the License for the specific language governing permissions and
5381 * limitations under the License.
5382 * =============================================================================
5383 */const bee=(t,e,n,r=en)=>{switch(t.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(S("a",t,e,n),S("b",t,e,n))];case"AddN":return[r.addN(S("tensors",t,e,n))];case"FloorMod":case"Mod":return[r.mod(S("a",t,e,n),S("b",t,e,n))];case"Mul":return[r.mul(S("a",t,e,n),S("b",t,e,n))];
vendor: 15,691 bytes, lines 5383-5451
5383case"RealDiv":case"Div":return[r.div(S("a",t,e,n),S("b",t,e,n))];case"DivNoNan":return[r.divNoNan(S("a",t,e,n),S("b",t,e,n))];case"FloorDiv":return[r.floorDiv(S("a",t,e,n),S("b",t,e,n))];case"Sub":return[r.sub(S("a",t,e,n),S("b",t,e,n))];case"Minimum":return[r.minimum(S("a",t,e,n),S("b",t,e,n))];case"Maximum":return[r.maximum(S("a",t,e,n),S("b",t,e,n))];case"Pow":return[r.pow(S("a",t,e,n),S("b",t,e,n))];case"SquaredDifference":return[r.squaredDifference(S("a",t,e,n),S("b",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5384 * @license
5385 * Copyright 2018 Google LLC. All Rights Reserved.
5386 * Licensed under the Apache License, Version 2.0 (the "License");
5387 * you may not use this file except in compliance with the License.
5388 * You may obtain a copy of the License at
5389 *
5390 * http://www.apache.org/licenses/LICENSE-2.0
5391 *
5392 * Unless required by applicable law or agreed to in writing, software
5393 * distributed under the License is distributed on an "AS IS" BASIS,
5394 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5395 * See the License for the specific language governing permissions and
5396 * limitations under the License.
5397 * =============================================================================
5398 */const _ee=(t,e,n,r=en)=>{switch(t.op){case"Abs":case"ComplexAbs":return[r.abs(S("x",t,e,n))];case"Acos":return[r.acos(S("x",t,e,n))];case"Acosh":return[r.acosh(S("x",t,e,n))];case"Asin":return[r.asin(S("x",t,e,n))];case"Asinh":return[r.asinh(S("x",t,e,n))];case"Atan":return[r.atan(S("x",t,e,n))];case"Atan2":return[r.atan2(S("x",t,e,n),S("y",t,e,n))];case"Atanh":return[r.atanh(S("x",t,e,n))];case"Ceil":return[r.ceil(S("x",t,e,n))];case"Complex":return[r.complex(S("real",t,e,n),S("imag",t,e,n))];case"Cos":return[r.cos(S("x",t,e,n))];case"Cosh":return[r.cosh(S("x",t,e,n))];case"Elu":return[r.elu(S("x",t,e,n))];case"Erf":return[r.erf(S("x",t,e,n))];case"Exp":return[r.exp(S("x",t,e,n))];case"Expm1":return[r.expm1(S("x",t,e,n))];case"Floor":return[r.floor(S("x",t,e,n))];case"Log":return[r.log(S("x",t,e,n))];case"Log1p":return[r.log1p(S("x",t,e,n))];case"Imag":return[r.imag(S("x",t,e,n))];case"Neg":return[r.neg(S("x",t,e,n))];case"Reciprocal":return[r.reciprocal(S("x",t,e,n))];case"Real":return[r.real(S("x",t,e,n))];case"Relu":return[r.relu(S("x",t,e,n))];case"Round":return[r.round(S("x",t,e,n))];case"Selu":return[r.selu(S("x",t,e,n))];case"Sigmoid":return[r.sigmoid(S("x",t,e,n))];case"Sin":return[r.sin(S("x",t,e,n))];case"Sign":return[r.sign(S("x",t,e,n))];case"Sinh":return[r.sinh(S("x",t,e,n))];case"Softplus":return[r.softplus(S("x",t,e,n))];case"Sqrt":return[r.sqrt(S("x",t,e,n))];case"Square":return[r.square(S("x",t,e,n))];case"Tanh":return[r.tanh(S("x",t,e,n))];case"Tan":return[r.tan(S("x",t,e,n))];case"ClipByValue":return[r.clipByValue(S("x",t,e,n),S("clipValueMin",t,e,n),S("clipValueMax",t,e,n))];case"Relu6":return[r.relu6(S("x",t,e,n))];case"Rsqrt":return[r.rsqrt(Kt(t.inputNames[0],e,n))];case"LeakyRelu":return[r.leakyRelu(S("x",t,e,n),S("alpha",t,e,n))];case"Prelu":return[r.prelu(S("x",t,e,n),S("alpha",t,e,n))];case"IsNan":return[r.isNaN(Kt(t.inputNames[0],e,n))];case"IsInf":return[r.isInf(Kt(t.inputNames[0],e,n))];case"IsFinite":return[r.isFinite(Kt(t.inputNames[0],e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5399 * @license
5400 * Copyright 2020 Google LLC. All Rights Reserved.
5401 * Licensed under the Apache License, Version 2.0 (the "License");
5402 * you may not use this file except in compliance with the License.
5403 * You may obtain a copy of the License at
5404 *
5405 * http://www.apache.org/licenses/LICENSE-2.0
5406 *
5407 * Unless required by applicable law or agreed to in writing, software
5408 * distributed under the License is distributed on an "AS IS" BASIS,
5409 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5410 * See the License for the specific language governing permissions and
5411 * limitations under the License.
5412 * =============================================================================
5413 */function Cr(t,e,n=""){if(!(typeof t=="number"||typeof e=="number")){A(t.length===e.length,()=>n+` Shapes ${t} and ${e} must match`);for(let r=0;r<t.length;r++){const s=t[r],i=e[r];A(s<0||i<0||s===i,()=>n+` Shapes ${t} and ${e} must match`)}}}function RT(t){return!(typeof t=="number"||t.some(e=>e<0))}function jl(t,e,n){let r=rv(t,n);const s=!RT(r);if(s&&e.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${r}`);if(s&&e.forEach(i=>{r=rv(i.shape,r)}),!RT(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function rv(t,e){if(typeof t=="number")return e;if(typeof e=="number")return t;if(t.length!==e.length)throw new Error(`Incompatible ranks during merge: ${t} vs. ${e}`);const n=[];for(let r=0;r<t.length;++r){const s=t[r],i=e[r];if(s>=0&&i>=0&&s!==i)throw new Error(`Incompatible shape during merge: ${t} vs. ${e}`);n[r]=s>=0?s:i}return n}/**
5414 * @license
5415 * Copyright 2018 Google LLC. All Rights Reserved.
5416 * Licensed under the Apache License, Version 2.0 (the "License");
5417 * you may not use this file except in compliance with the License.
5418 * You may obtain a copy of the License at
5419 *
5420 * http://www.apache.org/licenses/LICENSE-2.0
5421 *
5422 * Unless required by applicable law or agreed to in writing, software
5423 * distributed under the License is distributed on an "AS IS" BASIS,
5424 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5425 * See the License for the specific language governing permissions and
5426 * limitations under the License.
5427 * =============================================================================
5428 */class See{constructor(e,n,r,s,i,o,a){this.name=e,this.dtype=n,this.maxSize=r,this.elementShape=s,this.identicalElementShapes=i,this.dynamicSize=o,this.clearAfterRead=a,this.tensors=[],this.closed_=!1,this.idTensor=De(0),Is(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(n=>{(e==null||!e.has(n.tensor.id))&&n.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);const n=this.tensors[e];if(n.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(n.cleared=!0),n.read=!0,n.tensor}readMany(e){return e.map(n=>this.read(n))}write(e,n){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);const r=this.tensors[e]||{};if(n.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e},
5429          because the value dtype is ${n.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=n.shape),Cr(this.elementShape,n.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),r.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(r.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);r.tensor=n,Is(n),r.written=!0,this.tensors[e]=r}writeMany(e,n){if(e.length!==n.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${n.length}.`);e.forEach((r,s)=>this.write(r,n[s]))}gather(e,n){if(n&&n!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${n}`);if(e)e=e.slice(0,this.size());else{e=[];for(let s=0;s<this.size();s++)e.push(s)}if(e.length===0)return Vs([],[0].concat(this.elementShape));const r=this.readMany(e);return Cr(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),wi(r,0)}concat(e){if(e&&e!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${e}`);if(this.size()===0)return Vs([],[0].concat(this.elementShape));const n=[];for(let s=0;s<this.size();s++)n.push(s);const r=this.readMany(n);return Cr(this.elementShape,r[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${r[0].shape})`),Jt(r,0)}scatter(e,n){if(n.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${n.dtype}`);if(e.length!==n.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${n.shape[0]}`);const r=Math.max(...e);if(!this.dynamicSize&&r>=this.maxSize)throw new Error(`Max index must be < array size (${r}  vs. ${this.maxSize})`);this.writeMany(e,Fa(n,0))}split(e,n){if(n.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${n.dtype}`);let r=0;const s=e.map(u=>(r+=u,r));if(r!==n.shape[0])throw new Error(`Expected sum of lengths to be equal to
5430          tensor.shape[0], but sum of lengths is
5431        ${r}, and tensor's shape is: ${n.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);const i=r===0?0:n.size/r,o=[];$e(()=>{n=K(n,[1,r,i]);for(let u=0;u<e.length;++u){const c=[0,u===0?0:s[u-1],0],h=[1,e[u],i];o[u]=K(Ne(n,c,h),this.elementShape)}return o});const a=[];for(let u=0;u<e.length;u++)a[u]=u;this.writeMany(a,o)}}/**
5432 * @license
5433 * Copyright 2020 Google LLC. All Rights Reserved.
5434 * Licensed under the Apache License, Version 2.0 (the "License");
5435 * you may not use this file except in compliance with the License.
5436 * You may obtain a copy of the License at
5437 *
5438 * http://www.apache.org/licenses/LICENSE-2.0
5439 *
5440 * Unless required by applicable law or agreed to in writing, software
5441 * distributed under the License is distributed on an "AS IS" BASIS,
5442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5443 * See the License for the specific language governing permissions and
5444 * limitations under the License.
5445 * =============================================================================
5446 */class Ca{get id(){return this.idTensor.id}constructor(e,n,r,s=-1){this.tensors=e,this.elementShape=n,this.elementDtype=r,e!=null&&e.forEach(i=>{if(r!==i.dtype)throw new Error(`Invalid data types; op elements ${r}, but list elements ${i.dtype}`);Cr(n,i.shape,"TensorList shape mismatch: "),Is(i)}),this.idTensor=De(0),this.maxNumElements=s,Is(this.idTensor)}copy(){return new Ca([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(n=>{(e==null||!e.has(n.id))&&n.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,n,r=-1){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(r!==-1&&this.tensors.length!==r)throw new Error(`Operation expected a list with ${r} elements but got a list with ${this.tensors.length} elements.`);Cr(e,this.elementShape,"TensorList shape mismatch: ");const s=jl(this.elementShape,this.tensors,e);return $e(()=>{const i=this.tensors.map(o=>K(o,s));return wi(i,0)})}popBack(e,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");const r=jl(this.elementShape,this.tensors,e),s=this.tensors.pop();return s.kept=!1,Cr(s.shape,e,"TensorList shape mismatch: "),K(s,r)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(Cr(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");Is(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);const n=new Ca([],this.elementShape,this.elementDtype,this.maxNumElements);n.tensors.length=e;for(let r=0;r<Math.min(this.tensors.length,e);++r)n.tensors[r]=this.tensors[r];return n}getItem(e,n,r){if(r!==this.elementDtype)throw new Error(`Invalid data types; op elements ${r}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(this.tensors[e]==null)throw new Error(`element at index ${e} is null.`);Cr(this.tensors[e].shape,n,"TensorList shape mismatch: ");const s=jl(this.elementShape,this.tensors,n);return K(this.tensors[e],s)}setItem(e,n){if(n.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n.dtype}, but list elements ${this.elementDtype}`);if(e<0||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);Cr(this.elementShape,n.shape,"TensorList shape mismatch: "),Is(n),this.tensors[e]!=null&&(this.tensors[e].kept=!1),this.tensors[e]=n}gather(e,n,r){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);Cr(this.elementShape,r,"TensorList shape mismatch: "),e=e.slice(0,this.size());const s=jl(this.elementShape,this.tensors,r);return e.length===0?Vs([],[0].concat(s)):$e(()=>{const i=e.map(o=>K(this.tensors[o],s));return wi(i,0)})}concat(e,n){if(e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);Cr(this.elementShape,n,"TensorList shape mismatch: ");const r=jl(this.elementShape,this.tensors,n);return this.size()===0?Vs([],[0].concat(r)):$e(()=>{const s=this.tensors.map(i=>K(i,r));return Jt(s,0)})}}function Tee(t,e,n){const r=t.dtype;if(t.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${t.shape}`);if(t.dtype!==n)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${n}`);const s=t.shape.slice(1);Cr(s,e,"TensorList shape mismatch: ");const i=Fa(t);return new Ca(i,e,r)}function Cee(t,e,n,r){return new Ca([],t,e,r)}function Nee(t,e,n,r){if(e.length!==t.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${t.shape[0]}`);const s=Math.max(...e);if(r!=null&&r!==-1&&s>=r)throw new Error(`Max index must be < array size (${s}  vs. ${r})`);const i=new Ca([],n,t.dtype,r),o=Fa(t,0);return e.forEach((a,u)=>{i.setItem(a,o[u])}),i}function Eee(t,e,n){let r=0;const s=e.map(c=>(r+=c,r));if(r!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to
5447          tensor.shape[0], but sum of lengths is
5448        ${r}, and tensor's shape is: ${t.shape}`);const i=t.shape.slice(1),o=rv(i,n),a=r===0?0:t.size/r,u=$e(()=>{const c=[];t=K(t,[1,r,a]);for(let h=0;h<e.length;++h){const f=[0,h===0?0:s[h-1],0],p=[1,e[h],a];c[h]=K(Ne(t,f,p),o)}return t.dispose(),c}),l=new Ca([],n,t.dtype,e.length);for(let c=0;c<u.length;c++)l.setItem(c,u[c]);return l}/**
5449 * @license
5450 * Copyright 2018 Google LLC. All Rights Reserved.
5451 * Licensed under the Apache License, Version 2.0 (the "License");
5452 * you may not use this file except in compliance with the License.
5453 * You may obtain a copy of the License at
5454 *
5455 * http://www.apache.org/licenses/LICENSE-2.0
5456 *
5457 * Unless required by applicable law or agreed to in writing, software
5458 * distributed under the License is distributed on an "AS IS" BASIS,
5459 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5460 * See the License for the specific language governing permissions and
5461 * limitations under the License.
5462 * =============================================================================
5463 */const kee=async(t,e,n)=>{switch(t.op){case"If":case"StatelessIf":{const r=S("thenBranch",t,e,n),s=S("elseBranch",t,e,n),i=S("cond",t,e,n),o=S("args",t,e,n);return(await i.data())[0]?n.functionMap[r].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap):n.functionMap[s].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=S("body",t,e,n),s=S("cond",t,e,n),i=S("args",t,e,n),o=await n.functionMap[s].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap),a=i.map(c=>c.id);let u=await o[0].data();o.forEach(c=>{!c.kept&&a.indexOf(c.id)===-1&&c.dispose()});let l=i;for(;u[0];){const c=l;l=await n.functionMap[r].executeFunctionAsync(l,n.tensorArrayMap,n.tensorListMap);const h=l.map(f=>f.id);c.forEach(f=>
5463{!f.kept&&a.indexOf(f.id)===-1&&h.indexOf(f.id)===-1&&f.dispose()});const d=await n.functionMap[s].executeFunctionAsync(l,n.tensorArrayMap,n.tensorListMap);u=await d[0].data(),d.forEach(f=>{!f.kept&&a.indexOf(f.id)===-1&&h.indexOf(f.id)===-1&&f.dispose()})}return l}case"LoopCond":{const r=S("pred",t,e,n);return[ei(r)]}case"Switch":{const r=S("pred",t,e,n);let s=S("data",t,e,n);return s.kept||(s=ei(s)),(await r.data())[0]?[void 0,s]:[s,void 0]}case"Merge":{const r=t.inputNames.find(s=>Kt(s,e,n)!==void 0);if(r){const s=Kt(r,e,n);return[ei(s)]}return}case"Enter":{const r=S("frameName",t,e,n),s=S("tensor",t,e,n);return n.enterFrame(r),[ei(s)]}case"Exit":{const r=S("tensor",t,e,n);return n.exitFrame(),[ei(r)]}case"NextIteration":{const r=S("tensor",t,e,n);return n.nextIteration(),[ei(r)]}case"TensorArrayV3":{const r=S("size",t,e,n),s=S("dtype",t,e,n),i=S("elementShape",t,e,n),o=S("dynamicSize",t,e,n),a=S("clearAfterRead",t,e,n),u=S("identicalElementShapes",t,e,n),l=S("name",t,e,n),c=new See(l,s,r,i,u,o,a);return n.addTensorArray(c),[c.idTensor,De(1)]}case"TensorArrayWriteV3":{const r=S("tensorArrayId",t,e,n),s=S("index",t,e,n),i=S("tensor",t,e,n),o=n.getTensorArray(r.id);return o.write(s,i),[o.idTensor]}case"TensorArrayReadV3":{const r=S("tensorArrayId",t,e,n),s=S("index",t,e,n);return[n.getTensorArray(r.id).read(s)]}case"TensorArrayGatherV3":{const r=S("tensorArrayId",t,e,n),s=S("indices",t,e,n),i=S("dtype",t,e,n);return[n.getTensorArray(r.id).gather(s,i)]}case"TensorArrayScatterV3":{const r=S("tensorArrayId",t,e,n),s=S("indices",t,e,n),i=S("tensor",t,e,n),o=n.getTensorArray(r.id);return o.scatter(s,i),[o.idTensor]}case"TensorArrayConcatV3":{const r=S("tensorArrayId",t,e,n),s=n.getTensorArray(r.id),i=S("dtype",t,e,n);return[s.concat(i)]}case"TensorArraySplitV3":{const r=S("tensorArrayId",t,e,n),s=S("tensor",t,e,n),i=S("lengths",t,e,n),o=n.getTensorArray(r.id);return o.split(i,s),[o.idTensor]}case"TensorArraySizeV3":{const r=S("tensorArrayId",t,e,n),s=n.getTensorArray(r.id);return[De(s.size(),"int32")]}case"TensorArrayCloseV3":{const r=S("tensorArrayId",t,e,n),s=n.getTensorArray(r.id);return s.clearAndClose(),[s.idTensor]}case"TensorListSetItem":{const r=S("tensorListId",t,e,n),s=S("index",t,e,n),i=S("tensor",t,e,n),o=n.getTensorList(r.id);return o.setItem(s,i),[o.idTensor]}case"TensorListGetItem":{const r=S("tensorListId",t,e,n),s=S("index",t,e,n),i=S("elementShape",t,e,n),o=S("elementDType",t,e,n);return[n.getTensorList(r.id).getItem(s,i,o)]}case"TensorListScatterV2":case"TensorListScatter":{const r=S("indices",t,e,n),s=S("tensor",t,e,n),i=S("elementShape",t,e,n),o=S("numElements",t,e,n),a=Nee(s,r,i,o);return n.addTensorList(a),[a.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=S("elementShape",t,e,n),s=S("elementDType",t,e,n);let i;t.op==="TensorListReserve"?i="numElements":i="maxNumElements";const o=S(i,t,e,n),a=t.op==="TensorListReserve"?-1:o,u=Cee(r,s,o,a);return n.addTensorList(u),[u.idTensor]}case"TensorListGather":{const r=S("tensorListId",t,e,n),s=S("indices",t,e,n),i=S("elementShape",t,e,n),o=S("elementDType",t,e,n);return[n.getTensorList(r.id).gather(s,o,i)]}case"TensorListStack":{const r=S("tensorListId",t,e,n),s=S("elementShape",t,e,n),i=S("elementDType",t,e,n),o=S("numElements",t,e,n);return[n.getTensorList(r.id).stack(s,i,o)]}case"TensorListFromTensor":{const r=S("tensor",t,e,n),s=S("elementShape",t,e,n),i=S("elementDType",t,e,n),o=Tee(r,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const r=S("tensorListId",t,e,n),s=n.getTensorList(r.id),i=S("dtype",t,e,n),o=S("elementShape",t,e,n);return[s.concat(i,o)]}case"TensorListPushBack":{const r=S("tensorListId",t,e,n),s=S("tensor",t,e,n),i=n.getTensorList(r.id);return i.pushBack(s),[i.idTensor]}case"TensorListPopBack":{const r=S("tensorListId",t,e,n),s=S("elementShape",t,e,n),i=S("elementDType",t,e,n);return[n.getTensorList(r.id).popBack(s,i)]}case"TensorListSplit":{const r=S("tensor",t,e,n),s=S("elementShape",t,e,n),i=S("lengths",t,e,n),o=Eee(r,i,s);return n.addTensorList(o),[o.idTensor]}case"TensorListLength":{const r=S("tensorListId",t,e,n),s=n.getTensorList(r.id);return[De(s.size(),"int32")]}case"TensorListResize":{const r=S("tensorListId",t,e,n),s=S("size",t,e,n),o=n.getTensorList(r.id).resize(s);return n.addTensorList(o),[o.idTensor]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5464 * @license
5465 * Copyright 2018 Google LLC. All Rights Reserved.
5466 * Licensed under the Apache License, Version 2.0 (the "License");
5467 * you may not use this file except in compliance with the License.
5468 * You may obtain a copy of the License at
5469 *
5470 * http://www.apache.org/licenses/LICENSE-2.0
5471 *
5472 * Unless required by applicable law or agreed to in writing, software
5473 * distributed under the License is distributed on an "AS IS" BASIS,
5474 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5475 * See the License for the specific language governing permissions and
5476 * limitations under the License.
5477 * =============================================================================
5478 */function OT(t,e,n){const[r,s]=S("fusedOps",t,e,n),i=r==="biasadd",o=!i,a=s==="prelu",u=r==="fusedbatchnorm",l=S("numArgs",t,e,n);if(i){if(a&&l!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!a&&i&&l!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(u)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const c=S("strides",t,e,n),h=qd(t,e,n),d=S("dataFormat",t,e,n).toUpperCase(),f=S("dilations",t,e,n);let[p,y]=S("args",t,e,n);o&&(y=p,p=void 0);const v=S("leakyreluAlpha",t,e,n);return{stride:c,pad:h,dataFormat:d,dilations:f,biasArg:p,preluArg:y,activationFunc:s,leakyreluAlpha:v}}const $ee=(t,e,n,r=en)=>{switch(t.op){case"Conv1D":{const s=S("stride",t,e,n),i=S("pad",t,e,n),o=S("dataFormat",t,e,n).toUpperCase(),a=S("dilation",t,e,n);return[r.conv1d(S("x",t,e,n),S("filter",t,e,n),s,i,o,a)]}case"Conv2D":{const s=S("strides",t,e,n),i=qd(t,e,n),o=S("dataFormat",t,e,n).toUpperCase(),a=S("dilations",t,e,n);return[r.conv2d(S("x",t,e,n),S("filter",t,e,n),[s[1],s[2]],i,o,[a[1],a[2]])]}case"_FusedConv2D":{const{stride:s,pad:i,dataFormat:o,dilations:a,biasArg:u,preluArg:l,activationFunc:c,leakyreluAlpha:h}=OT(t,e,n);return[r.fused.conv2d({x:S("x",t,e,n),filter:S("filter",t,e,n),strides:[s[1],s[2]],pad:i,dataFormat:o,dilations:[a[1],a[2]],bias:u,activation:c,preluActivationWeights:l,leakyreluAlpha:h})]}case"FusedDepthwiseConv2dNative":{const{stride:s,pad:i,dataFormat:o,dilations:a,biasArg:u,preluArg:l,activationFunc:c,leakyreluAlpha:h}=OT(t,e,n);return[r.fused.depthwiseConv2d({x:S("x",t,e,n),filter:S("filter",t,e,n),strides:[s[1],s[2]],pad:i,dataFormat:o,dilations:[a[1],a[2]],bias:u,activation:c,preluActivationWeights:l,leakyreluAlpha:h})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const s=S("outputShape",t,e,n),i=S("strides",t,e,n),o=qd(t,e,n);return[r.conv2dTranspose(S("x",t,e,n),S("filter",t,e,n),s,[i[1],i[2]],o)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const s=S("strides",t,e,n),i=qd(t,e,n),o=S("dilations",t,e,n),a=S("dataFormat",t,e,n).toUpperCase();return[r.depthwiseConv2d(S("input",t,e,n),S("filter",t,e,n),[s[1],s[2]],i,a,[o[1],o[2]])]}case"Conv3D":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("dataFormat",t,e,n).toUpperCase(),a=S("dilations",t,e,n);return[r.conv3d(S("x",t,e,n),S("filter",t,e,n),[s[1],s[2],s[3]],i,o,[a[1],a[2],a[3]])]}case"AvgPool":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("kernelSize",t,e,n);return[r.avgPool(S("x",t,e,n),[o[1],o[2]],[s[1],s[2]],i)]}case"MaxPool":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("kernelSize",t,e,n);return[r.maxPool(S("x",t,e,n),[o[1],o[2]],[s[1],s[2]],i)]}case"MaxPoolWithArgmax":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("kernelSize",t,e,n),a=S("includeBatchInIndex",t,e,n),{result:u,indexes:l}=r.maxPoolWithArgmax(S("x",t,e,n),[o[1],o[2]],[s[1],s[2]],i,a);return[u,l]}case"AvgPool3D":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("kernelSize",t,e,n);return[r.avgPool3d(S("x",t,e,n),[o[1],o[2],o[3]],[s[1],s[2],s[3]],i)]}case"MaxPool3D":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("kernelSize",t,e,n);return[r.maxPool3d(S("x",t,e,n),[o[1],o[2],o[3]],[s[1],s[2],s[3]],i)]}case"Dilation2D":{const s=S("strides",t,e,n),i=S("pad",t,e,n),o=S("dilations",t,e,n),a=s[1],u=s[2],l=o[1],c=o[2];return[r.dilation2d(S("x",t,e,n),S("filter",t,e,n),[a,u],i,[l,c],"NHWC")]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5479 * @license
5480 * Copyright 2018 Google LLC. All Rights Reserved.
5481 * Licensed under the Apache License, Version 2.0 (the "License");
5482 * you may not use this file except in compliance with the License.
5483 * You may obtain a copy of the License at
5484 *
5485 * http://www.apache.org/licenses/LICENSE-2.0
5486 *
5487 * Unless required by applicable law or agreed to in writing, software
5488 * distributed under the License is distributed on an "AS IS" BASIS,
5489 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5490 * See the License for the specific language governing permissions and
5491 * limitations under the License.
5492 * =============================================================================
5493 */const Iee=(t,e,n,r=en)=>{switch(t.op){case"Fill":{const s=S("shape",t,e,n),i=S("dtype",t,e,n),o=S("value",t,e,n);return[r.fill(s,o,i)]}case"LinSpace":{const s=S("start",t,e,n),i=S("stop",t,e,n),o=S("num",t,e,n);return[r.linspace(s,i,o)]}case"Multinomial":{const s=S("logits",t,e,n),i=S("numSamples",t,e,n),o=S("seed",t,e,n);return[r.multinomial(s,i,o)]}case"OneHot":{const s=S("indices",t,e,n),i=S("depth",t,e,n),o=S("onValue",t,e,n),a=S("offValue",t,e,n),u=S("dtype",t,e,n);return[r.oneHot(s,i,o,a,u)]}case"Ones":return[r.ones(S("shape",t,e,n),S("dtype",t,e,n))];case"OnesLike":return[r.onesLike(S("x",t,e,n))];case"RandomStandardNormal":return[r.randomStandardNormal(S("shape",t,e,n),S("dtype",t,e,n),S("seed",t,e,n))];case"RandomUniform":return[r.randomUniform(S("shape",t,e,n),S("minval",t,e,n),S("maxval",t,e,n),S("dtype",t,e,n))];case"RandomUniformInt":return[r.randomUniformInt(S("shape",t,e,n),S("minval",t,e,n),S("maxval",t,e,n),S("seed",t,e,n))];case"Range":{const s=S("start",t,e,n),i=S("stop",t,e,n),o=S("step",t,e,n);return[r.range(s,i,o,S("dtype",t,e,n))]}case"TruncatedNormal":{const s=S("shape",t,e,n),i=S("mean",t,e,n),o=S("stdDev",t,e,n),a=S("seed",t,e,n);return[r.truncatedNormal(s,i,o,S("dtype",t,e,n),a)]}case"Zeros":return[r.zeros(S("shape",t,e,n),S("dtype",t,e,n))];case"ZerosLike":return[r.zerosLike(S("x",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5494 * @license
5495 * Copyright 2018 Google LLC. All Rights Reserved.
5496 * Licensed under the Apache License, Version 2.0 (the "License");
5497 * you may not use this file except in compliance with the License.
5498 * You may obtain a copy of the License at
5499 *
5500 * http://www.apache.org/licenses/LICENSE-2.0
5501 *
5502 * Unless required by applicable law or agreed to in writing, software
5503 * distributed under the License is distributed on an "AS IS" BASIS,
5504 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5505 * See the License for the specific language governing permissions and
5506 * limitations under the License.
5507 * =============================================================================
5508 */function Vg(t,e,n){const r=S("boxes",t,e,n),s=S("scores",t,e,n),i=S("maxOutputSize",t,e,n),o=S("iouThreshold",t,e,n),a=S("scoreThreshold",t,e,n),u=S("softNmsSigma",t,e,n);return{boxes:r,scores:s,maxOutputSize:i,iouThreshold:o,scoreThreshold:a,softNmsSigma:u}}const Aee=async(t,e,n,r,s=en)=>{switch(t.op){case"NonMaxSuppressionV5":{const{boxes:i,scores:o,maxOutputSize:a,iouThreshold:u,scoreThreshold:l,softNmsSigma:c}=Vg(t,e,n),h=await s.image.nonMaxSuppressionWithScoreAsync(i,o,a,u,l,c);return[h.selectedIndices,h.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:i,scores:o,maxOutputSize:a,iouThreshold:u,scoreThreshold:l}=Vg(t,e,n),c=S("padToMaxOutputSize",t,e,n),h=await s.image.nonMaxSuppressionPaddedAsync(i,o,a,u,l,c);return[h.selectedIndices,h.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:i,scores:o,maxOutputSize:a,iouThreshold:u,scoreThreshold:l}=Vg(t,e,n);return[await s.image.nonMaxSuppressionAsync(i,o,a,u,l)]}case"Where":{const i=s.cast(S("condition",t,e,n),"bool"),o=[await s.whereAsync(i)];return i.dispose(),o}case"ListDiff":return s.setdiff1dAsync(S("x",t,e,n),S("y",t,e,n));default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5509 * @license
5510 * Copyright 2018 Google LLC. All Rights Reserved.
5511 * Licensed under the Apache License, Version 2.0 (the "License");
5512 * you may not use this file except in compliance with the License.
5513 * You may obtain a copy of the License at
5514 *
5515 * http://www.apache.org/licenses/LICENSE-2.0
5516 *
5517 * Unless required by applicable law or agreed to in writing, softw
5517are
5518 * distributed under the License is distributed on an "AS IS" BASIS,
5519 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5520 * See the License for the specific language governing permissions and
5521 * limitations under the License.
5522 * =============================================================================
5523 */const Ree=(t,e,n,r=en)=>{switch(t.op){case"LowerBound":{const s=S("sortedSequence",t,e,n),i=S("values",t,e,n);return[r.lowerBound(s,i)]}case"TopKV2":{const s=S("x",t,e,n),i=S("k",t,e,n),o=S("sorted",t,e,n),a=r.topk(s,i,o);return[a.values,a.indices]}case"UpperBound":{const s=S("sortedSequence",t,e,n),i=S("values",t,e,n);return[r.upperBound(s,i)]}case"Unique":{const s=S("x",t,e,n),i=r.unique(s);return[i.values,i.indices]}case"UniqueV2":{const s=S("x",t,e,n),i=S("axis",t,e,n),o=r.unique(s,i);return[o.values,o.indices]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5524 * @license
5525 * Copyright 2018 Google LLC. All Rights Reserved.
5526 * Licensed under the Apache License, Version 2.0 (the "License");
5527 * you may not use this file except in compliance with the License.
5528 * You may obtain a copy of the License at
5529 *
5530 * http://www.apache.org/licenses/LICENSE-2.0
5531 *
5532 * Unless required by applicable law or agreed to in writing, software
5533 * distributed under the License is distributed on an "AS IS" BASIS,
5534 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5535 * See the License for the specific language governing permissions and
5536 * limitations under the License.
5537 * =============================================================================
5538 */const Oee=(t,e,n,r=en)=>{switch(t.op){case"Const":return e[t.name];case"PlaceholderWithDefault":const s=S("default",t,e,n);return[Kt(t.name,e,n)||s];case"Placeholder":return[Kt(t.name,e,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{const c=S("x",t,e,n);return[ei(c)]}case"IdentityN":return S("x",t,e,n).map(c=>ei(c));case"Snapshot":const i=S("x",t,e,n);return[ei(i)];case"Shape":return[r.tensor1d(S("x",t,e,n).shape,"int32")];case"ShapeN":return S("x",t,e,n).map(c=>r.tensor1d(c.shape));case"Size":return[r.scalar(S("x",t,e,n).size,"int32")];case"Rank":return[r.scalar(S("x",t,e,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const o=S("x",t,e,n),a=S("data",t,e,n),u=S("message",t,e,n),l=S("summarize",t,e,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(u);for(let c=0;c<a.length;c++)console.log(Array.prototype.slice.call(a[c].dataSync()).slice(0,l));return[o];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5539 * @license
5540 * Copyright 2020 Google LLC. All Rights Reserved.
5541 * Licensed under the Apache License, Version 2.0 (the "License");
5542 * you may not use this file except in compliance with the License.
5543 * You may obtain a copy of the License at
5544 *
5545 * http://www.apache.org/licenses/LICENSE-2.0
5546 *
5547 * Unless required by applicable law or agreed to in writing, software
5548 * distributed under the License is distributed on an "AS IS" BASIS,
5549 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5550 * See the License for the specific language governing permissions and
5551 * limitations under the License.
5552 * =============================================================================
5553 */class Dee{get id(){return this.handle.id}constructor(e,n){this.keyDType=e,this.valueDType=n,this.handle=De(0),this.tensorMap=new Map,Is(this.handle)}clearAndClose(){this.tensorMap.forEach(e=>e.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return De(this.size(),"int32")}async import(e,n){this.checkKeyAndValueTensor(e,n);const r=await e.data();return this.tensorMap.forEach(s=>s.dispose()),this.tensorMap.clear(),$e(()=>{const s=Fa(n),i=r.length,o=s.length;A(i===o,()=>`The number of elements doesn't match, keys has ${i} elements, the values has ${o} elements.`);for(let a=0;a<i;a++){const u=r[a],l=s[a];Is(l),this.tensorMap.set(u,l)}return this.handle})}async find(e,n){this.checkKeyAndValueTensor(e,n);const r=await e.data();return $e(()=>{const s=[];for(let i=0;i<r.length;i++){const o=r[i],a=this.findWithDefault(o,n);s.push(a)}return wi(s)})}findWithDefault(e,n){const r=this.tensorMap.get(e);return r??n}checkKeyAndValueTensor(e,n){if(e.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${e.dtype}`);if(n.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${n.dtype}`)}}/**
5554 * @license
5555 * Copyright 2020 Google LLC. All Rights Reserved.
5556 * Licensed under the Apache License, Version 2.0 (the "License");
5557 * you may not use this file except in compliance with the License.
5558 * You may obtain a copy of the License at
5559 *
5560 * http://www.apache.org/licenses/LICENSE-2.0
5561 *
5562 * Unless required by applicable law or agreed to in writing, software
5563 * distributed under the License is distributed on an "AS IS" BASIS,
5564 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5565 * See the License for the specific language governing permissions and
5566 * limitations under the License.
5567 * =============================================================================
5568 */const Pee=async(t,e,n,r)=>{switch(t.op){case"HashTable":case"HashTableV2":{const s=r.getHashTableHandleByName(t.name);if(s!=null)return[s];{const i=S("keyDType",t,e,n),o=S("valueDType",t,e,n),a=new Dee(i,o);return r.addHashTable(t.name,a),[a.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{const s=S("tableHandle",t,e,n,r),i=S("keys",t,e,n),o=S("values",t,e,n);return[await r.getHashTableById(s.id).import(i,o)]}case"LookupTableFind":case"LookupTableFindV2":{const s=S("tableHandle",t,e,n,r),i=S("keys",t,e,n),o=S("defaultValue",t,e,n);return[await r.getHashTableById(s.id).find(i,o)]}case"LookupTableSize":case"LookupTableSizeV2":{const s=S("tableHandle",t,e,n,r);return[r.getHashTableById(s.id).tensorSize()]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5569 * @license
5570 * Copyright 2018 Google LLC. All Rights Reserved.
5571 * Licensed under the Apache License, Version 2.0 (the "License");
5572 * you may not use this file except in compliance with the License.
5573 * You may obtain a copy of the License at
5574 *
5575 * http://www.apache.org/licenses/LICENSE-2.0
5576 *
5577 * Unless required by applicable law or agreed to in writing, software
5578 * distributed under the License is distributed on an "AS IS" BASIS,
5579 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5580 * See the License for the specific language governing permissions and
5581 * limitations under the License.
5582 * =============================================================================
5583 */const Fee=(t,e,n,r=en)=>{switch(t.op){case"ResizeBilinear":{const s=S("images",t,e,n),i=S("size",t,e,n),o=S("alignCorners",t,e,n),a=S("halfPixelCenters",t,e,n);return[r.image.resizeBilinear(s,[i[0],i[1]],o,a)]}case"ResizeNearestNeighbor":{const s=S("images",t,e,n),i=S("size",t,e,n),o=S("alignCorners",t,e,n),a=S("halfPixelCenters",t,e,n);return[r.image.resizeNearestNeighbor(s,[i[0],i[1]],o,a)]}case"CropAndResize":{const s=S("image",t,e,n),i=S("boxes",t,e,n),o=S("boxInd",t,e,n),a=S("cropSize",t,e,n),u=S("method",t,e,n),l=S("extrapolationValue",t,e,n);return[r.image.cropAndResize(s,i,o,a,u,l)]}case"ImageProjectiveTransformV3":{const s=S("images",t,e,n),i=S("transforms",t,e,n),o=S("outputShape",t,e,n),a=S("fillValue",t,e,n),u=S("interpolation",t,e,n),l=S("fillMode",t,e,n);return[r.image.transform(s,i,u.toLowerCase(),l.toLowerCase(),a,o)]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5584 * @license
5585 * Copyright 2018 Google LLC. All Rights Reserved.
5586 * Licensed under the Apache License, Version 2.0 (the "License");
5587 * you may not use this file except in compliance with the License.
5588 * You may obtain a copy of the License at
5589 *
5590 * http://www.apache.org/licenses/LICENSE-2.0
5591 *
5592 * Unless required by applicable law or agreed to in writing, software
5593 * distributed under the License is distributed on an "AS IS" BASIS,
5594 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5595 * See the License for the specific language governing permissions and
5596 * limitations under the License.
5597 * =============================================================================
5598 */const Lee=(t,e,n,r=en)=>{switch(t.op){case"Equal":return[r.equal(S("a",t,e,n),S("b",t,e,n))];case"NotEqual":return[r.notEqual(S("a",t,e,n),S("b",t,e,n))];case"Greater":return[r.greater(S("a",t,e,n),S("b",t,e,n))];case"GreaterEqual":return[r.greaterEqual(S("a",t,e,n),S("b",t,e,n))];case"Less":return[r.less(S("a",t,e,n),S("b",t,e,n))];case"LessEqual":return[r.lessEqual(S("a",t,e,n),S("b",t,e,n))];case"LogicalAnd":return[r.logicalAnd(S("a",t,e,n),S("b",t,e,n))];case"LogicalNot":return[r.logicalNot(S("a",t,e,n))];case"LogicalOr":return[r.logicalOr(S("a",t,e,n),S("b",t,e,n))];case"Select":case"SelectV2":return[r.where(S("condition",t,e,n),S("a",t,e,n),S("b",t,e,n))];case"BitwiseAnd":return[r.bitwiseAnd(S("a",t,e,n),S("b",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5599 * @license
5600 * Copyright 2018 Google LLC. All Rights Reserved.
5601 * Licensed under the Apache License, Version 2.0 (the "License");
5602 * you may not use this file except in compliance with the License.
5603 * You may obtain a copy of the License at
5604 *
5605 * http://www.apache.org/licenses/LICENSE-2.0
5606 *
5607 * Unless required by applicable law or agreed to in writing, software
5608 * distributed under the License is distributed on an "AS IS" BASIS,
5609 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5610 * See the License for the specific language governing permissions and
5611 * limitations under the License.
5612 * =============================================================================
5613 */const Mee=(t,e,n,r=en)=>{switch(t.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(S("a",t,e,n),S("b",t,e,n),S("transposeA",t,e,n),S("transposeB",t,e,n))];case"Einsum":return[r.einsum(S("equation",t,e,n),...S("tensors",t,e,n))];case"Transpose":return[r.transpose(S("x",t,e,n),S("perm",t,e,n))];case"_FusedMatMul":const[s,i]=S("fusedOps",t,e,n),o=s==="biasadd",a=i==="prelu",u=S("numArgs",t,e,n),l=S("leakyreluAlpha",t,e,n);if(o){if(a&&u!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!a&&u!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[c,h]=S("args",t,e,n);return[r.fused.matMul({a:S("a",t,e,n),b:S("b",t,e,n),transposeA:S("transposeA",t,e,n),transposeB:S("transposeB",t,e,n),bias:c,activation:i,preluActivationWeights:h,leakyreluAlpha:l})];case"MatrixBandPart":return[r.linalg.bandPart(S("a",t,e,n),S("numLower",t,e,n),S("numUpper",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5614 * @license
5615 * Copyright 2018 Google LLC. All Rights Reserved.
5616 * Licensed under the Apache License, Version 2.0 (the "License");
5617 * you may not use this file except in compliance with the License.
5618 * You may obtain a copy of the License at
5619 *
5620 * http://www.apache.org/licenses/LICENSE-2.0
5621 *
5622 * Unless required by applicable law or agreed to in writing, software
5623 * distributed under the License is distributed on an "AS IS" BASIS,
5624 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5625 * See the License for the specific language governing permissions and
5626 * limitations under the License.
5627 * =============================================================================
5628 */const Vee=(t,e,n,r=en)=>{switch(t.op){case"EuclideanNorm":return[r.euclideanNorm(S("x",t,e,n),S("axis",t,e,n),S("keepDims",t,e,n))];case"FusedBatchNorm":case"FusedBatchNormV2":return[r.batchNorm(S("x",t,e,n),S("mean",t,e,n),S("variance",t,e,n),S("offset",t,e,n),S("scale",t,e,n),S("epsilon",t,e,n))];case"FusedBatchNormV3":return[r.batchNorm(S("x",t,e,n),S("mean",t,e,n),S("variance",t,e,n),S("offset",t,e,n),S("scale",t,e,n),S("epsilon",t,e,n))];case"LRN":return[r.localResponseNormalization(S("x",t,e,n),S("radius",t,e,n),S("bias",t,e,n),S("alpha",t,e,n),S("beta",t,e,n))];case"Softmax":return[r.softmax(S("x",t,e,n))];case"LogSoftmax":return[r.logSoftmax(S("x",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5629 * @license
5630 * Copyright 2022 Google LLC. All Rights Reserved.
5631 * Licensed under the Apache License, Version 2.0 (the "License");
5632 * you may not use this file except in compliance with the License.
5633 * You may obtain a copy of the License at
5634 *
5635 * http://www.apache.org/licenses/LICENSE-2.0
5636 *
5637 * Unless required by applicable law or agreed to in writing, software
5638 * distributed under the License is distributed on an "AS IS" BASIS,
5639 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5640 * See the License for the specific language governing permissions and
5641 * limitations under the License.
5642 * =============================================================================
5643 */const Bee=(t,e,n,r=en)=>{switch(t.op){case"RaggedGather":{const{outputNestedSplits:s,outputDenseValues:i}=r.raggedGather(S("paramsNestedSplits",t,e,n),S("paramsDenseValues",t,e,n),S("indices",t,e,n),S("outputRaggedRank",t,e,n));return s.concat(i)}case"RaggedRange":{const{rtNestedSplits:s,rtDenseValues:i}=r.raggedRange(S("starts",t,e,n),S("limits",t,e,n),S("splits",t,e,n));return[s,i]}case"RaggedTensorToTensor":return[r.raggedTensorToTensor(S("shape",t,e,n),S("values",t,e,n),S("defaultValue",t,e,n),S("rowPartitionTensors",t,e,n),S("rowPartitionTypes",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5644 * @license
5645 * Copyright 2018 Google LLC. All Rights Reserved.
5646 * Licensed under the Apache License, Version 2.0 (the "License");
5647 * you may not use this file except in compliance with the License.
5648 * You may obtain a copy of the License at
5649 *
5650 * http://www.apache.org/licenses/LICENSE-2.0
5651 *
5652 * Unless required by applicable law or agreed to in writing, software
5653 * distributed under the License is distributed on an "AS IS" BASIS,
5654 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5655 * See the License for the specific language governing permissions and
5656 * limitations under the License.
5657 * =============================================================================
5658 */const Wee=(t,e,n,r=en)=>{switch(t.op){case"Max":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.max(S("x",t,e,n),a,u)]}case"Mean":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.mean(S("x",t,e,n),a,u)]}case"Min":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.min(S("x",t,e,n),a,u)]}case"Sum":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.sum(S("x",t,e,n),a,u)]}case"All":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.all(S("x",t,e,n),a,u)]}case"Any":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.any(S("x",t,e,n),a,u)]}case"ArgMax":{const a=S("axis",t,e,n);return[r.argMax(S("x",t,e,n),a)]}case"ArgMin":{const a=S("axis",t,e,n);return[r.argMin(S("x",t,e,n),a)]}case"Prod":{const a=S("axis",t,e,n),u=S("keepDims",t,e,n);return[r.prod(S("x",t,e,n),a,u)]}case"Cumprod":{const a=S("axis",t,e,n),u=S("exclusive",t,e,n),l=S("reverse",t,e,n);return[r.cumprod(S("x",t,e,n),a,u,l)]}case"Cumsum":{const a=S("axis",t,e,n),u=S("exclusive",t,e,n),l=S("reverse",t,e,n);return[r.cumsum(S("x",t,e,n),a,u,l)]}case"Bincount":const s=S("x",t,e,n),i=S("weights",t,e,n),o=S("size",t,e,n);return[r.bincount(s,i,o)];case"DenseBincount":{const a=S("x",t,e,n),u=S("weights",t,e,n),l=S("size",t,e,n),c=S("binaryOutput",t,e,n);return[r.denseBincount(a,u,l,c)]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5659 * @license
5660 * Copyright 2018 Google LLC. All Rights Reserved.
5661 * Licensed under the Apache License, Version 2.0 (the "License");
5662 * you may not use this file except in compliance with the License.
5663 * You may obtain a copy of the License at
5664 *
5665 * http://www.apache.org/licenses/LICENSE-2.0
5666 *
5667 * Unless required by applicable law or agreed to in writing, software
5668 * distributed under the License is distributed on an "AS IS" BASIS,
5669 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5670 * See the License for the specific language governing permissions and
5671 * limitations under the License.
5672 * =============================================================================
5673 */const Uee=(t,e,n,r=en)=>{switch(t.op){case"ConcatV2":case"Concat":{const s=S("n",t,e,n),i=S("axis",t,e,n);let o=S("tensors",t,e,n);return o=o.slice(0,s),[r.concat(o,i)]}case"Gather":{const s=S("x",t,e,n),i=S("indices",t,e,n);return[r.gather(s,r.cast(i,"int32"),0)]}case"GatherV2":{const s=S("axis",t,e,n),i=S("batchDims",t,e,n),o=S("x",t,e,n),a=S("indices",t,e,n);return[r.gather(o,r.cast(a,"int32"),s,i)]}case"Reverse":{const s=S("dims",t,e,n),i=[];for(let a=0;a<s.length;a++)s[a]&&i.push(a);const o=S("x",t,e,n);return[r.reverse(o,i)]}case"ReverseV2":{const s=S("axis",t,e,n),i=S("x",t,e,n);return[r.reverse(i,s)]}case"Slice":{const s=S("begin",t,e,n),i=S("size",t,e,n);return[r.slice(S("x",t,e,n),s,i)]}case"StridedSlice":{const s=S("begin",t,e,n),i=S("end",t,e,n),o=S("strides",t,e,n),a=S("beginMask",t,e,n),u=S("endMask",t,e,n),l=S("ellipsisMask",t,e,n),c=S("newAxisMask",t,e,n),h=S("shrinkAxisMask",t,e,n),d=S("x",t,e,n);return[r.stridedSlice(d,s,i,o,a,u,l,c,h)]}case"Pack":return $e(()=>{const s=S("axis",t,e,n),i=S("tensors",t,e,n),o=i[0].shape,a=r.squeeze(i[0]).shape,u=i.map(l=>{const c=xt(l.shape,o);if(!c&&!xt(r.squeeze(l).shape,a))throw new Error("the input tensors shape does not match");return c?l:r.reshape(l,o)});return[r.stack(u,s)]});case"Unpack":{const s=S("axis",t,e,n),i=S("tensor",t,e,n);return r.unstack(i,s)}case"Tile":{const s=S("reps",t,e,n);return[r.tile(S("x",t,e,n),s)]}case"Split":case"SplitV":{const s=S("axis",t,e,n),i=S("numOrSizeSplits",t,e,n),o=S("x",t,e,n);return r.split(o,i,s)}case"ScatterNd":{const s=S("indices",t,e,n),i=S("values",t,e,n),o=S("shape",t,e,n);return[r.scatterND(s,i,o)]}case"GatherNd":{const s=S("x",t,e,n),i=S("indices",t,e,n);return[r.gatherND(s,i)]}case"SparseToDense":{const s=S("sparseIndices",t,e,n),i=S("outputShape",t,e,n),o=S("sparseValues",t,e,n),a=S("defaultValue",t,e,n);return[r.sparseToDense(s,o,i,o.dtype===a.dtype?a:r.cast(a,o.dtype))]}case"TensorScatterUpdate":{const s=S("indices",t,e,n),i=S("values",t,e,n),o=S("tensor",t,e,n);return[r.tensorScatterUpdate(o,s,i)]}default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5674 * @license
5675 * Copyright 2021 Google LLC. All Rights Reserved.
5676 * Licensed under the Apache License, Version 2.0 (the "License");
5677 * you may not use this file except in compliance with the License.
5678 * You may obtain a copy of the License at
5679 *
5680 * http://www.apache.org/licenses/LICENSE-2.0
5681 *
5682 * Unless required by applicable law or agreed to in writing, software
5683 * distributed under the License is distributed on an "AS IS" BASIS,
5684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5685 * See the License for the specific language governing permissions and
5686 * limitations under the License.
5687 * =============================================================================
5688 */const zee=(t,e,n,r=en)=>{switch(t.op){case"SparseFillEmptyRows":{const{outputIndices:s,outputValues:i,emptyRowIndicator:o,reverseIndexMap:a}=r.sparse.sparseFillEmptyRows(S("indices",t,e,n),S("values",t,e,n),S("denseShape",t,e,n),S("defaultValue",t,e,n));return[s,i,o,a]}case"SparseReshape":{const{outputIndices:s,outputShape:i}=r.sparse.sparseReshape(S("inputIndices",t,e,n),S("inputShape",t,e,n),S("newShape",t,e,n));return[s,i]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean(S("data",t,e,n),S("indices",t,e,n),S("segmentIds",t,e,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum(S("data",t,e,n),S("indices",t,e,n),S("segmentIds",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5689 * @license
5690 * Copyright 2018 Google LLC. All Rights Reserved.
5691 * Licensed under the Apache License, Version 2.0 (the "License");
5692 * you may not use this file except in compliance with the License.
5693 * You may obtain a copy of the License at
5694 *
5695 * http://www.apache.org/licenses/LICENSE-2.0
5696 *
5697 * Unless required by applicable law or agreed to in writing, software
5698 * distributed under the License is distributed on an "AS IS" BASIS,
5699 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5700 * See the License for the specific language governing permissions and
5701 * limitations under the License.
5702 * =============================================================================
5703 */const jee=(t,e,n,r=en)=>{switch(t.op){case"FFT":return[r.fft(S("x",t,e,n))];case"IFFT":return[r.ifft(S("x",t,e,n))];case"RFFT":return[r.rfft(S("x",t,e,n))];case"IRFFT":return[r.irfft(S("x",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5704 * @license
5705 * Copyright 2021 Google LLC. All Rights Reserved.
5706 * Licensed under the Apache License, Version 2.0 (the "License");
5707 * you may not use this file except in compliance with the License.
5708 * You may obtain a copy of the License at
5709 *
5710 * http://www.apache.org/licenses/LICENSE-2.0
5711 *
5712 * Unless required by applicable law or agreed to in writing, software
5713 * distributed under the License is distributed on an "AS IS" BASIS,
5714 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5715 * See the License for the specific language governing permissions and
5716 * limitations under the License.
5717 * =============================================================================
5718 */const Gee=(t,e,n,r=en)=>{switch(t.op){case"StaticRegexReplace":return[r.string.staticRegexReplace(S("input",t,e,n),S("pattern",t,e,n),S("rewrite",t,e,n),S("replaceGlobal",t,e,n))];case"StringNGrams":{const{nGrams:s,nGramsSplits:i}=r.string.stringNGrams(S("data",t,e,n),S("dataSplits",t,e,n),S("separator",t,e,n),S("nGramWidths",t,e,n),S("leftPad",t,e,n),S("rightPad",t,e,n),S("padWidth",t,e,n),S("preserveShortSequences",t,e,n));return[s,i]}case"StringSplit":{const{indices:s,values:i,shape:o}=r.string.stringSplit(S("input",t,e,n),S("delimiter",t,e,n),S("skipEmpty",t,e,n));return[s,i,o]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast(S("input",t,e,n),S("numBuckets",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5719 * @license
5720 * Copyright 2018 Google LLC. All Rights Reserved.
5721 * Licensed under the Apache License, Version 2.0 (the "License");
5722 * you may not use this file except in compliance with the License.
5723 * You may obtain a copy of the License at
5724 *
5725 * http://www.apache.org/licenses/LICENSE-2.0
5726 *
5727 * Unless required by applicable law or agreed to in writing, software
5728 * distributed under the License is distributed on an "AS IS" BASIS,
5729 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5730 * See the License for the specific language governing permissions and
5731 * limitations under the License.
5732 * =============================================================================
5733 */const Hee=(t,e,n,r=en)=>{switch(t.op){case"Cast":return[r.cast(S("x",t,e,n),S("dtype",t,e,n))];case"ExpandDims":{const s=S("axis",t,e,n);return[r.expandDims(S("x",t,e,n),s)]}case"Squeeze":{const s=S("axis",t,e,n);return[r.squeeze(S("x",t,e,n),s)]}case"Reshape":return[r.reshape(S("x",t,e,n),S("shape",t,e,n))];case"EnsureShape":return[r.ensureShape(S("x",t,e,n),S("shape",t,e,n))];case"MirrorPad":return[r.mirrorPad(S("x",t,e,n),S("padding",t,e,n),S("mode",t,e,n))];case"PadV2":case"Pad":return[r.pad(S("x",t,e,n),S("padding",t,e,n),S("constantValue",t,e,n))];
vendor: 4,741 bytes, lines 5733-5751
5733case"SpaceToBatchND":{const s=S("blockShape",t,e,n),i=S("paddings",t,e,n);return[r.spaceToBatchND(S("x",t,e,n),s,i)]}case"BatchToSpaceND":{const s=S("blockShape",t,e,n),i=S("crops",t,e,n);return[r.batchToSpaceND(S("x",t,e,n),s,i)]}case"DepthToSpace":{const s=S("blockSize",t,e,n),i=S("dataFormat",t,e,n).toUpperCase();return[r.depthToSpace(S("x",t,e,n),s,i)]}case"BroadcastTo":return[r.broadcastTo(S("x",t,e,n),S("shape",t,e,n))];case"BroadcastArgs":return[r.broadcastArgs(S("s0",t,e,n),S("s1",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}};/**
5734 * @license
5735 * Copyright 2018 Google LLC. All Rights Reserved.
5736 * Licensed under the Apache License, Version 2.0 (the "License");
5737 * you may not use this file except in compliance with the License.
5738 * You may obtain a copy of the License at
5739 *
5740 * http://www.apache.org/licenses/LICENSE-2.0
5741 *
5742 * Unless required by applicable law or agreed to in writing, software
5743 * distributed under the License is distributed on an "AS IS" BASIS,
5744 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5745 * See the License for the specific language governing permissions and
5746 * limitations under the License.
5747 * =============================================================================
5748 */function DT(t,e,n,r,s=$e){const i=((o,a,u)=>{switch(o.category){case"arithmetic":return s(()=>bee(o,a,u));case"basic_math":return s(()=>_ee(o,a,u));case"control":return kee(o,a,u);case"convolution":return s(()=>$ee(o,a,u));case"creation":return s(()=>Iee(o,a,u));case"dynamic":return Aee(o,a,u);case"evaluation":return s(()=>Ree(o,a,u));case"image":return s(()=>Fee(o,a,u));case"graph":return s(()=>Oee(o,a,u));case"logical":return s(()=>Lee(o,a,u));case"matrices":return s(()=>Mee(o,a,u));case"normalization":return s(()=>Vee(o,a,u));case"ragged":return s(()=>Bee(o,a,u));case"reduction":return s(()=>Wee(o,a,u));case"slice_join":return s(()=>Uee(o,a,u));case"sparse":return s(()=>zee(o,a,u));case"spectral":return s(()=>jee(o,a,u));case"string":return s(()=>Gee(o,a,u));case"transformation":return s(()=>Hee(o,a,u));case"hash_table":return Pee(o,a,u,r);case"custom":const l=ZD(o.op);if(l&&l.customExecutor)return l.customExecutor(new wee(o,a,u));throw TypeError(`Custom op ${o.op} is not registered.`);default:throw TypeError(`Unknown op '${o.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(t,e,n);return ma(i)?i.then(o=>[].concat(o)):[].concat(i)}class PT{constructor(e={},n={},r={},s={},i){this.weightMap=e,this.tensorArrayMap=n,this.tensorListMap=r,this.functionMap=s,this.parseNodeNameCache=i,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,n){return{id:e,frameName:n,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let n=0;n<this.contexts.length-1;n++){const r=this.contexts.slice(0,this.contexts.length-n);e.push(this.contextIdforContexts(r))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map(n=>n.id===0&&n.iterationId===0?"":`${n.frameName}-${n.iterationId}`).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(this.contexts&&this.contexts.length>1)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;const e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}else throw new Error("Cannot increase frame iteration, the context is empty")}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const n in this.tensorArrayMap)this.tensorArrayMap[n].clearAndClose(e);for(const n in this.tensorListMap)this.tensorListMap[n].clearAndClose(e)}}/**
5749 * @license
5750 * Copyright 2019 Google LLC. All Rights Reserved.
5751 * Licensed under the Apache License, Version 2.0 (the "License");
5752 * you may not use this file except in compliance with the License.
5753 * You may obtain a copy of the License at
5754 *
5755 * http://www.apache.org/licenses/LICENSE-2.0
5756 *
5757 * Unless required by applicable law or agreed to in writing, software
5758 * distributed under the License is distributed on an "AS IS" BASIS,
5759 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5760 * See the License for the specific language governing permissions and
5761 * limitations under the License.
5762 * =============================================================================
5763 */function FT(t,e,n,r){const s=new Set,i=[];let o=null,a=null;const u=new Set,l=new Set(Object.keys(t).map(d=>Un(d)[0]));r=r||[];const c=new Set(r.map(d=>Un(d.name)[0])),h=[...e];for(;h.length>0;){const d=h.pop();if((Vo(d)||ete(d)||tte(d))&&o==null&&(o=d,a=o.children.map(f=>f.name).filter(f=>s.has(f))),s.add(d.name),n[d.name]==null&&!l.has(d.name)&&!c.has(d.name)){if(d.inputs.length===0){i.push(d.name);continue}d.inputs.forEach(f=>{u.has(f.name)||(u.add(f.name),h.push(f))})}}return{inputs:t,outputs:e,usedNodes:s,missingInputs:i,dynamicNode:o,syncInputs:a}}function qee(t,e){const{usedNodes:n,inputs:r}=e,s=Object.keys(r).map(v=>Un(v)[0]).map(v=>t.nodes[v]),i=t.initNodes||[],o=v=>n.has(typeof v=="string"?v:v.name);function a(v){return[...new Map(v.map(g=>[g.name,g])).values()]}const u=a([...s,...t.weights,...i]).filter(o),l=a([...u,...Object.values(t.nodes)]).filter(o),c=new Map(l.map(v=>[v.name,v])),h={};for(const v of l){h[v.name]=h[v.name]||0;for(const g of v.children)o(g)||(h[g.name]=Number.POSITIVE_INFINITY),h[g.name]=(h[g.name]||0)+1}const d=Object.entries(h).filter(([,v])=>v===0).map(([v])=>v),f=[...d];for(;d.length>0;){const v=d.pop(),g=c.get(v);for(const x of g.children.filter(o))--h[x.name]===0&&(f.push(x.name),d.push(x.name))}const p=f.map(v=>c.get(v)),y=Kee(p,u);return Xee(y,u),y}function Kee(t,e){const n=new Map(t.map(o=>[o.name,o])),r=e.map(o=>o.name),s=new Set(r);for(;r.length>0;){const o=r.pop(),a=n.get(o);for(const u of a.children)!n.has(u.name)||s.has(u.name)||(s.add(u.name),r.push(u.name))}return t.filter(o=>s.has(o.name))}
5763class md extends Error{constructor(e){super(`NodesExecutionOrderError: ${e}`)}}function Xee(t,e){const n=new Map(t.map((a,u)=>[a.name,u])),r=new Set(e.map(a=>a.name)),s=a=>r.has(typeof a=="string"?a:a.name),i=new Set(t.map(a=>a.name)),o=a=>i.has(typeof a=="string"?a:a.name);for(const a of t){for(const u of a.children.filter(o)){if(!n.has(u.name))throw new md(`Child ${u.name} of node ${a.name} is unreachable.`);if(n.get(a.name)>n.get(u.name))throw new md(`Node ${a.name} is scheduled to run after its child ${u.name}.`)}if(!s(a))for(const u of a.inputs){if(!n.has(u.name))throw new md(`Input ${u.name} of node ${a.name} is unreachable.`);if(n.get(u.name)>n.get(a.name))throw new md(`Node ${a.name} is scheduled to run before its input ${u.name}.`)}}}function Yee(t){const e=new Map(t.map((a,u)=>[a.name,u])),n=Number.MAX_SAFE_INTEGER,r=t.map((a,u)=>Vo(a)?n:u),s=a=>{const u=r[e.get(a.name)];return u??-1},i=t.map((a,u)=>a.children.map(s).reduce((l,c)=>Math.max(l,c),r[u])),o=new Map;for(let a=0;a<t.length;++a){const u=i[a];if(u===n)continue;const l=t[a],c=t[u];o.has(c.name)||o.set(c.name,[]),o.get(c.name).push(l)}return o}const Qee=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),Zee=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),Jee=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function Vo(t){return Qee.has(t.op)}function ete(t){return Zee.has(t.op)}function tte(t){return Jee.has(t.op)}/**
5764 * @license
5765 * Copyright 2018 Google LLC. All Rights Reserved.
5766 * Licensed under the Apache License, Version 2.0 (the "License");
5767 * you may not use this file except in compliance with the License.
5768 * You may obtain a copy of the License at
5769 *
5770 * http://www.apache.org/licenses/LICENSE-2.0
5771 *
5772 * Unless required by applicable law or agreed to in writing, software
5773 * distributed under the License is distributed on an "AS IS" BASIS,
5774 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5775 * See the License for the specific language governing permissions and
5776 * limitations under the License.
5777 * =============================================================================
5778 */class ep{get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const n=Object.keys(e).map(r=>e[r].map(s=>s.id));this._weightIds=[].concat(...n),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(e=>e.signatureKey||e.name)}get outputNodes(){return this._outputs.map(e=>{const n=e.signatureKey||e.name;return e.defaultOutput?`${n}:${e.defaultOutput}`:n})}get functions(){return Object.keys(this._functions).reduce((e,n)=>(e[n]=this._functions[n].signature,e),{})}constructor(e,n){this.graph=e,this.parent=n,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEach(r=>{this._functionExecutorMap[r]=new ep(e.functions[r],this)})}getCompilationKey(e,n){const r=e.map(i=>i.name).sort(),s=n.map(i=>i.name).sort();return r.join(this.SEPARATOR)+"--"+s.join(this.SEPARATOR)}compile(e,n){const r=FT(e,n,this.weightMap,this._initNodes),{missingInputs:s,dynamicNode:i,syncInputs:o}=r;if(i!=null)throw new Error(`This execution contains the node '${i.name}', which has the dynamic op '${i.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${o}]`);if(s.length>0){const l=n.map(h=>h.name),c=Object.keys(e);throw new Error(`Cannot compute the outputs [${l}] from the provided inputs [${c}]. Missing the following inputs: [${s}]`)}const a=qee(this.graph,r),u=Yee(a);return{orderedNodes:a,nodeLiveUntilMap:u}}cloneAndKeepTensor(e){if(e==null)return null;const n=e.clone();return Is(n),n}cloneTensorList(e){return e?e.map(r=>this.cloneAndKeepTensor(r)):null}cloneTensorMap(e){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,this.cloneTensorList(r)]))}
5778execute(e,n){this.disposeIntermediateTensors(),e=this.mapInputs(e);const r=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),n=this.mapOutputs(n),this.checkOutputs(n);const s=r.map(d=>this.graph.nodes[Un(d)[0]]),i=n.map(d=>Un(d)[0]),o=new Set(i);let a=i.map(d=>this.graph.nodes[d]);a.length===0&&(a=this._outputs);const u=this.getCompilationKey(s,a);let l=this.compiledMap.get(u);l==null&&(l=this.compile(e,a),this.compiledMap.set(u,l));try{this.keepIntermediateTensors=U().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(d){this.keepIntermediateTensors=!1,console.warn(d.message)}const c={},h={};return $e(()=>{const d=new PT(this.weightMap,c,h,this.functionExecutorMap,this.parseNodeNameCache),f=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(e).forEach(g=>{const[x,w]=Un(g,d),_=[];_[w]=e[g],f[x]=_,this.keepIntermediateTensors&&(this.clonedTensorsMap[x]=this.cloneTensorList(_))});const p=this.getFrozenTensorIds(f),{orderedNodes:y,nodeLiveUntilMap:v}=l;for(const g of y){if(f[g.name])continue;const x=DT(g,f,d,this._resourceManager);if(ma(x))throw new Error(`The execution of the op '${g.op}' returned a promise. Please use model.executeAsync() instead.`);f[g.name]=x,this.keepIntermediateTensors&&(this.clonedTensorsMap[g.name]=this.cloneTensorList(x)),this.checkTensorForDisposalWithNodeLiveUntilInfo(g,f,d,p,o,v.get(g.name))}return this.parent==null&&d.dispose(p),n.map(g=>Kt(g,f,d))})}getFrozenTensorIds(e){const n=[].concat.apply([],Object.keys(e).map(r=>e[r]).map(r=>r.map(s=>s.id)));return new Set(n)}checkTensorForDisposal(e,n,r,s,i,o,a){if(!(Vo(n)||o.has(e))){for(const u of r[e])u!=null&&(a[u.id]=(a[u.id]||0)+n.children.length);for(const u of n.inputs){if(Vo(u))continue;const l=$T(u.name,r,s);if(l!=null)for(const c of l){if(!c||c.kept||i.has(c.id))continue;const h=a[c.id];h===1?(c.dispose(),delete a[c.id]):h!=null&&a[c.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(e,n,r,s,i,o){function a(u){return Vo(u)||i.has(u.name)}if(!(Vo(e)||o==null))for(const u of o){if(a(u))continue;const l=$T(u.name,n,r);for(const c of l)!c||c.kept||s.has(c.id)||c.dispose()}}async executeAsync(e,n){return this._executeAsync(e,n)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach(e=>{for(const n of e)n&&!n.isDisposed&&n.dispose()}),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(e,n,r=!1,s={},i={}){this.disposeIntermediateTensors(),r||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),n=this.mapOutputs(n),this.checkOutputs(n));try{this.keepIntermediateTensors=U().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(d){this.keepIntermediateTensors=!1,console.warn(d.message)}const o=new PT(this.weightMap,s,i,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));const a=await this.executeWithControlFlow(e,o,n,r),u=n.map(d=>Kt(d,a,o)),l=u.map(d=>d.id),c=Object.keys(e).map(d=>e[d].id),h=new Set([...l,...c,...this.weightIds]);return Object.values(a).forEach(d=>{d.forEach(f=>{f&&!f.isDisposed&&!h.has(f.id)&&f.dispose()})}),this.parent==null&&o.dispose(h),u}async executeFunctionAsync(e,n,r){const s=e.reduce((i,o,a)=>(i[this.inputs[a].name]=o,i),{});return this._executeAsync(s,this.outputNodes,!0,n,r)}async executeWithControlFlow(e,n,r,s){const i=Object.keys(e),o=i.map(_=>this.graph.nodes[Un(_)[0]]),a=r.map(_=>Un(_)[0]),u=new Set(a);let l=a.map(_=>this.graph.nodes[_]);l.length===0&&(l=this._outputs);const{usedNodes:c,missingInputs:h,dynamicNode:d,syncInputs:f}=FT(e,l,this.weightMap,this._initNodes),p=[...o,...this.graph.weights,...this._initNodes||[]].map(_=>({node:_,contexts:n.currentContext})),y=Object.assign({},this.weightMap);Object.keys(e).forEach(_=>{const[T,E]=Un(_),k=[];k[E]=e[_],y[T]=k});const v={},g=this.getFrozenTensorIds(y),x={};for(;p.length>0;){const _=this.processStack(o,p,n,y,x,g,u,v,c);await Promise.all(_)}d==null&&!s&&console.warn("This model execution did not contain any no
5778des with control flow or dynamic output shapes. You can use model.execute() instead.");const w=l.filter(_=>!Vo(_)&&!Kt(_.name,y,n)).map(_=>_.name);if(w.length>0){let _="";throw d!=null&&(_=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${f}]`),new Error(`Cannot compute the outputs [${w}] from the provided inputs [${i}]. Consider providing the following inputs: [${h}]. ${_}`)}return y}processStack(e,n,r,s,i,o,a,u,l){const c=[];for(;n.length>0;){const h=n.pop();r.currentContext=h.contexts;let d="";if(h.node.op==="Enter"&&S("isConstant",h.node,s,r)&&([d]=Js(h.node.name,r)),s[h.node.name]==null){const f=DT(h.node,s,r,this._resourceManager);d||([d]=Js(h.node.name,r));const p=r.currentContext;ma(f)?c.push(f.then(y=>(s[d]=y,this.keepIntermediateTensors&&(this.clonedTensorsMap[d]=this.cloneTensorList(y)),r.currentContext=p,this.checkTensorForDisposal(d,h.node,s,r,o,a,u),this.processChildNodes(h.node,n,r,s,i,l),y))):(s[d]=f,this.keepIntermediateTensors&&(this.clonedTensorsMap[d]=this.cloneTensorList(f)),this.checkTensorForDisposal(d,h.node,s,r,o,a,u),this.processChildNodes(h.node,n,r,s,i,l))}else this.processChildNodes(h.node,n,r,s,i,l)}return c}processChildNodes(e,n,r,s,i,o){e.children.forEach(a=>{const[u]=Js(a.name,r);i[u]||!o.has(a.name)||(a.op==="Merge"?a.inputNames.some(l=>!!Kt(l,s,r))&&(i[u]=!0,n.push({contexts:r.currentContext,node:a})):a.inputNames.every(l=>!!Kt(l,s,r))&&(i[u]=!0,n.push({contexts:r.currentContext,node:a})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(n=>n.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(n=>{const r=e[n],[s]=Un(n),i=this.graph.nodes[s];if(i.attrParams.shape&&i.attrParams.shape.value){const o=i.attrParams.shape.value,a=o.length===r.shape.length&&r.shape.every((u,l)=>o[l]===-1||o[l]===u);A(a,()=>`The shape of dict['${i.name}'] provided in model.execute(dict) must be [${o}], but was [${r.shape}]`)}i.attrParams.dtype&&i.attrParams.dtype.value&&A(r.dtype===i.attrParams.dtype.value,()=>`The dtype of dict['${i.name}'] provided in model.execute(dict) must be ${i.attrParams.dtype.value}, but was ${r.dtype}`)})}mapInputs(e){var n,r;const s={};for(const i in e){const o=(r=(n=this._signature)===null||n===void 0?void 0:n.inputs)===null||r===void 0?void 0:r[i];o!=null?s[o.name]=e[i]:s[i]=e[i]}return s}checkInputs(e){const n=Object.keys(e).filter(r=>{const[s]=Un(r);return this.graph.nodes[s]==null});if(n.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${n}] that are not part of graph`)}mapOutputs(e){return e.map(n=>{var r,s;const i=(s=(r=this._signature)===null||r===void 0?void 0:r.outputs)===null||s===void 0?void 0:s[n];return i!=null?i.name:n},{})}checkOutputs(e){e.forEach(n=>{const[r]=Un(n);if(!this.graph.nodes[r])throw new Error(`The output '${n}' is not found in the graph`)})}}class nte{constructor(e={},n={}){this.hashTableNameToHandle=e,this.hashTableMap=n}addHashTable(e,n){this.hashTableNameToHandle[e]=n.handle,this.hashTableMap[n.id]=n}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}/**
5779 * @license
5780 * Copyright 2018 Google LLC. All Rights Reserved.
5781 * Licensed under the Apache License, Version 2.0 (the "License");
5782 * you may not use this file except in compliance with the License.
5783 * You may obtain a copy of the License at
5784 *
5785 * http://www.apache.org/licenses/LICENSE-2.0
5786 *
5787 * Unless required by applicable law or agreed to in writing, software
5788 * distributed under the License is distributed on an "AS IS" BASIS,
5789 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5790 * See the License for the specific language governing permissions and
5791 * limitations under the License.
5792 * =============================================================================
5793 */const rte="?tfjs-format=file",ste="model.json";class ite{get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}constructor(e,n={},r=tD){this.modelUrl=e,this.loadOptions=n,this.version="n/a",this.io=r,n==null&&(this.loadOptions={}),this.resourceManager=new nte}findIOHandler(){const e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=this.io.browserHTTPRequest
5793(e,this.loadOptions);else{const n=this.io.getLoadHandlers(e,this.loadOptions);if(n.length===0)n.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(n.length>1)throw new Error(`Found more than one (${n.length}) load handlers for URL '${[e]}'`);this.handler=n[0]}}load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=this.handler.load();return ma(e)?e.then(n=>n.getWeightStream==null?this.loadSync(n):this.loadStreaming(n)):this.loadSync(e)}loadSync(e){const n=this.io.decodeWeights(e.weightData,e.weightSpecs);return this.loadWithWeightMap(e,n)}async loadStreaming(e){if(e.getWeightStream==null)throw new Error("Model artifacts missing streamWeights function");const n=await KR(e.getWeightStream(),e.weightSpecs);return this.loadWithWeightMap(e,n)}loadWithWeightMap(e,n){this.artifacts=e;const r=this.artifacts.modelTopology;let s=this.artifacts.signature;if(this.artifacts.userDefinedMetadata!=null){const i=this.artifacts.userDefinedMetadata;i.signature!=null&&(s=i.signature),i.structuredOutputKeys!=null&&(this.structuredOutputKeys=i.structuredOutputKeys)}if(this.signature=s,this.version=`${r.versions.producer}.${r.versions.minConsumer}`,this.executor=new ep(IT.Instance.transformGraph(r,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){const i=IT.Instance.transformGraph(e.modelInitializer);this.initializer=new ep(i),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}async save(e,n){if(typeof e=="string"){const r=this.io.getSaveHandlers(e);if(r.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(r.length>1)throw new Error(`Found more than one (${r.length}) save handlers for URL '${e}'`);e=r[0]}if(e.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}addStructuredOutputNames(e){if(this.structuredOutputKeys){const n=e instanceof Lt?[e]:e,r={};return n.forEach((s,i)=>r[this.structuredOutputKeys[i]]=s),r}return e}predict(e,n){const r=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(r)}async predictAsync(e,n){const r=await this.executeAsync(e,this.outputNodes);return this.addStructuredOutputNames(r)}normalizeInputs(e){var n;if(!(e instanceof Lt)&&!Array.isArray(e)){const i=(n=this.signature)===null||n===void 0?void 0:n.inputs;if(i!=null)for(const o in i){const a=i[o];a.resourceId!=null&&(e[o]=this.resourceIdToCapturedInput[a.resourceId])}return e}e=Array.isArray(e)?e:[e];const r=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+r!==this.inputNodes.length)throw new Error(`Input tensor count mismatch, the graph model has ${this.inputNodes.length-r} non-resource placeholders, while there are ${e.length} input tensors provided.`);let s=0;return this.inputNodes.reduce((i,o)=>{var a,u,l;const c=(l=(u=(a=this.signature)===null||a===void 0?void 0:a.inputs)===null||u===void 0?void 0:u[o])===null||l===void 0?void 0:l.resourceId;return c!=null?i[o]=this.resourceIdToCapturedInput[c]:i[o]=e[s++],i},{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}executeInitializerGraph(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}async executeInitializerGraphAsync(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.executeAsync({},[]):this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs))}setResourceIdToCapturedInput(e){if(this.resourceIdToCapturedInput={},this.initializerSignature){const n=this.initializerSignature.outputs,r=Object.keys(n);for(let s=0;s<r.length;s++){const i=r[s],o=n[i];this.resourceIdToCapturedInput[o.resourceId]=e[s]}}}execute(e,n){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),n=this.normalizeOutputs(n);const r=this.executor.execute(e,n);return r.length>1?r:r[0]}async executeAsync(e,n){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),e=this.normalizeInputs(e),n=this.normalizeOutputs(n);const r=await this.executor.executeAsync(e,n);return r.length>1?r:r[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((n,r)=>(n[r]=[e[r]],n),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&mt(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}async function LT(t,e={},n=tD){if(t==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");e==null&&(e={}),e.fromTFHub&&typeof t=="string"&&(t=ote(t));const r=new ite(t,e,n);return await r.load(),r}function ote(t){return t.endsWith("/")||(t=t+"/"),`${t}${ste}${rte}`}/**
5794    * @license
5795    * Copyright 2023 Google LLC. All Rights Reserved.
5796    * Licensed under the Apache License, Version 2.0 (the "License");
5797    * you may not use this file except in compliance with the License.
5798    * You may obtain a copy of the License at
5799    *
5800    * http://www.apache.org/licenses/LICENSE-2.0
5801    *
5802    * Unless required by applicable law or agreed to in writing, software
5803    * distributed under the License is distributed on an "AS IS" BASIS,
5804    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5805    * See the License for the specific language governing permissions and
5806    * limitations under the License.
5807    * =============================================================================
5808    */var wn=function(){return wn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},wn.apply(this,arguments)};function ls(t,e,n,r){return new(n||(n=Promise))(function(s,i){function o(l){try{u(r.next(l))}catch(c){i(c)}}function a(l){try{u(r.throw(l))}catch(c){i(c)}}function u(l){var c;l.done?s(l.value):(c=l.value,c instanceof n?c:new n(function(h){h(c)})).then(o,a)}u((r=r.apply(t,[])).next())})}function cs(t,e){var n,r,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(u){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(s=2&c[0]?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(s=o.trys,!((s=s.length>0&&s[s.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(c[0]===6&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(h){c=[6,h],r=0}finally{n=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([u,l])}}}var tp=["wrist","thumb_cmc","thumb_mcp","thumb_ip","thumb_tip","index_finger_mcp","index_finger_pip","index_finger_dip","index_finger_tip","middle_finger_mcp","middle_finger_pip","middle_finger_dip","middle_finger_tip","ring_finger_mcp","ring_finger_pip","ring_finger_dip","ring_finger_tip","pinky_finger_mcp","pinky_finger_pip","pinky_finger_dip","pinky_finger_tip"],Bg={runtime:"mediapipe",maxHands:2,modelType:"full"},ate=function(){function t(e){var n,r=this;this.width=0,this.height=0,this.selfieMode=!1,this.handsSolution=new ZH.Hands({locateFile:function(s,i){return e.solutionPath?e.solutionPath.replace(/\/+$/,"")+"/"+s:i+"/"+s}}),e.modelType==="lite"?n=0:n=1,this.handsSolution.setOptions({modelComplexity:n,selfieMode:this.selfieMode,maxNumHands:e.maxHands}),this.handsSolution.onResults(function(s){if(r.height=s.image.height,r.width=s.image.width,r.hands=[],s.multiHandLandmarks!==null)for(var i=s.multiHandedness,o=s.multiHandLandmarks,a=s.multiHandWorldLandmarks,u=0;u<i.length;u++)r.hands.push(wn(wn({},r.translateOutput(o[u],a[u])),{score:i[u].score,handedness:i[u].label}))})}return t.prototype.translateOutput=function(e,n){var r=this;return{keypoints:e.map(function(s,i){return{x:s.x*r.width,y:s.y*r.height,score:s.visibility,name:tp[i]}}),keypoints3D:n.map(function(s,i){return{x:s.x,y:s.y,z:s.z,score:s.visibility,name:tp[i]}})}},t.prototype.estimateHands=function(e,n){return ls(this,void 0,void 0,function(){var r,s;return cs(this,function(i){switch(i.label){case 0:return n&&n.flipHorizontal&&n.flipHorizontal!==this.selfieMode&&(this.selfieMode=n.flipHorizontal,this.handsSolution.setOptions({selfieMode:this.selfieMode})),e instanceof Lt?(s=ImageData.bind,[4,fJ(e)]):[3,2];case 1:return r=new(s.apply(ImageData,[void 0,i.sent(),e.shape[1],e.shape[0]])),[3,3];case 2:r=e,i.label=3;case 3:return e=r,[4,this.handsSolution.send({image:e})];case 4:return i.sent(),[2,this.hands]}})})},t.prototype.dispose=function(){this.handsSolution.close()},t.prototype.reset=function(){this.handsSolution.reset(),this.width=0,this.height=0,this.hands=null,this.selfieMode=!1},t.prototype.initialize=function(){return this.handsSolution.initialize()},t}();function ute(t){return ls(this,void 0,void 0,function(){var e,n;return cs(this,function(r){switch(r.label){case 0:return e=function(s){if(s==null)return wn({},Bg);var i=wn({},s);return i.runtime="mediapipe",i.maxHands==null&&(i.maxHands=Bg.maxHands),i.modelType==null&&(i.modelType=Bg.modelType),i}(t),[4,(n=new ate(e)).initialize()];case 1:return r.sent(),[2,n]}})})}function Wg(t){return t.width*t.height}function MT(t){var e=t.xCenter-t.width/2,n=e+t.width,r=t.yCenter-t.height/2;return{xMin:e,xMax:n,yMin:r,yMax:r+t.height,width:t.width,height:t.height}}function lte(t,e){var n=MT(t),r=MT(e);if(!function(o,a){return!(o.xMax<a.xMin||a.xMax<o.xMin||o.yMax<a.yMin||a.y
5808Max<o.yMin)}(n,r))return 0;var s=Wg(function(o,a){var u=Math.max(o.xMin,a.xMin),l=Math.min(o.xMax,a.xMax),c=Math.max(o.yMin,a.yMin),h=Math.min(o.yMax,a.yMax);return{xMin:u,xMax:l,yMin:c,yMax:h,width:Math.max(l-u,0),height:Math.max(h-c,0)}}(n,r)),i=Wg(n)+Wg(r)-s;return i>0?s/i:0}function cte(t,e,n,r){var s=t.width,i=t.height,o=1,a=Math.cos(t.rotation),u=Math.sin(t.rotation),l=t.xCenter,c=t.yCenter,h=1/e,d=1/n,f=new Array(16);return f[0]=s*a*o*h,f[1]=-i*u*h,f[2]=0,f[3]=(-.5*s*a*o+.5*i*u+l)*h,f[4]=s*u*o*d,f[5]=i*a*d,f[6]=0,f[7]=(-.5*i*a-.5*s*u*o+c)*d,f[8]=0,f[9]=0,f[10]=s*h,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,function(p){if(p.length!==16)throw new Error("Array length must be 16 but got "+p.length);return[[p[0],p[1],p[2],p[3]],[p[4],p[5],p[6],p[7]],[p[8],p[9],p[10],p[11]],[p[12],p[13],p[14],p[15]]]}(f)}function tP(t){return t instanceof Lt?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function np(t){return t-2*Math.PI*Math.floor((t+Math.PI)/(2*Math.PI))}function nP(t){return t instanceof Lt?t:pJ(t)}function Ug(t,e){A(t.width!==0,function(){return e+" width cannot be 0."}),A(t.height!==0,function(){return e+" height cannot be 0."})}function hte(t,e){var n=function(r,s,i,o){var a=s-r,u=o-i,l=u/a;return{scale:l,offset:i-r*l}}(0,255,e[0],e[1]);return $e(function(){return ge(re(t,n.scale),n.offset)})}function VT(t,e,n){var r=e.outputTensorSize,s=e.keepAspectRatio,i=e.borderMode,o=e.outputTensorFloatRange,a=tP(t),u=function(d,f){return f?{xCenter:f.xCenter*d.width,yCenter:f.yCenter*d.height,width:f.width*d.width,height:f.height*d.height,rotation:f.rotation}:{xCenter:.5*d.width,yCenter:.5*d.height,width:d.width,height:d.height,rotation:0}}(a,n),l=function(d,f,p){if(p===void 0&&(p=!1),!p)return{top:0,left:0,right:0,bottom:0};var y=f.height,v=f.width;Ug(f,"targetSize"),Ug(d,"roi");var g,x,w=y/v,_=d.height/d.width,T=0,E=0;return w>_?(g=d.width,x=d.width*w,E=(1-_/w)/2):(g=d.height/w,x=d.height,T=(1-w/_)/2),d.width=g,d.height=x,{top:E,left:T,right:T,bottom:E}}(u,r,s),c=cte(u,a.width,a.height),h=$e(function(){var d=nP(t),f=sa(function(v,g,x){return Ug(x,"inputResolution"),[1/x.width*v[0][0]*g.width,1/x.height*v[0][1]*g.width,v[0][3]*g.width,1/x.width*v[1][0]*g.height,1/x.height*v[1][1]*g.height,v[1][3]*g.height,0,0]}(c,a,r),[1,8]),p=i==="zero"?"constant":"nearest",y=xm.transform(ks(vt(d,"float32")),f,"bilinear",p,0,[r.height,r.width]);return o!=null?hte(y,o):y});return{imageTensor:h,padding:l,transformationMatrix:c}}function BT(t,e,n,r){return r===1?.5*(t+e):t+(e-t)*n/(r-1)}function WT(t){return{xCenter:t.xMin+t.width/2,yCenter:t.yMin+t.height/2,width:t.width,height:t.height}}function dte(t){var e=t.relativeKeypoints;if(e.length<=1)throw new Error("2 or more keypoints required to calculate a rect.");var n=Number.MAX_VALUE,r=Number.MAX_VALUE,s=Number.MIN_VALUE,i=Number.MIN_VALUE;return e.forEach(function(o){n=Math.min(n,o.x),s=Math.max(s,o.x),r=Math.min(r,o.y),i=Math.max(i,o.y)}),{xCenter:(n+s)/2,yCenter:(r+i)/2,width:s-n,height:i-r}}function fte(t,e,n,r,s){var i=n==="rect"?function(o,a,u){var l,c=o.locationData;return l=WT(c.boundingBox),l}(t):function(o,a){var u=o.locationData;return a==="boundingbox"?WT(u.relativeBoundingBox):dte(u)}(t,e);return s&&(i.rotation=function(o,a,u){var l,c=o.locationData,h=u.rotationVectorStartKeypointIndex,d=u.rotationVectorEndKeypointIndex;l=u.rotationVectorTargetAngle?u.rotationVectorTargetAngle:Math.PI*u.rotationVectorTargetAngleDegree/180;var f=c.relativeKeypoints[h].x*a.width,p=c.relativeKeypoints[h].y*a.height,y=c.relativeKeypoints[d].x*a.width,v=c.relativeKeypoints[d].y*a.height;return np(l-Math.atan2(-(v-p),y-f))}(t,r,s)),i}function pte(t){return $e(function(){var e=function(s){return $e(function(){return[Ne(s,[0,0,0],[1,-1,1]),Ne(s,[0,0,1],[1,-1,-1])]})}(t),n=e[0],r=e[1];return{boxes:Ht(r),logits:Ht(n)}})}function mte(t,e,n,r){return ls(this,void 0,void 0,function(){var s,i,o,a,u;return cs(this,function(l){switch(l.label){case 0:return t.sort(function(c,h){return Math.max.apply(Math,h.score)-Math.max.apply(Math,c.score)}),s=sa(t.map(function(c){return[c.locationData.relativeBoundingBox.yMin,c.locationData.relativeBoundingBox.xMin,c.locationData.relativeBoundingBox.yMax,c.locationData.relativeBoundingBox.xMax]})),i=un(t.map(function(c){return c.score[0]})),[4,xm.nonMaxSuppressionAsync(s,i,e,n)];case 1:return[4,(o=l.sent()).array()];case 2:return a=l.sent(),u=t.filter(function(c,h){return a.indexOf(h)>-1}
5808),mt([s,i,o]),[2,u]}})})}function gte(t,e){return t.map(function(n){var r=wn(wn({},n),{x:n.x*e.width,y:n.y*e.height});return n.z!=null&&(r.z=n.z*e.width),r})}function yte(t,e,n){return ls(this,void 0,void 0,function(){var r,s,i,o,a;return cs(this,function(u){switch(u.label){case 0:return r=t[0],s=t[1],i=function(l,c,h){return $e(function(){var d,f,p,y;h.reverseOutputOrder?(f=Ht(Ne(l,[0,h.boxCoordOffset+0],[-1,1])),d=Ht(Ne(l,[0,h.boxCoordOffset+1],[-1,1])),y=Ht(Ne(l,[0,h.boxCoordOffset+2],[-1,1])),p=Ht(Ne(l,[0,h.boxCoordOffset+3],[-1,1]))):(d=Ht(Ne(l,[0,h.boxCoordOffset+0],[-1,1])),f=Ht(Ne(l,[0,h.boxCoordOffset+1],[-1,1])),p=Ht(Ne(l,[0,h.boxCoordOffset+2],[-1,1])),y=Ht(Ne(l,[0,h.boxCoordOffset+3],[-1,1]))),f=ge(re(Ae(f,h.xScale),c.w),c.x),d=ge(re(Ae(d,h.yScale),c.h),c.y),h.applyExponentialOnBoxSize?(p=re(vi(Ae(p,h.hScale)),c.h),y=re(vi(Ae(y,h.wScale)),c.w)):(p=re(Ae(p,h.hScale),c.h),y=re(Ae(y,h.wScale),c.h));var v=Ee(d,Ae(p,2)),g=Ee(f,Ae(y,2)),x=ge(d,Ae(p,2)),w=ge(f,Ae(y,2)),_=Jt([K(v,[h.numBoxes,1]),K(g,[h.numBoxes,1]),K(x,[h.numBoxes,1]),K(w,[h.numBoxes,1])],1);if(h.numKeypoints)for(var T=0;T<h.numKeypoints;++T){var E=h.keypointCoordOffset+T*h.numValuesPerKeypoint,k=void 0,N=void 0;h.reverseOutputOrder?(k=Ht(Ne(l,[0,E],[-1,1])),N=Ht(Ne(l,[0,E+1],[-1,1]))):(N=Ht(Ne(l,[0,E],[-1,1])),k=Ht(Ne(l,[0,E+1],[-1,1])));var O=ge(re(Ae(k,h.xScale),c.w),c.x),R=ge(re(Ae(N,h.yScale),c.h),c.y);_=Jt([_,K(O,[h.numBoxes,1]),K(R,[h.numBoxes,1])],1)}return _})}(s,e,n),o=$e(function(){var l=r;return n.sigmoidScore?(n.scoreClippingThresh!=null&&(l=cO(r,-n.scoreClippingThresh,n.scoreClippingThresh)),l=ra(l)):l}),[4,vte(i,o,n)];case 1:return a=u.sent(),mt([i,o]),[2,a]}})})}function vte(t,e,n){return ls(this,void 0,void 0,function(){var r,s,i,o,a,u,l,c,h,d,f,p;return cs(this,function(y){switch(y.label){case 0:return r=[],[4,t.data()];case 1:return s=y.sent(),[4,e.data()];case 2:for(i=y.sent(),o=0;o<n.numBoxes;++o)if(!(n.minScoreThresh!=null&&i[o]<n.minScoreThresh||(a=o*n.numCoords,u=xte(s[a+0],s[a+1],s[a+2],s[a+3],i[o],n.flipVertically,o),(l=u.locationData.relativeBoundingBox).width<0||l.height<0))){if(n.numKeypoints>0)for((c=u.locationData).relativeKeypoints=[],h=n.numKeypoints*n.numValuesPerKeypoint,d=0;d<h;d+=n.numValuesPerKeypoint)f=a+n.keypointCoordOffset+d,p={x:s[f+0],y:n.flipVertically?1-s[f+1]:s[f+1]},c.relativeKeypoints.push(p);r.push(u)}return[2,r]}})})}function xte(t,e,n,r,s,i,o){return{score:[s],ind:o,locationData:{relativeBoundingBox:{xMin:e,yMin:i?1-n:t,xMax:r,yMax:i?1-t:n,width:r-e,height:n-t}}}}function wte(t,e){return t==="none"?e:function(n){return 1/(1+Math.exp(-n))}(e)}function UT(t,e,n,r){return ls(this,void 0,void 0,function(){var s,i,o,a,u,l,c,h;return cs(this,function(d){switch(d.label){case 0:return n=n||e.flipHorizontally||!1,r=r||e.flipVertically||!1,s=t.size,i=s/e.numLandmarks,[4,t.data()];case 1:for(o=d.sent(),a=[],u=0;u<e.numLandmarks;++u)l=u*i,(h={x:0,y:0}).x=n?e.inputImageWidth-o[l]:o[l],i>1&&(h.y=r?e.inputImageHeight-o[l+1]:o[l+1]),i>2&&(h.z=o[l+2]),i>3&&(h.score=wte(e.visibilityActivation,o[l+3])),a.push(h);for(c=0;c<a.length;++c)(h=a[c]).x=h.x/e.inputImageWidth,h.y=h.y/e.inputImageHeight,h.z=h.z/e.inputImageWidth/(e.normalizeZ||1);return[2,a]}})})}function zT(t,e,n){var r=t.width,s=t.height,i=t.rotation;if(n.rotation==null&&n.rotationDegree==null||(i=function(c,h){return h.rotation!=null?c+=h.rotation:h.rotationDegree!=null&&(c+=Math.PI*h.rotationDegree/180),np(c)}(i,n)),i===0)t.xCenter=t.xCenter+r*n.shiftX,t.yCenter=t.yCenter+s*n.shiftY;else{var o=(e.width*r*n.shiftX*Math.cos(i)-e.height*s*n.shiftY*Math.sin(i))/e.width,a=(e.width*r*n.shiftX*Math.sin(i)+e.height*s*n.shiftY*Math.cos(i))/e.height;t.xCenter=t.xCenter+o,t.yCenter=t.yCenter+a}if(n.squareLong){var u=Math.max(r*e.width,s*e.height);r=u/e.width,s=u/e.height}else if(n.squareShort){var l=Math.min(r*e.width,s*e.height);r=l/e.width,s=l/e.height}return t.width=r*n.scaleX,t.height=s*n.scaleY,t}function bte(t,e){for(var n=function(L,W){var G=L[0].x*W.width,H=L[0].y*W.height,X=(L[4].x+L[8].x)/2,Q=(L[4].y+L[8].y)/2;return X=(X+L[6].x)/2*W.width,Q=(Q+L[6].y)/2*W.height,np(Math.PI/2-Math.atan2(-(
5808Q-H),X-G))}(t,e),r=np(-n),s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,u=0,l=t;u<l.length;u++){var c=(v=l[u]).x,h=v.y;s=Math.min(s,c),i=Math.max(i,c),o=Math.min(o,h),a=Math.max(a,h)}var d=(i+s)/2,f=(a+o)/2;s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(var p=0,y=t;p<y.length;p++){var v,g=((v=y[p]).x-d)*e.width,x=(v.y-f)*e.height,w=g*Math.cos(r)-x*Math.sin(r),_=g*Math.sin(r)+x*Math.cos(r);s=Math.min(s,w),i=Math.max(i,w),o=Math.min(o,_),a=Math.max(a,_)}var T=(i+s)/2,E=(a+o)/2,k=T*Math.cos(n)-E*Math.sin(n)+e.width*d,N=T*Math.sin(n)+E*Math.cos(n)+e.height*f,O=(i-s)/e.width,R=(a-o)/e.height;return{xCenter:k/e.width,yCenter:N/e.height,width:O,height:R,rotation:n}}var _te={reduceBoxesInLowestLayer:!1,interpolatedScaleAspectRatio:1,featureMapHeight:[],featureMapWidth:[],numLayers:4,minScale:.1484375,maxScale:.75,inputSizeHeight:192,inputSizeWidth:192,anchorOffsetX:.5,anchorOffsetY:.5,strides:[8,16,16,16],aspectRatios:[1],fixedAnchorSize:!0},zg={runtime:"tfjs",modelType:"full",maxHands:2,detectorModelUrl:"https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/detector/full/1",landmarkModelUrl:"https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/landmark/full/1"},jg={flipHorizontal:!1,staticImageMode:!1},Ste={applyExponentialOnBoxSize:!1,flipVertically:!1,ignoreClasses:[],numClasses:1,numBoxes:2016,numCoords:18,boxCoordOffset:0,keypointCoordOffset:4,numKeypoints:7,numValuesPerKeypoint:2,sigmoidScore:!0,scoreClippingThresh:100,reverseOutputOrder:!0,xScale:192,yScale:192,hScale:192,wScale:192,minScoreThresh:.5},Tte=.3,Cte={shiftX:0,shiftY:-.5,scaleX:2.6,scaleY:2.6,squareLong:!0},Nte={shiftX:0,shiftY:-.1,scaleX:2,scaleY:2,squareLong:!0},Ete={outputTensorSize:{width:192,height:192},keepAspectRatio:!0,outputTensorFloatRange:[0,1],borderMode:"zero"},kte={outputTensorSize:{width:224,height:224},keepAspectRatio:!0,outputTensorFloatRange:[0,1],borderMode:"zero"},$te={numLandmarks:21,inputImageWidth:224,inputImageHeight:224,normalizeZ:.4,visibilityActivation:"none",flipHorizontally:!1,flipVertically:!1},Ite={numLandmarks:21,inputImageWidth:1,inputImageHeight:1,visibilityActivation:"none",flipHorizontally:!1,flipVertically:!1},rp,Ate=function(){function t(e,n,r){this.detectorModel=e,this.landmarkModel=n,this.maxHands=r,this.prevHandRectsFromLandmarks=null,this.anchors=function(u){u.reduceBoxesInLowestLayer==null&&(u.reduceBoxesInLowestLayer=!1),u.interpolatedScaleAspectRatio==null&&(u.interpolatedScaleAspectRatio=1),u.fixedAnchorSize==null&&(u.fixedAnchorSize=!1);for(var l=[],c=0;c<u.numLayers;){for(var h=[],d=[],f=[],p=[],y=c;y<u.strides.length&&u.strides[y]===u.strides[c];){var v=BT(u.minScale,u.maxScale,y,u.strides.length);if(y===0&&u.reduceBoxesInLowestLayer)f.push(1),f.push(2),f.push(.5),p.push(.1),p.push(v),p.push(v);else{for(var g=0;g<u.aspectRatios.length;++g)f.push(u.aspectRatios[g]),p.push(v);if(u.interpolatedScaleAspectRatio>0){var x=y===u.strides.length-1?1:BT(u.minScale,u.maxScale,y+1,u.strides.length);p.push(Math.sqrt(v*x)),f.push(u.interpolatedScaleAspectRatio)}}y++}for(var w=0;w<f.length;++w){var _=Math.sqrt(f[w]);h.push(p[w]/_),d.push(p[w]*_)}var T=0,E=0;if(u.featureMapHeight.length>0)T=u.featureMapHeight[c],E=u.featureMapWidth[c];else{var k=u.strides[c];T=Math.ceil(u.inputSizeHeight/k),E=Math.ceil(u.inputSizeWidth/k)}for(var N=0;N<T;++N)for(var O=0;O<E;++O)for(var R=0;R<h.length;++R){var L={xCenter:(O+u.anchorOffsetX)/E,yCenter:(N+u.anchorOffsetY)/T,width:0,height:0};u.fixedAnchorSize?(L.width=1,L.height=1):(L.width=d[R],L.height=h[R]),l.push(L)}c=y}return l}(_te);var s=un(this.anchors.map(function(u){return u.width})),i=un(this.anchors.map(function(u){return u.height})),o=un(this.anchors.map(function(u){return u.xCenter})),a=un(this.anchors.map(function(u){return u.yCenter}));this.anchorTensor={x:o,y:a,w:s,h:i}}return t.prototype.estimateHands=function(e,n){return ls(this,void 0,void 0,function(){var r,s,i,o,a,u,l,c,h,d,f,p,y,v,g,x,w,_,T=this;return cs(this,function(E){switch(E.label){case 0:return r=function(O){if(O==null)return wn({},jg);var R=wn({},O);return R.flipHorizontal==null&&(R.flipHorizontal=jg.flipHorizontal),R.staticImageMode==null&&(R.staticImageMode=jg.staticImageMode),R}(n),e==null?(this.reset(),[2,[]]):(s=tP(e),i=$e(function(){var O=vt(nP(e),"float32");return r.flipHorizontal&&(O=Ht(xm.flipLeftRight(ks(O,0)),[0])),O}),o=this.prevHandRectsFromLandmarks,r.staticImageMode||o==null||o.length<this.maxHands?[4,this.detectPalm(i)]:[3,2]);case 1:return(u=E.sent()).length===0?(this.reset(),i.dispose(),[2,[]]):(l=u.map(function(O){return T.palmDetectionToRoi(O,s)}),a=l,[3,3]);case 2:a=o,E.label=3;
5808case 3:return k=.5,N=[],[a].forEach(function(O){return O.forEach(function(R){(N=N.filter(function(L){return lte(R,L)<=k})).push(R)})}),a=N,[4,Promise.all(a.map(function(O){return T.handLandmarks(O,i)}))];case 4:for(c=E.sent(),h=[],this.prevHandRectsFromLandmarks=[],d=0,f=c;d<f.length;d++)(p=f[d])!=null&&(y=p.landmarks,v=p.worldLandmarks,g=p.handScore,x=p.handedness,this.prevHandRectsFromLandmarks.push(this.handLandmarksToRoi(y,s)),(w=gte(y,s))!=null&&w.forEach(function(O,R){delete O.z,O.name=tp[R]}),(_=v)!=null&&_.forEach(function(O,R){O.name=tp[R]}),h.push({keypoints:w,keypoints3D:_,handedness:x,score:g}));return i.dispose(),[2,h]}var k,N})})},t.prototype.dispose=function(){this.detectorModel.dispose(),this.landmarkModel.dispose(),mt([this.anchorTensor.x,this.anchorTensor.y,this.anchorTensor.w,this.anchorTensor.h])},t.prototype.reset=function(){this.prevHandRectsFromLandmarks=null},t.prototype.detectPalm=function(e){return ls(this,void 0,void 0,function(){var n,r,s,i,o,a,u,l,c,h;return cs(this,function(d){switch(d.label){case 0:return n=VT(e,Ete),r=n.imageTensor,s=n.padding,i=this.detectorModel.predict(r),o=pte(i),a=o.boxes,[4,yte([u=o.logits,a],this.anchorTensor,Ste)];case 1:return(l=d.sent()).length===0?(mt([r,i,u,a]),[2,l]):[4,mte(l,this.maxHands,Tte)];case 2:return c=d.sent(),h=function(f,p){f===void 0&&(f=[]);for(var y=p.left,v=p.top,g=p.left+p.right,x=p.top+p.bottom,w=0;w<f.length;w++){var _=f[w],T=_.locationData.relativeBoundingBox,E=(T.xMin-y)/(1-g),k=(T.yMin-v)/(1-x),N=T.width/(1-g),O=T.height/(1-x);T.xMin=E,T.yMin=k,T.width=N,T.height=O,T.xMax=E+N,T.yMax=k+O;var R=_.locationData.relativeKeypoints;R&&R.forEach(function(L){var W=(L.x-y)/(1-g),G=(L.y-v)/(1-x);L.x=W,L.y=G})}return f}(c,s),mt([r,i,u,a]),[2,h]}})})},t.prototype.palmDetectionToRoi=function(e,n){return zT(fte(e,"boundingbox","normRect",n,{rotationVectorStartKeypointIndex:0,rotationVectorEndKeypointIndex:2,rotationVectorTargetAngleDegree:90}),n,Cte)},t.prototype.handLandmarks=function(e,n){return ls(this,void 0,void 0,function(){var r,s,i,o,a,u,l,c,h,d,f,p,y,v,g,x;return cs(this,function(w){switch(w.label){case 0:return r=VT(n,kte,e),s=r.imageTensor,i=r.padding,o=this.landmarkModel.execute(s,["Identity_2:0","Identity_1:0","Identity:0","Identity_3:0"]),a=o[0],u=o[1],l=o[2],c=o[3],[4,u.data()];case 1:return(h=w.sent()[0])<.5?(mt(o),mt(s),[2,null]):[4,l.data()];case 2:return d=w.sent()[0],f=d>=.5?"Left":"Right",[4,UT(a,$te)];case 3:return p=w.sent(),[4,UT(c,Ite)];case 4:return y=w.sent(),v=function(_,T){var E=T.left,k=T.top,N=T.left+T.right,O=T.top+T.bottom;return _.map(function(R){return wn(wn({},R),{x:(R.x-E)/(1-N),y:(R.y-k)/(1-O),z:R.z/(1-N)})})}(p,i),g=function(_,T,E){E===void 0&&(E={ignoreRotation:!1});for(var k=[],N=0,O=_;N<O.length;N++){var R=O[N],L=R.x-.5,W=R.y-.5,G=E.ignoreRotation?0:T.rotation,H=Math.cos(G)*L-Math.sin(G)*W,X=Math.sin(G)*L+Math.cos(G)*W;H=H*T.width+T.xCenter,X=X*T.height+T.yCenter;var Q=R.z*T.width,Y=wn({},R);Y.x=H,Y.y=X,Y.z=Q,k.push(Y)}return k}(v,e),x=function(_,T){for(var E=[],k=0,N=_;k<N.length;k++){var O=N[k],R=O.x,L=O.y,W=T.rotation,G=Math.cos(W)*R-Math.sin(W)*L,H=Math.sin(W)*R+Math.cos(W)*L,X=wn({},O);X.x=G,X.y=H,E.push(X)}return E}(y,e),mt(o),mt(s),[2,{landmarks:g,worldLandmarks:x,handScore:h,handedness:f}]}})})},t.prototype.handLandmarksToRoi=function(e,n){return zT(bte([].concat(e.slice(0,4),e.slice(5,7),e.slice(9,11),e.slice(13,15),e.slice(17,19)),n),n,Nte)},t}();function Rte(t){return ls(this,void 0,void 0,function(){var e,n,r,s,i,o;return cs(this,function(a){switch(a.label){case 0:return e=function(u){if(u==null)return wn({},zg);var l=wn({},u);if(l.runtime="tfjs",l.maxHands==null&&(l.maxHands=zg.maxHands),l.modelType==null&&(l.modelType=zg.modelType),l.modelType!=="lite"&&l.modelType!=="full")throw new Error("Model type must be one of lite or full, but got "+l.modelType);return l.detectorModelUrl==null&&(l.modelType==="lite"?l.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/detector/lite/1":l.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/detector/full/1"),l.landmarkModelUrl==null&&(l.modelType==="lite"?l.landmarkModelUrl="https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/landmark/lite/1":l.landmarkModelUrl="https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/landmark/full/1"),l}(t),n=e.detectorModelUrl.indexOf("https://tfhub.dev")>-1,r=e.landmarkModelUrl.indexOf("https://tfhub.dev")>-1,[4,Promise.all([LT(e.detectorModelUrl,{fromTFHub:n}),LT(e.landmarkModelUrl,{fromTFHub:r})])];case 1:return s=a.sent(),i=s[0],o=s[1],[2,new Ate(i,o,e.maxHands)]}})})}function Ote(t,e){return ls(this,void 0,void 0,function(){var n,r;return cs(this,function(s){if(t===rp.MediaPipeHands){if(r=void 0,(n=e)!=null){if(n.runtime==="tfjs")return[2,Rte(n)];if(n.runtime==="mediapipe")return[2,ute(n)];r=n.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+r)}throw new Error(t+" is not a supported model name.")})})}(function(t){t.MediaPipeHands="MediaPipeHands"})(rp||(rp={}));/**
5809 * @license
5810 * Copyright 2018 Google LLC. All Rights Reserved.
5811 * Licensed under the Apache License, Version 2.0 (the "License");
5812 * you may not use this file except in compliance with the License.
5813 * You may obtain a copy of the License at
5814 *
5815 * http://www.apache.org/licenses/LICENSE-2.0
5816 *
5817 * Unless required by applicable law or agreed to in writing, software
5818 * distributed under the License is distributed on an "AS IS" BASIS,
5819 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5820 * See the License for the specific language governing permissions and
5821 * limitations under the License.
5822 * =============================================================================
5823 */const Bo={},gd={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Dte(t,e){Bo[t]=e}function fs(t,e){if(!(t in Bo)||e!=null){const r=Fte(t,e);if(r!==null)Bo[t]=r;else return console.log("Could not get context for WebGL version",t),null}const n=Bo[t];return n==null||n.isContextLost()?(delete Bo[t],fs(t)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),Bo[t])}function Pte(t){if(!U().getBool("IS_SAFARI")&&typeof OffscreenCanvas<"u"&&t===2)return new OffscreenCanvas(300,150);if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function Fte(t,e){if(t!==1&&t!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=e??Pte(t);return n.addEventListener("webglcontextlost",r=>{r.preventDefault(),delete Bo[t]},!1),U().getBool("SOFTWARE_WEBGL_ENABLED")&&(gd.failIfMajorPerformanceCaveat=!1),t===1?n.getContext("webgl",gd)||n.getContext("experimental-webgl",gd):n.getContext("webgl2",gd)}/**
5824 * @license
5825 * Copyright 2017 Google LLC. All Rights Reserved.
5826 * Licensed under the Apache License, Version 2.0 (the "License");
5827 * you may not use this file except in compliance with the License.
5828 * You may obtain a copy of the License at
5829 *
5830 * http://www.apache.org/licenses/LICENSE-2.0
5831 *
5832 * Unless required by applicable law or agreed to in writing, software
5833 * distributed under the License is distributed on an "AS IS" BASIS,
5834 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5835 * See the License for the specific language governing permissions and
5836 * limitations under the License.
5837 * =============================================================================
5838 */var Kc;(function(t){t[t.DENSE=0]="DENSE",t[t.SHARED_BATCH=1]="SHARED_BATCH"})(Kc||(Kc={}));var ar;(function(t){t[t.RENDER=0]="RENDER",t[t.UPLOAD=1]="UPLOAD",t[t.PIXELS=2]="PIXELS",t[t.DOWNLOAD=3]="DOWNLOAD"})(ar||(ar={}));var Xt;(function(t){t[t.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",t[t.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",t[t.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",t[t.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",t[t.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(Xt||(Xt={}));function Th(t,e){return[e,t]}function Lte(t,e){return t*e}function yd(t){const e=ne(t),n=Math.ceil(e/4);return v0(n)}function vl(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}function Mte(t,e){const[n,r]=vl(t,e);return n*r*4}function uw(t,e){const n=t;let r,s,i,o,a,u,l,c,h,d;return U().getNumber("WEBGL_VERSION")===2?(r=n.R32F,s=n.R16F,i=n.RGBA16F,o=n.RGBA32F,a=n.RED,l=4,c=1,h=n.HALF_FLOAT,d=n.FLOAT,u=n.RGBA8):(r=t.RGBA,s=t.RGBA,i=t.RGBA,o=n.RGBA,a=t.RGBA,l=4,c=4,h=e!=null?e.HALF_FLOAT_OES:null,d=t.FLOAT,u=t.RGBA),{internalFormatFloat:r,internalFormatHalfFloat:s,internalFormatPackedHalfFloat:i,internalFormatPackedFloat:o,textureFormatFloat:a,downloadTextureFormat:u,downloadUnpackNumChannels:l,defaultNumChannels:c,textureTypeHalfFloat:h,textureTypeFloat:d}}/**
5839 * @license
5840 * Copyright 2017 Google LLC. All Rights Reserved.
5841 * Licensed under the Apache License, Version 2.0 (the "License");
5842 * you may not use this file except in compliance with the License.
5843 * You may obtain a copy of the License at
5844 *
5845 * http://www.apache.org/licenses/LICENSE-2.0
5846 *
5847 * Unless required by applicable law or agreed to in writing, softw
vendor: 18,448 bytes, lines 5847-5998
5847are
5848 * distributed under the License is distributed on an "AS IS" BASIS,
5849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5850 * See the License for the specific language governing permissions and
5851 * limitations under the License.
5852 * =============================================================================
5853 */function ue(t,e){const n=e();return U().getBool("DEBUG")&&Vte(t),n}function Vte(t){const e=t.getError();if(e!==t.NO_ERROR)throw new Error("WebGL Error: "+zte(t,e))}const Bte=596e-10,Wte=65504;function Ute(t){return!!(U().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||t===0||Bte<Math.abs(t)&&Math.abs(t)<Wte)}function zte(t,e){switch(e){case t.NO_ERROR:return"NO_ERROR";case t.INVALID_ENUM:return"INVALID_ENUM";case t.INVALID_VALUE:return"INVALID_VALUE";case t.INVALID_OPERATION:return"INVALID_OPERATION";case t.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case t.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case t.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return`Unknown error code ${e}`}}function vd(t,e){return Ni(t,()=>t.getExtension(e),'Extension "'+e+'" not supported on this browser.')}function jte(t,e){const n=Ni(t,()=>t.createShader(t.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(ue(t,()=>t.shaderSource(n,e)),ue(t,()=>t.compileShader(n)),t.getShaderParameter(n,t.COMPILE_STATUS)===!1)throw console.log(t.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function Gte(t,e){const n=Ni(t,()=>t.createShader(t.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(ue(t,()=>t.shaderSource(n,e)),ue(t,()=>t.compileShader(n)),U().get("ENGINE_COMPILE_ONLY"))return n;if(t.getShaderParameter(n,t.COMPILE_STATUS)===!1)throw rP(e,t.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}const Hte=/ERROR: [0-9]+:([0-9]+):/g;function rP(t,e){const n=Hte.exec(e);if(n==null){console.log(`Couldn't parse line number in error: ${e}`),console.log(t);return}const r=+n[1],s=t.split(`
5854`),i=s.length.toString().length+2,o=s.map((h,d)=>ku((d+1).toString(),i)+h);let a=0;for(let h=0;h<o.length;h++)a=Math.max(o[h].length,a);const u=o.slice(0,r-1),l=o.slice(r-1,r),c=o.slice(r);console.log(u.join(`
5855`)),console.log(e.split(`
5856`)[0]),console.log(`%c ${ku(l[0],a)}`,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(c.join(`
5857`))}function qte(t){return Ni(t,()=>t.createProgram(),"Unable to create WebGLProgram.")}function Kte(t,e){if(ue(t,()=>t.linkProgram(e)),!U().get("ENGINE_COMPILE_ONLY")&&t.getProgramParameter(e,t.LINK_STATUS)===!1)throw console.log(t.getProgramInfoLog(e)),new Error("Failed to link vertex and fragment shaders.")}function Gg(t,e){if(ue(t,()=>t.validateProgram(e)),t.getProgramParameter(e,t.VALIDATE_STATUS)===!1)throw console.log(t.getProgramInfoLog(e)),new Error("Shader program validation failed.")}function Xte(t,e){const n=Ni(t,()=>t.createBuffer(),"Unable to create WebGLBuffer");return ue(t,()=>t.bindBuffer(t.ARRAY_BUFFER,n)),ue(t,()=>t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)),n}function Yte(t,e){const n=Ni(t,()=>t.createBuffer(),"Unable to create WebGLBuffer");return ue(t,()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n)),ue(t,()=>t.bufferData(t.ELEMENT_ARRAY_BUFFER,e,t.STATIC_DRAW)),n}function Qte(t){return Ni(t,()=>t.createTexture(),"Unable to create WebGLTexture.")}function Zte(t,e){const n=U().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(t<=0||e<=0){const r=`[${t}x${e}]`;throw new Error("Requested texture size "+r+" is invalid.")}if(t>n||e>n){const r=`[${t}x${e}]`,s=`[${n}x${n}]`;throw new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU "+s+".")}}function Jte(t){return Ni(t,()=>t.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function jT(t,e,n,r,s,i,o){const a=t.getAttribLocation(e,n);return a===-1?!1:(ue(t,()=>t.bindBuffer(t.ARRAY_BUFFER,r)),ue(t,()=>t.vertexAttribPointer(a,s,t.FLOAT,!1,i,o)),ue(t,()=>t.enableVertexAttribArray(a)),!0)}function ene(t,e,n){ine(t,n),ue(t,()=>t.activeTexture(t.TEXTURE0+n)),ue(t,()=>t.bindTexture(t.TEXTURE_2D,e))}function tne(t,e,n){return Ni(t,()=>t.getUniformLocation(e,n),'uniform "'+n+'" not present in program.')}function nne(t,e,n){return t.getUniformLocation(e,n)}function rne(t,e,n,r){ue(t,()=>ene(t,e,r)),ue(t,()=>t.uniform1i(n,r))}function Hg(t,e,n){ue(t,()=>t.bindFramebuffer(t.FRAMEBUFFER,n)),ue(t,()=>t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0))}function GT(t,e){ue(t,()=>t.bindFramebuffer(t.FRAMEBUFFER,e)),ue(t,()=>t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0))}function xd(t){const e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+sne(t,e))}function sne(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 Ni(t,e,n){const r=ue(t,()=>e());if(r==null)throw new Error(n);return r}function ine(t,e){const n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(r<t.TEXTURE0||r>n){const s=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${s}.`)}}function tl(t,e=2){return ne(t.slice(0,t.length-e))}function nl(t){if(t.length===0)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 wd(t){let e=[1,1,1];return t.length===0||t.length===1&&t[0]===1||(e=[tl(t),...nl(t)]),e}function one(t,e=!1){let n=U().getNumber("WEBGL_MAX_TEXTURE_SIZE"),r=U().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");r===1/0&&U().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(r=n/2),e&&(n=n*2,r=r*2,t=t.map((a,u)=>u>=t.length-2?_1(t[u]):t[u]),t.length===1&&(t=[2,t[0]])),t.length!==2&&(t=_o(t).newShape);let s=ne(t),i=null;t.length<=1&&s<=n?i=[1,s]:t.length===2&&t[0]<=n&&t[1]<=n?i=t:t.length===3&&t[0]*t[1]<=n&&t[2]<=n?i=[t[0]*t[1],t[2]]:t.length===3&&t[0]<=n&&t[1]*t[2]<=n?i=[t[0],t[1]*t[2]]:t.length===4&&t[0]*t[1]*t[2]<=n&&t[3]<=n?i=[t[0]*t[1]*t[2],t[3]]:t.length===4&&t[0]<=n&&t[1]*t[2]*t[3]<=n&&(i=[t[0],t[1]*t[2]*t[3]]);const o=i!=null&&Math.max(...i)>r&&Math.min(...i)<=(e?2:1)&&Math.min(...i)>0;if(i==null||o)if(e){const a=tl(t);let u=2,l=2;t.length&&([u,l]=nl(t)),s=a*(u/2)*(l/2),i=v0(s).map(c=>c*2)}else i=v0(s);return i}function bd(t){return t%2===0}function sp(t,e){if(t=t.slice(-2),e=e.slice(-2),xt(t,e)||!t.length||!e.length||t[0]===0||t[1]===0||e[0]===0||e[1]===0)return!0;if(t.length!==e.length){const n=t[t.length-1],r=e[e.length-1];if(n===r||bd(n)&&bd(r)&&(t[0]===1||e[0]===1))return!0}return t[1]===e[1]&&bd(t[0])&&bd(e[0])}let qg,Kg;function ane(t){if(qg==null){const e=fs(t);qg=e.getParameter(e.MAX_TEXTURE_SIZE)}return qg}function une(t){if(Kg==null){const e=fs(t);Kg=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,Kg)}function lne(t){if(t===0)return 0;let e;const n=fs(t);return Dr(n,"EXT_disjoint_timer_query_webgl2")&&t===2?e=2:Dr(n,"EXT_disjoint_timer_query")?e=1:e=0,e}function Dr(t,e){return t.getExtension(e)!=null}function HT(t){try{if(fs(t)!=null)return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function cne(t){if(t===0)return!1;const e=fs(t);if(t===1){if(!Dr(e,"OES_texture_float"))return!1}else if(!Dr(e,"EXT_color_buffer_float"))return!1;return sv(e)}function hne(t){if(t===0)return!1;const e=fs(t);if(t===1){if(!Dr(e,"OES_texture_float")||!Dr(e,"WEBGL_color_buffer_float"))return!1}else{if(Dr(e,"EXT_color_buffer_float"))return sv(e);const r="EXT_color_buffer_half_float";if(Dr(e,r)){const s=e.getExtension(r);return dne(e,s)}return!1}return sv(e)}function sv(t){const e=uw(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);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);const o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(n),t.deleteFramebuffer(i),o}function dne(t,e){const n=uw(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);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);const a=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(o),a}function fne(t){return t!==2?!1:fs(t).fenceSync!=null}function Ch(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>{n!=null&&A(n.dtype!=="complex64",()=>`${e} does not support complex64 tensors in the WebGL backend.`)})}/**
5858 * @license
5859 * Copyright 2019 Google LLC. All Rights Reserved.
5860 * Licensed under the Apache License, Version 2.0 (the "License");
5861 * you may not use this file except in compliance with the License.
5862 * You may obtain a copy of the License at
5863 *
5864 * http://www.apache.org/licenses/LICENSE-2.0
5865 *
5866 * Unless required by applicable law or agreed to in writing, software
5867 * distributed under the License is distributed on an "AS IS" BASIS,
5868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5869 * See the License for the specific language governing permissions and
5870 * limitations under the License.
5871 * =============================================================================
5872 */const de=U();de.registerFlag("HAS_WEBGL",()=>de.getNumber("WEBGL_VERSION")>0);de.registerFlag("WEBGL_VERSION",()=>HT(2)?2:HT(1)?1:0);de.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);de.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>de.get("WEBGL_VERSION")===2);de.registerFlag("WEBGL_CPU_FORWARD",()=>!0);de.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);de.registerFlag("WEBGL_PACK",()=>de.getBool("HAS_WEBGL"));de.registerFlag("WEBGL_PACK_NORMALIZATION",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_CLIP",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_REDUCE",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_LAZILY_UNPACK",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_CONV_IM2COL",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",()=>de.getBool("WEBGL_PACK"));de.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>ane(de.getNumber("WEBGL_VERSION")));de.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>une(de.getNumber("WEBGL_VERSION")));de.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{const t=de.getNumber("WEBGL_VERSION");return t===0?0:lne(t)});de.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>de.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!UR());de.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>cne(de.getNumber("WEBGL_VERSION")));de.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>de.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:de.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));de.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>hne(de.getNumber("WEBGL_VERSION")));de.registerFlag("WEBGL_FENCE_API_ENABLED",()=>fne(de.getNumber("WEBGL_VERSION")));de.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>de.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);de.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,t=>{if(typeof t!="number")throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${t}.`);if(t<0&&t!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${t}.`)});de.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>UR()?1:-1,t=>{if(typeof t!="number")throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${t}.`);if(t<0&&t!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${t}.`)});de.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128);de.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",()=>!1);de.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",()=>1e5);de.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",()=>128);de.registerFlag("WEBGL_EXP_CONV",()=>!1);de.registerFlag("SOFTWARE_WEBGL_ENABLED",()=>de.getBool("IS_TEST"));de.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",()=>1/0);de.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",()=>!1);de.registerFlag("WEBGL2_ISNAN_CUSTOM",()=>!1);de.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);/**
5873 * @license
5874 * Copyright 2018 Google LLC. All Rights Reserved.
5875 * Licensed under the Apache License, Version 2.0 (the "License");
5876 * you may not use this file except in compliance with the License.
5877 * You may obtain a copy of the License at
5878 *
5879 * http://www.apache.org/licenses/LICENSE-2.0
5880 *
5881 * Unless required by applicable law or agreed to in writing, software
5882 * distributed under the License is distributed on an "AS IS" BASIS,
5883 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5884 * See the License for the specific language governing permissions and
5885 * limitations under the License.
5886 * =============================================================================
5887 */function Nn(){let t,e,n,r,s,i,o,a,u,l;return U().getNumber("WEBGL_VERSION")===2?(t="#version 300 es",e="in",n="out",r="in",s="texture",i="outputColor",o="out vec4 outputColor;",a=U().getBool("WEBGL2_ISNAN_CUSTOM")?`
5888      bool isnan_custom(float val) {
5889        uint floatToUint = floatBitsToUint(val);
5890        return (floatToUint & 0x7fffffffu) > 0x7f800000u;
5891      }
5892
5893      bvec4 isnan_custom(vec4 val) {
5894        return bvec4(isnan_custom(val.x),
5895          isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));
5896      }
5897
5898      #define isnan(value) isnan_custom(value)
5899    `:"",u="",l=`
5900      #define round(value) newRound(value)
5901      int newRound(float value) {
5902        return int(floor(value + 0.5));
5903      }
5904
5905      ivec4 newRound(vec4 value) {
5906        return ivec4(floor(value + vec4(0.5)));
5907      }
5908    `):(t="",e="attribute",n="varying",r="varying",s="texture2D",i="gl_FragColor",o="",a=`
5909      #define isnan(value) isnan_custom(value)
5910      bool isnan_custom(float val) {
5911        return (val > 0. || val < 1. || val == 0.) ? false : true;
5912      }
5913      bvec4 isnan_custom(vec4 val) {
5914        return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));
5915      }
5916    `,u=`
5917      uniform float INFINITY;
5918
5919      bool isinf(float val) {
5920        return abs(val) == INFINITY;
5921      }
5922      bvec4 isinf(vec4 val) {
5923        return equal(abs(val), vec4(INFINITY));
5924      }
5925    `,l=`
5926      int round(float value) {
5927        return int(floor(value + 0.5));
5928      }
5929
5930      ivec4 round(vec4 value) {
5931        return ivec4(floor(value + vec4(0.5)));
5932      }
5933    `),{version:t,attribute:e,varyingVs:n,varyingFs:r,texture2D:s,output:i,defineOutput:o,defineSpecialNaN:a,defineSpecialInf:u,defineRound:l}}/**
5934 * @license
5935 * Copyright 2018 Google LLC. All Rights Reserved.
5936 * Licensed under the Apache License, Version 2.0 (the "License");
5937 * you may not use this file except in compliance with the License.
5938 * You may obtain a copy of the License at
5939 *
5940 * http://www.apache.org/licenses/LICENSE-2.0
5941 *
5942 * Unless required by applicable law or agreed to in writing, software
5943 * distributed under the License is distributed on an "AS IS" BASIS,
5944 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5945 * See the License for the specific language governing permissions and
5946 * limitations under the License.
5947 * =============================================================================
5948 */function Ma(t,e,n="index"){const r=Zt(e);return r.map((s,i)=>{const o=`int ${t[i]} = ${n} / ${s}`,a=i===r.length-1?`int ${t[i+1]} = ${n} - ${t[i]} * ${s}`:`index -= ${t[i]} * ${s}`;return`${o}; ${a};`}).join("")}function bm(t,e,n="index"){const r=Zt(e);return r.map((s,i)=>{const o=`int ${t[i]} = ${n} / outShapeStrides[${i}]`,a=i===r.length-1?`int ${t[i+1]} = ${n} - ${t[i]} * outShapeStrides[${i}]`:`index -= ${t[i]} * outShapeStrides[${i}]`;return`${o}; ${a};`}).join("")}function pne(t,e){const n=t.length,r=t.map(i=>`${e}[${i}]`),s=new Array(n-1);s[n-2]=r[n-1];for(let i=n-3;i>=0;--i)s[i]=`(${s[i+1]} * ${r[i+1]})`;return s}function mne(t,e,n="index"){const r=t.map((i,o)=>o),s=pne(r,e);return s.map((i,o)=>{const a=`int ${t[o]} = ${n} / ${s[o]}`,u=o===s.length-1?`int ${t[o+1]} = ${n} - ${t[o]} * ${s[o]}`:`index -= ${t[o]} * ${s[o]}`;return`${a}; ${u};`}).join("")}function lw(t){const e=Zt(t).map(n=>n.toString());return`
5949  int getFlatIndex(ivec3 coords) {
5950    return coords.x * ${e[0]} + coords.y * ${e[1]} + coords.z;
5951  }
5952`}function cw(){return`
5953  int getFlatIndex(ivec3 coords) {
5954    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;
5955  }
5956`}const sP=`
5957  const float FLOAT_MAX = 1.70141184e38;
5958  const float FLOAT_MIN = 1.17549435e-38;
5959
5960  lowp vec4 encode_float(highp float v) {
5961    if (isnan(v)) {
5962      return vec4(255, 255, 255, 255);
5963    }
5964
5965    highp float av = abs(v);
5966
5967    if(av < FLOAT_MIN) {
5968      return vec4(0.0, 0.0, 0.0, 0.0);
5969    } else if(v > FLOAT_MAX) {
5970      return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
5971    } else if(v < -FLOAT_MAX) {
5972      return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;
5973    }
5974
5975    highp vec4 c = vec4(0,0,0,0);
5976
5977    highp float e = floor(log2(av));
5978    highp float m = exp2(fract(log2(av))) - 1.0;
5979
5980    c[2] = floor(128.0 * m);
5981    m -= c[2] / 128.0;
5982    c[1] = floor(32768.0 * m);
5983    m -= c[1] / 32768.0;
5984    c[0] = floor(8388608.0 * m);
5985
5986    highp float ebias = e + 127.0;
5987    c[3] = floor(ebias / 2.0);
5988    ebias -= c[3] * 2.0;
5989    c[2] += floor(ebias) * 128.0;
5990
5991    c[3] += 128.0 * step(0.0, -v);
5992
5993    return c / 255.0;
5994  }
5995`;/**
5996 * @license
5997 * Copyright 2017 Google LLC. All Rights Reserved.
5998 * Licensed under the Apache License, Version 2.0 (the "License");
5999 * you may not use this file except in compliance with the License.
6000 * You may obtain a copy of the License at
6001 *
6002 * http://www.apache.org/licenses/LICENSE-2.0
6003 *
6004 * Unless required by applicable law or agreed to in writing, software
6005 * distributed under the License is distributed on an "AS IS" BASIS,
6006 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6007 * See the License for the specific language governing permissions and
6008 * limitations under the License.
6009 * =============================================================================
6010 */const{getBroadcastDims:iP}=RJ;function gne(t,e,n){const r=[];if(t.forEach(f=>{const p=ne(f.shapeInfo.logicalShape);if(f.shapeInfo.isUniform?r.push(`uniform float ${f.name}${p>1?`[${p}]`:""};`):(r.push(`uniform sampler2D ${f.name};`),r.push(`uniform int offset${f.name};`)),n.enableShapeUniforms){const{uniformShape:y}=hw(n.packedInputs,f.shapeInfo.logicalShape,f.shapeInfo.texShape);switch(y.length){case 1:r.push(`uniform int ${f.name}Shape;`);break;case 2:r.push(`uniform ivec2 ${f.name}Shape;`);break;case 3:r.push(`uniform ivec3 ${f.name}Shape;`);break;case 4:r.push(`uniform ivec4 ${f.name}Shape;`);break}r.push(`uniform ivec2 ${f.name}TexShape;`)}}),n.enableShapeUniforms){switch(e.logicalShape.length){case 1:r.push("uniform int outShape;");break;case 2:r.push("uniform ivec2 outShape;"),r.push("uniform int outShapeStrides;");break;case 3:r.push("uniform ivec3 outShape;"),r.push("uniform ivec2 outShapeStrides;");break;case 4:r.push("uniform ivec4 outShape;"),r.push("uniform ivec3 outShapeStrides;");break}r.push("uniform ivec2 outTexShape;")}
vendor: 5,151 bytes, lines 6010-6145
6010n.customUniforms&&n.customUniforms.forEach(f=>{r.push(`uniform ${f.type} ${f.name}${f.arrayIndex?`[${f.arrayIndex}]`:""};`)});const s=r.join(`
6011`),i=t.map(f=>yne(f,e,n.packedInputs,n.enableShapeUniforms)).join(`
6012`),o=e.texShape,a=Nn(),u=wne(a);let l,c,h=Sne(a);return e.isPacked?(l=vne(e.logicalShape,o,n.enableShapeUniforms),c=_ne(a)):(l=xne(e.logicalShape,o,n.enableShapeUniforms),c=bne(a)),n.packedInputs&&(h+=Ene),[h,u,c,s,l,i,n.userCode].join(`
6013`)}function xl(t,e=!1){const n=t.shapeInfo.logicalShape;switch(n.length){case 0:return Vne(t,e);case 1:return Wne(t,e);case 2:return zne(t,e);case 3:return Gne(t,e);case 4:return qne(t,e);case 5:return Kne(t);case 6:return Xne(t);default:throw new Error(`${n.length}-D input sampling is not yet supported`)}}function oP(t,e){switch(t.shapeInfo.logicalShape.length){case 0:return Mne(t);case 1:return Bne(t,e);case 2:return Une(t,e);case 3:return jne(t,e);default:return Hne(t,e)}}function yne(t,e,n=!1,r){let s="";n?s+=oP(t,r):s+=xl(t,r);const i=t.shapeInfo.logicalShape,o=e.logicalShape;return i.length<=o.length&&(n?s+=Yne(t,e):s+=Qne(t,e)),s}function vne(t,e,n){switch(t.length){case 0:return aP();case 1:return kne(t,e,n);case 2:return Fne(t,e,n);case 3:return Ine(t,e,n);default:return Rne(t,e,n)}}function xne(t,e,n){switch(t.length){case 0:return aP();case 1:return $ne(t,e,n);case 2:return Lne(t,e,n);case 3:return Ane(t,e,n);case 4:return One(t,e,n);case 5:return Dne(t,e);case 6:return Pne(t,e);default:throw new Error(`${t.length}-D output sampling is not yet supported`)}}function wne(t){return`
6014    float sampleTexture(sampler2D textureSampler, vec2 uv) {
6015      return ${t.texture2D}(textureSampler, uv).r;
6016    }
6017  `}function bne(t){return`
6018    void setOutput(float val) {
6019      ${t.output} = vec4(val, 0, 0, 0);
6020    }
6021  `}function _ne(t){return`
6022    void setOutput(vec4 val) {
6023      ${t.output} = val;
6024    }
6025  `}function Sne(t){return`${t.version}
6026    precision highp float;
6027    precision highp int;
6028    precision highp sampler2D;
6029    ${t.varyingFs} vec2 resultUV;
6030    ${t.defineOutput}
6031    const vec2 halfCR = vec2(0.5, 0.5);
6032
6033    struct ivec5
6034    {
6035      int x;
6036      int y;
6037      int z;
6038      int w;
6039      int u;
6040    };
6041
6042    struct ivec6
6043    {
6044      int x;
6045      int y;
6046      int z;
6047      int w;
6048      int u;
6049      int v;
6050    };
6051
6052    uniform float NAN;
6053    ${t.defineSpecialNaN}
6054    ${t.defineSpecialInf}
6055    ${t.defineRound}
6056
6057    int imod(int x, int y) {
6058      return x - y * (x / y);
6059    }
6060
6061    int idiv(int a, int b, float sign) {
6062      int res = a / b;
6063      int mod = imod(a, b);
6064      if (sign < 0. && mod != 0) {
6065        res -= 1;
6066      }
6067      return res;
6068    }
6069
6070    //Based on the work of Dave Hoskins
6071    //https://www.shadertoy.com/view/4djSRW
6072    #define HASHSCALE1 443.8975
6073    float random(float seed){
6074      vec2 p = resultUV * seed;
6075      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);
6076      p3 += dot(p3, p3.yzx + 19.19);
6077      return fract((p3.x + p3.y) * p3.z);
6078    }
6079
6080    ${Tne}
6081    ${Cne}
6082    ${Nne}
6083  `}const Tne=`
6084vec2 uvFromFlat(int texNumR, int texNumC, int index) {
6085  int texR = index / texNumC;
6086  int texC = index - texR * texNumC;
6087  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
6088}
6089vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
6090  int texelIndex = index / 2;
6091  int texR = texelIndex / texNumC;
6092  int texC = texelIndex - texR * texNumC;
6093  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
6094}
6095`,Cne=`
6096vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,
6097  int texNumC, int row, int col) {
6098  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
6099  int texR = texelIndex / texNumC;
6100  int texC = texelIndex - texR * texNumC;
6101  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
6102}
6103`,Nne=`
6104vec2 packedUVfrom3D(int texNumR, int texNumC,
6105    int texelsInBatch, int texelsInLogicalRow, int b,
6106    int row, int col) {
6107  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
6108  int texR = index / texNumC;
6109  int texC = index - texR * texNumC;
6110  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
6111}
6112`,Ene=`
6113  float getChannel(vec4 frag, vec2 innerDims) {
6114    vec2 modCoord = mod(innerDims, 2.);
6115    return modCoord.x == 0. ?
6116      (modCoord.y == 0. ? frag.r : frag.g) :
6117      (modCoord.y == 0. ? frag.b : frag.a);
6118  }
6119  float getChannel(vec4 frag, int dim) {
6120    float modCoord = mod(float(dim), 2.);
6121    return modCoord == 0. ? frag.r : frag.g;
6122  }
6123`;function aP(){return`
6124    int getOutputCoords() {
6125      return 0;
6126    }
6127  `}function kne(t,e,n){const r=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return r[0]===1?n?`
6128      int getOutputCoords() {
6129        return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));
6130      }
6131    `:`
6132      int getOutputCoords() {
6133        return 2 * int(resultUV.x * ${r[1]}.0);
6134      }
6135    `:r[1]===1?n?`
6136      int getOutputCoords() {
6137        return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));
6138      }
6139    `:`
6140      int getOutputCoords() {
6141        return 2 * int(resultUV.y * ${r[0]}.0);
6142      }
6143    `:n?`
6144    int getOutputCoords() {
6145      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
6146      ivec2 resTexRC = ivec2(resultUV.yx *
6147                             vec2(packedTexShape[0], packedTexShape[1]));
6148      return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);
6149    }
6150  `:`
6151    int getOutputCoords() {
6152      ivec2 resTexRC = ivec2(resultUV.yx *
6153                             vec2(${r[0]}, ${r[1]}));
6154      return 2 * (resTexRC.x * ${r[1]} + resTexRC.y);
6155    }
6156  `}function $ne(t,e,n){return e[0]===1?n?`
6157      int getOutputCoords() {
6158        return int(resultUV.x * float(outTexShape[1]));
6159      }
6160    `:`
6161      int getOutputCoords() {
6162        return int(resultUV.x * ${e[1]}.0);
6163      }
6164    `:e[1]===1?n?`
6165      int getOutputCoords() {
6166        return int(resultUV.y * float(outTexShape[0]));
6167      }
6168    `:`
6169      int getOutputCoords() {
6170        return int(resultUV.y * ${e[0]}.0);
6171      }
6172    `:n?`
6173    int getOutputCoords() {
6174      ivec2 resTexRC = ivec2(resultUV.yx *
6175                             vec2(outTexShape[0], outTexShape[1]));
6176      return resTexRC.x * outTexShape[1] + resTexRC.y;
6177    }
6178  `:`
6179    int getOutputCoords() {
6180      ivec2 resTexRC = ivec2(resultUV.yx *
6181                             vec2(${e[0]}, ${e[1]}));
6182      return resTexRC.x * ${e[1]} + resTexRC.y;
6183    }
6184  `}function Ine(t,e,n){if(n)return`
6185    ivec3 getOutputCoords() {
6186      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
6187      int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));
6188      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));
6189      ivec2 resTexRC = ivec2(resultUV.yx *
6190                             vec2(packedTexShape[0], packedTexShape[1]));
6191      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
6192
6193      int b = index / texelsInBatch;
6194      index -= b * texelsInBatch;
6195
6196      int r = 2 * (index / texelsInLogicalRow);
6197      int c = imod(index, texelsInLogicalRow) * 2;
6198
6199      return ivec3(b, r, c);
6200    }
6201  `;const r=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],s=Math.ceil(t[2]/2),i=s*Math.ceil(t[1]/2);return`
6202    ivec3 getOutputCoords() {
6203      ivec2 resTexRC = ivec2(resultUV.yx *
6204                             vec2(${r[0]}, ${r[1]}));
6205      int index = resTexRC.x * ${r[1]} + resTexRC.y;
6206
6207      int b = index / ${i};
6208      index -= b * ${i};
6209
6210      int r = 2 * (index / ${s});
6211      int c = imod(index, ${s}) * 2;
6212
6213      return ivec3(b, r, c);
6214    }
6215  `}function Ane(t,e,n){if(n)return`
6216  ivec3 getOutputCoords() {
6217    ivec2 resTexRC = ivec2(resultUV.yx *
6218                           vec2(outTexShape[0], outTexShape[1]));
6219    int index = resTexRC.x * outTexShape[1] + resTexRC.y;
6220    ${bm(["r","c","d"],t)}
6221    return ivec3(r, c, d);
6222  }
6223`;const r=Ma(["r","c","d"],t);return`
6224    ivec3 getOutputCoords() {
6225      ivec2 resTexRC = ivec2(resultUV.yx *
6226                             vec2(${e[0]}, ${e[1]}));
6227      int index = resTexRC.x * ${e[1]} + resTexRC.y;
6228      ${r}
6229      return ivec3(r, c, d);
6230    }
6231  `}function Rne(t,e,n){if(n)return`
6232    ivec4 getOutputCoords() {
6233      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
6234      ivec2 resTexRC = ivec2(resultUV.yx *
6235                             vec2(packedTexShape[0], packedTexShape[1]));
6236      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
6237
6238      int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));
6239      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));
6240      int texelsInBatchN = texelsInBatch * outShape[1];
6241
6242      int b2 = index / texelsInBatchN;
6243      index -= b2 * texelsInBatchN;
6244
6245      int b = index / texelsInBatch;
6246      index -= b * texelsInBatch;
6247
6248      int r = 2 * (index / texelsInLogicalRow);
6249      int c = imod(index, texelsInLogicalRow) * 2;
6250
6251      return ivec4(b2, b, r, c);
6252    }
6253  `;const r=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],s=Math.ceil(t[t.length-1]/2),i=s*Math.ceil(t[t.length-2]/2);let o=i,a="",u="b, r, c";for(let l=2;l<t.length-1;l++)o*=t[t.length-l-1],a=`
6254      int b${l} = index / ${o};
6255      index -= b${l} * ${o};
6256    `+a,u=`b${l}, `+u;return`
6257    ivec${t.length} getOutputCoords() {
6258      ivec2 resTexRC = ivec2(resultUV.yx *
6259                             vec2(${r[0]}, ${r[1]}));
6260      int index = resTexRC.x * ${r[1]} + resTexRC.y;
6261
6262      ${a}
6263
6264      int b = index / ${i};
6265      index -= b * ${i};
6266
6267      int r = 2 * (index / ${s});
6268      int c = imod(index, ${s}) * 2;
6269
6270      return ivec${t.length}(${u});
6271    }
6272  `}function One(t,e,n){if(n)return`
6273    ivec4 getOutputCoords() {
6274      ivec2 resTexRC = ivec2(resultUV.yx *
6275        vec2(outTexShape[0], outTexShape[1]));
6276      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
6277      ${bm(["r","c","d","d2"],t)}
6278      return ivec4(r, c, d, d2);
6279    }
6280  `;const r=Ma(["r","c","d","d2"],t);return`
6281    ivec4 getOutputCoords() {
6282      ivec2 resTexRC = ivec2(resultUV.yx *
6283        vec2(${e[0]}, ${e[1]}));
6284      int index = resTexRC.x * ${e[1]} + resTexRC.y;
6285      ${r}
6286      return ivec4(r, c, d, d2);
6287    }
6288  `}function Dne(t,e){const n=Ma(["r","c","d","d2","d3"],t);return`
6289    ivec5 getOutputCoords() {
6290      ivec2 resTexRC = ivec2(resultUV.yx * vec2(${e[0]},
6291                             ${e[1]}));
6292
6293      int index = resTexRC.x * ${e[1]} + resTexRC.y;
6294
6295      ${n}
6296
6297      ivec5 outShape = ivec5(r, c, d, d2, d3);
6298      return outShape;
6299    }
6300  `}function Pne(t,e){const n=Ma(["r","c","d","d2","d3","d4"],t);return`
6301    ivec6 getOutputCoords() {
6302      ivec2 resTexRC = ivec2(resultUV.yx *
6303        vec2(${e[0]}, ${e[1]}));
6304      int index = resTexRC.x * ${e[1]} + resTexRC.y;
6305
6306      ${n}
6307
6308      ivec6 result = ivec6(r, c, d, d2, d3, d4);
6309      return result;
6310    }
6311  `}function Fne(t,e,n){const r=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(xt(t,e))return n?`
6312      ivec2 getOutputCoords() {
6313        ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
6314        return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));
6315      }
6316    `:`
6317      ivec2 getOutputCoords() {
6318        return 2 * ivec2(resultUV.yx * vec2(${r[0]}, ${r[1]}));
6319      }
6320    `;const s=Math.ceil(t[1]/2);return n?`
6321    ivec2 getOutputCoords() {
6322      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
6323      int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));
6324      ivec2 resTexRC = ivec2(resultUV.yx *
6325                             vec2(packedTexShape[0], packedTexShape[1]));
6326
6327      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
6328      int r = 2 * (index / texelsInLogicalRow);
6329      int c = imod(index, texelsInLogicalRow) * 2;
6330
6331      return ivec2(r, c);
6332    }
6333  `:`
6334    ivec2 getOutputCoords() {
6335      ivec2 resTexRC = ivec2(resultUV.yx *
6336                             vec2(${r[0]}, ${r[1]}));
6337
6338      int index = resTexRC.x * ${r[1]} + resTexRC.y;
6339      int r = 2 * (index / ${s});
6340      int c = imod(index, ${s}) * 2;
6341
6342      return ivec2(r, c);
6343    }
6344  `}function Lne(t,e,n){return xt(t,e)?n?`
6345      ivec2 getOutputCoords() {
6346        return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));
6347      }
6348    `:`
6349      ivec2 getOutputCoords() {
6350        return ivec2(resultUV.yx * vec2(${e[0]}, ${e[1]}));
6351      }
6352    `:t[1]===1?n?`
6353      ivec2 getOutputCoords() {
6354        ivec2 resTexRC = ivec2(resultUV.yx *
6355                               vec2(outTexShape[0], outTexShape[1]));
6356        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
6357        return ivec2(index, 0);
6358      }
6359    `:`
6360      ivec2 getOutputCoords() {
6361        ivec2 resTexRC = ivec2(resultUV.yx *
6362                               vec2(${e[0]}, ${e[1]}));
6363        int index = resTexRC.x * ${e[1]} + resTexRC.y;
6364        return ivec2(index, 0);
6365      }
6366    `:t[0]===1?n?`
6367      ivec2 getOutputCoords() {
6368        ivec2 resTexRC = ivec2(resultUV.yx *
6369                               vec2(outTexShape[0], outTexShape[1]));
6370        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
6371        return ivec2(0, index);
6372      }
6373    `:`
6374      ivec2 getOutputCoords() {
6375        ivec2 resTexRC = ivec2(resultUV.yx *
6376                               vec2(${e[0]}, ${e[1]}));
6377        int index = resTexRC.x * ${e[1]} + resTexRC.y;
6378        return ivec2(0, index);
6379      }
6380    `:n?`
6381    ivec2 getOutputCoords() {
6382      ivec2 resTexRC = ivec2(resultUV.yx *
6383                             vec2(outTexShape[0], outTexShape[1]));
6384      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
6385      int r = index / outShape[1];
6386      int c = index - r * outShape[1];
6387      return ivec2(r, c);
6388    }
6389  `:`
6390    ivec2 getOutputCoords() {
6391      ivec2 resTexRC = ivec2(resultUV.yx *
6392                             vec2(${e[0]}, ${e[1]}));
6393      int index = resTexRC.x * ${e[1]} + resTexRC.y;
6394      int r = index / ${t[1]};
6395      int c = index - r * ${t[1]};
6396      return ivec2(r, c);
6397    }
6398  `}function Va(t){return`offset${t}`}function Mne(t){const e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1),r=Nn();return`
6399    vec4 ${n}() {
6400      return ${r.texture2D}(${e}, halfCR);
6401    }
6402  `}function Vne(t,e){const n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(t.shapeInfo.isUniform)return`float ${r}() {return ${n};}`;const[s,i]=t.shapeInfo.texShape;if(s===1&&i===1)return`
6403      float ${r}() {
6404        return sampleTexture(${n}, halfCR);
6405      }
6406    `;const o=Va(n);if(e)return`
6407    float ${r}() {
6408      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], ${o});
6409      return sampleTexture(${n}, uv);
6410    }
6411  `;const[a,u]=t.shapeInfo.texShape;return`
6412    float ${r}() {
6413      vec2 uv = uvFromFlat(${a}, ${u}, ${o});
6414      return sampleTexture(${n}, uv);
6415    }
6416  `}function Bne(t,e){const n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),s=t.shapeInfo.texShape,i=Nn();if(e)return`
6417    vec4 ${r}(int index) {
6418      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));
6419      vec2 uv = packedUVfrom1D(
6420        packedTexShape[0], packedTexShape[1], index);
6421      return ${i.texture2D}(${n}, uv);
6422    }
6423  `;const o=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];return`
6424    vec4 ${r}(int index) {
6425      vec2 uv = packedUVfrom1D(
6426        ${o[0]}, ${o[1]}, index);
6427      return ${i.texture2D}(${n}, uv);
6428    }
6429  `}function Wne(t,e){const n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(t.shapeInfo.isUniform)return`
6430      float ${r}(int index) {
6431        ${wl(t)}
6432      }
6433    `;const s=t.shapeInfo.texShape,i=s[0],o=s[1];if(o===1&&i===1)return`
6434      float ${r}(int index) {
6435        return sampleTexture(${n}, halfCR);
6436      }
6437    `;const a=Va(n);return o===1?e?`
6438      float ${r}(int index) {
6439        vec2 uv = vec2(0.5, (float(index + ${a}) + 0.5) / float(${n}TexShape[0]));
6440        return sampleTexture(${n}, uv);
6441      }
6442    `:`
6443      float ${r}(int index) {
6444        vec2 uv = vec2(0.5, (float(index + ${a}) + 0.5) / ${i}.0);
6445        return sampleTexture(${n}, uv);
6446      }
6447    `:i===1?e?`
6448      float ${r}(int index) {
6449        vec2 uv = vec2((float(index + ${a}) + 0.5) / float(${n}TexShape[1]), 0.5);
6450        return sampleTexture(${n}, uv);
6451      }
6452    `:`
6453      float ${r}(int index) {
6454        vec2 uv = vec2((float(index + ${a}) + 0.5) / ${o}.0, 0.5);
6455        return sampleTexture(${n}, uv);
6456      }
6457    `:e?`
6458    float ${r}(int index) {
6459      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], index + ${a});
6460      return sampleTexture(${n}, uv);
6461    }
6462  `:`
6463    float ${r}(int index) {
6464      vec2 uv = uvFromFlat(${i}, ${o}, index + ${a});
6465      return sampleTexture(${n}, uv);
6466    }
6467  `}function Une(t,e){const n=t.shapeInfo.logicalShape,r=t.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),i=t.shapeInfo.texShape,o=i[0],a=i[1],u=Nn();if(i!=null&&xt(n,i))return e?`
6468      vec4 ${s}(int row, int col) {
6469        vec2 uv = (vec2(col, row) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);
6470
6471        return ${u.texture2D}(${r}, uv);
6472      }
6473    `:`
6474      vec4 ${s}(int row, int col) {
6475        vec2 uv = (vec2(col, row) + halfCR) / vec2(${a}.0, ${o}.0);
6476
6477        return ${u.texture2D}(${r}, uv);
6478      }
6479    `;if(e)return`
6480    vec4 ${s}(int row, int col) {
6481      ivec2 packedTexShape = ivec2(ceil(float(${r}TexShape[0]) / 2.0), ceil(float(${r}TexShape[1]) / 2.0));
6482      int valuesPerRow = int(ceil(float(${r}Shape[1]) / 2.0));
6483      vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);
6484      return ${u.texture2D}(${r}, uv);
6485    }
6486  `;const l=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],c=Math.ceil(n[1]/2);return`
6487    vec4 ${s}(int row, int col) {
6488      vec2 uv = packedUVfrom2D(${c}, ${l[0]}, ${l[1]}
6488, row, col);
6489      return ${u.texture2D}(${r}, uv);
6490    }
6491  `}function zne(t,e){const n=t.shapeInfo.logicalShape,r=t.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),i=t.shapeInfo.texShape;if(i!=null&&xt(n,i)){if(e)return`
6492      float ${s}(int row, int col) {
6493        vec2 uv = (vec2(col, row) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);
6494        return sampleTexture(${r}, uv);
6495      }
6496    `;const d=i[0],f=i[1];return`
6497    float ${s}(int row, int col) {
6498      vec2 uv = (vec2(col, row) + halfCR) / vec2(${f}.0, ${d}.0);
6499      return sampleTexture(${r}, uv);
6500    }
6501  `}const{newShape:o,keptDims:a}=_o(n),u=o;if(u.length<n.length){const d=bl(t,u),f=["row","col"];return`
6502      ${xl(d,e)}
6503      float ${s}(int row, int col) {
6504        return ${s}(${_l(f,a)});
6505      }
6506    `}if(t.shapeInfo.isUniform)return`
6507      float ${s}(int row, int col) {
6508        int index = round(dot(vec2(row, col), vec2(${n[1]}, 1)));
6509        ${wl(t)}
6510      }
6511    `;const l=i[0],c=i[1],h=Va(r);return c===1?e?`
6512      float ${s}(int row, int col) {
6513        float index = dot(vec3(row, col, ${h}), vec3(${r}Shape[1], 1, 1));
6514        vec2 uv = vec2(0.5, (index + 0.5) / float(${r}TexShape[0]));
6515        return sampleTexture(${r}, uv);
6516      }
6517    `:`
6518    float ${s}(int row, int col) {
6519      float index = dot(vec3(row, col, ${h}), vec3(${n[1]}, 1, 1));
6520      vec2 uv = vec2(0.5, (index + 0.5) / ${l}.0);
6521      return sampleTexture(${r}, uv);
6522    }
6523  `:l===1?e?`
6524      float ${s}(int row, int col) {
6525        float index = dot(vec3(row, col, ${h}), vec3(${r}Shape[1], 1, 1));
6526        vec2 uv = vec2((index + 0.5) / float(${r}TexShape[1]), 0.5);
6527        return sampleTexture(${r}, uv);
6528      }
6529    `:`
6530    float ${s}(int row, int col) {
6531      float index = dot(vec3(row, col, ${h}), vec3(${n[1]}, 1, 1));
6532      vec2 uv = vec2((index + 0.5) / ${c}.0, 0.5);
6533      return sampleTexture(${r}, uv);
6534    }
6535  `:e?`
6536      float ${s}(int row, int col) {
6537        // Explicitly use integer operations as dot() only works on floats.
6538        int index = row * ${r}Shape[1] + col + ${h};
6539        vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index);
6540        return sampleTexture(${r}, uv);
6541      }
6542    `:`
6543  float ${s}(int row, int col) {
6544    // Explicitly use integer operations as dot() only works on floats.
6545    int index = row * ${n[1]} + col + ${h};
6546    vec2 uv = uvFromFlat(${l}, ${c}, index);
6547    return sampleTexture(${r}, uv);
6548  }
6549`}function jne(t,e){const n=t.shapeInfo.logicalShape,r=t.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),i=t.shapeInfo.texShape,o=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];if(n[0]===1){const d=n.slice(1),f=[1,2],p=bl(t,d),y=["b","row","col"];return`
6550        ${oP(p,e)}
6551        vec4 ${s}(int b, int row, int col) {
6552          return ${s}(${_l(y,f)});
6553        }
6554      `}const a=Nn();if(e)return`
6555    vec4 ${s}(int b, int row, int col) {
6556      ivec2 packedTexShape = ivec2(ceil(float(${r}TexShape[0]) / 2.0), ceil(float(${r}TexShape[1]) / 2.0));
6557      int valuesPerRow = int(ceil(float(${r}Shape[2]) / 2.0));
6558      int texelsInBatch = valuesPerRow * int(ceil(float(${r}Shape[1]) / 2.0));
6559      vec2 uv = packedUVfrom3D(
6560        packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);
6561      return ${a.texture2D}(${r}, uv);
6562    }
6563  `;const u=o[0],l=o[1],c=Math.ceil(n[2]/2),h=c*Math.ceil(n[1]/2);return`
6564    vec4 ${s}(int b, int row, int col) {
6565      vec2 uv = packedUVfrom3D(
6566        ${u}, ${l}, ${h}, ${c}, b, row, col);
6567      return ${a.texture2D}(${r}, uv);
6568    }
6569  `}function Gne(t,e){const n=t.shapeInfo.logicalShape,r=t.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[1]*n[2],o=n[2],{newShape:a,keptDims:u}=_o(n),l=a;if(l.length<n.length){const y=bl(t,l),v=["row","col","depth"];return`
6570        ${xl(y,e)}
6571        float ${s}(int row, int col, int depth) {
6572          return ${s}(${_l(v,u)});
6573        }
6574      `}if(t.shapeInfo.isUniform)return`
6575      float ${s}(int row, int col, int depth) {
6576        int index = round(dot(vec3(row, col, depth),
6577                          vec3(${i}, ${o}, 1)));
6578        ${wl(t)}
6579      }
6580    `;const c=t.shapeInfo.texShape,h=c[0],d=c[1],f=t.shapeInfo.flatOffset;if(d===i&&f==null)return e?`
6581      float ${s}(int row, int col, int depth) {
6582        int stride1 = ${r}Shape[2];
6583        float texR = float(row);
6584        float texC = dot(vec2(col, depth), vec2(stride1, 1));
6585        vec2 uv = (vec2(texC, texR) + halfCR) /
6586                   vec2(${r}TexShape[1], ${r}TexShape[0]);
6587        return sampleTexture(${r}, uv);
6588      }
6589    `:`
6590        float ${s}(int row, int col, int depth) {
6591          float texR = float(row);
6592          float texC = dot(vec2(col, depth), vec2(${o}, 1));
6593          vec2 uv = (vec2(texC, texR) + halfCR) /
6594                     vec2(${d}.0, ${h}.0);
6595          return sampleTexture(${r}, uv);
6596        }
6597      `;if(d===o&&f==null)return e?`
6598      float ${s}(int row, int col, int depth) {
6599        float texR = dot(vec2(row, col), vec2(${r}Shape[1], 1));
6600        float texC = float(depth);
6601        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);
6602        return sampleTexture(${r}, uv);
6603      }
6604    `:`
6605    float ${s}(int row, int col, int depth) {
6606      float texR = dot(vec2(row, col), vec2(${n[1]}, 1));
6607      float texC = float(depth);
6608      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${d}.0, ${h}.0);
6609      return sampleTexture(${r}, uv);
6610    }
6611  `;const p=Va(r);return e?`
6612    float ${s}(int row, int col, int depth) {
6613      // Explicitly use integer operations as dot() only works on floats.
6614      int stride0 = ${r}Shape[1] * ${r}Shape[2];
6615      int stride1 = ${r}Shape[2];
6616      int index = row * stride0 + col * stride1 + depth + ${p};
6617      vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index);
6618      return sampleTexture(${r}, uv);
6619    }
6620    `:`
6621      float ${s}(int row, int col, int depth) {
6622        // Explicitly use integer operations as dot() only works on floats.
6623        int index = row * ${i} + col * ${o} + depth + ${p};
6624        vec2 uv = uvFromFlat(${h}, ${d}, index);
6625        return sampleTexture(${r}, uv);
6626      }
6627  `}function Hne(t,e){const n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),s=Nn();if(e)return`
6628    vec4 ${r}(int b2, int b, int row, int col) {
6629      int valuesPerRow = int(ceil(float(${n}Shape[3]) / 2.0));
6630      int texelsInBatch = valuesPerRow * int(ceil(float(${n}Shape[2]) / 2.0));
6631      int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);
6632      texelsInBatch *= ${n}Shape[1];
6633      index = b2 * texelsInBatch + index;
6634      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));
6635      int texR = index / packedTexShape[1];
6636      int texC = index - texR * packedTexShape[1];
6637      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${s.texture2D}(${n}, uv);
6638    }
6639  `;const i=t.shapeInfo.logicalShape,o=i.length,a=t.shapeInfo.texShape,u=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],l=u[0],c=u[1],h=Math.ceil(i[o-1]/2);let d=h*Math.ceil(i[o-2]/2),f="int b, int row, int col",p=`b * ${d} + (row / 2) * ${h} + (col / 2)`;for(let y=2;y<o-1;y++)f=`int b${y}, `+f,d*=i[o-y-1],p=`b${y} * ${d} + `+p;return`
6640    vec4 ${r}(${f}) {
6641      int index = ${p};
6642      int texR = index / ${c};
6643      int texC = index - texR * ${c};
6644      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${c}, ${l});
6645      return ${s.texture2D}(${n}, uv);
6646    }
6647  `}function qne(t,e){const n=t.shapeInfo.logicalShape,r=t.name,s="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[3],o=n[2]*i,a=n[1]*o,{newShape:u,keptDims:l}=_o(n);if(u.length<n.length){const x=bl(t,u),w=["row","col","depth","depth2"];return`
6648      ${xl(x,e)}
6649      float ${s}(int row, int col, int depth, int depth2) {
6650        return ${s}(${_l(w,l)});
6651      }
6652    `}if(t.shapeInfo.isUniform)return`
6653      float ${s}(int row, int col, int depth, int depth2) {
6654        int index = round(dot(vec4(row, col, depth, depth2),
6655                          vec4(${a}, ${o}, ${i}, 1)));
6656        ${wl(t)}
6657      }
6658    `;const c=t.shapeInfo.flatOffset,h=t.shapeInfo.texShape,d=h[0],f=h[1],p=`int stride2 = ${r}Shape[3];`,y=`int stride1 = ${r}Shape[2] * stride2;`,v=`int stride0 = ${r}Shape[1] * stride1;`;if(f===a&&c==null)return e?`
6659      float ${s}(int row, int col, int depth, int depth2) {
6660        ${p}
6661        ${y}
6662        float texR = float(row);
6663        float texC =
6664            dot(vec3(col, depth, depth2),
6665                vec3(stride1, stride2, 1));
6666        vec2 uv = (vec2(texC, texR) + halfCR) /
6667                   vec2(${r}TexShape[1], ${r}TexShape[0]);
6668        return sampleTexture(${r}, uv);
6669      }
6670    `:`
6671      float ${s}(int row, int col, int depth, int depth2) {
6672        float texR = float(row);
6673        float texC =
6674            dot(vec3(col, depth, depth2),
6675                vec3(${o}, ${i}, 1));
6676        vec2 uv = (vec2(texC, texR) + halfCR) /
6677                   vec2(${f}.0, ${d}.0);
6678        return sampleTexture(${r}, uv);
6679      }
6680    `;if(f===i&&c==null)return e?`
6681      float ${s}(int row, int col, int depth, int depth2) {
6682        float texR = dot(vec3(row, col, depth),
6683                         vec3(${r}Shape[1] * ${r}Shape[2], ${r}Shape[2], 1));
6684        float texC = float(depth2);
6685        vec2 uv = (vec2(texC, texR) + halfCR) /
6686                  vec2(${r}TexShape[1], ${r}TexShape[0]);
6687        return sampleTexture(${r}, uv);
6688      }
6689    `:`
6690      float ${s}(int row, int col, int depth, int depth2) {
6691        float texR = dot(vec3(row, col, depth),
6692                         vec3(${n[1]*n[2]}, ${n[2]}, 1));
6693        float texC = float(depth2);
6694        vec2 uv = (vec2(texC, texR) + halfCR) /
6695                  vec2(${f}.0, ${d}.0);
6696        return sampleTexture(${r}, uv);
6697      }
6698    `;const g=Va(r);return e?`
6699    float ${s}(int row, int col, int depth, int depth2) {
6700      // Explicitly use integer operations as dot() only works on floats.
6701      ${p}
6702      ${y}
6703      ${v}
6704      int index = row * stride0 + col * stride1 +
6705          depth * stride2 + depth2;
6706      vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index + ${g});
6707      return sampleTexture(${r}, uv);
6708    }
6709  `:`
6710    float ${s}(int row, int col, int depth, int depth2) {
6711      // Explicitly use integer operations as dot() only works on floats.
6712      int index = row * ${a} + col * ${o} +
6713          depth * ${i} + depth2;
6714      vec2 uv = uvFromFlat(${d}, ${f}, index + ${g});
6715      return sampleTexture(${r}, uv);
6716    }
6717  `}function Kne(t){const e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),s=e[4],i=e[3]*s,o=e[2]*i,a=e[1]*o,{newShape:u,keptDims:l}=_o(e);if(u.length<e.length){const y=bl(t,u),v=["row","col","depth","depth2","depth3"];return`
6718      ${xl(y)}
6719      float ${r}(int row, int col, int depth, int depth2, int depth3) {
6720        return ${r}(${_l(v,l)});
6721      }
6722    `}if(t.shapeInfo.isUniform)return`
6723      float ${r}(int row, int col, int depth, int depth2, int depth3) {
6724        float index = dot(
6725          vec4(row, col, depth, depth2),
6726          vec4(${a}, ${o}, ${i}, ${s})) +
6727          depth3;
6728        ${wl(t)}
6729      }
6730    `;const c=t.shapeInfo.flatOffset,h=t.shapeInfo.texShape,d=h[0],f=h[1];if(f===a&&c==null)return`
6731      float ${r}(int row, int col, int depth, int depth2, int depth3) {
6732        int texR = row;
6733        float texC = dot(vec4(col, depth, depth2, depth3),
6734                         vec4(${o}, ${i}, ${s}, 1));
6735        vec2 uv = (vec2(texC, texR) + halfCR) /
6736                   vec2(${f}.0, ${d}.0);
6737        return sampleTexture(${n}, uv);
6738      }
6739    `;if(f===s&&c==null)return`
6740      float ${r}(int row, int col, int depth, int depth2, int depth3) {
6741        float texR = dot(
6742          vec4(row, col, depth, depth2),
6743          vec4(${e[1]*e[2]*e[3]},
6744               ${e[2]*e[3]}, ${e[3]}, 1));
6745        int texC = depth3;
6746        vec2 uv = (vec2(texC, texR) + halfCR) /
6747                  vec2(${f}.0, ${d}.0);
6748        return sampleTexture(${n}, uv);
6749      }
6750    `;const p=Va(n);return`
6751    float ${r}(int row, int col, int depth, int depth2, int depth3) {
6752      // Explicitly use integer operations as dot() only works on floats.
6753      int index = row * ${a} + col * ${o} + depth * ${i} +
6754          depth2 * ${s} + depth3 + ${p};
6755      vec2 uv = uvFromFlat(${d}, ${f}, index);
6756      return sampleTexture(${n}, uv);
6757    }
6758  `}function Xne(t){const e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:s,keptDims:i}=_o(e);if(s.length<e.length){const v=bl(t,s),g=["row","col","depth","depth2","depth3","depth4"];return`
6759      ${xl(v)}
6760      float ${r}(int row, int col, int depth,
6761                    int depth2, int depth3, int depth4) {
6762        return ${r}(${_l(g,i)});
6763      }
6764    `}const o=e[5],a=e[4]*o,u=e[3]*a,l=e[2]*u,c=e[1]*l;if(t.shapeInfo.isUniform)return`
6765      float ${r}(int row, int col, int depth,
6766                  int depth2, int depth3, int depth4) {
6767        int index = round(dot(
6768          vec4(row, col, depth, depth2),
6769          vec4(${c}, ${l}, ${u}, ${a})) +
6770          dot(
6771            vec2(depth3, depth4),
6772            vec2(${o}, 1)));
6773        ${wl(t)}
6774      }
6775    `;const h=t.shapeInfo.flatOffset,d=t.shapeInfo.texShape,f=d[0],p=d[1];if(p===c&&h==null)return`
6776      float ${r}(int row, int col, int depth,
6777                    int depth2, int depth3, int depth4) {
6778        int texR = row;
6779        float texC = dot(vec4(col, depth, depth2, depth3),
6780          vec4(${l}, ${u}, ${a}, ${o})) +
6781               float(depth4);
6782        vec2 uv = (vec2(texC, texR) + halfCR) /
6783                   vec2(${p}.0, ${f}.0);
6784        return sampleTexture(${n}, uv);
6785      }
6786    `;if(p===o&&h==null)return`
6787      float ${r}(int row, int col, int depth,
6788                    int depth2, int depth3, int depth4) {
6789        float texR = dot(vec4(row, col, depth, depth2),
6790          vec4(${e[1]*e[2]*e[3]*e[4]},
6791               ${e[2]*e[3]*e[4]},
6792               ${e[3]*e[4]},
6793               ${e[4]})) + float(depth3);
6794        int texC = depth4;
6795        vec2 uv = (vec2(texC, texR) + halfCR) /
6796                  vec2(${p}.0, ${f}.0);
6797        return sampleTexture(${n}, uv);
6798      }
6799    `;const y=Va(n);return`
6800    float ${r}(int row, int col, int depth,
6801                  int depth2, int depth3, int depth4) {
6802      // Explicitly use integer operations as dot() only works on floats.
6803      int index = row * ${c} + col * ${l} + depth * ${u} +
6804          depth2 * ${a} + depth3 * ${o} + depth4 + ${y};
6805      vec2 uv = uvFromFlat(${f}, ${p}, index);
6806      return sampleTexture(${n}, uv);
6807    }
6808  `}function wl(t){const e=t.name,n=ne(t.shapeInfo.logicalShape);return n<2?`return ${e};`:`
6809    for (int i = 0; i < ${n}; i++) {
6810      if (i == index) {
6811        return ${e}[i];
6812      }
6813    }
6814  `}function Yne(t,e){const n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),s="get"+r+"AtOutCoords",i=t.shapeInfo.logicalShape.length,o=e.logicalShape.length,a=iP(t.shapeInfo.logicalShape,e.logicalShape),u=qe(o),l=o-i;let c;const h=["x","y","z","w","u","v"];i===0?c="":o<2&&a.length>=1?c="coords = 0;":c=a.map(x=>`coords.${h[x+l]} = 0;`).join(`
6815`);let d="";o<2&&i>0?d="coords":d=t.shapeInfo.logicalShape.map((x,w)=>`coords.${h[w+l]}`).join(", ");let f="return outputValue;";const y=ne(t.shapeInfo.logicalShape)===1,g=ne(e.logicalShape)===1;if(i===1&&!y&&!g)f=`
6816      return vec4(outputValue.xy, outputValue.xy);
6817    `;else if(y&&!g)o===1?f=`
6818        return vec4(outputValue.x, outputValue.x, 0., 0.);
6819      `:f=`
6820        return vec4(outputValue.x);
6821      `;else if(a.length){const x=i-2,w=i-1;a.indexOf(x)>-1&&a.indexOf(w)>-1?f="return vec4(outputValue.x);":a.indexOf(x)>-1?f="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":a.indexOf(w)>-1&&(f="return vec4(outputValue.xx, outputValue.zz);")}return`
6822    vec4 ${s}() {
6823      ${u} coords = getOutputCoords();
6824      ${c}
6825      vec4 outputValue = get${r}(${d});
6826      ${f}
6827    }
6828  `}function Qne(t,e){const n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),s="get"+r+"AtOutCoords",i=e.texShape,o=t.shapeInfo.texShape,a=t.shapeInfo.logicalShape.length,u=e.logicalShape.length;if(!t.shapeInfo.isUniform&&a===u&&t.shapeInfo.flatOffset==null&&xt(o,i))return`
6829      float ${s}() {
6830        return sampleTexture(${n}, resultUV);
6831      }
6832    `;const l=qe(u),c=iP(t.shapeInfo.logicalShape,e.logicalShape),h=u-a;let d;const f=["x","y","z","w","u","v"];a===0?d="":u<2&&c.length>=1?d="coords = 0;":d=c.map(y=>`coords.${f[y+h]} = 0;`).join(`
6833`);let p="";return u<2&&a>0?p="coords":p=t.shapeInfo.logicalShape.map((y,v)=>`coords.${f[v+h]}`).join(", "),`
6834    float ${s}() {
6835      ${l} coords = getOutputCoords();
6836      ${d}
6837      return get${r}(${p});
6838    }
6839  `}function qe(t){if(t<=1)return"int";if(t===2)return"ivec2";if(t===3)return"ivec3";if(t===4)return"ivec4";if(t===5)return"ivec5";if(t===6)return"ivec6";throw Error(`GPU for rank ${t} is not yet supported`)}function hw(t,e,n){const{newShape:r,keptDims:s}=_o(e),i=e.length,o=t&&i===3&&e[0]===1,a=o?e.slice(1):r,u=!t&&i>1&&!xt(e,n)&&r.length<i||o;return{useSqueezeShape:u,uniformShape:u?a:e,keptDims:s}}function bl(t,e){const n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function _l(t,e){return e.map(n=>t[n]).join(", ")}/**
6840 * @license
6841 * Copyright 2017 Google LLC. All Rights Reserved.
6842 * Licensed under the Apache License, Version 2.0 (the "License");
6843 * you may not use this file except in compliance with the License.
6844 * You may obtain a copy of the License at
6845 *
6846 * http://www.apache.org/licenses/LICENSE-2.0
6847 *
6848 * Unless required by applicable law or agreed to in writing, software
6849 * distributed under the License is distributed on an "AS IS" BASIS,
6850 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6851 * See the License for the specific language governing permissions and
6852 * limitations under the License.
6853 * =============================================================================
6854 */function Zne(t,e,n,r){const s=n.map((c,h)=>{const d={logicalShape:c.shape,texShape:c.isUniform?null:c.texData.texShape,isUniform:c.isUniform,isPacked:c.isUniform?!1:c.texData.isPacked,flatOffset:null};return c.texData!=null&&c.texData.slice!=null&&c.texData.slice.flatOffset>0&&(d.flatOffset=c.texData.slice.flatOffset),{name:e.variableNames[h],shapeInfo:d}}),i=s.map(c=>c.shapeInfo),o={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},a=gne(s,o,e),u=Gte(t.gl,a),l=t.createProgram(u);return U().get("ENGINE_COMPILE_ONLY")?{program:e,fragmentShader:u,source:a,webGLProgram:l,inShapeInfos:i,outShapeInfo:o,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(t.buildVao(l),Object.assign({program:e,fragmentShader:u,source:a,webGLProgram:l,inShapeInfos:i,outShapeInfo:o},uP(t,e,l)))}function uP(t,e,n){const r=[],s=[];let i,o,a,u=null,l=null;l=t.getUniformLocation(n,"NAN",!1),U().getNumber("WEBGL_VERSION")===1&&(u=t.getUniformLocation(n,"INFINITY",!1));const c=!1;for(const h of e.variableNames){const d={name:h,uniform:t.getUniformLocation(n,h,c),offset:t.getUniformLocation(n,`offset${h}`,c)};e.enableShapeUniforms&&(d.shape=t.getUniformLocation(n,`${h}Shape`,c),d.texShape=t.getUniformLocation(n,`${h}TexShape`,c)),r.push(d)}if(e.enableShapeUniforms&&(i=t.getUniformLocation(n,"outShape",c),a=t.getUniformLocation(n,"outShapeStrides",c),o=t.getUniformLocation(n,"outTexShape",c)),e.customUniforms)for(const h of e.customUniforms)s.push(t.getUniformLocation(n,h.name,c));return{variablesLocations:r,customUniformLocations:s,infLoc:u,nanLoc:l,outShapeLocation:i,outShapeStridesLocation:a,outTexShapeLocation:o}}function qT(t,e){if(t.length!==e.length)throw Error(`Binary was compiled with ${t.length}
6854 inputs, but was executed with ${e.length} inputs`);t.forEach((n,r)=>{const s=n.logicalShape,i=e[r],o=i.shape;if(!xt(s,o))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${s} and ${o} must match`);if(n.isUniform&&i.isUniform)return;const a=n.texShape,u=i.isUniform?null:i.texData.texShape;if(!xt(a,u))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${a} and ${u} must match`)})}function Jne(t,e,n,r,s){e.program.enableShapeUniforms||(qT(e.inShapeInfos,n),qT([e.outShapeInfo],[r]));const i=r.texData.texture,o=r.texData.texShape;r.texData.isPacked?t.setOutputPackedMatrixTexture(i.texture,o[0],o[1]):t.setOutputMatrixTexture(i.texture,o[0],o[1]),t.setProgram(e.webGLProgram),t.bindVertexArray(e.webGLProgram.vao),U().getNumber("WEBGL_VERSION")===1&&e.infLoc!==null&&t.gl.uniform1f(e.infLoc,1/0),e.nanLoc!==null&&t.gl.uniform1f(e.nanLoc,NaN);for(let u=0;u<n.length;++u){const l=n[u],{uniform:c,offset:h,shape:d,texShape:f}=e.variablesLocations[u];if(d){const{uniformShape:p}=hw(e.program.packedInputs,l.shape,l.texData.texShape);switch(p.length){case 1:t.gl.uniform1iv(d,new Int32Array(p));break;case 2:t.gl.uniform2iv(d,new Int32Array(p));break;case 3:t.gl.uniform3iv(d,new Int32Array(p));break;case 4:t.gl.uniform4iv(d,new Int32Array(p));break}}if(f&&t.gl.uniform2i(f,l.texData.texShape[0],l.texData.texShape[1]),c!=null){if(l.isUniform){if(ne(l.shape)<2)t.gl.uniform1f(c,l.uniformValues[0]);else{let p=l.uniformValues;p instanceof Float32Array||(p=new Float32Array(p)),t.gl.uniform1fv(c,p)}continue}l.texData.slice!=null&&h!=null&&t.gl.uniform1i(h,l.texData.slice.flatOffset),t.setInputMatrixTexture(l.texData.texture.texture,c,u)}}const a=e.outShapeLocation;if(a)switch(r.shape.length){case 1:t.gl.uniform1iv(a,new Int32Array(r.shape));break;case 2:t.gl.uniform2iv(a,new Int32Array(r.shape));break;case 3:t.gl.uniform3iv(a,new Int32Array(r.shape));break;case 4:t.gl.uniform4iv(a,new Int32Array(r.shape));break}if(e.outShapeStridesLocation){const u=Zt(r.shape);switch(r.shape.length){case 2:t.gl.uniform1iv(e.outShapeStridesLocation,new Int32Array(u));break;case 3:t.gl.uniform2iv(e.outShapeStridesLocation,new Int32Array(u));break;case 4:t.gl.uniform3iv(e.outShapeStridesLocation,new Int32Array(u));break}}if(e.outTexShapeLocation&&t.gl.uniform2i(e.outTexShapeLocation,r.texData.texShape[0],r.texData.texShape[1]),e.program.customUniforms&&s)for(let u=0;u<e.program.customUniforms.length;++u){const l=e.program.customUniforms[u],c=e.customUniformLocations[u],h=s[u];if(l.type==="float")t.gl.uniform1fv(c,h);else if(l.type==="vec2")t.gl.uniform2fv(c,h);else if(l.type==="vec3")t.gl.uniform3fv(c,h);else if(l.type==="vec4")t.gl.uniform4fv(c,h);else if(l.type==="int")t.gl.uniform1iv(c,h);else if(l.type==="ivec2")t.gl.uniform2iv(c,h);else if(l.type==="ivec3")t.gl.uniform3iv(c,h);else if(l.type==="ivec4")t.gl.uniform4iv(c,h);else throw Error(`uniform type ${l.type} is not supported yet.`)}t.executeProgram()}function ere(t,e,n){let r="";e.concat(n).forEach(o=>{const a=o.texData!=null&&o.texData.slice!=null&&o.texData.slice.flatOffset>0;if(t.enableShapeUniforms&&!o.isUniform){const u=o.texData.texShape,{useSqueezeShape:l,uniformShape:c,keptDims:h}=hw(t.packedInputs,o.shape,u);let d="",f="",p="";if(c.length===1&&t.packedInputs){const T=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)];d=`${T[0]>1}_${T[1]>1}`}else if(c.length===2&&!t.packedInputs)f=`${c[0]>1}_${c[1]>1}`;else if(c.length>2&&!t.packedInputs){const T=Zt(c);p=`${T[0]===u[1]}_${T[T.length-1]===u[1]}`}const y=o.shape.length,v=c.length===2&&xt(o.shape,u),g=ne(o.shape)===1,x=Kf(o.shape,n.shape),w=!t.packedInputs&&y===n.shape.length&&xt(u,n.texData.texShape),_=t.packedInputs||c.length>2?"":`${u[0]>1}_${u[1]>1}`;r+=`${y}_${w}_${l?h:""}_${c.length}_${g}_${x}_${v}_${d}_${f}_${p}_${_}_${a}`}else{const u=o.isUniform?"uniform":o.texData.texShape;r+=`${o.shape}_${u}_${a}`}});const s=t.userCode;let i=t.constructor.name;return i+="_"+r+"_"+s+`${U().getNumber("WEBGL_VERSION")}`,i}function fn(t){return U().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&t<=4}/**
6855 * @license
6856 * Copyright 2019 Google LLC. All Rights Reserved.
6857 * Licensed under the Apache License, Version 2.0 (the "License");
6858 * you may not use this file except in compliance with the License.
6859 * You may obtain a copy of the License at
6860 *
6861 * http://www.apache.org/licenses/LICENSE-2.0
6862 *
6863 * Unless required by applicable law or agreed to in writing, software
6864 * distributed under the License is distributed on an "AS IS" BASIS,
6865 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6866 * See the License for the specific language governing permissions and
6867 * limitations under the License.
6868 * =============================================================================
6869 */class tre{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Kc.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=Nn();this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length),this.userCode=`
6870      ivec3 outCoordsFromFlatIndex(int index) {
6871        ${this.enableShapeUniforms?bm(["r","c","d"],e):Ma(["r","c","d"],e)}
6872        return ivec3(r, c, d);
6873      }
6874
6875      void main() {
6876        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
6877        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);
6878
6879        vec4 result = vec4(0.);
6880
6881        for (int i=0; i<4; i++) {
6882          int flatIndex = index + i;
6883          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
6884          result[i] = getA(rc.x, rc.y, rc.z);
6885        }
6886
6887        ${n.output} = result;
6888      }
6889    `}}/**
6890 * @license
6891 * Copyright 2019 Google LLC. All Rights Reserved.
6892 * Licensed under the Apache License, Version 2.0 (the "License");
6893 * you may not use this file except in compliance with the License.
6894 * You may obtain a copy of the License at
6895 *
6896 * http://www.apache.org/licenses/LICENSE-2.0
6897 *
6898 * Unless required by applicable law or agreed to in writing, software
6899 * distributed under the License is distributed on an "AS IS" BASIS,
6900 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6901 * See the License for the specific language governing permissions and
6902 * limitations under the License.
6903 * =============================================================================
6904 */class nre{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Kc.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=Nn();this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length),this.userCode=`
6905      ivec3 outCoordsFromFlatIndex(int index) {
6906        ${this.enableShapeUniforms?bm(["r","c","d"],e):Ma(["r","c","d"],e)}
6907        return ivec3(r, c, d);
6908      }
6909
6910      void main() {
6911        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
6912        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);
6913
6914        vec4 result = vec4(0.);
6915
6916        for (int i=0; i<4; i++) {
6917          int flatIndex = index + i;
6918          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
6919          result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));
6920        }
6921
6922        ${n.output} = result;
6923      }
6924    `}}/**
6925 * @license
6926 * Copyright 2018 Google LLC. All Rights Reserved.
6927 * Licensed under the Apache License, Version 2.0 (the "License");
6928 * you may not use this file except in compliance with the License.
6929 * You may obtain a copy of the License at
6930 *
6931 * http://www.apache.org/licenses/LICENSE-2.0
6932 *
6933 * Unless required by applicable law or agreed to in writing, software
6934 * distributed under the License is distributed on an "AS IS" BASIS,
6935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6936 * See the License for the specific language governing permissions and
6937 * limitations under the License.
6938 * =============================================================================
6939 */class rre{constructor(e){this.variableNames=["A"],this.outTexUsage=ar.DOWNLOAD;const n=Nn();this.outputShape=e,this.userCode=`
6940      ${sP}
6941
6942      void main() {
6943        float x = getAAtOutCoords();
6944        ${n.output} = encode_float(x);
6945      }
6946    `}}/**
6947 * @license
6948 * Copyright 2018 Google LLC. All Rights Reserved.
6949 * Licensed under the Apache License, Version 2.0 (the "License");
6950 * you may not use this file except in compliance with the License.
6951 * You may obtain a copy of the License at
6952 *
6953 * http://www.apache.org/licenses/LICENSE-2.0
6954 *
6955 * Unless required by applicable law or agreed to in writing, software
6956 * distributed under the License is distributed on an "AS IS" BASIS,
6957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6958 * See the License for the specific language governing permissions and
6959 * limitations under the License.
6960 * =============================================================================
6961 */class sre{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=ar.DOWNLOAD;const n=Nn();this.outputShape=e,this.userCode=`
6962      ${sP}
6963
6964      void main() {
6965        ivec3 coords = getOutputCoords();
6966        float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));
6967        ${n.output} = encode_float(x);
6968      }
6969    `}}/**
6970 * @license
6971 * Copyright 2018 Google LLC. All Rights Reserved.
6972 * Licensed under the Apache License, Version 2.0 (the "License");
6973 * you may not use this file except in compliance with the License.
6974 * You may obtain a copy of the License at
6975 *
6976 * http://www.apache.org/licenses/LICENSE-2.0
6977 *
6978 * Unless required by applicable law or agreed to in writing, software
6979 * distributed under the License is distributed on an "AS IS" BASIS,
6980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6981 * See the License for the specific language governing permissions and
6982 * limitations under the License.
6983 * =============================================================================
6984 */const ire={R:0,G:1,B:2,A:3};class KT{constructor(e,n=!1,r="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const s=Nn();this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length);let i="result";n&&(i="floor(result * 255. + 0.5)");let o="";for(let a=0;a<r.length;a++){const u=r[a];o+=`
6985          if(offset == ${a}) {
6986            result = values[${ire[u]}];
6987          }`}this.userCode=`
6988      ${this.enableShapeUniforms?cw():lw(e)}
6989
6990      void main() {
6991        ivec3 coords = getOutputCoords();
6992        int flatIndex = getFlatIndex(coords);
6993        float result = 0.;
6994        int offset = imod(flatIndex, ${r.length});
6995
6996        flatIndex = idiv(flatIndex, ${r.length}, 1.);
6997
6998        int r = flatIndex / texShape[1];
6999        if (r < texShape[0]) {
7000          int c = imod(flatIndex, texShape[1]);
7001          vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
7002          vec4 values = ${s.texture2D}(A, uv);
7003          ${o}
7004        }
7005        ${s.output} = vec4(${i}, 0., 0., 0.);
7006      }
7007    `}}/**
7008 * @license
7009 * Copyright 2018 Google LLC. All Rights Reserved.
7010 * Licensed under the Apache License, Version 2.0 (the "License");
7011 * you may not use this file except in compliance with the License.
7012 * You may obtain a copy of the License at
7013 *
7014 * http://www.apache.org/licenses/LICENSE-2.0
7015 *
7016 * Unless required by applicable law or agreed to in writing, software
7017 * distributed under the License is distributed on an "AS IS" BASIS,
7018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7019 * See the License for the specific language governing permissions and
7020 * limitations under the License.
7021 * =============================================================================
7022 */class ore{constructor(e,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const r=Nn();this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length);let s="",i="result";n&&(i="floor(result * 255. + 0.5)");for(let o=0;o<=1;o++)for(let a=0;a<=1;a++){const u=o*2+a;s+=`
7023          localCoords = coords;
7024          if(localCoords[2] + ${a} < ${this.enableShapeUniforms?"outShape[2]":`${e[2]}`}) {
7025          localCoords[2] += ${a};
7026          if (localCoords[1] + ${o} < ${this.enableShapeUniforms?"outShape[1]":`${e[1]}`}) {
7027            localCoords[1] += ${o};
7028
7029            flatIndex = getFlatIndex(localCoords);
7030            offset = imod(flatIndex, 4);
7031
7032            flatIndex = idiv(flatIndex, 4, 1.);
7033
7034            int r = flatIndex / texShape[1];
7035            int c = imod(flatIndex, texShape[1]);
7036            vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
7037            values = ${r.texture2D}(A, uv);
7038
7039            if (offset == 0) {
7040              result[${u}] = values[0];
7041            } else if (offset == 1) {
7042              result[${u}] = values[1];
7043            } else if (offset == 2) {
7044              result[${u}] = values[2];
7045            } else {
7046              result[${u}] = values[3];
7047            }
7048          }
7049        }
7050        `}this.userCode=`
7051        ${this.enableShapeUniforms?cw():lw(e)}
7052
7053        void main() {
7054          ivec3 coords = getOutputCoords();
7055
7056          vec4 result = vec4(0.);
7057          int flatIndex, r, c, offset;
7058          ivec3 localCoords;
7059          vec2 uv;
7060          vec4 values;
7061
7062          ${s}
7063
7064          ${r.output} = ${i};
7065        }
7066    `}}/**
7067 * @license
7068 * Copyright 2017 Google LLC. All Rights Reserved.
7069 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 15,364 bytes, lines 7070-7108
7070 * you may not use this file except in compliance with the License.
7071 * You may obtain a copy of the License at
7072 *
7073 * http://www.apache.org/licenses/LICENSE-2.0
7074 *
7075 * Unless required by applicable law or agreed to in writing, software
7076 * distributed under the License is distributed on an "AS IS" BASIS,
7077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7078 * See the License for the specific language governing permissions and
7079 * limitations under the License.
7080 * =============================================================================
7081 */function are(t){const e=Nn(),n=`${e.version}
7082    precision highp float;
7083    ${e.attribute} vec3 clipSpacePos;
7084    ${e.attribute} vec2 uv;
7085    ${e.varyingVs} vec2 resultUV;
7086
7087    void main() {
7088      gl_Position = vec4(clipSpacePos, 1);
7089      resultUV = uv;
7090    }`;return jte(t,n)}function ure(t){const e=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return Xte(t,e)}function lre(t){const e=new Uint16Array([0,1,2,2,1,3]);return Yte(t,e)}function Nh(t,e,n,r,s,i){Zte(e,n);const o=Qte(t),a=t.TEXTURE_2D;return ue(t,()=>t.bindTexture(a,o)),ue(t,()=>t.texParameteri(a,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)),ue(t,()=>t.texParameteri(a,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)),ue(t,()=>t.texParameteri(a,t.TEXTURE_MIN_FILTER,t.NEAREST)),ue(t,()=>t.texParameteri(a,t.TEXTURE_MAG_FILTER,t.NEAREST)),U().getNumber("WEBGL_VERSION")===1?ue(t,()=>t.texImage2D(a,0,r,e,n,0,s,i,null)):ue(t,()=>t.texStorage2D(a,1,r,e,n)),ue(t,()=>t.bindTexture(t.TEXTURE_2D,null)),{texture:o,texShape:[n,e]}}function lP(t){return t.internalFormatFloat}function cre(t,e,n,r){const[s,i]=Th(e,n);return Nh(t,s,i,lP(r),r.textureFormatFloat,t.FLOAT)}function cP(t){return t.internalFormatHalfFloat}function hre(t,e,n,r){const[s,i]=Th(e,n);return Nh(t,s,i,cP(r),r.textureFormatFloat,r.textureTypeHalfFloat)}function hP(t){return t.downloadTextureFormat}function dre(t,e,n,r){const[s,i]=Th(e,n);return Nh(t,s,i,hP(r),t.RGBA,t.UNSIGNED_BYTE)}function dP(t){return t.internalFormatPackedFloat}function fre(t,e,n,r){const[s,i]=vl(e,n);return Nh(t,s,i,dP(r),t.RGBA,t.FLOAT)}function fP(t){return t.internalFormatPackedHalfFloat}function pre(t,e,n,r){const[s,i]=vl(e,n);return Nh(t,s,i,fP(r),t.RGBA,r.textureTypeHalfFloat)}function mre(t,e,n){return ue(t,()=>t.bindBuffer(t.ARRAY_BUFFER,n)),jT(t,e,"clipSpacePos",n,3,20,0)&&jT(t,e,"uv",n,2,20,12)}function gre(t,e,n,r,s,i){ue(t,()=>t.bindTexture(t.TEXTURE_2D,e));let o,a,u;s instanceof Uint8Array?(o=new Uint8Array(n*r*4),a=t.UNSIGNED_BYTE,u=t.RGBA):(o=new Float32Array(n*r*4),a=t.FLOAT,u=i.internalFormatPackedFloat),o.set(s),U().getNumber("WEBGL_VERSION")===2?ue(t,()=>t.texSubImage2D(t.TEXTURE_2D,0,0,0,n,r,t.RGBA,a,o)):ue(t,()=>t.texImage2D(t.TEXTURE_2D,0,u,n,r,0,t.RGBA,a,o)),ue(t,()=>t.bindTexture(t.TEXTURE_2D,null))}function yre(t,e,n){ue(t,()=>t.bindTexture(t.TEXTURE_2D,e)),n.data instanceof Uint8Array?U().getNumber("WEBGL_VERSION")===2?ue(t,()=>t.texSubImage2D(t.TEXTURE_2D,0,0,0,n.width,n.height,t.RGBA,t.UNSIGNED_BYTE,n.data)):ue(t,()=>t.texImage2D(t.TEXTURE_2D,0,t.RGBA,n.width,n.height,0,t.RGBA,t.UNSIGNED_BYTE,n.data)):U().getNumber("WEBGL_VERSION")===2?ue(t,()=>t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,n)):ue(t,()=>t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n)),ue(t,()=>t.bindTexture(t.TEXTURE_2D,null))}function vre(t,e,n,r){const s=t.createBuffer();ue(t,()=>t.bindBuffer(t.PIXEL_PACK_BUFFER,s));const a=4*4*e*n;return ue(t,()=>t.bufferData(t.PIXEL_PACK_BUFFER,a,t.STREAM_READ)),ue(t,()=>t.readPixels(0,0,n,e,t.RGBA,t.FLOAT,0)),ue(t,()=>t.bindBuffer(t.PIXEL_PACK_BUFFER,null)),s}function xre(t,e,n){const r=t,s=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,e),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,s),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),s}function wre(t,e,n,r){const[s,i]=Th(e,n),o=4,a=new Uint8Array(Lte(e*n,o));return ue(t,()=>t.readPixels(0,0,s,i,r.downloadTextureFormat,t.UNSIGNED_BYTE,a)),new Float32Array(a.buffer)}function bre(t,e,n,r,s,i,o,a){const u=t,l=new Float32Array(Mte(i,o));return u.bindBuffer(u.PIXEL_PACK_BUFFER,e),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,l),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),l}function _re(t,e,n){const r=new Float32Array(e*n*4);return ue(t,()=>t.readPixels(0,0,n,e,t.RGBA,t.FLOAT,r)),r}/**
7091 * @license
7092 * Copyright 2017 Google LLC. All Rights Reserved.
7093 * Licensed under the Apache License, Version 2.0 (the "License");
7094 * you may not use this file except in compliance with the License.
7095 * You may obtain a copy of the License at
7096 *
7097 * http://www.apache.org/licenses/LICENSE-2.0
7098 *
7099 * Unless required by applicable law or agreed to in writing, software
7100 * distributed under the License is distributed on an "AS IS" BASIS,
7101 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7102 * See the License for the specific language governing permissions and
7103 * limitations under the License.
7104 * =============================================================================
7105 */class Xg{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];const n=U().getNumber("WEBGL_VERSION");if(e!=null?(this.gl=e,Dte(n,e)):this.gl=fs(n),e=this.gl,U().getNumber("WEBGL_VERSION")===2){const i=e;this.createVertexArray=()=>ue(i,()=>i.createVertexArray()),this.bindVertexArray=o=>ue(i,()=>i.bindVertexArray(o)),this.deleteVertexArray=o=>ue(i,()=>i.deleteVertexArray(o)),this.getVertexArray=()=>ue(i,()=>i.getParameter(i.VERTEX_ARRAY_BINDING))}else if(e!=null){const i=e.getExtension("OES_vertex_array_object");if(i==null)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>ue(e,()=>i.createVertexArrayOES()),this.bindVertexArray=o=>ue(e,()=>i.bindVertexArrayOES(o)),this.deleteVertexArray=o=>ue(e,()=>i.deleteVertexArrayOES(o)),this.getVertexArray=()=>ue(e,()=>e.getParameter(i.VERTEX_ARRAY_BINDING_OES))}let r="WEBGL_color_buffer_float";const s="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),U().getNumber("WEBGL_VERSION")===1){const i="OES_texture_float",o="OES_texture_half_float";if(this.textureFloatExtension=vd(this.gl,i),Dr(this.gl,o))this.textureHalfFloatExtension=vd(this.gl,o);else if(U().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(r),Dr(this.gl,s))this.colorBufferHalfFloatExtension=vd(this.gl,s);else if(U().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(r="EXT_color_buffer_float",Dr(this.gl,r))this.colorBufferFloatExtension=this.gl.getExtension(r);else if(Dr(this.gl,s))this.colorBufferHalfFloatExtension=this.gl.getExtension(s);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=ure(this.gl),this.indexBuffer=lre(this.gl),this.framebuffer=Jte(this.gl),this.textureConfig=uw(this.gl,this.textureHalfFloatExtension)}get debug(){return U().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture.  This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");const e=this.gl;ue(e,()=>e.finish()),ue(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),ue(e,()=>e.deleteFramebuffer(this.framebuffer)),ue(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),ue(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),ue(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,n){return this.throwIfDisposed(),cre(this.gl,e,n,this.textureConfig)}createFloat16MatrixTexture(e,n){return this.throwIfDisposed(),hre(this.gl,e,n,this.textureConfig)}createUnsignedBytesMatrixTexture(e,n){return this.throwIfDisposed(),dre(this.gl,e,n,this.textureConfig)}uploadPixelDataToTexture(e,n){this.throwIfDisposed(),yre(this.gl,e,n)}uploadDenseMatrixToTexture(e,n,r,s){this.throwIfDisposed(),gre(this.gl,e,n,r,s,this.textureConfig)}createFloat16PackedMatrixTexture(e,n){return this.throwIfDisposed(),pre(this.gl,e,n,this.textureConfig)}createPackedMatrixTexture(e,n){return this.throwIfDisposed(),fre(this.gl,e,n,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(GT(this.gl,this.framebuffer),this.outputTexture=null),ue(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,n,r){return this.downloadMatrixDriver(e,()=>wre(this.gl,n,r,this.textureConfig))}downloadPackedMatrixFromBuffer(e,n,r,s,i,o){return bre(this.gl,e,n,r,s,i,o,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,n){return xre(this.gl,e,n)}createBufferFromTexture(e,n,r){this.bindTextureToFrameBuffer(e);const s=vre(this.gl,n,r,this.textureConfig);return this.unbindTextureToFrameBuffer(),s}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let n,r;if(U().getBool("WEBGL_FENCE_API_ENABLED")){const s=e,i=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),r=()=>{const o=s.clientWaitSync(i,0,0);return o===s.ALREADY_SIGNALED||o===s.CONDITION_SATISFIED},n=i}else U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(n=this.beginQuery(),this.endQuery(),r=()=>this.isQueryAvailable(n,U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):r=()=>!0;return{query:n,isFencePassed:r}}downloadMatrixFromPackedTexture(e,n,r){return this.downloadMatrixDriver(e,()=>_re(this.gl,n,r))}createProgram(e){this.throwIfDisposed();const n=this.gl;this.vertexShader==null&&(this.vertexShader=are(n));const r=qte(n);ue(n,()=>n.attachShader(r,this.vertexShader)),ue(n,()=>n.attachShader(r,e)),Kte(n,r);const s=Object.assign(r,{vao:this.createVertexArray()});return this.debug&&Gg(n,s),s}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const n=this.gl;ue(n,()=>n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),mre(n,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&(ue(this.gl,()=>this.gl.deleteProgram(e)),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&Gg(this.gl,this.program),ue(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,n,r=!0){return this.throwIfDisposed(),r?tne(this.gl,e,n):nne(this.gl,e,n)}getAttributeLocation(e,n){return this.throwIfDisposed(),ue(this.gl,()=>this.gl.getAttribLocation(e,n))}getUniformLocationNoThrow(e,n){return this.throwIfDisposed(),this.gl.getUniformLocation(e,n)}setInputMatrixTexture(e,n,r){this.throwIfDisposed(),this.throwIfNoProgram(),rne(this.gl,e,n,r)}setOutputMatrixTexture(e,n,r){this.setOutputMatrixTextureDriver(e,r,n)}setOutputPackedMatrixTexture(e,n,r){this.throwIfDisposed();const[s,i]=vl(n,r);this.setOutputMatrixTextureDriver(e,s,i)}setOutputMatrixWriteRegion(e,n,r,s){this.setOutputMatrixWriteRegionDriver(r,e,s,n)}setOutputPackedMatrixWriteRegion(e,n,r,s){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&Gg(this.gl,this.program),xd(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){const n=this.getVertexArray();console.assert(n===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}ue(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),ue(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=vd(this.gl,U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const r=this.gl,s=this.getQueryTimerExtensionWebGL2(),i=r.createQuery();return r.beginQuery(s.TIME_ELAPSED_EXT,i),i}const e=this.getQueryTimerExtensionWebGL1(),n=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,n),n}endQuery(){if(U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const n=this.gl,r=this.getQueryTimerExtensionWebGL2();n.endQuery(r.TIME_ELAPSED_EXT);return}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await sT(()=>this.disposed||this.isQueryAvailable(e,U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,n){if(n===0)return null;if(n===2){const r=this.gl;return r.getQueryParameter(e,r.QUERY_RESULT)/1e6}else{const r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(e,r.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,n){if(n===0)return!0;if(n===2){const r=this.gl,s=this.getQueryTimerExtensionWebGL2(),i=r.getQueryParameter(e,r.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(s.GPU_DISJOINT_EXT)),i&&!this.disjoint}else{const r=this.getQueryTimerExtensionWebGL1(),s=r.getQueryObjectEXT(e,r.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),s&&!this.disjoint}}pollFence(e){return new Promise(n=>{this.addItemToPoll(()=>e.isFencePassed(),()=>n())})}pollItems(){const e=Sre(this.itemsToPoll.map(n=>n.isDoneFn));for(let n=0;n<=e;++n){const{resolveFn:r}=this.itemsToPoll[n];r()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,n){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:n}),this.itemsToPoll.length>1)return;let r;"setTimeoutCustom"in U().platform&&(r=U().platform.setTimeoutCustom.bind(U().platform)),sT(()=>(this.pollItems(),this.itemsToPoll.length===0),()=>0,null,r)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),Hg(this.gl,e,this.framebuffer),this.debug&&xd(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(Hg(this.gl,this.outputTexture,this.framebuffer),this.debug&&xd(this.gl)):GT(this.gl,this.framebuffer)}downloadMatrixDriver(e,n){this.bindTextureToFrameBuffer(e);const r=n();return this.unbindTextureToFrameBuffer(),r}setOutputMatrixTextureDriver(e,n,r){this.throwIfDisposed();const s=this.gl;Hg(s,e,this.framebuffer),this.debug&&xd(s),this.outputTexture=e,ue(s,()=>s.viewport(0,0,n,r)),ue(s,()=>s.scissor(0,0,n,r))}setOutputMatrixWriteRegionDriver(e,n,r,s){this.throwIfDisposed(),ue(this.gl,()=>this.gl.scissor(e,n,r,s))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}}function Sre(t){let e=0;for(;e<t.length&&t[e]();++e);return e-1}/**
7106 * @license
7107 * Copyright 2020 Google LLC. All Rights Reserved.
7108 * Licensed under the Apache License, Version 2.0 (the License);
7109 * you may not use this file except in compliance with the License.
7110 * You may obtain a copy of the License at
7111 *
7112 * http://www.apache.org/licenses/LICENSE-2.0
7113 *
7114 * Unless required by applicable law or agreed to in writing, software
7115 * distributed under the License is distributed on an AS IS BASIS,
7116 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7117 * See the License for the specific language governing permissions and
7118 * limitations under the License.
7119 * =============================================================================
7120 */function Tre(t){const e=new Float32Array(t.length);for(let n=0;n<t.length;++n)e[n]=Math.abs(t[n]);return e}/**
7121 * @license
7122 * Copyright 2020 Google LLC. All Rights Reserved.
7123 * Licensed under the Apache License, Version 2.0 (the "License");
7124 * you may not use this file except in compliance with the License.
7125 * You may obtain a copy of the License at
7126 *
7127 * http://www.apache.org/licenses/LICENSE-2.0
7128 *
7129 * Unless required by applicable law or agreed to in writing, software
7130 * distributed under the License is distributed on an "AS IS" BASIS,
7131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7132 * See the License for the specific language governing permissions and
7133 * limitations under the License.
7134 * =============================================================================
7135 */function Ln(t){return(e,n,r,s,i)=>{const o=Le(e,n),a=o.length,u=Zt(o),l=ne(o),c=ho(i,l),h=e.length,d=n.length,f=Zt(e),p=Zt(n),y=Kf(e,o),v=Kf(n,o);if(y.length+v.length===0)for(let g=0;g<c.length;++g)c[g]=t(r[g%r.length],s[g%s.length]);else for(let g=0;g<c.length;++g){const x=S1(g,a,u),w=x.slice(-h);y.forEach(k=>w[k]=0);const _=_0(w,h,f),T=x.slice(-d);v.forEach(k=>T[k]=0);const E=_0(T,d,p);c[g]=t(r[_],s[E])}return[c,o]}}/**
7136 * @license
7137 * Copyright 2020 Google LLC. All Rights Reserved.
7138 * Licensed under the Apache License, Version 2.0 (the "License");
7139 * you may not use this file except in compliance with the License.
7140 * You may obtain a copy of the License at
7141 *
7142 * http://www.apache.org/licenses/LICENSE-2.0
7143 *
7144 * Unless required by applicable law or agreed to in writing, software
7145 * distributed under the License is distributed on an "AS IS" BASIS,
7146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7147 * See the License for the specific language governing permissions and
7148 * limitations under the License.
7149 * =============================================================================
7150 */function Cre(t,e,n,r){if(r==="int32"){const s=Int32Array.from(t);return[e,"int32",s]}if(r==="bool"){const s=am([0],n),[i,o]=Ln((a,u)=>a!==u?1:0)(e,[],t,s,"bool");return[o,"bool",i]}throw new Error(`Error in Cast: failed to cast ${n} to ${r}`)}/**
7151 * @license
7152 * Copyright 2020 Google LLC. All Rights Reserved.
7153 * Licensed under the Apache License, Version 2.0 (the "License");
7154 * you may not use this file except in compliance with the License.
7155 * You may obtain a copy of the License at
7156 *
7157 * http://www.apache.org/licenses/LICENSE-2.0
7158 *
7159 * Unless required by applicable law or agreed to in writing, software
7160 * distributed under the License is distributed on an "AS IS" BASIS,
7161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7162 * See the License for the specific language governing permissions and
7163 * limitations under the License.
7164 * =============================================================================
7165 */const Nre=Ln((t,e)=>t+e);/**
7166 * @license
7167 * Copyright 2020 Google LLC. All Rights Reserved.
7168 * Licensed under the Apache License, Version 2.0 (the "License");
7169 * you may not use this file except in compliance with the License.
7170 * You may obtain a copy of the License at
7171 *
7172 * http://www.apache.org/licenses/LICENSE-2.0
7173 *
7174 * Unless required by applicable law or agreed to in writing, software
7175 * distributed under the License is distributed on an "AS IS" BASIS,
7176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7177 * See the License for the specific language governing permissions and
7178 * limitations under the License.
7179 * =============================================================================
7180 */function Ere(t,e,n,r,s){const i=ne(r),o=fo(s,n);for(let a=0;a<t.length;a++){const u=t[a];if(u<0)throw new Error("Input x must be non-negative!");u>=s||(i>0?o[u]+=e[a]:o[u]+=1)}return o}function kre(t,e,n,r=!1){const s=t.shape[0],i=t.shape[1],o=wt([s,n],e.dtype);for(let a=0;a<s;a++)for(let u=0;u<i;u++){const l=t.get(a,u);if(l<0)throw new Error("Input x must be non-negative!");l>=n||(r?o.set(1,a,l):e.size>0?o.set(o.get(a,l)+e.get(a,u),a,l):o.set(o.get(a,l)+1,a,l))}return o}/**
7181 * @license
7182 * Copyright 2023 Google LLC.
7183 * Licensed under the Apache License, Version 2.0 (the "License");
7184 * you may not use this file except in compliance with the License.
7185 * You may obtain a copy of the License at
7186 *
7187 * http://www.apache.org/licenses/LICENSE-2.0
7188 *
7189 * Unless required by applicable law or agreed to in writing, software
7190 * distributed under the License is distributed on an "AS IS" BASIS,
7191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7192 * See the License for the specific language governing permissions and
7193 * limitations under the License.
7194 * =============================================================================
7195 */const $re=Ln((t,e)=>t&e);/**
7196 * @license
7197 * Copyright 2020 Google LLC. All Rights Reserved.
7198 * Licensed under the Apache License, Version 2.0 (the "License");
7199 * you may not use this file except in compliance with the License.
7200 * You may obtain a copy of the License at
7201 *
7202 * http://www.apache.org/licenses/LICENSE-2.0
7203 *
7204 * Unless required by applicable law or agreed to in writing, software
7205 * distributed under the License is distributed on an "AS IS" BASIS,
7206 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7207 * See the License for the specific language governing permissions and
7208 * limitations under the License.
7209 * =============================================================================
7210 */function Ei(t){return(e,n,r)=>{const s=zt(n,e.length);for(let i=0;i<e.length;++i)s[i]=t(e[i],r);return s}}/**
7211 * @license
7212 * Copyright 2020 Google LLC. All Rights Reserved.
7213 * Licensed under the Apache License, Version 2.0 (the License);
7214 * you may not use this file except in compliance with the License.
7215 * You may obtain a copy of the License at
7216 *
7217 * http://www.apache.org/licenses/LICENSE-2.0
7218 *
7219 * Unless required by applicable law or agreed to in writing, software
7220 * distributed under the License is distributed on an AS IS BASIS,
7221 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7222 * See the License for the specific language governing permissions and
7223 * limitations under the License.
7224 * =============================================================================
7225 */const Ire=Ei(t=>Math.ceil(t));/**
7226 * @license
7227 * Copyright 2020 Google LLC. All Rights Reserved.
7228 * Licensed under the Apache License, Version 2.0 (the "License");
7229 * you may not use this file except in compliance with the License.
7230 * You may obtain a copy of the License at
7231 *
7232 * http://www.apache.org/licenses/LICENSE-2.0
7233 *
7234 * Unless required by applicable law or agreed to in writing, software
7235 * distributed under the License is distributed on an "AS IS" BASIS,
7236 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7237 * See the License for the specific language governing permissions and
7238 * limitations under the License.
7239 * =============================================================================
7240 */function Are(t,e,n,r){const s=zt(n,ne(e));if(r&&n!=="string"){let i=0;t.forEach(o=>{const a=ne(o.shape);s.set(o.vals,i),i+=a})}else{let i=0;t.forEach(o=>{const a=n==="string"?el(o.vals):o.vals;let u=0;for(let l=0;l<o.shape[0];++l){const c=l*e[1]+i;for(let h=0;h<o.shape[1];++h)s[c+h]=a[u++]}i+=o.shape[1]})}return s}/**
7241 * @license
7242 * Copyright 2020 Google LLC. All Rights Reserved.
7243 * Licensed under the Apache License, Version 2.0 (the "License");
7244 * you may not use this file except in compliance with the License.
7245 * You may obtain a copy of the License at
7246 *
7247 * http://www.apache.org/licenses/LICENSE-2.0
7248 *
7249 * Unless required by applicable law or agreed to in writing, software
7250 * distributed under the License is distributed on an "AS IS" BASIS,
7251 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7252 * See the License for the specific language governing permissions and
7253 * limitations under the License.
7254 * =============================================================================
7255 */const Rre=Ln((t,e)=>t===e?1:0);/**
7256 * @license
7257 * Copyright 2020 Google LLC. All Rights Reserved.
7258 * Licensed under the Apache License, Version 2.0 (the License);
7259 * you may not use this file except in compliance with the License.
7260 * You may obtain a copy of the License at
7261 *
7262 * http://www.apache.org/licenses/LICENSE-2.0
7263 *
7264 * Unless required by applicable law or agreed to in writing, softw
7264are
7265 * distributed under the License is distributed on an AS IS BASIS,
7266 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7267 * See the License for the specific language governing permissions and
7268 * limitations under the License.
7269 * =============================================================================
7270 */const Ore=Ei(t=>Math.exp(t));/**
7271 * @license
7272 * Copyright 2020 Google LLC. All Rights Reserved.
7273 * Licensed under the Apache License, Version 2.0 (the License);
7274 * you may not use this file except in compliance with the License.
7275 * You may obtain a copy of the License at
7276 *
7277 * http://www.apache.org/licenses/LICENSE-2.0
7278 *
7279 * Unless required by applicable law or agreed to in writing, software
7280 * distributed under the License is distributed on an AS IS BASIS,
7281 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7282 * See the License for the specific language governing permissions and
7283 * limitations under the License.
7284 * =============================================================================
7285 */const Dre=Ei(t=>Math.expm1(t));/**
7286 * @license
7287 * Copyright 2020 Google LLC. All Rights Reserved.
7288 * Licensed under the Apache License, Version 2.0 (the License);
7289 * you may not use this file except in compliance with the License.
7290 * You may obtain a copy of the License at
7291 *
7292 * http://www.apache.org/licenses/LICENSE-2.0
7293 *
7294 * Unless required by applicable law or agreed to in writing, software
7295 * distributed under the License is distributed on an AS IS BASIS,
7296 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7297 * See the License for the specific language governing permissions and
7298 * limitations under the License.
7299 * =============================================================================
7300 */const Pre=Ei(t=>Math.floor(t));/**
7301 * @license
7302 * Copyright 2020 Google LLC. All Rights Reserved.
7303 * Licensed under the Apache License, Version 2.0 (the "License");
7304 * you may not use this file except in compliance with the License.
7305 * You may obtain a copy of the License at
7306 *
7307 * http://www.apache.org/licenses/LICENSE-2.0
7308 *
7309 * Unless required by applicable law or agreed to in writing, software
7310 * distributed under the License is distributed on an "AS IS" BASIS,
7311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7312 * See the License for the specific language governing permissions and
7313 * limitations under the License.
7314 * =============================================================================
7315 */const Fre=Ln((t,e)=>Math.floor(t/e));/**
7316 * @license
7317 * Copyright 2021 Google LLC. All Rights Reserved.
7318 * Licensed under the Apache License, Version 2.0 (the "License");
7319 * you may not use this file except in compliance with the License.
7320 * You may obtain a copy of the License at
7321 *
7322 * http://www.apache.org/licenses/LICENSE-2.0
7323 *
7324 * Unless required by applicable law or agreed to in writing, software
7325 * distributed under the License is distributed on an "AS IS" BASIS,
7326 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7327 * See the License for the specific language governing permissions and
7328 * limitations under the License.
7329 * =============================================================================
7330 */function Lre(t,e,n,r,s,i,o,a,u){const l=wt([r,i],n);for(let c=0;c<r;c++){const h=[];let d=0;for(let f=0;f<s;f++){const p=t[c*s+f];d+=p*o[f],h.push(p)}if(d<0||d>=u/i)throw new Error(`Invalid indices: ${h} does not index into ${a}`);for(let f=0;f<i;f++)l.values[c*i+f]=e.get(...e.indexToLoc(d*i+f))}return l}/**
7331 * @license
7332 * Copyright 2020 Google LLC. All Rights Reserved.
7333 * Licensed under the Apache License, Version 2.0 (the "License");
7334 * you may not use this file except in compliance with the License.
7335 * You may obtain a copy of the License at
7336 *
7337 * http://www.apache.org/licenses/LICENSE-2.0
7338 *
7339 * Unless required by applicable law or agreed to in writing, software
7340 * distributed under the License is distributed on an "AS IS" BASIS,
7341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7342 * See the License for the specific language governing permissions and
7343 * limitations under the License.
7344 * =============================================================================
7345 */function Mre(t,e,n){const r=wt(n,t.dtype);for(let s=0;s<r.size;++s){const o=r.indexToLoc(s).slice(),a=o[0],u=o[2],l=e.locToIndex([a,u]);o[2]=e.values[l];const c=t.locToIndex(o);
73450<=c&&c<t.values.length&&(r.values[s]=t.values[c])}return r}/**
7346 * @license
7347 * Copyright 2020 Google LLC. All Rights Reserved.
7348 * Licensed under the Apache License, Version 2.0 (the "License");
7349 * you may not use this file except in compliance with the License.
7350 * You may obtain a copy of the License at
7351 *
7352 * http://www.apache.org/licenses/LICENSE-2.0
7353 *
7354 * Unless required by applicable law or agreed to in writing, software
7355 * distributed under the License is distributed on an "AS IS" BASIS,
7356 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7357 * See the License for the specific language governing permissions and
7358 * limitations under the License.
7359 * =============================================================================
7360 */const Vre=Ln((t,e)=>t>e?1:0);/**
7361 * @license
7362 * Copyright 2020 Google LLC. All Rights Reserved.
7363 * Licensed under the Apache License, Version 2.0 (the "License");
7364 * you may not use this file except in compliance with the License.
7365 * You may obtain a copy of the License at
7366 *
7367 * http://www.apache.org/licenses/LICENSE-2.0
7368 *
7369 * Unless required by applicable law or agreed to in writing, software
7370 * distributed under the License is distributed on an "AS IS" BASIS,
7371 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7372 * See the License for the specific language governing permissions and
7373 * limitations under the License.
7374 * =============================================================================
7375 */const Bre=Ln((t,e)=>t>=e?1:0);/**
7376 * @license
7377 * Copyright 2020 Google LLC. All Rights Reserved.
7378 * Licensed under the Apache License, Version 2.0 (the "License");
7379 * you may not use this file except in compliance with the License.
7380 * You may obtain a copy of the License at
7381 *
7382 * http://www.apache.org/licenses/LICENSE-2.0
7383 *
7384 * Unless required by applicable law or agreed to in writing, software
7385 * distributed under the License is distributed on an "AS IS" BASIS,
7386 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7387 * See the License for the specific language governing permissions and
7388 * limitations under the License.
7389 * =============================================================================
7390 */const Wre=Ln((t,e)=>t<e?1:0);/**
7391 * @license
7392 * Copyright 2020 Google LLC. All Rights Reserved.
7393 * Licensed under the Apache License, Version 2.0 (the "License");
7394 * you may not use this file except in compliance with the License.
7395 * You may obtain a copy of the License at
7396 *
7397 * http://www.apache.org/licenses/LICENSE-2.0
7398 *
7399 * Unless required by applicable law or agreed to in writing, software
7400 * distributed under the License is distributed on an "AS IS" BASIS,
7401 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7402 * See the License for the specific language governing permissions and
7403 * limitations under the License.
7404 * =============================================================================
7405 */const Ure=Ln((t,e)=>t<=e?1:0);/**
7406 * @license
7407 * Copyright 2020 Google LLC. All Rights Reserved.
7408 * Licensed under the Apache License, Version 2.0 (the "License");
7409 * you may not use this file except in compliance with the License.
7410 * You may obtain a copy of the License at
7411 *
7412 * http://www.apache.org/licenses/LICENSE-2.0
7413 *
7414 * Unless required by applicable law or agreed to in writing, software
7415 * distributed under the License is distributed on an "AS IS" BASIS,
7416 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7417 * See the License for the specific language governing permissions and
7418 * limitations under the License.
7419 * =============================================================================
7420 */function zre(t,e,n){const r=(e-t)/(n-1),s=fo(n,"float32");s[0]=t;for(let i=1;i<s.length;i++)s[i]=s[i-1]+r;return s}/**
7421 * @license
7422 * Copyright 2020 Google LLC. All Rights Reserved.
7423 * Licensed under the Apache License, Version 2.0 (the License);
7424 * you may not use this file except in compliance with the License.
7425 * You may obtain a copy of the License at
7426 *
7427 * http://www.apache.org/licenses/LICENSE-2.0
7428 *
7429 * Unless required by applicable law or agreed to in writing, softw
7429are
7430 * distributed under the License is distributed on an AS IS BASIS,
7431 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7432 * See the License for the specific language governing permissions and
7433 * limitations under the License.
7434 * =============================================================================
7435 */const jre=Ei(t=>Math.log(t));/**
7436 * @license
7437 * Copyright 2020 Google LLC. All Rights Reserved.
7438 * Licensed under the Apache License, Version 2.0 (the "License");
7439 * you may not use this file except in compliance with the License.
7440 * You may obtain a copy of the License at
7441 *
7442 * http://www.apache.org/licenses/LICENSE-2.0
7443 *
7444 * Unless required by applicable law or agreed to in writing, software
7445 * distributed under the License is distributed on an "AS IS" BASIS,
7446 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7447 * See the License for the specific language governing permissions and
7448 * limitations under the License.
7449 * =============================================================================
7450 */function Gre(t,e,n,r){const s=ho(r,ne(n));for(let i=0;i<s.length;++i){const o=i*e;let a=t[o];for(let u=0;u<e;++u){const l=t[o+u];(Number.isNaN(l)||l>a)&&(a=l)}s[i]=a}return s}/**
7451 * @license
7452 * Copyright 2020 Google LLC. All Rights Reserved.
7453 * Licensed under the Apache License, Version 2.0 (the "License");
7454 * you may not use this file except in compliance with the License.
7455 * You may obtain a copy of the License at
7456 *
7457 * http://www.apache.org/licenses/LICENSE-2.0
7458 *
7459 * Unless required by applicable law or agreed to in writing, software
7460 * distributed under the License is distributed on an "AS IS" BASIS,
7461 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7462 * See the License for the specific language governing permissions and
7463 * limitations under the License.
7464 * =============================================================================
7465 */const Hre=Ln((t,e)=>Math.max(t,e));/**
7466 * @license
7467 * Copyright 2020 Google LLC. All Rights Reserved.
7468 * Licensed under the Apache License, Version 2.0 (the "License");
7469 * you may not use this file except in compliance with the License.
7470 * You may obtain a copy of the License at
7471 *
7472 * http://www.apache.org/licenses/LICENSE-2.0
7473 *
7474 * Unless required by applicable law or agreed to in writing, software
7475 * distributed under the License is distributed on an "AS IS" BASIS,
7476 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7477 * See the License for the specific language governing permissions and
7478 * limitations under the License.
7479 * =============================================================================
7480 */const qre=Ln((t,e)=>Math.min(t,e));/**
7481 * @license
7482 * Copyright 2020 Google LLC. All Rights Reserved.
7483 * Licensed under the Apache License, Version 2.0 (the "License");
7484 * you may not use this file except in compliance with the License.
7485 * You may obtain a copy of the License at
7486 *
7487 * http://www.apache.org/licenses/LICENSE-2.0
7488 *
7489 * Unless required by applicable law or agreed to in writing, software
7490 * distributed under the License is distributed on an "AS IS" BASIS,
7491 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7492 * See the License for the specific language governing permissions and
7493 * limitations under the License.
7494 * =============================================================================
7495 */const pP=Ln((t,e)=>t*e);/**
7496 * @license
7497 * Copyright 2020 Google LLC. All Rights Reserved.
7498 * Licensed under the Apache License, Version 2.0 (the "License");
7499 * you may not use this file except in compliance with the License.
7500 * You may obtain a copy of the License at
7501 *
7502 * http://www.apache.org/licenses/LICENSE-2.0
7503 *
7504 * Unless required by applicable law or agreed to in writing, software
7505 * distributed under the License is distributed on an "AS IS" BASIS,
7506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7507 * See the License for the specific language governing permissions and
7508 * limitations under the License.
7509 * =============================================================================
7510 */function Kre(t,e,n){const r=ml(-1,n);return pP([],e,r,t,n)}/**
7511 * @license
7512 * Copyright 2020 Google LLC. All Rights Reserved.
7513 * Licensed under the Apache License, Version 2.0 (the "License");
7514 * you may not use this file except in compliance with the License.
7515 * You may obtain a copy of the License at
7516 *
7517 * http://www.apache.org/licenses/LICENSE-2.0
7518 *
7519 * Unless required by applicable law or agreed to in writing, software
7520 * distributed under the License is distributed on an "AS IS" BASIS,
7521 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7522 * See the License for the specific language governing permissions and
7523 * limitations under the License.
7524 * =============================================================================
7525 */const Xre=Ln((t,e)=>t!==e?1:0);/**
7526 * @license
7527 * Copyright 2020 Google LLC. All Rights Reserved.
7528 * Licensed under the Apache License, Version 2.0 (the "License");
7529 * you may not use this file except in compliance with the License.
7530 * You may obtain a copy of the License at
7531 *
7532 * http://www.apache.org/licenses/LICENSE-2.0
7533 *
7534 * Unless required by applicable law or agreed to in writing, software
7535 * distributed under the License is distributed on an "AS IS" BASIS,
7536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7537 * See the License for the specific language governing permissions and
7538 * limitations under the License.
7539 * =============================================================================
7540 */function Yre(t,e,n,r,s){const i=e.length,o=ne(e),a=Zt(e),u=Zt(s),l=ho(n,ne(s));for(let c=0;c<o;++c){const h=S1(c,i,a),d=new Array(h.length);for(let p=0;p<d.length;p++)d[p]=h[r[p]];const f=_0(d,i,u);l[f]=t[c]}return l}/**
7541 * @license
7542 * Copyright 2020 Google LLC. All Rights Reserved.
7543 * Licensed under the Apache License, Version 2.0 (the "License");
7544 * you may not use this file except in compliance with the License.
7545 * You may obtain a copy of the License at
7546 *
7547 * http://www.apache.org/licenses/LICENSE-2.0
7548 *
7549 * Unless required by applicable law or agreed to in writing, software
7550 * distributed under the License is distributed on an "AS IS" BASIS,
7551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7552 * See the License for the specific language governing permissions and
7553 * limitations under the License.
7554 * =============================================================================
7555 */function Qre(t,e,n,r){const[s,i]=qs(t,r),o=zs(e,"int32"),a=fo(ne(s),o),u=ne(i);for(let l=0;l<a.length;++l){const c=l*u;let h=1;for(let d=0;d<u;++d)h*=n[c+d];a[l]=h}return{outVals:a,outShape:s,outDtype:o}}/**
7556 * @license
7557 * Copyright 2022 Google LLC. All Rights Reserved.
7558 * Licensed under the Apache License, Version 2.0 (the "License");
7559 * you may not use this file except in compliance with the License.
7560 * You may obtain a copy of the License at
7561 *
7562 * http://www.apache.org/licenses/LICENSE-2.0
7563 *
7564 * Unless required by applicable law or agreed to in writing, software
7565 * distributed under the License is distributed on an "AS IS" BASIS,
7566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7567 * See the License for the specific language governing permissions and
7568 * limitations under the License.
7569 * =============================================================================
7570 */function Zre(t,e,n){t.forEach((r,s)=>{if(r<0||r>=n){const i=S1(s,e.length,Zt(e)).join(",");throw new Error(`indices[${i}] = ${r} is not in [0, ${n})`)}})}function Jre(t,e){for(let n=0;n<t.length;++n){const r=t[n],s=n===t.length-1?e:t[n+1].length;if(r.length===0)throw new Error("Ragged splits may not be empty");if(r[0]<0)throw new Error("Ragged splits must be non-negative");if(r[r.length-1]>s)throw new Error("Ragged splits must not point past values");for(let i=1;i<r.length;++i)if(r[i-1]>r[i])throw new Error("Ragged splits must be sorted in ascending order")}}function ese(t,e,n,r){const s=[];let i=0;const o=e.length-1+n.length,a=new Array(o).fill(null).map(()=>[0]);Jre(n,r);let u=1;for(let l=0;l<e.length-1;++l){u*=e[l];const c=e[l+1];for(let h=1;h<u+1;++h)a[l].push(h*c)}for(let l=0;l<t.length;++l){let c=t[l],h=t[l]+1;for(let d=0;d<n.length;++d){const f=n[d],p=d+e.length-1;if(p>=0){const y=a[p],v=y[y.length-1]-f[c];for(let g=c;g<h;++g)a[p].push(f[g+1]+v)}c=f[c],h=f[h]}h!==c&&(s.push([c,h]),i+=h-c)}
vendor: 8,672 bytes, lines 7570-7609
7570return{outSplits:a,valueSlices:s,numValues:i}}function tse(t){const e=[];for(let n=0;n<t.length;++n){const r=t[n].length,s=zt("int32",r);e.push(s),t[n].forEach((i,o)=>s[o]=i)}return e}function XT(t,e){const n=t.slice(0,e);for(;n.length<e;)n.push(1);for(let r=e;r<t.length;r++)n[e-1]*=t[r];return n}function nse(t,e,n,r,s,i){const o=XT(e,2)[1],a=XT(i,2)[1];let u=0;for(const l of n)for(let c=l[0];c<l[1];++c){for(let h=0;h<r;++h)s[u*a+h]=t[c*o+h];++u}}function rse(t,e,n,r,s){const i=e.slice();i[0]=s;const o=zt(n,ne(i)),a=t.length,u=a===0?0:a/e[0];return nse(t,e,r,u,o,i),[o,i]}function sse(t,e,n,r,s,i,o,a){if(t.length===0)throw new Error("paramsNestedSplits must be non empty");if(e[0].length===0)throw new Error("Split tensors must not be scalars");const u=e[0][0]-1;if(Zre(i,o,u),r.length===0)throw new Error("params.rank must be nonzero");const l=r[0],{outSplits:c,valueSlices:h,numValues:d}=ese(i,o,t,l),f=tse(c),p=rse(n,r,s,h,d);return[f,p[0],p[1]]}/**
7571 * @license
7572 * Copyright 2022 Google LLC.
7573 * Licensed under the Apache License, Version 2.0 (the "License");
7574 * you may not use this file except in compliance with the License.
7575 * You may obtain a copy of the License at
7576 *
7577 * http://www.apache.org/licenses/LICENSE-2.0
7578 *
7579 * Unless required by applicable law or agreed to in writing, software
7580 * distributed under the License is distributed on an "AS IS" BASIS,
7581 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7582 * See the License for the specific language governing permissions and
7583 * limitations under the License.
7584 * =============================================================================
7585 */const YT=2147483647;function ise(t,e,n,r,s,i,o){if(e.length>1)throw new Error("starts must be a scalar or vector");if(s.length>1)throw new Error("limits must be a scalar or vector");if(o.length>1)throw new Error("deltas must be a scalar or vector");const a=e.length===0,u=s.length===0,l=o.length===0,c=[];a||c.push(e[0]),u||c.push(s[0]),l||c.push(o[0]);for(let v=1;v<c.length;++v)if(c[v]!==c[v-1])throw new Error("starts, limits, and deltas must have the same shape");const h=c.length===0?1:c[0],d=zt("int32",h+1);d[0]=0;for(let v=0;v<h;++v){const g=a?t[0]:t[v],x=u?r[0]:r[v],w=l?i[0]:i[v];if(w===0)throw new Error("Requires delta != 0");let _;if(w>0&&x<g||w<0&&x>g)_=0;else if(_=Math.ceil(Math.abs((x-g)/w)),_>YT)throw new Error(`Requires ((limit - start) / delta) <= ${YT}`);d[v+1]=d[v]+_}const f=d[h],p=zt(n,f);let y=0;for(let v=0;v<h;++v){const g=d[v+1]-d[v];let x=a?t[0]:t[v];const w=l?i[0]:i[v];for(let _=0;_<g;++_)p[y++]=x,x+=w}return[d,p]}/**
7586 * @license
7587 * Copyright 2022 Google LLC. All Rights Reserved.
7588 * Licensed under the Apache License, Version 2.0 (the "License");
7589 * you may not use this file except in compliance with the License.
7590 * You may obtain a copy of the License at
7591 *
7592 * http://www.apache.org/licenses/LICENSE-2.0
7593 *
7594 * Unless required by applicable law or agreed to in writing, software
7595 * distributed under the License is distributed on an "AS IS" BASIS,
7596 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7597 * See the License for the specific language governing permissions and
7598 * limitations under the License.
7599 * =============================================================================
7600 */var Sr=ns;class ip{constructor(e,n,r,s,i,o,a,u,l,c){this.shape=e,this.shapeShape=n,this.values=r,this.valuesShape=s,this.valuesDType=i,this.defaultValue=o,this.defaultValueShape=a,this.rowPartitionValues=u,this.rowPartitionValuesShapes=l,this.rowPartitionTypes=yD(c),this.raggedRank=vD(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===Sr.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===Sr.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const n=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case Sr.VALUE_ROWIDS:return ip.getMaxWidthValueRowID(n);case Sr.ROW_SPLITS:return ip.getMaxWidthRowSplit(n);default:throw new Error(`Cannot handle partition type ${Sr[this.getRowPartitionTypeByDimension(e-1)]}`)}}static getMaxWidthRowSplit(e){const n=e.length;if(n===0||n===1)return 0;let r=0;for(let s=0;s<n-1;++s){const i=e[s+1]-e[s];i>r&&(r=i)}return r}static getMaxWidthValueRowID(e){const n=e.length;if(n===0)return 0;let r=0,s=e[0],i=0;for(let o=1;o<n;++o){const a=e[o];a!==s&&(s=a,i=Math.max(o-r,i),r=o)}return Math.max(n-r,i)}tensorShapeFromTensor(e,n,r=!0){if(n.length===0){if(e[0]===-1)return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return ZT(e,r)}calculateOutputSize(e){const n=this.valuesShape,r=this.defaultValueShape;xD(r,n);const s=this.tensorShapeFromTensor(this.shape,this.shapeShape),o=gD(this.raggedRank,s,n);o[0]<0&&(o[0]=e);for(let a=1;a<=this.raggedRank;++a)o[a]<0&&(o[a]=this.getMaxWidth(a));return o}calculateFirstParentOutputIndex(e,n,r){const s=Math.min(e,r),i=[];let o=0;for(let a=0;a<s;++a,o+=n)i.push(o);for(let a=s;a<e;++a)i.push(-1);return A(i.length===e,()=>"Final length of result must be equal to firstDimension."),i}calculateOutputIndexRowSplit(e,n,r,s){const i=e.length,o=[];for(let a=0;a<i-1;++a){const u=e[a+1]-e[a];let l=Math.min(s,u),c=n[a];c===-1&&(l=0);for(let h=0;h<l;++h)o.push(c),c+=r;for(let h=0;h<u-l;++h)o.push(-1)}if(i>0&&o.length!==e[i-1])throw new Error("Invalid row split size.");return o}calculateOutputIndexValueRowID(e,n,r,s){const i=e.length,o=[];if(i===0)return[];let a=0,u=e[0];if(u>=n.length)throw new Error(`Got currentValueRowId=${u}, which is not less than ${n.length}`);let l=n[u];o.push(l);for(let c=1;c<i;++c){const h=e[c];if(h===u)l>=0&&(++a,a<s?l+=r:l=-1);else{if(a=0,u=h,h>=n.length)throw new Error(`Got nextValueRowId=${h} which is not less than ${n.length}`);l=n[h]}o.push(l)}if(o.length!==e.length)throw new Error("Invalid row ids.");return o}calculateOutputIndex(e,n,r,s){const i=this.getRowPartitionTensor(e),o=this.getRowPartitionTypeByDimension(e);switch(o){case Sr.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(i,n,r,s);case Sr.ROW_SPLITS:if(i.length-1>n.length)throw new Error(`Row partition size is greater than output size: ${i.length-1} > ${n.length}`);return this.calculateOutputIndexRowSplit(i,n,r,s);default:throw new Error(`Unsupported partition type: ${Sr[o]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");const n=this.rowPartitionTypes[0];switch(n){case Sr.FIRST_DIM_SIZE:return e[0];case Sr.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case Sr.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${Sr[n]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const n=this.getFirstDimensionSize(),r=this.calculateOutputSize(n),s=new Array(this.raggedRank+1);s[s.length-1]=1;for(let u=s.length-2;u>=0;--u)s[u]=s[u+1]*r[u+1];const i=ZT(r,!1),o=zt(this.valuesDType,ne(i));if(s[0]*r[0]>0){let u=this.calculateFirstParentOutputIndex(n,s[0],r[0]);for(let l=1;l<=this.raggedRank;++l)u=this.calculateOutputIndex(l-1,u,s[l],r[l]);this.setOutput(this.raggedRank,u,o,i)}return[i,o]}setOutput(e,n,r,s){if(r.length===0)return;const i=this.values,o=r;let a=s.slice();a=a.slice(e+1);const u=ne(a),l=n.length;let c=this.defaultValue;if(c.length!==u&&c.length!==1){const p=this.defaultValueShape;$e(()=>{const y=K(c,p);c=mc(y,a).dataSync()})}let h=0,d=0,f=0;for(let p=0;p<=l;++p){let y=p<l?n[p]:-1;if(y===f){++f;continue}if(d<f){const v=i.subarray(h*u),g=o.subarray(d*u),x=(f-d)*u;QT(g,v,x)}if(p>=l){const v=r.length;y=Math.floor(v/u)}if(y>f)if(this.defaultValue.length===1)o.subarray(f*u,y*u).fill(this.defaultValue[0]),f=y;else for(;y>f;){const v=o.slice(f*u);QT(v,c,u),++f}y<0?(h=p+1,d=f):(h=p,d=f,f=d+1)}}}function QT(t,e,n){for(let r=0;r<n;r++)t[r]=e[r]}function ZT(t,e){const n=[];for(let r of t){if(r<0){if(!e)throw new Error(`Dimension ${r} must be >= 0`);if(r<-1)throw new Error(`Dimension ${r} must be >= -1`);r=-1}n.push(r)}return n}function ose(t,e,n,r,s,i,o,a,u,l){return new ip(t,e,n,r,s,i,o,a,u,l).compute()}/**
7601 * @license
7602 * Copyright 2020 Google LLC. All Rights Reserved.
7603 * Licensed under the Apache License, Version 2.0 (the "License");
7604 * you may not use this file except in compliance with the License.
7605 * You may obtain a copy of the License at
7606 *
7607 * http://www.apache.org/licenses/LICENSE-2.0
7608 *
7609 * Unless required by applicable law or agreed to in writing, softw
7609are
7610 * distributed under the License is distributed on an "AS IS" BASIS,
7611 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7612 * See the License for the specific language governing permissions and
7613 * limitations under the License.
7614 * =============================================================================
7615 */function ase(t,e,n,r){const s=t===e,i=t<e&&n<0,o=e<t&&n>1;if(s||i||o)return fo(0,r);const a=Math.abs(Math.ceil((e-t)/n)),u=fo(a,r);e<t&&n===1&&(n=-1),u[0]=t;for(let l=1;l<u.length;l++)u[l]=u[l-1]+n;return u}/**
7616 * @license
7617 * Copyright 2020 Google LLC. All Rights Reserved.
7618 * Licensed under the Apache License, Version 2.0 (the License);
7619 * you may not use this file except in compliance with the License.
7620 * You may obtain a copy of the License at
7621 *
7622 * http://www.apache.org/licenses/LICENSE-2.0
7623 *
7624 * Unless required by applicable law or agreed to in writing, software
7625 * distributed under the License is distributed on an AS IS BASIS,
7626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7627 * See the License for the specific language governing permissions and
7628 * limitations under the License.
7629 * =============================================================================
7630 */const use=Ei(t=>1/Math.sqrt(t));/**
7631 * @license
7632 * Copyright 2020 Google LLC. All Rights Reserved.
7633 * Licensed under the Apache License, Version 2.0 (the "License");
7634 * you may not use this file except in compliance with the License.
7635 * You may obtain a copy of the License at
7636 *
7637 * http://www.apache.org/licenses/LICENSE-2.0
7638 *
7639 * Unless required by applicable law or agreed to in writing, software
7640 * distributed under the License is distributed on an "AS IS" BASIS,
7641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7642 * See the License for the specific language governing permissions and
7643 * limitations under the License.
7644 * =============================================================================
7645 */function lse(t,e,n,r,s,i,o,a,u,l){const c=[r/s,s],h=t.values,d=e.values;if(r===0)return wt(n,e.dtype);const f=u instanceof Zu?u:wt(c,e.dtype);typeof u=="string"||typeof u=="number"?f.values.fill(u):typeof u=="boolean"&&f.values.fill(+u);for(let p=0;p<i;p++){const y=[];let v=0;for(let g=0;g<o;g++){const x=h[p*o+g];y.push(x),v+=x*a[g]}if(v<0||v>=r/s)throw new Error(`Invalid indices: ${y} does not index into ${n}`);for(let g=0;g<s;g++)l?f.values[v*s+g]+=d[p*s+g]:f.values[v*s+g]=e.rank===0?d[0]:d[p*s+g]}return f}/**
7646 * @license
7647 * Copyright 2020 Google LLC. All Rights Reserved.
7648 * Licensed under the Apache License, Version 2.0 (the License);
7649 * you may not use this file except in compliance with the License.
7650 * You may obtain a copy of the License at
7651 *
7652 * http://www.apache.org/licenses/LICENSE-2.0
7653 *
7654 * Unless required by applicable law or agreed to in writing, software
7655 * distributed under the License is distributed on an AS IS BASIS,
7656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7657 * See the License for the specific language governing permissions and
7658 * limitations under the License.
7659 * =============================================================================
7660 */const cse=Ei(t=>1/(1+Math.exp(-t)));/**
7661 * @license
7662 * Copyright 2020 Google LLC. All Rights Reserved.
7663 * Licensed under the Apache License, Version 2.0 (the "License");
7664 * you may not use this file except in compliance with the License.
7665 * You may obtain a copy of the License at
7666 *
7667 * http://www.apache.org/licenses/LICENSE-2.0
7668 *
7669 * Unless required by applicable law or agreed to in writing, software
7670 * distributed under the License is distributed on an "AS IS" BASIS,
7671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7672 * See the License for the specific language governing permissions and
7673 * limitations under the License.
7674 * =============================================================================
7675 */function hse(t,e,n,r,s){const i=tw(r,e,n),o=ne(n),a=Zt(r);if(i){const h=nw(e,a);return s==="string"?t.slice(h,h+o):t.subarray(h,h+o)}const u=s==="string"?el(t):t,l=wt(r,s,u),c=wt(n,s);for(let h=0;h<c.size;++h){const d=c.indexToLoc(h),f=d.map((p,y)=>p+e[y]);c.set(l.get(...f),...d)}
vendor: 5,177 bytes, lines 7675-7738
7675return s==="string"?QD(c.values):c.values}/**
7676 * @license
7677 * Copyright 2021 Google LLC. All Rights Reserved.
7678 * Licensed under the Apache License, Version 2.0 (the "License");
7679 * you may not use this file except in compliance with the License.
7680 * You may obtain a copy of the License at
7681 *
7682 * http://www.apache.org/licenses/LICENSE-2.0
7683 *
7684 * Unless required by applicable law or agreed to in writing, software
7685 * distributed under the License is distributed on an "AS IS" BASIS,
7686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7687 * See the License for the specific language governing permissions and
7688 * limitations under the License.
7689 * =============================================================================
7690 */function dse(t,e,n,r,s,i,o){const a=e[0],u=i[0],l=new Array(u),c=new Array(a),h=e[1];if(u===0){if(a!==0)throw new Error(LD(a));const v=zt(n,0),g=zt(s,0);return[v,[0,h],g,l,c]}let d=!0,f=0;const p=new Array(u).fill(0);for(let v=0;v<a;++v){const g=t[v*h];if(g<0)throw new Error(MD(v,g));if(g>=u)throw new Error(VD(v,g,u));++p[g],d=d&&g>=f,f=g}let y=!0;for(let v=0;v<u;++v){const g=p[v]===0;l[v]=g,y=y&&!g,p[v]=Math.max(p[v],1),v>0&&(p[v]+=p[v-1])}if(y&&d){const v=t,g=r;for(let x=0;x<a;++x)c[x]=x;return[v,[a,h],g,l,c]}else{const v=p[u-1],g=zt(n,v*h),x=zt(s,v),w=new Array(u).fill(0);for(let _=0;_<a;++_){const T=t[_*h],E=w[T],k=(T===0?0:p[T-1])+E;w[T]++;for(let N=0;N<h;++N)g[k*h+N]=t[_*h+N];x[k]=r[_],c[_]=k}for(let _=0;_<u;++_)if(w[_]===0){const E=_===0?0:p[_-1];g[E*h+0]=_;for(let k=1;k<h;++k)g[E*h+k]=0;x[E]=o}return[g,[v,h],x,l,c]}}/**
7691 * @license
7692 * Copyright 2021 Google LLC. All Rights Reserved.
7693 * Licensed under the Apache License, Version 2.0 (the "License");
7694 * you may not use this file except in compliance with the License.
7695 * You may obtain a copy of the License at
7696 *
7697 * http://www.apache.org/licenses/LICENSE-2.0
7698 *
7699 * Unless required by applicable law or agreed to in writing, software
7700 * distributed under the License is distributed on an "AS IS" BASIS,
7701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7702 * See the License for the specific language governing permissions and
7703 * limitations under the License.
7704 * =============================================================================
7705 */function fse(t,e,n,r,s){const i=ne(r),o=e[0],a=s.length,u=[];let l=1,c=-1;for(let v=0;v<a;++v){const g=s[v];if(g===-1){if(c!==-1)throw new Error(BD(c,v));c=v,u.push(1)}else{if(g<0)throw new Error(WD(v,g));l*=g,u.push(g)}}if(c!==-1){if(l<=0)throw new Error(UD());const v=Math.trunc(i/l);if(l*v!==i)throw new Error(zD(r,u));u[c]=v}if(ne(u)!==i)throw new Error(jD(r,u));const d=r.length,f=[];if(d>0){f[d-1]=1;for(let v=d-2;v>=0;--v)f[v]=f[v+1]*r[v+1]}const p=[];if(a>0){p[a-1]=1;for(let v=a-2;v>=0;--v)p[v]=p[v+1]*u[v+1]}const y=zt(n,o*a);for(let v=0;v<o;++v){let g=0;for(let x=0;x<d;++x)g+=t[v*d+x]*f[x];for(let x=0;x<a;++x)y[v*a+x]=Math.trunc(g/p[x]),g%=p[x]}return[y,[o,a],u]}/**
7706 * @license
7707 * Copyright 2021 Google LLC. All Rights Reserved.
7708 * Licensed under the Apache License, Version 2.0 (the "License");
7709 * you may not use this file except in compliance with the License.
7710 * You may obtain a copy of the License at
7711 *
7712 * http://www.apache.org/licenses/LICENSE-2.0
7713 *
7714 * Unless required by applicable law or agreed to in writing, software
7715 * distributed under the License is distributed on an "AS IS" BASIS,
7716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7717 * See the License for the specific language governing permissions and
7718 * limitations under the License.
7719 * =============================================================================
7720 */function pse(t,e,n,r,s,i=!1,o=0){const a=r.length,u=[e[0],t.length/e[0]],l=u[1],h=a>0?s[a-1]+1:0;if(h<0)throw new Error(H0());const d=e.slice();d[0]=h;const f=d.reduce((w,_)=>w*_,1),p=zt(n,f);if(a===0)return h>0&&p.fill(o),[p,d];if(h<=0)throw new Error(H0());let y=0,v=1,g=0,x=s[y];for(;;){let w=0;if(v<a){if(w=s[v],x===w){++v;continue}if(x>=w)throw new Error(GD())}if(x<0||x>=h)throw new Error(HD(x,h));x>g&&p.fill(o,g*l,x*l);for(let _=y;_<v;++_){const T=r[_];if(T<0||T>=u[0])throw new Error(qD(_,r[_],u[0]));for(let E=0;E<l;E++)p[x*l+E]+=t[T*l+E]}if(i)for(let _=0;_<l;_++)p[x*l+_]/=v-y;if(y=v,++v,g=x+1,x=w,v>a)break}return g<h&&p.fill(o,g*l,h*l),[p,d]}/**
7721 * @license
7722 * Copyright 2020 Google LLC. All Rights Reserved.
7723 * Licensed under the Apache License, Version 2.0 (the License);
7724 * you may not use this file except in compliance with the License.
7725 * You may obtain a copy of the License at
7726 *
7727 * http://www.apache.org/licenses/LICENSE-2.0
7728 *
7729 * Unless required by applicable law or agreed to in writing, software
7730 * distributed under the License is distributed on an AS IS BASIS,
7731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7732 * See the License for the specific language governing permissions and
7733 * limitations under the License.
7734 * =============================================================================
7735 */const mse=Ei(t=>Math.sqrt(t));/**
7736 * @license
7737 * Copyright 2020 Google LLC. All Rights Reserved.
7738 * Licensed under the Apache License, Version 2.0 (the "License");
7739 * you may not use this file except in compliance with the License.
7740 * You may obtain a copy of the License at
7741 *
7742 * http://www.apache.org/licenses/LICENSE-2.0
7743 *
7744 * Unless required by applicable law or agreed to in writing, software
7745 * distributed under the License is distributed on an "AS IS" BASIS,
7746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7747 * See the License for the specific language governing permissions and
7748 * limitations under the License.
7749 * =============================================================================
7750 */const gse=Ln((t,e)=>{const n=t-e;return n*n});/**
7751 * @license
7752 * Copyright 2023 Google LLC.
7753 * Licensed under the Apache License, Version 2.0 (the "License");
7754 * you may not use this file except in compliance with the License.
7755 * You may obtain a copy of the License at
7756 *
7757 * http://www.apache.org/licenses/LICENSE-2.0
7758 *
7759 * Unless required by applicable law or agreed to in writing, software
7760 * distributed under the License is distributed on an "AS IS" BASIS,
7761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7762 * See the License for the specific language governing permissions and
7763 * limitations under the License.
7764 * =============================================================================
7765 */const yse=Ei((t,e)=>{const{pattern:n,replaceGlobal:r,rewrite:s}=e;return t.replace(new RegExp(n,r?"g":""),s)});/**
7766 * @license
7767 * Copyright 2020 Google LLC. All Rights Reserved.
7768 * Licensed under the Apache License, Version 2.0 (the "License");
7769 * you may not use this file except in compliance with the License.
7770 * You may obtain a copy of the License at
7771 *
7772 * http://www.apache.org/licenses/LICENSE-2.0
7773 *
7774 * Unless required by applicable law or agreed to in writing, software
7775 * distributed under the License is distributed on an "AS IS" BASIS,
7776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7777 * See the License for the specific language governing permissions and
7778 * limitations under the License.
7779 * =============================================================================
7780 */function vse(t,e,n,r){const s=wt(t,e.dtype);for(let i=0;i<s.size;i++){const o=s.indexToLoc(i),a=new Array(o.length);for(let u=0;u<a.length;u++)a[u]=o[u]*n[u]+r[u];s.set(e.get(...a),...o)}return s}/**
7781 * @license
7782 * Copyright 2021 Google LLC. All Rights Reserved.
7783 * Licensed under the Apache License, Version 2.0 (the "License");
7784 * you may not use this file except in compliance with the License.
7785 * You may obtain a copy of the License at
7786 *
7787 * http://www.apache.org/licenses/LICENSE-2.0
7788 *
7789 * Unless required by applicable law or agreed to in writing, software
7790 * distributed under the License is distributed on an "AS IS" BASIS,
7791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7792 * See the License for the specific language governing permissions and
7793 * limitations under the License.
7794 * =============================================================================
7795 */class xse{constructor(e,n,r,s,i,o){this.separator=na(e),this.nGramWidths=n,this.leftPad=na(r),this.rightPad=na(s),this.padWidth=i,this.preserveShort=o}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,n){const r=this.getPadWidth(n);return Math.max(0,e+2*r-n+1)}createNGrams(e,n,r,s,i,o){for(let a=0;a<i;++a){const u=this.getPadWidth(o),l=Math.max(0,u-a),c=Math.max(0,u-(i-(a+1))),h=o-(l+c),d=n+(l>0?0:a-u);let f=0;f+=l*this.leftPad.length;for(let x=0;x<h;++x)f+=e[d+x].length;f+=c*this.rightPad.length;const p=l+c+h-1;f+=p*this.separator.length,r[s+a]=new Uint8Array(f);const y=r[s+a];let v=0;const g=x=>x.forEach(w=>y[v++]=w);for(let x=0;x<l;++x)g(this.leftPad),g(this.separator);for(let x=0;x<h-1;++x)g(e[d+x]),g(this.separator);if(h>0){g(e[d+h-1]);for(let x=0;x<c;++x)g(this.separator),g(this.rightPad)}else{for(let x=0;x<c-1;++x)g(this.rightPad),g(this.separator);g(this.rightPad)}}}compute(e,n){const r=e.length,s=n.length;if(s>0){let u=n[0];if(u!==0)throw new Error(`First split value must be 0, got ${u}`);for(let l=1;l<s;++l){let c=n[l]>=u;if(c=c&&n[l]<=r,!c)throw new Error(`Invalid split value ${n[l]}, must be in [${u}, ${r}]`);u=n[l]}if(u!==r)throw new Error(`Last split value must be data size. Expected ${r}, got ${u}`)}const i=s-1,o=zt("int32",s);if(r===0||s===0){const u=new Array(r);for(let l=0;l<=i;++l)o[l]=0;return[u,o]}o[0]=0;for(let u=1;u<=i;++u){const l=n[u]-n[u-1];let c=0;this.nGramWidths.forEach(h=>{c+=this.getNumNGrams(l,h)}),this.preserveShort&&l>0&&c===0&&(c=1),o[u]=o[u-1]+c}const a=new Array(o[i]);for(let u=0;u<i;++u){const l=n[u];let c=o[u];if(this.nGramWidths.forEach(h=>{const d=n[u+1]-n[u],f=this.getNumNGrams(d,h);this.createNGrams(e,l,a,c,f,h),c+=f}),this.preserveShort&&c===o[u]){const h=n[u+1]-n[u];if(h===0)continue;const d=h+2*this.padWidth;this.createNGrams(e,l,a,c,1,d)}}return[a,o]}}function wse(t,e,n,r,s,i,o,a){return new xse(n,r,s,i,o,a).compute(t,e)}/**
7796 * @license
7797 * Copyright 2021 Google LLC. All Rights Reserved.
7798 * Licensed under the Apache License, Version 2.0 (the "License");
7799 * you may not use this file except in compliance with the License.
7800 * You may obtain a copy of the License at
7801 *
7802 * http://www.apache.org/licenses/LICENSE-2.0
7803 *
7804 * Unless required by applicable law or agreed to in writing, software
7805 * distributed under the License is distributed on an "AS IS" BASIS,
7806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7807 * See the License for the specific language governing permissions and
7808 * limitations under the License.
7809 * =============================================================================
7810 */function bse(t,e,n,r){if(!t.length)return;if(e.length===0){for(let i=0;i<t.length;++i)r.push(t.subarray(i,i+1));return}if(e.length===1){const i=e[0];let o=t.indexOf(i);for(;o!==-1;){const a=t.subarray(0,o);(!n||a.length!==0)&&r.push(a),t=t.subarray(o+1),o=t.indexOf(i)}(!n||t.length!==0)&&r.push(t);return}let s=0;for(let i=0;i<t.length+1;i++)if(i===t.length||e.indexOf(t[i])!==-1){const o=t.subarray(s,i);(!n||o.length!==0)&&r.push(o),s=i+1}}function _se(t,e,n){const r=t.length,s=[];let i=0,o=0;const a=new Array(r);for(let d=0;d<r;++d){const f=s.length;bse(t[d],e,n,s);const p=s.length-f;a[d]=p,i+=p,o=Math.max(o,p)}const u=zt("int32",i*2),l=new Array(i),c=[r,o];let h=0;for(let d=0;d<r;++d)for(let f=0;f<a[d];++f)u[h*2]=d,u[h*2+1]=f,l[h]=s[h],++h;return[u,l,c]}/**
7811 * @license
7812 * Copyright 2021 Google LLC. All Rights Reserved.
7813 * Licensed under the Apache License, Version 2.0 (the "License");
7814 * you may not use this file except in compliance with the License.
7815 * You may obtain a copy of the License at
7816 *
7817 * http://www.apache.org/licenses/LICENSE-2.0
7818 *
7819 * Unless required by applicable law or agreed to in writing, software
7820 * distributed under the License is distributed on an "AS IS" BASIS,
7821 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7822 * See the License for the specific language governing permissions and
7823 * limitations under the License.
7824 * =============================================================================
7825 */function Sse(t,e){const n=zt("int32",t.length);for(let r=0;r<t.length;++r)n[r]=F5(t[r]).modulo(e).getLowBitsUnsigned();return n}/**
7826 * @license
7827 * Copyright 2020 Google LLC. All Rights Reserved.
7828 * Licensed under the Apache License, Version 2.0 (the "License");
7829 * you may not use this file except in compliance with the License.
7830 * You may obtain a copy of the License at
7831 *
7832 * http://www.apache.org/licenses/LICENSE-2.0
7833 *
7834 * Unless required by applicable law or agreed to in writing, software
7835 * distributed under the License is distributed on an "AS IS" BASIS,
7836 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7837 * See the License for the specific language governing permissions and
7838 * limitations under the License.
7839 * =============================================================================
7840 */const Tse=Ln((t,e)=>t-e);/**
7841 * @license
7842 * Copyright 2019 Google LLC. All Rights Reserved.
7843 * Licensed under the Apache License, Version 2.0 (the "License");
7844 * you may not use this file except in compliance with the License.
7845 * You may obtain a copy of the License at
7846 *
7847 * http://www.apache.org/licenses/LICENSE-2.0
7848 *
7849 * Unless required by applicable law or agreed to in writing, software
7850 * distributed under the License is distributed on an "AS IS" BASIS,
7851 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7852 * See the License for the specific language governing permissions and
7853 * limitations under the License.
7854 * =============================================================================
7855 */function Cse(t,e){const n=new Array(t.rank);for(let s=0;s<n.length;s++)n[s]=t.shape[s]*e[s];const r=wt(n,t.dtype);for(let s=0;s<r.values.length;++s){const i=r.indexToLoc(s),o=new Array(t.rank);for(let u=0;u<o.length;u++)o[u]=i[u]%t.shape[u];const a=t.locToIndex(o);r.values[s]=t.values[a]}return r}/**
7856 * @license
7857 * Copyright 2020 Google LLC. All Rights Reserved.
7858 * Licensed under the Apache License, Version 2.0 (the "License");
7859 * you may not use this file except in compliance with the License.
7860 * You may obtain a copy of the License at
7861 *
7862 * http://www.apache.org/licenses/LICENSE-2.0
7863 *
7864 * Unless required by applicable law or agreed to in writing, softw
vendor: 4,510 bytes, lines 7864-7903
7864are
7865 * distributed under the License is distributed on an "AS IS" BASIS,
7866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7867 * See the License for the specific language governing permissions and
7868 * limitations under the License.
7869 * =============================================================================
7870 */const ec=(t,e)=>{const n=e.value-t.value;return n===0?t.index-e.index:n};function mP(t,e,n=0,r=t.length-1){for(;r>n;){if(r-n>600){const a=r-n+1,u=e-n+1,l=Math.log(a),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(a-c)/a)*Math.sign(u-a/2),d=Math.max(n,Math.floor(e-u*c/a+h)),f=Math.min(r,Math.floor(e+(a-u)*c/a+h));mP(t,e,d,f)}const s=t[e];let i=n,o=r;for(Ul(t,n,e),ec(t[r],s)>0&&Ul(t,n,r);i<o;){for(Ul(t,i,o),i++,o--;ec(t[i],s)<0;)i=i+1;for(;ec(t[o],s)>0;)o=o-1}ec(t[n],s)===0?Ul(t,n,o):(o=o+1,Ul(t,o,r)),o<=e&&(n=o+1),e<=o&&(r=o-1)}}function Nse(t,e,n,r,s){const i=e[e.length-1],[o,a]=[t.length/i,i],u=ho(n,o*r),l=ho("int32",o*r);for(let h=0;h<o;h++){const d=h*a,f=t.subarray(d,d+a);let p=new Array(f.length);f.forEach((x,w)=>p[w]={value:x,index:w}),r<p.length&&(mP(p,r),p=p.slice(0,r)),s&&p.sort(ec);const y=h*r,v=u.subarray(y,y+r),g=l.subarray(y,y+r);for(let x=0;x<r;x++)v[x]=p[x].value,g[x]=p[x].index}const c=e.slice();return c[c.length-1]=r,[wt(c,n,u),wt(c,"int32",l)]}/**
7871 * @license
7872 * Copyright 2020 Google LLC. All Rights Reserved.
7873 * Licensed under the Apache License, Version 2.0 (the "License");
7874 * you may not use this file except in compliance with the License.
7875 * You may obtain a copy of the License at
7876 *
7877 * http://www.apache.org/licenses/LICENSE-2.0
7878 *
7879 * Unless required by applicable law or agreed to in writing, software
7880 * distributed under the License is distributed on an "AS IS" BASIS,
7881 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7882 * See the License for the specific language governing permissions and
7883 * limitations under the License.
7884 * =============================================================================
7885 */function Ese(t,e,n,r){const s=Gt(e,n)[0],i=[1,n[0],1];for(let p=0;p<s;p++)i[0]*=n[p];i[1]=n[s];for(let p=s+1;p<n.length;p++)i[2]*=n[p];const o=new Map,a=new Int32Array(n[s]),u=new Zu(i,r,t),l=[],c=i[0]===1&&i[2]===1;for(let p=0;p<n[s];p++){let y;if(c)y=t[p].toString();else{const g=[];for(let x=0;x<i[0];x++)for(let w=0;w<i[2];w++)g.push(u.get(x,p,w));y=g.join(",")}const v=o.get(y);if(v!=null)a[p]=v;else{const g=o.size;o.set(y,g),a[p]=g,l.push(p)}}const h=i.slice();h[1]=o.size;const d=new Zu(h,r);l.forEach((p,y)=>{for(let v=0;v<i[0];v++)for(let g=0;g<i[2];g++)d.set(u.get(v,p,g),v,y,g)});const f=n.slice();return f[s]=h[1],{outputValues:d.values,outputShape:f,indices:a}}/**
7886 * @license
7887 * Copyright 2020 Google LLC. All Rights Reserved.
7888 * Licensed under the Apache License, Version 2.0 (the "License");
7889 * you may not use this file except in compliance with the License.
7890 * You may obtain a copy of the License at
7891 *
7892 * http://www.apache.org/licenses/LICENSE-2.0
7893 *
7894 * Unless required by applicable law or agreed to in writing, software
7895 * distributed under the License is distributed on an "AS IS" BASIS,
7896 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7897 * See the License for the specific language governing permissions and
7898 * limitations under the License.
7899 * =============================================================================
7900 */const kse=Object.freeze(Object.defineProperty({__proto__:null,addImpl:Nre,bincountImpl:Ere,bincountReduceImpl:kre,bitwiseAndImpl:$re,castImpl:Cre,ceilImpl:Ire,concatImpl:Are,equalImpl:Rre,expImpl:Ore,expm1Impl:Dre,floorDivImpl:Fre,floorImpl:Pre,gatherNdImpl:Lre,gatherV2Impl:Mre,greaterEqualImpl:Bre,greaterImpl:Vre,lessEqualImpl:Ure,lessImpl:Wre,linSpaceImpl:zre,logImpl:jre,maxImpl:Gre,maximumImpl:Hre,minimumImpl:qre,multiplyImpl:pP,negImpl:Kre,notEqualImpl:Xre,prodImpl:Qre,raggedGatherImpl:sse,raggedRangeImpl:ise,raggedTensorToTensorImpl:ose,rangeImpl:ase,rsqrtImpl:use,scatterImpl:lse,sigmoidImpl:cse,simpleAbsImpl:Tre,sliceImpl:hse,sparseFillEmptyRowsImpl:dse,sparseReshapeImpl:fse,sparseSegmentReductionImpl:pse,sqrtImpl:mse,squaredDifferenceImpl:gse,staticRegexReplaceImpl:yse,stridedSliceImpl:vse,stringNGramsImpl:wse,stringSplitImpl:_se,stringToHashBucketFastImpl:Sse,subImpl:Tse,tileImpl:Cse,topKImpl:Nse,transposeImpl:Yre,uniqueImpl:Ese},Symbol.toStringTag,{value:"Module"}));/**
7901 * @license
7902 * Copyright 2020 Google LLC. All Rights Reserved.
7903 * Licensed under the Apache License, Version 2.0 (the "License");
7904 * you may not use this file except in compliance with the License.
7905 * You may obtain a copy of the License at
7906 *
7907 * http://www.apache.org/licenses/LICENSE-2.0
7908 *
7909 * Unless required by applicable law or agreed to in writing, software
7910 * distributed under the License is distributed on an "AS IS" BASIS,
7911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7912 * See the License for the specific language governing permissions and
7913 * limitations under the License.
7914 * =============================================================================
7915 */const{addImpl:$se,bincountImpl:gP,bincountReduceImpl:Ise,bitwiseAndImpl:Ase,castImpl:Rse,ceilImpl:Ose,concatImpl:Dse,equalImpl:Pse,expImpl:Fse,expm1Impl:Lse,floorImpl:Mse,gatherNdImpl:Vse,gatherV2Impl:Bse,greaterImpl:Wse,greaterEqualImpl:Use,lessImpl:zse,lessEqualImpl:jse,linSpaceImpl:Gse,logImpl:Hse,maxImpl:qse,maximumImpl:Kse,minimumImpl:Xse,multiplyImpl:Yse,negImpl:Qse,notEqualImpl:Zse,prodImpl:Jse,raggedGatherImpl:eie,raggedRangeImpl:tie,raggedTensorToTensorImpl:nie,rangeImpl:rie,rsqrtImpl:sie,scatterImpl:iie,sigmoidImpl:oie,simpleAbsImpl:yP,sliceImpl:aie,sparseFillEmptyRowsImpl:uie,sparseReshapeImpl:lie,sparseSegmentReductionImpl:vP,sqrtImpl:cie,staticRegexReplaceImpl:hie,stridedSliceImpl:die,stringNGramsImpl:fie,stringSplitImpl:pie,stringToHashBucketFastImpl:mie,subImpl:gie,tileImpl:yie,topKImpl:vie,transposeImpl:dw,uniqueImpl:xie}=kse;/**
7916 * @license
7917 * Copyright 2018 Google LLC. All Rights Reserved.
7918 * Licensed under the Apache License, Version 2.0 (the "License");
7919 * you may not use this file except in compliance with the License.
7920 * You may obtain a copy of the License at
7921 *
7922 * http://www.apache.org/licenses/LICENSE-2.0
7923 *
7924 * Unless required by applicable law or agreed to in writing, software
7925 * distributed under the License is distributed on an "AS IS" BASIS,
7926 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7927 * See the License for the specific language governing permissions and
7928 * limitations under the License.
7929 * =============================================================================
7930 */function xP(t,e){return["x","y","z","w","u","v"].slice(0,e).map(n=>`${t}.${n}`)}function bn(t,e){return e===1?[t]:xP(t,e)}function wie(t,e){if(t===1)return"rc";let n="";for(let r=0;r<t;r++)n+=e[r],r<t-1&&(n+=",");return n}/**
7931 * @license
7932 * Copyright 2018 Google LLC. All Rights Reserved.
7933 * Licensed under the Apache License, Version 2.0 (the "License");
7934 * you may not use this file except in compliance with the License.
7935 * You may obtain a copy of the License at
7936 *
7937 * http://www.apache.org/licenses/LICENSE-2.0
7938 *
7939 * Unless required by applicable law or agreed to in writing, software
7940 * distributed under the License is distributed on an "AS IS" BASIS,
7941 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7942 * See the License for the specific language governing permissions and
7943 * limitations under the License.
7944 * =============================================================================
7945 */class bie{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=fn(this.outputShape.length),this.rank===0)this.userCode=`
7946        void main() {
7947          setOutput(vec4(getA(), 0., 0., 0.));
7948        }
7949      `;else{const n=bn("rc",this.rank),r=qe(this.rank),s=this.getOutOfBoundsCondition(n),i=this.getSetup(n),o=this.getOutput(n);this.userCode=`
7950        void main() {
7951          ${r} rc = getOutputCoords();
7952
7953          if(${s}) {
7954            setOutput(vec4(0));
7955          } else {
7956            ${i}
7957
7958            setOutput(vec4(${o}));
7959          }
7960        }
7961      `}}getSourceCoordsArr(e){const n=[];for(let r=0;r<=1;r++)for(let s=0;s<=1;s++){let i=`${r===0?"r":"rp1"}, ${s===0?"c":"cp1"}`;for(let o=2;o<this.rank;o++)i=`${e[e.length-1-o]},`+i;n.push(i)}return n}getOutOfBoundsCondition(e){if(this.rank===1)return`rc > ${this.enableShapeUniforms?"outShape":this.outputShape[0]}`;let n="";for(let r=this.rank-2;r<this.rank;r++)n+=`${e[r]} >= ${this.enableShapeUniforms?`outShape[${r}]`:this.outputShape[r]}`,r<this.rank-1&&(n+="||");return n}getSetup(e){if(this.rank===1)return"";const n=e.slice(-2),r=this.enableShapeUniforms?`outShape[${this.rank} - 1]`:this.outputShape[this.rank-1],s=this.enableShapeUniforms?`outShape[${this.rank} - 2]`:this.outputShape[this.rank-2];return`
7962      int r = ${n[0]};
7963      int c = ${n[1]};
7964      int rp1 = r + 1;
7965      int cp1 = c + 1;
7966
7967      bool cEdge = cp1 >= ${r};
7968      bool rEdge = rp1 >= ${s};
7969    `}getOutput(e){const n=this.getSourceCoordsArr(e);return this.rank===1?`getA(rc), (rc + 1 >= ${this.enableShapeUniforms?"outShape":this.outputShape[0]} ? 0. : getA(rc + 1)), 0, 0`:`getA(${n[0]}),
7970            cEdge ? 0. : getA(${n[1]}),
7971            rEdge ? 0. : getA(${n[2]}),
7972            rEdge || cEdge ? 0. : getA(${n[3]})`}}/**
7973 * @license
7974 * Copyright 2018 Google LLC. All Rights Reserved.
7975 * Licensed under the Apache License, Version 2.0 (the "License");
7976 * you may not use this file except in compliance with the License.
7977 * You may obtain a copy of the License at
7978 *
7979 * http://www.apache.org/licenses/LICENSE-2.0
7980 *
7981 * Unless required by applicable law or agreed to in writing, software
7982 * distributed under the License is distributed on an "AS IS" BASIS,
7983 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7984 * See the License for the specific language governing permissions and
7985 * limitations under the License.
7986 * =============================================================================
7987 */class wP{constructor(e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length);let r="";for(let s=0;s<4;s++){let i="thisRC = rc;";s%2===1&&(i+="thisRC.z += 1;"),s>1&&(i+="thisRC.y += 1;"),r+=`
7988        ${i}
7989        ${s>0?"if(thisRC.y < rows && thisRC.z < cols){":""}
7990          int flatIndex = getFlatIndex(thisRC);
7991
7992          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
7993          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));
7994
7995          result[${s}] =
7996            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
7997        ${s>0?"}":""}
7998      `}this.userCode=`
7999      ${_ie(n,this.enableShapeUniforms)}
8000      ${this.enableShapeUniforms?cw():lw(e)}
8001
8002      void main() {
8003        ivec3 rc = getOutputCoords();
8004
8005        vec4 result = vec4(0.);
8006
8007        ivec3 thisRC;
8008        int rows = ${this.enableShapeUniforms?"outShape[1]":e[1]};
8009        int cols = ${this.enableShapeUniforms?"outShape[2]":e[2]};
8010
8011        ${r}
8012
8013        setOutput(result);
8014      }
8015    `}}function _ie(t,e){return`
8016    ivec3 inputCoordsFromReshapedOutCoords(int index) {
8017      ${e?mne(["r","c","d"],"inputShape"):Ma(["r","c","d"],t)}
8018      return ivec3(r, c, d);
8019    }
8020  `}/**
8021 * @license
8022 * Copyright 2017 Google LLC. All Rights Reserved.
8023 * Licensed under the Apache License, Version 2.0 (the "License");
8024 * you may not use this file except in compliance with the License.
8025 * You may obtain a copy of the License at
8026 *
8027 * http://www.apache.org/licenses/LICENSE-2.0
8028 *
8029 * Unless required by applicable law or agreed to in writing, software
8030 * distributed under the License is distributed on an "AS IS" BASIS,
8031 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8032 * See the License for the specific language governing permissions and
8033 * limitations under the License.
8034 * =============================================================================
8035 */class Sie{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}acquireTexture(e,n,r){const s=eC(n,r),i=tC(e,s,r);i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]);const o=JT(e,s,this.gpgpu.gl,this.gpgpu.textureConfig,r);if(this.freeTextures[i].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=o,this.log();const u=this.freeTextures[i].pop();return this.usedTextures[i].push(u),u}let a;return s===Xt.PACKED_2X2_FLOAT32?a=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):s===Xt.PACKED_2X2_FLOAT16?a=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):s===Xt.UNPACKED_FLOAT32?a=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):s===Xt.UNPACKED_FLOAT16?a=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):s===Xt.PACKED_4X1_UNSIGNED_BYTE&&(a=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[i].push(a),this.numUsedTextures++,this._numBytesAllocated+=o,this.log(),a}releaseTexture(e,n,r,s){if(this.freeTextures==null)return;const i=eC(r,s),o=tC(n,i,s);o in this.freeTextures||(this.freeTextures[o]=[]);const a=JT(n,i,this.gpgpu.gl,this.gpgpu.textureConfig,s),u=U().getNumber("WEBGL_DELET
8035E_TEXTURE_THRESHOLD");u!==-1&&this._numBytesAllocated>u?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=a):(this.freeTextures[o].push(e),this.numFreeTextures++,this._numBytesFree+=a),this.numUsedTextures--;const l=this.usedTextures[o],c=l&&l.indexOf(e);if(c==null||c<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l[c]=l[l.length-1],l.pop(),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);const n=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*n)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(const e in this.freeTextures)this.freeTextures[e].forEach(n=>{this.gpgpu.deleteMatrixTexture(n.texture)});for(const e in this.usedTextures)this.usedTextures[e].forEach(n=>{this.gpgpu.deleteMatrixTexture(n.texture)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function Tie(t,e){const n=t;if(e===n.R32F)return 4;if(e===n.R16F)return 2;if(e===n.RGBA32F)return 16;if(e===t.RGBA)return 16;if(e===n.RGBA16F)return 8;if(e===n.RGBA8)return 4;throw new Error(`Unknown internal format ${e}`)}function JT(t,e,n,r,s){const i=Cie(e,r);let o;if(s){const[u,l]=vl(t[0],t[1]);o=u*l}else{const[u,l]=Th(t[0],t[1]);o=u*l}const a=Tie(n,i);return o*a}function Cie(t,e){switch(t){case Xt.PACKED_2X2_FLOAT32:return dP(e);case Xt.PACKED_2X2_FLOAT16:return fP(e);case Xt.UNPACKED_FLOAT32:return lP(e);case Xt.UNPACKED_FLOAT16:return cP(e);case Xt.PACKED_4X1_UNSIGNED_BYTE:return hP(e);default:throw new Error(`Unknown physical texture type ${t}`)}}function Nie(t){return U().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?t?Xt.PACKED_2X2_FLOAT32:Xt.UNPACKED_FLOAT32:t?Xt.PACKED_2X2_FLOAT16:Xt.UNPACKED_FLOAT16}function eC(t,e){if(t===ar.UPLOAD)return Xt.PACKED_2X2_FLOAT32;if(t===ar.RENDER||t==null)return Nie(e);if(t===ar.DOWNLOAD||t===ar.PIXELS)return Xt.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${t}`)}function tC(t,e,n){return`${t[0]}_${t[1]}_${e}_${n}`}/**
8036 * @license
8037 * Copyright 2017 Google LLC. All Rights Reserved.
8038 * Licensed under the Apache License, Version 2.0 (the "License");
8039 * you may not use this file except in compliance with the License.
8040 * You may obtain a copy of the License at
8041 *
8042 * http://www.apache.org/licenses/LICENSE-2.0
8043 *
8044 * Unless required by applicable law or agreed to in writing, software
8045 * distributed under the License is distributed on an "AS IS" BASIS,
8046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8047 * See the License for the specific language governing permissions and
8048 * limitations under the License.
8049 * =============================================================================
8050 */class As{constructor(e,n){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length),this.userCode=`
8051      float unaryOperation(float x) {
8052        ${n}
8053      }
8054
8055      void main() {
8056        float x = getAAtOutCoords();
8057        float y = unaryOperation(x);
8058
8059        setOutput(y);
8060      }
8061    `}}const jr="if (isnan(x)) return x;",Eie="return x;",nC="return abs(x);",kie="return (x >= 0.0) ? x : (exp(x) - 1.0);",$ie=jr+`
8062  return (x < 0.0) ? 0.0 : x;
8063`,Iie=jr+`
8064  return (x < 0.0) ? 0.0 : min(6.0, x);
8065`,Mi="return x;",Aie="return 1.0 / (1.0 + exp(-1.0 * x));";/**
8066 * @license
8067 * Copyright 2018 Google LLC. All Rights Reserved.
8068 * Licensed under the Apache License, Version 2.0 (the "License");
8069 * you may not use this file except in compliance with the License.
8070 * You may obtain a copy of the License at
8071 *
8072 * http://www.apache.org/licenses/LICENSE-2.0
8073 *
8074 * Unless required by applicable law or agreed to in writing, softw
vendor: 21,713 bytes, lines 8074-8175
8074are
8075 * distributed under the License is distributed on an "AS IS" BASIS,
8076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8077 * See the License for the specific language governing permissions and
8078 * limitations under the License.
8079 * =============================================================================
8080 */const Rie="return x;",Oie=`
8081  vec4 result;
8082
8083  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
8084  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
8085  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
8086  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);
8087
8088  return result;
8089`,Die=`
8090  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
8091  bvec4 isNaN = isnan(x);
8092
8093  result.r = isNaN.r ? x.r : result.r;
8094  result.g = isNaN.g ? x.g : result.g;
8095  result.b = isNaN.b ? x.b : result.b;
8096  result.a = isNaN.a ? x.a : result.a;
8097
8098  return result;
8099`,Pie=`
8100  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
8101  bvec4 isNaN = isnan(x);
8102
8103  result.r = isNaN.r ? x.r : result.r;
8104  result.g = isNaN.g ? x.g : result.g;
8105  result.b = isNaN.b ? x.b : result.b;
8106  result.a = isNaN.a ? x.a : result.a;
8107
8108  return result;
8109`,Fie="return 1.0 / (1.0 + exp(-1.0 * x));";class Gi{constructor(e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length),this.userCode=`
8110      vec4 unaryOperation(vec4 x) {
8111        ${n}
8112      }
8113
8114      void main() {
8115        vec4 x = getAAtOutCoords();
8116        vec4 y = unaryOperation(x);
8117
8118        setOutput(y);
8119      }
8120    `}}/**
8121 * @license
8122 * Copyright 2018 Google LLC. All Rights Reserved.
8123 * Licensed under the Apache License, Version 2.0 (the "License");
8124 * you may not use this file except in compliance with the License.
8125 * You may obtain a copy of the License at
8126 *
8127 * http://www.apache.org/licenses/LICENSE-2.0
8128 *
8129 * Unless required by applicable law or agreed to in writing, software
8130 * distributed under the License is distributed on an "AS IS" BASIS,
8131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8132 * See the License for the specific language governing permissions and
8133 * limitations under the License.
8134 * =============================================================================
8135 */class Lie{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length);const n=e.length,r=bn("rc",n),s=qe(n),i=wie(n,r),o=r.slice(-2),a=n<=1?"rc":`vec2(${o.join(",")})`;this.userCode=`
8136      void main() {
8137        ${s} rc = getOutputCoords();
8138        vec4 packedInput = getA(${i});
8139
8140        setOutput(getChannel(packedInput, ${a}));
8141      }
8142    `}}/**
8143 * @license
8144 * Copyright 2017 Google LLC. All Rights Reserved.
8145 * Licensed under the Apache License, Version 2.0 (the "License");
8146 * you may not use this file except in compliance with the License.
8147 * You may obtain a copy of the License at
8148 *
8149 * http://www.apache.org/licenses/LICENSE-2.0
8150 *
8151 * Unless required by applicable law or agreed to in writing, software
8152 * distributed under the License is distributed on an "AS IS" BASIS,
8153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8154 * See the License for the specific language governing permissions and
8155 * limitations under the License.
8156 * =============================================================================
8157 */const Mie=WO,Vie=1e-7,Bie=1e-4,_d={};function Wie(t){return t in _d||(_d[t]={}),_d[t]}const Uie=U().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"),zie=600;function jie(){return U().global.screen==null?1024:U().global.screen.height*U().global.screen.width*window.devicePixelRatio*zie/1024/1024}class _m extends A${nextDataId(){return _m.nextDataId++}constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!U().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let n;if(e!=null){if(e instanceof Xg)n=e;else{const r=fs(U().getNumber("WEBGL_VERSION"),e);n=new Xg(r)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const r=fs(U().getNumber("WEBGL_VERSION"));n=new Xg(r),this.binaryCache=Wie(U().getNumber("WEBGL_VERSION")),this.gpgpuCreatedLocally=!0}this.gpgpu=n,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new Sie(this.gpgpu),this.numMBBeforeWarning=jie(),this.texData=new t5(this,Oi())}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}writeTexture(e,n,r,s,i,o){const a=this.makeTensorInfo(n,r),u=this.texData.get(a.dataId);u.isPacked=!1,u.texture={texture:e,texShape:[s,i]},u.texShape=[s,i];const l=wd(n),c=new KT(l,!1,o),h=this.runWebGLProgram(c,[a],r,[[s,i]]);return h.shape=n,u.texture=null,this.disposeIntermediateTensorInfo(a),h.dataId}write(e,n,r){if((U().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||U().getBool("DEBUG"))&&this.checkNumericalProblems(e),r==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const s={id:this.nextDataId()};return this.texData.set(s,{shape:n,dtype:r,values:e,usage:ar.UPLOAD,refCount:1}),s}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){const n=this.texData.get(e);n.refCount++}decRef(e){if(this.texData.has(e)){const n=this.texData.get(e);n.refCount--}}move(e,n,r,s,i){if(U().getBool("DEBUG")&&this.checkNumericalProblems(n),s==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:r,dtype:s,values:n,usage:ar.UPLOAD,refCount:i})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const n=this.texData.get(e),{values:r,dtype:s,complexTensorInfos:i,slice:o,shape:a,isPacked:u}=n;if(o!=null){let d;u?d=new Gi(a,Mi):d=new As(a,Mi);const f=this.runWebGLProgram(d,[{dataId:e,shape:a,dtype:s}],s),p=this.readSync(f.dataId);return this.disposeIntermediateTensorInfo(f),p}if(r!=null)return this.convertAndCacheOnCPU(e);if(s==="string")return r;const l=this.activeTimers!=null;let c;l&&(c=Zr());let h;if(s==="complex64"){const d=this.readSync(i.real.dataId),f=this.readSync(i.imag.dataId);h=G0(d,f)}else h=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=Zr()-c),this.convertAndCacheOnCPU(e,h)}async read(e){if(this.pendingRead.has(e)){const p=this.pendingRead.get(e);return new Promise(y=>p.push(y))}const n=this.texData.get(e),{values:r,shape:s,slice:i,dtype:o,complexTensorInfos:a,isPacked:u}=n;if(i!=null){let p;u?p=new Gi(s,Mi):p=new As(s,Mi);const y=this.runWebGLProgram(p,[{dataId:e,shape:s,dtype:o}],o),v=this.read(y.dataId);return this.disposeIntermediateTensorInfo(y),v}if(r!=null)return this.convertAndCacheOnCPU(e);if(U().getBool("DEBUG")&&!U().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&U().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,c;if(o!=="complex64"&&U().get("WEBGL_BUFFER_SUPPORTED")){c=this.decode(e);const p=this.texData.get(c.dataId);l=this.gpgpu.createBufferFromTexture(p.texture.texture,...yd(s))}this.pendingRead.set(e,[]),o!=="complex64"&&await this.gpgpu.createAndWaitForFence();let h;if(o==="complex64"){const p=await Promise.all([this.read(a.real.dataId),this.read(a.imag.dataId)]),y=p[0],v=p[1];h=G0(y,v)}else if(l==null)h=this.getValuesFromTexture(e);else{const p=ne(s);h=this.gpgpu.downloadFloat32MatrixFromBuffer(l,p)}if(c!=null&&this.disposeIntermediateTensorInfo(c),l!=null){const p=this.gpgpu.gl;ue(p,()=>p.deleteBuffer(l))}const d=this.convertAndCacheOnCPU(e,h),f=this.pendingRead.get(e);return this.pendingRead.delete(e),f.forEach(p=>p(d)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&Oi().removeDataId(e,this),this.pendingDeletes--),d}readToGPU(e,n={}){const r=this.texData.get(e),{values:s,shape:i,slice:o,dtype:a,isPacked:u,texture:l}=r;if(a==="complex64")throw new Error("Does not support reading texture for complex64 dtype.");if(o!=null){let f;u?f=new Gi(i,Mi):f=new As(i,Mi);const p=this.runWebGLProgram(f,[{dataId:e,shape:i,dtype:a}],a),y=this.readToGPU(p,n);return this.disposeIntermediateTensorInfo(p),y}if(l==null)throw s!=null?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const c=this.decode(e,n.customTexShape),h=Oi().makeTensorFromTensorInfo(c),d=this.texData.get(c.dataId);return Object.assign({tensorRef:h},d.texture)}bufferSync(e){const n=this.readSync(e.dataId);if(e.dtype==="string")try{const r=n.map(s=>Qu(s));return wt(e.shape,e.dtype,r)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return wt(e.shape,e.dtype,n)}checkNumericalProblems(e){if(e!=null)for(let n=0;n<e.length;n++){const r=e[n];if(!Ute(r))throw U().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error(`The value ${r} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`):Error(`The value ${r} cannot be represented on this device.`)}}getValuesFromTexture(e){const{shape:n,dtype:r,isPacked:s}=this.texData.get(e),i=ne(n);if(U().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const d=this.decode(e),f=this.texData.get(d.dataId),p=this.gpgpu.downloadMatrixFromPackedTexture(f.texture.texture,...yd(n)).subarray(0,i);return this.disposeIntermediateTensorInfo(d),p}const o=U().getBool("WEBGL_PACK")&&s===!0,a=o?wd(n):n,u=o?new sre(a):new rre(a),l=this.runWebGLProgram(u,[{shape:a,dtype:r,dataId:e}],"float32"),c=this.texData.get(l.dataId),h=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(c.texture.texture,c.texShape[0],c.texShape[1]).subarray(0,i);return this.disposeIntermediateTensorInfo(l),h}timerAvailable(){return U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(e){const n=this.activeTimers,r=[];let s=!1;this.programTimersStack==null?(this.programTimersStack=r,s=!0):this.activeTimers.push(r),this.activeTimers=r,e();const i=ga(this.activeTimers.map(u=>u.query)).filter(u=>u!=null),o=ga(this.activeTimers.map(u=>u.name)).filter(u=>u!=null);this.activeTimers=n,s&&(this.programTimersStack=null);const a={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if(U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const u=await Promise.all(i);a.kernelMs=n5(u),a.getExtraProfileInfo=()=>u.map((l,c)=>({name:o[c],ms:l})).map(l=>`${l.name}: ${l.ms}`).join(", ")}else a.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,a})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Zr(),endMs:null}}endTimer(e){return U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=Zr(),e)}async getQueryTime(e){if(U().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const n=e;return n.endMs-n.startMs}disposeData(e,n=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(n?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!n&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:r}=this.texData.get(e);return r!=null&&(this.disposeData(r.real.dataId,n),this.disposeData(r.imag.dataId,n)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:n,dtype:r,texShape:s,usage:i,isPacked:o,slice:a}=this.texData.get(e),u=a&&a.origDataId||e,l=this.dataRefCount.get(u);l>1?this.dataRefCount.set(u,l-1):(this.dataRefCount.delete(u),n!=null&&(this.numBytesInGPU-=this.computeBytes(s,r),this.textureManager.releaseTexture(n,s,i,o)));const c=this.texData.get(e);c.texture=null,c.texShape=null,c.isPacked=!1,c.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,n=Uie){return U().getBool("WEBGL_CPU_FORWARD")&&e.every(r=>this.texData.get(r.dataId).texture==null&&ne(r.shape)<n)}getGPGPUContext(){return this.gpgpu}where(e){ss("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");const n=e.dataSync();return Mie(e.shape,n)}packedUnaryOp(e,n,r){const s=new Gi(e.shape,n),i=this.compileAndRun(s,[e],r);return Oi().makeTensorFromTensorInfo(i)}abs(e){if(this.shouldExecuteOnCPU([e])&&e.dtype!=="complex64"){const s=yP(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,s)}if(U().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,nC,e.dtype);const n=new As(e.shape,nC),r=this.compileAndRun(n,[e]);return Oi().makeTensorFromTensorInfo(r)}makeTensorInfo(e,n,r){let s;if(n==="string"&&r!=null&&r.length>0&&im(r[0])){const i=r.map(o=>na(o));s=this.write(i,e,n)}else s=this.write(r,e,n);return this.texData.get(s).usage=null,{dataId:s,shape:e,dtype:n}}makeOutput(e,n,r){return Oi().makeTensorFromTensorInfo(this.makeTensorInfo(e,n,r),this)}unpackTensor(e){const n=new Lie(e.shape);return this.runWebGLProgram(n,[e],e.dtype)}packTensor(e){const n=new bie(e.shape);return this.runWebGLProgram(n,[e],e.dtype,null,!0)}packedReshape(e,n){const r=[tl(e.shape),...nl(e.shape)],s={dtype:e.dtype,shape:r,dataId:e.dataId},i=[tl(n),...nl(n)],o=new wP(i,r),a=!0,u=[r],l=this.runWebGLProgram(o,[s],e.dtype,u,a);return{dataId:l.dataId,shape:n,dtype:l.dtype}}decode(e,n){const r=this.texData.get(e),{isPacked:s,shape:i,dtype:o}=r;if(n!=null){const d=ne(i),f=n[0]*n[1]*4;A(d<=f,()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.")}const a=wd(i);let u;s?u=new nre(a):u=new tre(a);const l=!0,c=[n??yd(a)],h=this.runWebGLProgram(u,[{shape:a,dtype:o,dataId:e}],o,c,l,n);return{dtype:o,shape:i,dataId:h.dataId}}runWebGLProgram(e,n,r,s,i=!1,o){const a=this.makeTensorInfo(e.outputShape,r),u=this.texData.get(a.dataId);if(e.packedOutput&&(u.isPacked=!0),e.outPackingScheme===Kc.DENSE){const g=o??yd(e.outputShape);u.texShape=g.map(x=>x*2)}if(e.outTexUsage!=null&&(u.usage=e.outTexUsage),ne(a.shape)===0)return u.values=ho(a.dtype,0),a;const l=[],c=n.map(g=>{if(g.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let x=this.texData.get(g.dataId);if(x.texture==null){if(!e.packedInputs&&ne(g.shape)<=U().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:g.shape,texData:null,isUniform:!0,uniformValues:x.values};e.packedInputs&&(x.isPacked=!0,x.shape=g.shape)}if(this.uploadToGPU(g.dataId),!!x.isPacked!=!!e.packedInputs)g=x.isPacked?this.unpackTensor(g):this.packTensor(g),l.push(g),x=this.texData.get(g.dataId);else if(x.isPacked&&!sp(x.shape,g.shape)){const w=g,_=g.shape;g.shape=x.shape,g=this.packedReshape(g,_),l.push(g),x=this.texData.get(g.dataId),w.shape=_}return{shape:g.shape,texData:x,isUniform:!1}});this.uploadToGPU(a.dataId);const h={shape:a.shape,texData:u,isUniform:!1},d=ere(e,c,h),f=this.getAndSaveBinary(d,()=>Zne(this.gpgpu,e,c,h)),p=this.activeTimers!=null;let y;p&&(y=this.startTimer()),U().get("ENGINE_COMPILE_ONLY")||Jne(this.gpgpu,f,c,h,s),l.forEach(g=>this.disposeIntermediateTensorInfo(g)),p&&(y=this.endTimer(y),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(y)}));const v=U().getNumber("WEBGL_FLUSH_THRESHOLD");if(v>0){const g=Zr();g-this.lastGlFlushTime>v&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=g)}if(!U().getBool("WEBGL_LAZILY_UNPACK")&&u.isPacked&&i===!1){const g=this.unpackTensor(a);return this.disposeIntermediateTensorInfo(a),g}return a}compileAndRun(e,n,r,s,i=!1){return r=r||n[0].dtype,this.runWebGLProgram(e,n,r,s,i)}getAndSaveBinary(e,n){return e in this.binaryCache||(this.binaryCache[e]=n()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(U().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(n=>{this.gpgpu.deleteProgram(this.binaryCache[n].webGLProgram),delete this.binaryCache[n]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement<"u"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=$e(()=>{if(!U().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=U().getBool("DEBUG");U().set("DEBUG",!1);const n=this.abs(De(1e-8)).dataSync()[0];if(U().set("DEBUG",e),n>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?Vie:Bie}uploadToGPU(e){const n=this.texData.get(e),{shape:r,dtype:s,values:i,texture:o,usage:a,isPacked:u}=n;if(o!=null)return;const l=this.activeTimers!=null;let c;l&&(c=Zr());let h=n.texShape;if(h==null&&(h=one(r,u),n.texShape=h),i!=null){const d=wd(r);let f,p=h[1],y=h[0];const v=i instanceof Uint8Array||i instanceof Uint8ClampedArray;(u||!v)&&([p,y]=vl(h[0],h[1])),u?f=new ore(d,v):f=new KT(d,v);const g=v?[y,p]:h,x=this.makeTensorInfo(g,s),w=this.texData.get(x.dataId);v?w.usage=ar.PIXELS:w.usage=ar.UPLOAD,w.texShape=g,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(x.dataId),p,y,i);const _=[[y,p]],E=this.runWebGLProgram(f,[x],s,_,!0),k=this.texData.get(E.dataId);n.texShape=k.texShape,n.isPacked=k.isPacked,n.usage=k.usage,U().get("ENGINE_COMPILE_ONLY")?this.disposeData(E.dataId):(n.texture=k.texture,n.values=null,this.texData.delete(E.dataId)),this.disposeIntermediateTensorInfo(x),l&&(this.uploadWaitMs+=Zr()-c)}else{const d=this.acquireTexture(h,a,s,u);n.texture=d}}convertAndCacheOnCPU(e,n){const r=this.texData.get(e),{dtype:s}=r;return n!=null&&(r.values=Gie(n,s)),r.values}acquireTexture(e,n,r,s){if(this.numBytesInGPU+=this.computeBytes(e,r),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){const i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${i} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,n,s)}computeBytes(e,n){return e[0]*e[1]*zf(n)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,n]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(n));return Promise.all(e)}else{for(const[,n]of Object.entries(this.binaryCache)){const r=new Promise(s=>{try{this.checkCompletion_(n),s(!0)}catch(i){throw i}});e.push(r)}return Promise.all(e)}}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await bJ(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)===!1)throw console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS)===!1?(rP(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.")):new Error("Failed to link vertex and fragment shaders.");return!0}getUniformLocations(){for(const e of Object.values(this.binaryCache)){this.gpgpu.buildVao(e.webGLProgram);const{variablesLocations:n,customUniformLocations:r,infLoc:s,nanLoc:i,outShapeLocation:o,outShapeStridesLocation:a,outTexShapeLocation:u}=uP(this.gpgpu,e.program,e.webGLProgram);e.variablesLocations=n,e.customUniformLocations=r,e.infLoc=s,e.nanLoc=i,e.outShapeLocation=o,e.outShapeStridesLocation=a,e.outTexShapeLocation=u}}createTensorFromGPUData(e,n,r){e.channels=e.channels||"RGBA";const{texture:s,height:i,width:o,channels:a}=e,u=Oi().backend;if(!u.gpgpu.gl.isTexture(s))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");const l=u.writeTexture(s,n,r,i,o,a);return Oi().makeTensorFromDataId(l,n,r,u)}}_m.nextDataId=0;function Gie(t,e){if(e==="float32"||e==="complex64")return t;if(e==="int32"||e==="bool"){const n=e==="int32"?new Int32Array(t.length):new Uint8Array(t.length);for(let r=0;r<n.length;++r)n[r]=Math.round(t[r]);return n}else throw new Error(`Unknown dtype ${e}`)}/**
8158 * @license
8159 * Copyright 2020 Google Inc. All Rights Reserved.
8160 * Licensed under the Apache License, Version 2.0 (the "License");
8161 * you may not use this file except in compliance with the License.
8162 * You may obtain a copy of the License at
8163 *
8164 * http://www.apache.org/licenses/LICENSE-2.0
8165 *
8166 * Unless required by applicable law or agreed to in writing, software
8167 * distributed under the License is distributed on an "AS IS" BASIS,
8168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8169 * See the License for the specific language governing permissions and
8170 * limitations under the License.
8171 * =============================================================================
8172 */zR()&&nq("webgl",()=>new _m,2);/**
8173 * @license
8174 * Copyright 2017 Google LLC. All Rights Reserved.
8175 * Licensed under the Apache License, Version 2.0 (the "License");
8176 * you may not use this file except in compliance with the License.
8177 * You may obtain a copy of the License at
8178 *
8179 * http://www.apache.org/licenses/LICENSE-2.0
8180 *
8181 * Unless required by applicable law or agreed to in writing, software
8182 * distributed under the License is distributed on an "AS IS" BASIS,
8183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8184 * See the License for the specific language governing permissions and
8185 * limitations under the License.
8186 * =============================================================================
8187 */const fw=`
8188  if (isnan(a)) return a;
8189  if (isnan(b)) return b;
8190`;class Na{constructor(e,n,r){this.variableNames=["A","B"],this.outputShape=Le(n,r),this.enableShapeUniforms=fn(this.outputShape.length),this.userCode=`
8191      float binaryOperation(float a, float b) {
8192        ${e}
8193      }
8194
8195      void main() {
8196        float a = getAAtOutCoords();
8197        float b = getBAtOutCoords();
8198        setOutput(binaryOperation(a, b));
8199      }
8200    `}}/**
8201 * @license
8202 * Copyright 2018 Google LLC. All Rights Reserved.
8203 * Licensed under the Apache License, Version 2.0 (the "License");
8204 * you may not use this file except in compliance with the License.
8205 * You may obtain a copy of the License at
8206 *
8207 * http://www.apache.org/licenses/LICENSE-2.0
8208 *
8209 * Unless required by applicable law or agreed to in writing, software
8210 * distributed under the License is distributed on an "AS IS" BASIS,
8211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8212 * See the License for the specific language governing permissions and
8213 * limitations under the License.
8214 * =============================================================================
8215 */const Ba=`
8216  result.r = isNaN.r ? NAN : result.r;
8217  result.g = isNaN.g ? NAN : result.g;
8218  result.b = isNaN.b ? NAN : result.b;
8219  result.a = isNaN.a ? NAN : result.a;
8220`;class Sl{constructor(e,n,r,s=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Le(n,r);const i=this.outputShape.length;this.enableShapeUniforms=fn(i);let o="";if(s)if(i===0||ne(this.outputShape)===1)o=`
8221          result.y = 0.;
8222          result.z = 0.;
8223          result.w = 0.;
8224        `;else if(o=`
8225          ${qe(i)} coords = getOutputCoords();
8226        `,i===1)this.enableShapeUniforms?o+=`
8227            result.y = (coords + 1) >= outShape ? 0. : result.y;
8228            result.z = 0.;
8229            result.w = 0.;
8230          `:o+=`
8231            result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;
8232            result.z = 0.;
8233            result.w = 0.;
8234          `;else{const u=bn("coords",i);this.enableShapeUniforms?o+=`
8235            bool nextRowOutOfBounds =
8236              (${u[i-2]} + 1) >= outShape[${i} - 2];
8237            bool nextColOutOfBounds =
8238              (${u[i-1]} + 1) >= outShape[${i} - 1];
8239            result.y = nextColOutOfBounds ? 0. : result.y;
8240            result.z = nextRowOutOfBounds ? 0. : result.z;
8241            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
8242          `:o+=`
8243            bool nextRowOutOfBounds =
8244              (${u[i-2]} + 1) >= ${this.outputShape[i-2]};
8245            bool nextColOutOfBounds =
8246              (${u[i-1]} + 1) >= ${this.outputShape[i-1]};
8247            result.y = nextColOutOfBounds ? 0. : result.y;
8248            result.z = nextRowOutOfBounds ? 0. : result.z;
8249            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
8250          `}this.userCode=`
8251      vec4 binaryOperation(vec4 a, vec4 b) {
8252        ${e}
8253      }
8254
8255      void main() {
8256        vec4 a = getAAtOutCoords();
8257        vec4 b = getBAtOutCoords();
8258
8259        vec4 result = binaryOperation(a, b);
8260        ${o}
8261
8262        setOutput(result);
8263      }
8264    `}}/**
8265 * @license
8266 * Copyright 2020 Google LLC. All Rights Reserved.
8267 * Licensed under the Apache License, Version 2.0 (the "License");
8268 * you may not use this file except in compliance with the License.
8269 * You may obtain a copy of the License at
8270 *
8271 * http://www.apache.org/licenses/LICENSE-2.0
8272 *
8273 * Unless required by applicable law or agreed to in writing, softw
8273are
8274 * distributed under the License is distributed on an "AS IS" BASIS,
8275 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8276 * See the License for the specific language governing permissions and
8277 * limitations under the License.
8278 * =============================================================================
8279 */function Jn(t){const{inputs:e,backend:n}=t,{x:r}=e;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}const Hie={kernelName:E1,backendName:"webgl",kernelFunc:Jn};/**
8280 * @license
8281 * Copyright 2020 Google LLC. All Rights Reserved.
8282 * Licensed under the Apache License, Version 2.0 (the "License");
8283 * you may not use this file except in compliance with the License.
8284 * You may obtain a copy of the License at
8285 *
8286 * http://www.apache.org/licenses/LICENSE-2.0
8287 *
8288 * Unless required by applicable law or agreed to in writing, software
8289 * distributed under the License is distributed on an "AS IS" BASIS,
8290 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8291 * See the License for the specific language governing permissions and
8292 * limitations under the License.
8293 * =============================================================================
8294 */function Co(t){const{inputs:e,backend:n}=t,{real:r,imag:s}=e,i=n.makeTensorInfo(r.shape,"complex64"),o=n.texData.get(i.dataId),a=Jn({inputs:{x:r},backend:n}),u=Jn({inputs:{x:s},backend:n});return o.complexTensorInfos={real:a,imag:u},i}const qie={kernelName:sI,backendName:"webgl",kernelFunc:Co};/**
8295 * @license
8296 * Copyright 2020 Google LLC. All Rights Reserved.
8297 * Licensed under the Apache License, Version 2.0 (the "License");
8298 * you may not use this file except in compliance with the License.
8299 * You may obtain a copy of the License at
8300 *
8301 * http://www.apache.org/licenses/LICENSE-2.0
8302 *
8303 * Unless required by applicable law or agreed to in writing, software
8304 * distributed under the License is distributed on an "AS IS" BASIS,
8305 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8306 * See the License for the specific language governing permissions and
8307 * limitations under the License.
8308 * =============================================================================
8309 */const bP="return (a < 0.) ? b * a : a;",_P=`
8310  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
8311  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
8312`;function Kie(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{alpha:i}=r,o=n.makeTensorInfo([],"float32",ml(i,"float32")),a=U().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Sl(_P,s.shape,o.shape):new Na(bP,s.shape,o.shape),u=n.runWebGLProgram(a,[s,o],"float32");return n.disposeIntermediateTensorInfo(o),u}const Xie={kernelName:qI,backendName:"webgl",kernelFunc:Kie};/**
8313 * @license
8314 * Copyright 2020 Google LLC. All Rights Reserved.
8315 * Licensed under the Apache License, Version 2.0 (the "License");
8316 * you may not use this file except in compliance with the License.
8317 * You may obtain a copy of the License at
8318 *
8319 * http://www.apache.org/licenses/LICENSE-2.0
8320 *
8321 * Unless required by applicable law or agreed to in writing, software
8322 * distributed under the License is distributed on an "AS IS" BASIS,
8323 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8324 * See the License for the specific language governing permissions and
8325 * limitations under the License.
8326 * =============================================================================
8327 */const SP="return (a < 0.) ? b * a : a;",TP=`
8328  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
8329  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
8330`;function Yie(t){const{inputs:e,backend:n}=t,{x:r,alpha:s}=e,i=U().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Sl(TP,r.shape,s.shape):new Na(SP,r.shape,s.shape);return n.runWebGLProgram(i,[r,s],"float32")}const Qie={kernelName:CA,backendName:"webgl",kernelFunc:Yie};/**
8331 * @license
8332 * Copyright 2020 Google LLC. All Rights Reserved.
8333 * Licensed under the Apache License, Version 2.0 (the "License");
8334 * you may not use this file except in compliance with the License.
8335 * You may obtain a copy of the License at
8336 *
8337 * http://www.apache.org/licenses/LICENSE-2.0
8338 *
8339 * Unless required by applicable law or agreed to in writing, software
8340 * distributed under the License is distributed on an "AS IS" BASIS,
8341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8342 * See the License for the specific language governing permissions and
8343 * limitations under the License.
8344 * =============================================================================
8345 */const Tl="if (isnan(x)) return x;";function Pe({opSnippet:t,packedOpSnippet:e,cpuKernelImpl:n,dtype:r}){return({inputs:s,backend:i})=>{const{x:o}=s,a=i,u=r||o.dtype;if(a.shouldExecuteOnCPU([o])&&n!=null){const h=a.texData.get(o.dataId),d=n(h.values,u);return a.makeTensorInfo(o.shape,u,d)}const l=U().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&e!=null;let c;return l?c=new Gi(o.shape,e):c=new As(o.shape,t),a.runWebGLProgram(c,[o],u)}}function tn({opSnippet:t,packedOpSnippet:e,checkOutOfBounds:n=!1,supportsComplex:r=!1,cpuKernelImpl:s,dtype:i}){return({inputs:o,backend:a})=>{const{a:u,b:l}=o,c=a;if(r&&u.dtype==="complex64"){const p=c.texData.get(u.dataId),y=c.texData.get(l.dataId),[v,g]=[[p.complexTensorInfos.real,y.complexTensorInfos.real],[p.complexTensorInfos.imag,y.complexTensorInfos.imag]].map(w=>{const[_,T]=w,E={dataId:_.dataId,dtype:_.dtype,shape:u.shape},k={dataId:T.dataId,dtype:T.dtype,shape:l.shape},N=new Na(t,u.shape,l.shape);return c.runWebGLProgram(N,[E,k],zs(_.dtype,T.dtype))}),x=Co({inputs:{real:v,imag:g},backend:c});return c.disposeIntermediateTensorInfo(v),c.disposeIntermediateTensorInfo(g),x}const h=i||zs(u.dtype,l.dtype);if((u.dtype==="string"||l.dtype==="string"||c.shouldExecuteOnCPU([u,l]))&&s!=null){const p=c.texData.get(u.dataId).values,y=c.texData.get(l.dataId).values,v=u.dtype==="string"?el(p):p,g=u.dtype==="string"?el(y):y,[x,w]=s(u.shape,l.shape,v,g,h),_=c.makeTensorInfo(w,h),T=c.texData.get(_.dataId);return T.values=x,_}const d=U().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&e!=null;let f;return d?f=new Sl(e,u.shape,l.shape,n):f=new Na(t,u.shape,l.shape),c.runWebGLProgram(f,[u,l],h)}}function Xc(t,e=!1){if(t==="linear")return e?Rie:Eie;if(t==="relu")return e?Die:$ie;if(t==="elu")return e?Oie:kie;if(t==="relu6")return e?Pie:Iie;if(t==="prelu")return e?TP:SP;if(t==="leakyrelu")return e?_P:bP;if(t==="sigmoid")return e?Fie:Aie;throw new Error(`Activation ${t} has not been implemented for the WebGL backend.`)}/**
8346 * @license
8347 * Copyright 2018 Google LLC. All Rights Reserved.
8348 * Licensed under the Apache License, Version 2.0 (the "License");
8349 * you may not use this file except in compliance with the License.
8350 * You may obtain a copy of the License at
8351 *
8352 * http://www.apache.org/licenses/LICENSE-2.0
8353 *
8354 * Unless required by applicable law or agreed to in writing, software
8355 * distributed under the License is distributed on an "AS IS" BASIS,
8356 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8357 * See the License for the specific language governing permissions and
8358 * limitations under the License.
8359 * =============================================================================
8360 */class CP{constructor(e,n,r,s=!1,i=!1,o=!1,a=null,u=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r,this.enableShapeUniforms=fn(this.outputShape.length);const c=s?e[1]:e[2],h=Math.ceil(c/2),d=s?"i * 2, rc.y":"rc.y, i * 2",f=i?"rc.z, i * 2":"i * 2, rc.z",p=s?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],y=i?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let v="",g="";a&&(u?v=`vec4 activation(vec4 a) {
8361          vec4 b = getPreluActivationWeightsAtOutCoords();
8362          ${a}
8363        }`:l?v=`vec4 activation(vec4 a) {
8364          vec4 b = getLeakyreluAlphaAtOutCoords();
8365          ${a}
8366        }`:v=`vec4 activation(vec4 x) {
8367          ${a}
8368        }`,g="result = activation(result);");const x=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),u&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let w="rc.x",_="rc.x";e[0]<n[0]?w=`imod(rc.x, ${e[0]})`:n[0]<e[0]&&(_=`imod(rc.x, ${n[0]})`),this.userCode=`
8369      ${v}
8370      // Don't use uniform for sharedDimensionPacked for performance.
8371      const float sharedDimension = ${h}.0;
8372
8373      vec4 dot2x2ARowBCol(ivec3 rc) {
8374        vec4 result = vec4(0);
8375        int batchA = ${w};
8376        int batchB = ${_};
8377        for (int i = 0; i < ${h}; i++) {
8378          vec4 a = getMatrixA(batchA, ${d});
8379          vec4 b = getMatrixB(batchB, ${f});
8380
8381          // These swizzled products need to be separately added.
8382          // See: https://github.com/tensorflow/tfjs/issues/1735
8383          result += (${p[0]} * ${y[0]});
8384          result += (${p[1]} * ${y[1]});
8385        }
8386        return result;
8387      }
8388
8389      void main() {
8390        ivec3 rc = getOutputCoords();
8391        vec4 result = dot2x2ARowBCol(rc);
8392
8393        ${x}
8394
8395        ${g}
8396
8397        setOutput(result);
8398      }
8399    `}}/**
8400 * @license
8401 * Copyright 2018 Google LLC. All Rights Reserved.
8402 * Licensed under the Apache License, Version 2.0 (the "License");
8403 * you may not use this file except in compliance with the License.
8404 * You may obtain a copy of the License at
8405 *
8406 * http://www.apache.org/licenses/LICENSE-2.0
8407 *
8408 * Unless required by applicable law or agreed to in writing, software
8409 * distributed under the License is distributed on an "AS IS" BASIS,
8410 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8411 * See the License for the specific language governing permissions and
8412 * limitations under the License.
8413 * =============================================================================
8414 */const rC={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"};class sC{constructor(e,n,r){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Le(n,r),this.userCode=`
8415      float binaryOpComplex(
8416          float areal, float aimag, float breal, float bimag) {
8417        ${e}
8418      }
8419
8420      void main() {
8421        float areal = getARealAtOutCoords();
8422        float aimag = getAImagAtOutCoords();
8423        float breal = getBRealAtOutCoords();
8424        float bimag = getBImagAtOutCoords();
8425        setOutput(binaryOpComplex(areal, aimag, breal, bimag));
8426      }
8427    `}}/**
8428 * @license
8429 * Copyright 2020 Google LLC. All Rights Reserved.
8430 * Licensed under the Apache License, Version 2.0 (the "License");
8431 * you may not use this file except in compliance with the License.
8432 * You may obtain a copy of the License at
8433 *
8434 * http://www.apache.org/licenses/LICENSE-2.0
8435 *
8436 * Unless required by applicable law or agreed to in writing, software
8437 * distributed under the License is distributed on an "AS IS" BASIS,
8438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8439 * See the License for the specific language governing permissions and
8440 * limitations under the License.
8441 * =============================================================================
8442 */const iC="return a * b;";function pw(t){const{inputs:e,backend:n}=t,{a:r,b:s}=e,i=zs(r.dtype,s.dtype);if(r.dtype==="complex64"){const a=n.texData.get(r.dataId),u=n.texData.get(s.dataId),l=new sC(rC.REAL,r.shape,s.shape),c=new sC(rC.IMAG,r.shape,s.shape),h=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:r.shape},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:r.shape},{dataId:u.complexTensorInfos.real.dataId,dtype:u.complexTensorInfos.real.dtype,shape:s.shape},{dataId:u.complexTensorInfos.imag.dataId,dtype:u.complexTensorInfos.imag.dtype,shape:s.shape}],d=n.runWebGLProgram(l,h,"float32"),f=n.runWebGLProgram(c,h,"float32"),p=Co({inputs:{real:d,imag:f},backend:n});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),p}if(n.shouldExecuteOnCPU([r,s])){const a=n.texData.get(r.dataId),u=n.texData.get(s.dataId),[l,c]=Yse(r.shape,s.shape,a.values,u.values,i),h=n.makeTensorInfo(c,i),d=n.texData.get(h.dataId);return d.values=l,h}let o;return U().getBool("WEBGL_PACK_BINARY_OPERATIONS")?o=new Sl(iC,r.shape,s.shape):o=new Na(iC,r.shape,s.shape),n.runWebGLProgram(o,[r,s],i)}const Zie={kernelName:pA,backendName:"webgl",kernelFunc:pw};/**
8443 * @license
8444 * Copyright 2020 Google LLC. All Rights Reserved.
8445 * Licensed under the Apache License, Version 2.0 (the "License");
8446 * you may not use this file except in compliance with the License.
8447 * You may obtain a copy of the License at
8448 *
8449 * http://www.apache.org/licenses/LICENSE-2.0
8450 *
8451 * Unless required by applicable law or agreed to in writing, software
8452 * distributed under the License is distributed on an "AS IS" BASIS,
8453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8454 * See the License for the specific language governing permissions and
8455 * limitations under the License.
8456 * =============================================================================
8457 */function Jie(t,e,n){const r=[tl(t.shape),...nl(t.shape)],s={dtype:t.dtype,shape:r,dataId:t.dataId},i=[tl(e),...nl(e)],o=new wP(i,r),a=!0,u=[r],l=n.runWebGLProgram(o,[s],t.dtype,u,a);return{dataId:l.dataId,shape:e,dtype:l.dtype}}/**
8458 * @license
8459 * Copyright 2020 Google LLC. All Rights Reserved.
8460 * Licensed under the Apache License, Version 2.0 (the "License");
8461 * you may not use this file except in compliance with the License.
8462 * You may obtain a copy of the License at
8463 *
8464 * http://www.apache.org/licenses/LICENSE-2.0
8465 *
8466 * Unless required by applicable law or agreed to in writing, software
8467 * distributed under the License is distributed on an "AS IS" BASIS,
8468 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8469 * See the License for the specific language governing permissions and
8470 * limitations under the License.
8471 * =============================================================================
8472 */function se(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{shape:i}=r,o=n,a=ne(s.shape),u=s5(i,a),l=ne(u);A(a===l,()=>`The new shape (${u}) has ${l} elements and the old shape (${s.shape}) has ${a} elements. The new shape and old shape must have the same number of elements.`);const c=o.texData.get(s.dataId);return c.isPacked&&!sp(s.shape,u)&&!(c.texture!==null&&sp(c.shape,u))?Jie(s,u,o):(o.incRef(s.dataId),{dataId:s.dataId,shape:u,dtype:s.dtype})}const eoe={kernelName:DA,backendName:"webgl",kernelFunc:se};/**
8473 * @license
8474 * Copyright 2020 Google LLC. All Rights Reserved.
8475 * Licensed under the Apache License, Version 2.0 (the "License");
8476 * you may not use this file except in compliance with the License.
8477 * You may obtain a copy of the License at
8478 *
8479 * http://www.apache.org/licenses/LICENSE-2.0
8480 *
8481 * Unless required by applicable law or agreed to in writing, software
8482 * distributed under the License is distributed on an "AS IS" BASIS,
8483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8484 * See the License for the specific language governing permissions and
8485 * limitations under the License.
8486 * =============================================================================
8487 */class oC{constructor(e,n){this.variableNames=["x"];const{windowSize:r,batchSize:s,inSize:i,outSize:o}=e;this.outputShape=[s,o];const a=Math.floor(r/4)*4,u=r%4;let l="sumValue += dot(values, ones);";if(n!=null){const h=1/n;l=`sumValue += dot(values * ${Xu(h)?h.toPrecision(2):h}, ones);`}let c="";i%r>0&&(c=`
8488        if (inIdx < 0 || inIdx >= ${i}) {
8489          return 0.0;
8490        }
8491      `),this.userCode=`
8492      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
8493
8494      float getValue(int batch, int inIdx) {
8495        ${c}
8496        return getX(batch, inIdx);
8497      }
8498
8499      void main() {
8500        ivec2 coords = getOutputCoords();
8501        int batch = coords[0];
8502        int outIdx = coords[1];
8503        int inOffset = outIdx * ${r};
8504
8505        float sumValue = 0.0;
8506
8507        for (int i = 0; i < ${a}; i += 4) {
8508          int inIdx = inOffset + i;
8509          vec4 values = vec4(
8510            getValue(batch, inIdx),
8511            getValue(batch, inIdx + 1),
8512            getValue(batch, inIdx + 2),
8513            getValue(batch, inIdx + 3)
8514          );
8515
8516          ${l}
8517        }
8518
8519        int inIdx = inOffset + ${a};
8520        if (${u===1}) {
8521          vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);
8522
8523          ${l}
8524        } else if (${u===2}) {
8525          vec4 values = vec4(
8526            getValue(batch, inIdx),
8527            getValue(batch, inIdx + 1), 0.0, 0.0);
8528
8529          ${l}
8530        } else if (${u===3}) {
8531          vec4 values = vec4(
8532            getValue(batch, inIdx),
8533            getValue(batch, inIdx + 1),
8534            getValue(batch, inIdx + 2), 0.0);
8535
8536          ${l}
8537        }
8538        setOutput(sumValue);
8539      }
8540    `}}/**
8541 * @license
8542 * Copyright 2017 Google LLC. All Rights Reserved.
8543 * Licensed under the Apache License, Version 2.0 (the "License");
8544 * you may not use this file except in compliance with the License.
8545 * You may obtain a copy of the License at
8546 *
8547 * http://www.apache.org/licenses/LICENSE-2.0
8548 *
8549 * Unless required by applicable law or agreed to in writing, software
8550 * distributed under the License is distributed on an "AS IS" BASIS,
8551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8552 * See the License for the specific language governing permissions and
8553 * limitations under the License.
8554 * =============================================================================
8555 */class toe{constructor(e,n){this.variableNames=["x"];const{windowSize:r,batchSize:s,inSize:i,outSize:o}=e;this.outputShape=[s,o];let a="0.0",u="";n==="prod"?a="1.0":n==="min"?(a="1.0 / 1e-20",u="min"):n==="max"&&(a="-1.0 / 1e-20",u="max");let l=`${n}(${n}(${n}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;n==="sum"?l="sumValue":n==="prod"?l="prodValue":n==="all"?l="allValue":n==="any"&&(l="anyValue");const c=Math.floor(r/4)*4,h=r%4;let d=`
8556      if (${n==="sum"}) {
8557        sumValue += dot(values, ones);
8558      } else if (${n==="prod"}) {
8559        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
8560        prodValue *= tmp[0] * tmp[1];
8561      } else {
8562        minMaxValue = ${u}(values, minMaxValue);
8563        if (${n==="min"} || ${n==="max"}) {
8564          minMaxValue = ${u}(values, minMaxValue);
8565          bvec4 isNaN = isnan(values);
8566          if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {
8567            minMaxValue = vec4(NAN);
8568          }
8569        }
8570      }
8571    `,f="vec4";n==="all"?(a="1.0",d=`
8572        bool reducedAllValue = all(values);
8573        float floatedReducedAllValue = float(reducedAllValue);
8574        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
8575      `,f="bvec4"):n==="any"&&(a="0.0",d=`
8576        bool reducedAnyValue = any(values);
8577        float floatedReducedAnyValue = float(reducedAnyValue);
8578        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
8579      `,f="bvec4");let p="";i%r>0&&(p=`
8580        if (inIdx < 0 || inIdx >= ${i}) {
8581          return initializationValue;
8582        }
8583      `),this.userCode=`
8584      const float initializationValue = ${a};
8585      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
8586
8587      float getValue(int batch, int inIdx) {
8588        ${p}
8589        return getX(batch, inIdx);
8590      }
8591
8592      void main() {
8593        ivec2 coords = getOutputCoords();
8594        int batch = coords[0];
8595        int outIdx = coords[1];
8596        int inOffset = outIdx * ${r};
8597
8598        vec4 minMaxValue = vec4(${a});
8599        float prodValue = 1.0;
8600        float sumValue = 0.0;
8601        float allValue = 1.0;
8602        float anyValue = 0.0;
8603
8604        for (int i = 0; i < ${c}; i += 4) {
8605          int inIdx = inOffset + i;
8606          ${f} values = ${f}(
8607            getValue(batch, inIdx),
8608            getValue(batch, inIdx + 1),
8609            getValue(batch, inIdx + 2),
8610            getValue(batch, inIdx + 3)
8611          );
8612
8613          ${d}
8614        }
8615
8616        int inIdx = inOffset + ${c};
8617        if (${h===1}) {
8618          ${f} values = ${f}(
8619            getValue(batch, inIdx),
8620            initializationValue,
8621            initializationValue,
8622            initializationValue
8623          );
8624
8625          ${d}
8626        } else if (${h===2}) {
8627          ${f} values = ${f}(
8628            getValue(batch, inIdx),
8629            getValue(batch, inIdx + 1),
8630            initializationValue,
8631            initializationValue
8632          );
8633
8634          ${d}
8635        } else if (${h===3}) {
8636          ${f} values = ${f}(
8637            getValue(batch, inIdx),
8638            getValue(batch, inIdx + 1),
8639            getValue(batch, inIdx + 2),
8640            initializationValue
8641          );
8642
8643          ${d}
8644        }
8645        setOutput(${l});
8646      }
8647    `}}/**
8648 * @license
8649 * Copyright 2020 Google LLC. All Rights Reserved.
8650 * Licensed under the Apache License, Version 2.0 (the "License");
8651 * you may not use this file except in compliance with the License.
8652 * You may obtain a copy of the License at
8653 *
8654 * http://www.apache.org/licenses/LICENSE-2.0
8655 *
8656 * Unless required by applicable law or agreed to in writing, software
8657 * distributed under the License is distributed on an "AS IS" BASIS,
8658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8659 * See the License for the specific language governing permissions and
8660 * limitations under the License.
8661 * =============================================================================
8662 */function noe(t){const e=[];for(;e.length===0||e[e.length-1].outSize!==1;){const n=e.length?e[e.length-1].outSize:t[1],r=wm(n);e.push({inSize:n,windowSize:r,outSize:Math.ceil(n/r)})}return e}function Wa(t,e,n,r){const s=noe(t.shape);let i=t;for(let o=0;o<s.length;o++){const{inSize:a,windowSize:u,outSize:l}=s[o];let c,h;n==="mean"?c=o===0?new oC({windowSize:u,inSize:a,batchSize:t.shape[0],outSize:l},a):new oC({windowSize:u,inSize:a,batchSize:t.shape[0],outSize:l}):c=new toe({windowSize:u,inSize:a,batchSize:t.shape[0],outSize:l},n),h=i,i=r.runWebGLProgram(c,[i],e),h.dataId!==t.dataId&&r.disposeIntermediateTensorInfo(h)}return i}/**
8663 * @license
8664 * Copyright 2017 Google LLC. All Rights Reserved.
8665 * Licensed under the Apache License, Version 2.0 (the "License");
8666 * you may not use this file except in compliance with the License.
8667 * You may obtain a copy of the License at
8668 *
8669 * http://www.apache.org/licenses/LICENSE-2.0
8670 *
8671 * Unless required by applicable law or agreed to in writing, software
8672 * distributed under the License is distributed on an "AS IS" BASIS,
8673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8674 * See the License for the specific language governing permissions and
8675 * limitations under the License.
8676 * =============================================================================
8677 */class roe{constructor(e,n){this.variableNames=["A"];const r=new Array(e.length);for(let o=0;o<r.length;o++)r[o]=e[n[o]];this.outputShape=r,this.rank=r.length;const s=qe(this.rank),i=soe(n);this.userCode=`
8678    void main() {
8679      ${s} resRC = getOutputCoords();
8680      setOutput(getA(${i}));
8681    }
8682    `}}function soe(t){const e=t.length;if(e>6)throw Error(`Transpose for rank ${e} is not yet supported`);const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(e);for(let s=0;s<t.length;s++)r[t[s]]=n[s];return r.join()}/**
8683 * @license
8684 * Copyright 2019 Google LLC. All Rights Reserved.
8685 * Licensed under the Apache License, Version 2.0 (the "License");
8686 * you may not use this file except in compliance with the License.
8687 * You may obtain a copy of the License at
8688 *
8689 * http://www.apache.org/licenses/LICENSE-2.0
8690 *
8691 * Unless required by applicable law or agreed to in writing, software
8692 * distributed under the License is distributed on an "AS IS" BASIS,
8693 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8694 * See the License for the specific language governing permissions and
8695 * limitations under the License.
8696 * =============================================================================
8697 */class ioe{constructor(e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;const r=new Array(e.length);for(let c=0;c<r.length;c++)r[c]=e[n[c]];if(this.outputShape=r,this.rank=r.length,this.rank>6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const s=qe(this.rank),i=xP("rc",this.rank),o=new Array(this.rank);for(let c=0;c<n.length;c++)o[n[c]]=i[c];const a=`vec2(${o.slice(-2).join()})`,u=`++${i[this.rank-1]} < ${r[this.rank-1]}`,l=`getChannel(getA(${o.join()}), ${a})`;this.userCode=`
8698    void main() {
8699      ${s} rc = getOutputCoords();
8700      vec4 result = vec4(0.);
8701      result[0] = ${l};
8702      if(${u}) {
8703        result[1] = ${l};
8704      }
8705      --${i[this.rank-1]};
8706      if(++${i[this.rank-2]} < ${r[this.rank-2]}) {
8707        result[2] = ${l};
8708        if(${u}) {
8709          result[3] = ${l};
8710        }
8711      }
8712      setOutput(result);
8713    }
8714    `}}/**
8715 * @license
8716 * Copyright 2020 Google LLC. All Rights Reserved.
8717 * Licensed under the Apache License, Version 2.0 (the "License");
8718 * you may not use this file except in compliance with the License.
8719 * You may obtain a copy of the License at
8720 *
8721 * http://www.apache.org/licenses/LICENSE-2.0
8722 *
8723 * Unless required by applicable law or agreed to in writing, software
8724 * distributed under the License is distributed on an "AS IS" BASIS,
8725 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8726 * See the License for the specific language governing permissions and
8727 * limitations under the License.
8728 * =============================================================================
8729 */function Sm(t,e,n){const r=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new ioe(t.shape,e):new roe(t.shape,e);return n.runWebGLProgram(r,[t],t.dtype)}/**
8730 * @license
8731 * Copyright 2020 Google LLC. All Rights Reserved.
8732 * Licensed under the Apache License, Version 2.0 (the "License");
8733 * you may not use this file except in compliance with the License.
8734 * You may obtain a copy of the License at
8735 *
8736 * http://www.apache.org/licenses/LICENSE-2.0
8737 *
8738 * Unless required by applicable law or agreed to in writing, software
8739 * distributed under the License is distributed on an "AS IS" BASIS,
8740 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8741 * See the License for the specific language governing permissions and
8742 * limitations under the License.
8743 * =============================================================================
8744 */function ooe(t,e,n,r){const s=e,i=t.shape.length,o=Gt(s,t.shape);let a=o;const u=Ur(a,i),l=u!=null;let c=t;l&&(c=Sm(t,u,r),a=zr(a.length,i)),ws("sum",a,i);const[h,d]=qs(c.shape,a);let f=h;n&&(f=vr(h,o));const p=ne(d),v=ne(t.shape)/p,g=se({inputs:{x:c},attrs:{shape:[v,p]},backend:r}),x=I1(t.dtype),w=Wa(g,x,"sum",r),_=se({inputs:{x:w},attrs:{shape:f},backend:r});return r.disposeIntermediateTensorInfo(g),r.disposeIntermediateTensorInfo(w),l&&r.disposeIntermediateTensorInfo(c),_}/**
8745 * @license
8746 * Copyright 2020 Google LLC. All Rights Reserved.
8747 * Licensed under the Apache License, Version 2.0 (the "License");
8748 * you may not use this file except in compliance with the License.
8749 * You may obtain a copy of the License at
8750 *
8751 * http://www.apache.org/licenses/LICENSE-2.0
8752 *
8753 * Unless required by applicable law or agreed to in writing, software
8754 * distributed under the License is distributed on an "AS IS" BASIS,
8755 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8756 * See the License for the specific language governing permissions and
8757 * limitations under the License.
8758 * =============================================================================
8759 */function Tm(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,keepDims:o}=r;return ooe(s,i,o,n)}const aoe={kernelName:JA,backendName:"webgl",kernelFunc:Tm};/**
8760 * @license
8761 * Copyright 2020 Google LLC. All Rights Reserved.
8762 * Licensed under the Apache License, Version 2.0 (the "License");
8763 * you may not use this file except in compliance with the License.
8764 * You may obtain a copy of the License at
8765 *
8766 * http://www.apache.org/licenses/LICENSE-2.0
8767 *
8768 * Unless required by applicable law or agreed to in writing, software
8769 * distributed under the License is distributed on an "AS IS" BASIS,
8770 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8771 * See the License for the specific language governing permissions and
8772 * limitations under the License.
8773 * =============================================================================
8774 */function Tn(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{perm:i}=r,o=n,a=s.shape.length,u=new Array(a);for(let c=0;c<u.length;c++)u[c]=s.shape[i[c]];let l;if(o.shouldExecuteOnCPU([s])){const h=o.texData.get(s.dataId).values,d=dw(h,s.shape,s.dtype,i,u);l=o.makeTensorInfo(u,s.dtype);const f=o.texData.get(l.dataId);f.values=d}else l=Sm(s,i,o);return l}const uoe={kernelName:jd,backendName:"webgl",kernelFunc:Tn};/**
8775 * @license
8776 * Copyright 2020 Google LLC. All Rights Reserved.
8777 * Licensed under the Apache License, Version 2.0 (the "License");
8778 * you may not use this file except in compliance with the License.
8779 * You may obtain a copy of the License at
8780 *
8781 * http://www.apache.org/licenses/LICENSE-2.0
8782 *
8783 * Unless required by applicable law or agreed to in writing, softw
8783are
8784 * distributed under the License is distributed on an "AS IS" BASIS,
8785 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8786 * See the License for the specific language governing permissions and
8787 * limitations under the License.
8788 * =============================================================================
8789 */const NP=1e3;function op({a:t,b:e,transposeA:n,transposeB:r,backend:s,bias:i=null,preluActivationWeights:o=null,leakyreluAlpha:a=0,activation:u=null}){const l=t.shape.length,c=e.shape.length,h=n?t.shape[l-2]:t.shape[l-1],d=r?e.shape[c-1]:e.shape[c-2],f=n?t.shape[l-1]:t.shape[l-2],p=r?e.shape[c-2]:e.shape[c-1],y=t.shape.slice(0,-2),v=e.shape.slice(0,-2),g=ne(y),x=ne(v),_=Le(t.shape.slice(0,-2),e.shape.slice(0,-2)).concat([f,p]);A(h===d,()=>`Error in matMul: inner shapes (${h}) and (${d}) of Tensors with shapes ${t.shape} and ${e.shape} and transposeA=${n} and transposeB=${r} must match.`);const T=n?[g,h,f]:[g,f,h],E=r?[x,p,d]:[x,d,p],k=se({inputs:{x:t},backend:s,attrs:{shape:T}}),N=se({inputs:{x:e},backend:s,attrs:{shape:E}}),O=[k,N],R=Math.max(g,x),L=n?k.shape[1]:k.shape[2],W=i!=null,G=o!=null,H=u==="leakyrelu",X=u!=null?Xc(u,!0):null,Q=W||G||H||X!=null;let Y;if((f===1||p===1)&&L>NP&&Q===!1){let q=k,Z=N;n&&(q=Tn({inputs:{x:k},backend:s,attrs:{perm:[0,2,1]}}),O.push(q)),r&&(Z=Tn({inputs:{x:N},backend:s,attrs:{perm:[0,2,1]}}),O.push(Z));const ae=p!==1,fe=p===1;let We=q;ae&&(We=se({inputs:{x:q},backend:s,attrs:{shape:[R,L,1]}}),O.push(We));const Ue=p===1?2:1;let we=Z;fe&&(we=se({inputs:{x:Z},backend:s,attrs:{shape:[R,1,L]}}),O.push(we));const Ie=pw({inputs:{a:We,b:we},backend:s});Y=Tm({inputs:{x:Ie},backend:s,attrs:{axis:Ue,keepDims:!0}}),O.push(Ie)}else{const q=zs(t.dtype,e.dtype),Z=new CP(T,E,[R,f,p],n,r,W,X,G,H),ae=[k,N];if(i!=null&&ae.push(i),G&&ae.push(o),H){const fe=s.makeTensorInfo([],"float32",ml(a,"float32"));ae.push(fe),O.push(fe)}Y=s.runWebGLProgram(Z,ae,q)}const j=se({inputs:{x:Y},backend:s,attrs:{shape:_}});O.push(Y);for(const q of O)s.disposeIntermediateTensorInfo(q);return j}/**
8790 * @license
8791 * Copyright 2020 Google LLC. All Rights Reserved.
8792 * Licensed under the Apache License, Version 2.0 (the License);
8793 * you may not use this file except in compliance with the License.
8794 * You may obtain a copy of the License at
8795 *
8796 * http://www.apache.org/licenses/LICENSE-2.0
8797 *
8798 * Unless required by applicable law or agreed to in writing, software
8799 * distributed under the License is distributed on an AS IS BASIS,
8800 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8801 * See the License for the specific language governing permissions and
8802 * limitations under the License.
8803 * =============================================================================
8804 */function loe(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:i,bias:o,preluActivationWeights:a}=e,{transposeA:u,transposeB:l,activation:c,leakyreluAlpha:h}=r;return op({a:s,b:i,transposeA:u,transposeB:l,backend:n,bias:o,preluActivationWeights:a,leakyreluAlpha:h,activation:c})}const coe={kernelName:T0,backendName:"webgl",kernelFunc:loe};/**
8805 * @license
8806 * Copyright 2020 Google LLC. All Rights Reserved.
8807 * Licensed under the Apache License, Version 2.0 (the "License");
8808 * you may not use this file except in compliance with the License.
8809 * You may obtain a copy of the License at
8810 *
8811 * http://www.apache.org/licenses/LICENSE-2.0
8812 *
8813 * Unless required by applicable law or agreed to in writing, software
8814 * distributed under the License is distributed on an "AS IS" BASIS,
8815 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8816 * See the License for the specific language governing permissions and
8817 * limitations under the License.
8818 * =============================================================================
8819 */const aC="return abs(x);";function hoe(t){const{inputs:e,backend:n}=t,{x:r}=e;if(n.shouldExecuteOnCPU([r])&&r.dtype!=="complex64"){const i=n.texData.get(r.dataId),o=yP(i.values);return n.makeTensorInfo(r.shape,r.dtype,o)}let s;return U().getBool("WEBGL_PACK_UNARY_OPERATIONS")?s=new Gi(r.shape,aC):s=new As(r.shape,aC),n.runWebGLProgram(s,[r],r.dtype)}const doe={kernelName:F$,backendName:"webgl",kernelFunc:hoe};/**
8820 * @license
8821 * Copyright 2020 Google LLC. All Rights Reserved.
8822 * Licensed under the Apache License, Version 2.0 (the "License");
8823 * you may not use this file except in compliance with the License.
8824 * You may obtain a copy of the License at
8825 *
8826 * http://www.apache.org/licenses/LICENSE-2.0
8827 *
8828 * Unless required by applicable law or agreed to in writing, software
8829 * distributed under the License is distributed on an "AS IS" BASIS,
8830 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8831 * See the License for the specific language governing permissions and
8832 * limitations under the License.
8833 * =============================================================================
8834 */const foe=jr+`
8835  if (abs(x) > 1.) {
8836    return NAN;
8837  }
8838  return acos(x);
8839`,poe=Pe({opSnippet:foe}),moe={kernelName:L$,backendName:"webgl",kernelFunc:poe};/**
8840 * @license
8841 * Copyright 2020 Google LLC. All Rights Reserved.
8842 * Licensed under the Apache License, Version 2.0 (the "License");
8843 * you may not use this file except in compliance with the License.
8844 * You may obtain a copy of the License at
8845 *
8846 * http://www.apache.org/licenses/LICENSE-2.0
8847 *
8848 * Unless required by applicable law or agreed to in writing, software
8849 * distributed under the License is distributed on an "AS IS" BASIS,
8850 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8851 * See the License for the specific language governing permissions and
8852 * limitations under the License.
8853 * =============================================================================
8854 */const goe=jr+`
8855  if (x < 1.0) return NAN;
8856return log(x + sqrt(x * x - 1.0));`,yoe=Pe({opSnippet:goe}),voe={kernelName:M$,backendName:"webgl",kernelFunc:yoe};/**
8857 * @license
8858 * Copyright 2020 Google LLC. All Rights Reserved.
8859 * Licensed under the Apache License, Version 2.0 (the "License");
8860 * you may not use this file except in compliance with the License.
8861 * You may obtain a copy of the License at
8862 *
8863 * http://www.apache.org/licenses/LICENSE-2.0
8864 *
8865 * Unless required by applicable law or agreed to in writing, software
8866 * distributed under the License is distributed on an "AS IS" BASIS,
8867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8868 * See the License for the specific language governing permissions and
8869 * limitations under the License.
8870 * =============================================================================
8871 */const uC="return a + b;",xoe=tn({opSnippet:uC,packedOpSnippet:uC,supportsComplex:!0,cpuKernelImpl:$se}),woe={kernelName:C1,backendName:"webgl",kernelFunc:xoe};/**
8872 * @license
8873 * Copyright 2019 Google LLC. All Rights Reserved.
8874 * Licensed under the Apache License, Version 2.0 (the "License");
8875 * you may not use this file except in compliance with the License.
8876 * You may obtain a copy of the License at
8877 *
8878 * http://www.apache.org/licenses/LICENSE-2.0
8879 *
8880 * Unless required by applicable law or agreed to in writing, software
8881 * distributed under the License is distributed on an "AS IS" BASIS,
8882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8883 * See the License for the specific language governing permissions and
8884 * limitations under the License.
8885 * =============================================================================
8886 */class boe{constructor(e,n){this.outputShape=[],this.outputShape=e,this.variableNames=n.map((i,o)=>`T${o}`);const r=[];this.variableNames.forEach(i=>{r.push(`float v${i} = get${i}AtOutCoords();`)});const s=this.variableNames.map(i=>`v${i}`).join(" + ");this.userCode=`
8887      void main() {
8888        ${r.join(`
8889        `)}
8890
8891        float result = ${s};
8892        setOutput(result);
8893      }
8894    `}}/**
8895 * @license
8896 * Copyright 2019 Google LLC. All Rights Reserved.
8897 * Licensed under the Apache License, Version 2.0 (the "License");
8898 * you may not use this file except in compliance with the License.
8899 * You may obtain a copy of the License at
8900 *
8901 * http://www.apache.org/licenses/LICENSE-2.0
8902 *
8903 * Unless required by applicable law or agreed to in writing, software
8904 * distributed under the License is distributed on an "AS IS" BASIS,
8905 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8906 * See the License for the specific language governing permissions and
8907 * limitations under the License.
8908 * =============================================================================
8909 */class _oe{constructor(e,n){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=n.map((i,o)=>`T${o}`);const r=[];
vendor: 4,356 bytes, lines 8909-8965
8909this.variableNames.forEach(i=>{r.push(`vec4 v${i} = get${i}AtOutCoords();`)});const s=this.variableNames.map(i=>`v${i}`).join(" + ");this.userCode=`
8910      void main() {
8911        ${r.join(`
8912        `)}
8913
8914        vec4 result = ${s};
8915        setOutput(result);
8916      }
8917    `}}/**
8918 * @license
8919 * Copyright 2020 Google LLC. All Rights Reserved.
8920 * Licensed under the Apache License, Version 2.0 (the "License");
8921 * you may not use this file except in compliance with the License.
8922 * You may obtain a copy of the License at
8923 *
8924 * http://www.apache.org/licenses/LICENSE-2.0
8925 *
8926 * Unless required by applicable law or agreed to in writing, software
8927 * distributed under the License is distributed on an "AS IS" BASIS,
8928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8929 * See the License for the specific language governing permissions and
8930 * limitations under the License.
8931 * =============================================================================
8932 */function Kd(t){const{inputs:e,backend:n}=t,r=e;if(r.length===1)return Jn({inputs:{x:r[0]},backend:n});if(r.length>U().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const u=Math.floor(r.length/2),l=Kd({inputs:r.slice(0,u),backend:n}),c=Kd({inputs:r.slice(u),backend:n});return Kd({inputs:[l,c],backend:n})}const s=r.map(u=>u.dtype).reduce((u,l)=>zs(u,l)),i=r.map(u=>u.shape),a=U().getBool("WEBGL_PACK")?new _oe(r[0].shape,i):new boe(r[0].shape,i);return n.runWebGLProgram(a,r,s)}const Soe={kernelName:V$,backendName:"webgl",kernelFunc:Kd};/**
8933 * @license
8934 * Copyright 2020 Google LLC. All Rights Reserved.
8935 * Licensed under the Apache License, Version 2.0 (the "License");
8936 * you may not use this file except in compliance with the License.
8937 * You may obtain a copy of the License at
8938 *
8939 * http://www.apache.org/licenses/LICENSE-2.0
8940 *
8941 * Unless required by applicable law or agreed to in writing, software
8942 * distributed under the License is distributed on an "AS IS" BASIS,
8943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8944 * See the License for the specific language governing permissions and
8945 * limitations under the License.
8946 * =============================================================================
8947 */function Toe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,keepDims:o}=r,a=s.shape.length,u=Gt(i,s.shape);let l=u;const c=Ur(l,a);let h=s;c!=null&&(h=Tn({inputs:{x:s},backend:n,attrs:{perm:c}}),l=zr(l.length,a)),ws("all",l,a);const[d,f]=qs(h.shape,l),p=ne(f),y=se({inputs:{x:h},backend:n,attrs:{shape:[-1,p]}}),v=Wa(y,y.dtype,"all",n);let g;if(o){const x=vr(d,u);g=se({inputs:{x:v},backend:n,attrs:{shape:x}})}else g=se({inputs:{x:v},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),c!=null&&n.disposeIntermediateTensorInfo(h),g}const Coe={kernelName:B$,backendName:"webgl",kernelFunc:Toe};/**
8948 * @license
8949 * Copyright 2020 Google LLC. All Rights Reserved.
8950 * Licensed under the Apache License, Version 2.0 (the "License");
8951 * you may not use this file except in compliance with the License.
8952 * You may obtain a copy of the License at
8953 *
8954 * http://www.apache.org/licenses/LICENSE-2.0
8955 *
8956 * Unless required by applicable law or agreed to in writing, software
8957 * distributed under the License is distributed on an "AS IS" BASIS,
8958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8959 * See the License for the specific language governing permissions and
8960 * limitations under the License.
8961 * =============================================================================
8962 */function Noe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,keepDims:o}=r,a=s.shape.length,u=Gt(i,s.shape);let l=u;const c=Ur(l,a);let h=s;c!=null&&(h=Tn({inputs:{x:s},backend:n,attrs:{perm:c}}),l=zr(l.length,a)),ws("any",l,a);const[d,f]=qs(h.shape,l),p=ne(f),y=se({inputs:{x:h},backend:n,attrs:{shape:[-1,p]}}),v=Wa(y,y.dtype,"any",n);let g;if(o){const x=vr(d,u);g=se({inputs:{x:v},backend:n,attrs:{shape:x}})}else g=se({inputs:{x:v},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),c!=null&&n.disposeIntermediateTensorInfo(h),g}const Eoe={kernelName:W$,backendName:"webgl",kernelFunc:Noe};/**
8963 * @license
8964 * Copyright 2017 Google LLC. All Rights Reserved.
8965 * Licensed under the Apache License, Version 2.0 (the "License");
8966 * you may not use this file except in compliance with the License.
8967 * You may obtain a copy of the License at
8968 *
8969 * http://www.apache.org/licenses/LICENSE-2.0
8970 *
8971 * Unless required by applicable law or agreed to in writing, software
8972 * distributed under the License is distributed on an "AS IS" BASIS,
8973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8974 * See the License for the specific language governing permissions and
8975 * limitations under the License.
8976 * =============================================================================
8977 */class koe{constructor(e,n,r){this.variableNames=["A"];const{windowSize:s,batchSize:i,outSize:o}=e;r||this.variableNames.push("bestIndicesA"),this.outputShape=[i,o];const a=n==="max"?">":"<",u=r?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`
8978      void main() {
8979        ivec2 coords = getOutputCoords();
8980        int batch = coords[0];
8981        int outIdx = coords[1];
8982        int inOffset = outIdx * ${s};
8983
8984        int bestIndex = inOffset;
8985        float bestValue = getA(batch, bestIndex);
8986
8987        for (int i = 0; i < ${s}; i++) {
8988          int inIdx = ${u};
8989          float candidate = getA(batch, inIdx);
8990          if (candidate ${a} bestValue) {
8991            bestValue = candidate;
8992            bestIndex = inIdx;
8993          }
8994        }
8995        setOutput(float(bestIndex));
8996      }
8997    `}}/**
8998 * @license
8999 * Copyright 2019 Google LLC. All Rights Reserved.
9000 * Licensed under the Apache License, Version 2.0 (the "License");
9001 * you may not use this file except in compliance with the License.
9002 * You may obtain a copy of the License at
9003 *
9004 * http://www.apache.org/licenses/LICENSE-2.0
9005 *
9006 * Unless required by applicable law or agreed to in writing, software
9007 * distributed under the License is distributed on an "AS IS" BASIS,
9008 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9009 * See the License for the specific language governing permissions and
9010 * limitations under the License.
9011 * =============================================================================
9012 */class $oe{constructor(e,n,r,s){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,A(e.length>2,()=>`Packed arg${r.charAt(0).toUpperCase()+r.slice(1)} supports only inputs with rank above 2.`);const i=e[e.length-1],o=Math.ceil(i/n);this.outputShape=e.slice(0,-1),o>1&&this.outputShape.push(o),s||this.variableNames.push("bestIndicesA");const a=this.outputShape,u=a.length,l=qe(u),c=bn("coords",u);let h,d;if(o===1){d=u+1;const N=qe(d);h=`
9013        ${N} sourceLocR = ${N}(${c.join()}, 0);
9014        ++${c[u-1]};
9015        ${N} sourceLocG = ${N}(${c.join()}, 0);
9016        ++${c[u-2]};
9017        ${N} sourceLocA = ${N}(${c.join()}, 0);
9018        --${c[u-1]};
9019        ${N} sourceLocB = ${N}(${c.join()}, 0);
9020        --${c[u-2]};`}else d=u,h=`
9021        ${l} sourceLocR = coords;
9022        ++${c[u-1]};
9023        ${l} sourceLocG = coords;
9024        ++${c[u-2]};
9025        ${l} sourceLocA = coords;
9026        --${c[u-1]};
9027        ${l} sourceLocB = coords;
9028        --${c[u-2]};`;const f=["x","y","z","w","u","v"].slice(0,d),p="."+f[d-1],y=f.map(N=>"int "+N),v=bn("sourceLocR",d-1).concat("inIdx.r"),g=bn("sourceLocG",d-1).concat("inIdx.g"),x=bn("sourceLocB",d-1).concat("inIdx.b"),w=bn("sourceLocA",d-1).concat("inIdx.a"),_=r==="max"?"greaterThan":"lessThan",T=s?"":`
9029          inIdx = round(vec4(getBestIndicesAChannel(${v.join()}),
9030                             getBestIndicesAChannel(${g.join()}),
9031                             getBestIndicesAChannel(${x.join()}),
9032                             getBestIndicesAChannel(${w.join()})));`,E=`vec4(
9033            getAChannel(${v.join()}),
9034            hasNextCol ? getAChannel(${g.join()}) : 0.,
9035            hasNextRow ? getAChannel(${x.join()}) : 0.,
9036            hasNextRow && hasNextCol ? getAChannel(${w.join()}) : 0.)`,k=s?"":`
9037      float getBestIndicesAChannel(${y.join()}) {
9038        return getChannel(getBestIndicesA(${f.join()}),
9039                                          vec2(${f.slice(-2).join()}));
9040      }`;this.userCode=`
9041      float getAChannel(${y.join()}) {
9042        return getChannel(getA(${f.join()}),
9043                               vec2(${f.slice(-2).join()}));
9044      }
9045      ${k}
9046      void main() {
9047        ${l} coords = getOutputCoords();
9048        bool hasNextCol = ${c[u-1]}
9048 < ${a[u-1]-1};
9049        bool hasNextRow = ${c[u-2]} < ${a[u-2]-1};
9050        ${h}
9051        ivec4 srcIdx = ivec4(sourceLocR${p}, sourceLocG${p},
9052          sourceLocB${p}, sourceLocA${p}) * ${n};
9053        ivec4 inIdx = srcIdx;
9054        vec4 bestIndex = vec4(inIdx);
9055        vec4 bestValue = ${E};
9056
9057        for (int i = 0; i < ${n}; i++) {
9058          inIdx = srcIdx;
9059          ${T}
9060          vec4 candidate = ${E};
9061          bvec4 nan = isnan(candidate);
9062          bvec4 replace = bvec4(
9063            vec4(${_}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));
9064
9065          bestValue = vec4(replace.x  ? candidate.x : bestValue.x,
9066                           replace.y  ? candidate.y : bestValue.y,
9067                           replace.z  ? candidate.z : bestValue.z,
9068                           replace.w  ? candidate.w : bestValue.w);
9069          bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));
9070          srcIdx++;
9071        }
9072        setOutput(bestIndex);
9073      }
9074    `}}/**
9075 * @license
9076 * Copyright 2020 Google LLC. All Rights Reserved.
9077 * Licensed under the Apache License, Version 2.0 (the "License");
9078 * you may not use this file except in compliance with the License.
9079 * You may obtain a copy of the License at
9080 *
9081 * http://www.apache.org/licenses/LICENSE-2.0
9082 *
9083 * Unless required by applicable law or agreed to in writing, software
9084 * distributed under the License is distributed on an "AS IS" BASIS,
9085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9086 * See the License for the specific language governing permissions and
9087 * limitations under the License.
9088 * =============================================================================
9089 */function EP(t,e,n,r=null){let s=e.shape[0],i=e.shape[1];r!=null&&(s=r.shape[0],i=r.shape[1]);const o=wm(i),a={windowSize:o,inSize:i,batchSize:s,outSize:Math.ceil(i/o)},u=new koe(a,n,r==null),l=[e];r!=null&&l.push(r);const c=t.runWebGLProgram(u,l,"int32");if(c.shape[1]===1)return c;const h=EP(t,e,n,c);return t.disposeIntermediateTensorInfo(c),h}function kP(t,e,n,r=null){const s=r!=null?r.shape:e.shape,i=s[s.length-1],o=wm(i),a=new $oe(s,o,n,r==null),u=r==null?[e]:[e,r],l=t.runWebGLProgram(a,u,"int32");if(l.shape.length===e.shape.length){const c=kP(t,e,n,l);return t.disposeIntermediateTensorInfo(l),c}return l}function $P(t,e,n,r){const s=[n];if(ws("arg"+r.charAt(0).toUpperCase()+r.slice(1),s,e.shape.length),!U().getBool("WEBGL_PACK_REDUCE")||e.shape.length<=2){const i=[],o=t.texData.get(e.dataId),a=o!==null&&o.isPacked;let u=e;a&&(u=t.unpackTensor(e),i.push(u));const[l,c]=qs(u.shape,s),h=ne(c),d=se({inputs:{x:u},backend:t,attrs:{shape:[-1,h]}});i.push(d);const f=EP(t,d,r);i.push(f);const p=se({inputs:{x:f},backend:t,attrs:{shape:l}});return i.forEach(y=>t.disposeIntermediateTensorInfo(y)),p}return kP(t,e,r)}/**
9090 * @license
9091 * Copyright 2020 Google LLC. All Rights Reserved.
9092 * Licensed under the Apache License, Version 2.0 (the "License");
9093 * you may not use this file except in compliance with the License.
9094 * You may obtain a copy of the License at
9095 *
9096 * http://www.apache.org/licenses/LICENSE-2.0
9097 *
9098 * Unless required by applicable law or agreed to in writing, software
9099 * distributed under the License is distributed on an "AS IS" BASIS,
9100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9101 * See the License for the specific language governing permissions and
9102 * limitations under the License.
9103 * =============================================================================
9104 */function Ioe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i}=r;let o=Gt(i,s.shape);const a=Ur(o,s.shape.length);let u=s;const l=[];a!=null&&(u=Tn({inputs:{x:s},backend:n,attrs:{perm:a}}),l.push(u),o=zr(o.length,u.shape.length)),ws("argMax",[o[0]],u.shape.length);const c=$P(n,u,o[0],"max");return l.forEach(h=>n.disposeIntermediateTensorInfo(h)),c}const Aoe={kernelName:U$,backendName:"webgl",kernelFunc:Ioe};/**
9105 * @license
9106 * Copyright 2020 Google LLC. All Rights Reserved.
9107 * Licensed under the Apache License, Version 2.0 (the "License");
9108 * you may not use this file except in compliance with the License.
9109 * You may obtain a copy of the License at
9110 *
9111 * http://www.apache.org/licenses/LICENSE-2.0
9112 *
9113 * Unless required by applicable law or agreed to in writing, softw
9113are
9114 * distributed under the License is distributed on an "AS IS" BASIS,
9115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9116 * See the License for the specific language governing permissions and
9117 * limitations under the License.
9118 * =============================================================================
9119 */function Roe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i}=r;let o=Gt(i,s.shape);const a=Ur(o,s.shape.length);let u=s;const l=[];a!=null&&(u=Tn({inputs:{x:s},backend:n,attrs:{perm:a}}),l.push(u),o=zr(o.length,u.shape.length)),ws("argMin",[o[0]],u.shape.length);const c=$P(n,u,o[0],"min");return l.forEach(h=>n.disposeIntermediateTensorInfo(h)),c}const Ooe={kernelName:z$,backendName:"webgl",kernelFunc:Roe};/**
9120 * @license
9121 * Copyright 2020 Google LLC. All Rights Reserved.
9122 * Licensed under the Apache License, Version 2.0 (the "License");
9123 * you may not use this file except in compliance with the License.
9124 * You may obtain a copy of the License at
9125 *
9126 * http://www.apache.org/licenses/LICENSE-2.0
9127 *
9128 * Unless required by applicable law or agreed to in writing, software
9129 * distributed under the License is distributed on an "AS IS" BASIS,
9130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9131 * See the License for the specific language governing permissions and
9132 * limitations under the License.
9133 * =============================================================================
9134 */const Doe=jr+`
9135  if (abs(x) > 1.) {
9136    return NAN;
9137  }
9138  return asin(x);
9139`,Poe=Pe({opSnippet:Doe}),Foe={kernelName:j$,backendName:"webgl",kernelFunc:Poe};/**
9140 * @license
9141 * Copyright 2020 Google LLC. All Rights Reserved.
9142 * Licensed under the Apache License, Version 2.0 (the "License");
9143 * you may not use this file except in compliance with the License.
9144 * You may obtain a copy of the License at
9145 *
9146 * http://www.apache.org/licenses/LICENSE-2.0
9147 *
9148 * Unless required by applicable law or agreed to in writing, software
9149 * distributed under the License is distributed on an "AS IS" BASIS,
9150 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9151 * See the License for the specific language governing permissions and
9152 * limitations under the License.
9153 * =============================================================================
9154 */const Loe=jr+"return log(x + sqrt(x * x + 1.0));",Moe=Pe({opSnippet:Loe}),Voe={kernelName:G$,backendName:"webgl",kernelFunc:Moe};/**
9155 * @license
9156 * Copyright 2020 Google LLC. All Rights Reserved.
9157 * Licensed under the Apache License, Version 2.0 (the "License");
9158 * you may not use this file except in compliance with the License.
9159 * You may obtain a copy of the License at
9160 *
9161 * http://www.apache.org/licenses/LICENSE-2.0
9162 *
9163 * Unless required by applicable law or agreed to in writing, software
9164 * distributed under the License is distributed on an "AS IS" BASIS,
9165 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9166 * See the License for the specific language governing permissions and
9167 * limitations under the License.
9168 * =============================================================================
9169 */const Boe=jr+`
9170  return atan(x);
9171`,Woe=Pe({opSnippet:Boe}),Uoe={kernelName:H$,backendName:"webgl",kernelFunc:Woe};/**
9172 * @license
9173 * Copyright 2020 Google LLC. All Rights Reserved.
9174 * Licensed under the Apache License, Version 2.0 (the "License");
9175 * you may not use this file except in compliance with the License.
9176 * You may obtain a copy of the License at
9177 *
9178 * http://www.apache.org/licenses/LICENSE-2.0
9179 *
9180 * Unless required by applicable law or agreed to in writing, software
9181 * distributed under the License is distributed on an "AS IS" BASIS,
9182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9183 * See the License for the specific language governing permissions and
9184 * limitations under the License.
9185 * =============================================================================
9186 */const zoe=fw+`
9187  return atan(a, b);
9188`,joe=`
9189  vec4 result = atan(a, b);
9190  bvec4 isNaNA = isnan(a);
9191  bvec4 isNaNB = isnan(b);
9192  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
9193  `+Ba+`
9194  return result;
9195`,Goe=tn({opSnippet:zoe,packedOpSnippet:joe}),Hoe={kernelName:K$,backendName:"webgl",kernelFunc:Goe};/**
9196 * @license
9197 * Copyright 2020 Google LLC. All Rights Reserved.
9198 * Licensed under the Apache License, Version 2.0 (the "License");
9199 * you may not use this file except in compliance with the License.
9200 * You may obtain a copy of the License at
9201 *
9202 * http://www.apache.org/licenses/LICENSE-2.0
9203 *
9204 * Unless required by applicable law or agreed to in writing, software
9205 * distributed under the License is distributed on an "AS IS" BASIS,
9206 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9207 * See the License for the specific language governing permissions and
9208 * limitations under the License.
9209 * =============================================================================
9210 */const qoe=jr+`
9211  if ((x < -1.0) || (x > 1.0)) return NAN;
9212return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,Koe=Pe({opSnippet:qoe}),Xoe={kernelName:q$,backendName:"webgl",kernelFunc:Koe};/**
9213 * @license
9214 * Copyright 2017 Google LLC. All Rights Reserved.
9215 * Licensed under the Apache License, Version 2.0 (the "License");
9216 * you may not use this file except in compliance with the License.
9217 * You may obtain a copy of the License at
9218 *
9219 * http://www.apache.org/licenses/LICENSE-2.0
9220 *
9221 * Unless required by applicable law or agreed to in writing, software
9222 * distributed under the License is distributed on an "AS IS" BASIS,
9223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9224 * See the License for the specific language governing permissions and
9225 * limitations under the License.
9226 * =============================================================================
9227 */class Yc{constructor(e,n,r,s=!1,i=!1){if(this.variableNames=["x"],n==="avg"&&r)throw new Error("Cannot compute positions for average pool.");const o=e.filterWidth,a=e.strideHeight,u=e.strideWidth,l=e.dilationHeight,c=e.dilationWidth,h=e.effectiveFilterHeight,d=e.effectiveFilterWidth,f=e.padInfo.top,p=e.padInfo.left;this.outputShape=e.outShape;const y=n==="avg",v=`((batch  * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let x="0.0";if(y||(x="-1.0 / 1e-20"),r){const N=">=";this.userCode=`
9228        const ivec2 strides = ivec2(${a}, ${u});
9229        const ivec2 pads = ivec2(${f}, ${p});
9230
9231        void main() {
9232          ivec4 coords = getOutputCoords();
9233          int batch = coords[0];
9234          int d = coords[3];
9235
9236          ivec2 xRCCorner = coords.yz * strides - pads;
9237          int xRCorner = xRCCorner.x;
9238          int xCCorner = xRCCorner.y;
9239
9240          // max/min x(?, ?, d) to get y(yR, yC, d).
9241          // ? = to be determined
9242          float minMaxValue = 0.0;
9243          float minMaxValueFound = 0.0;
9244          int minMaxPosition = 0;
9245          float avgValue = 0.0;
9246
9247          for (int wR = 0; wR < ${h};
9248              wR += ${l}) {
9249            int xR = xRCorner + wR;
9250
9251            if (xR < 0 || xR >= ${e.inHeight}) {
9252              continue;
9253            }
9254
9255            for (int wC = 0; wC < ${d};
9256                wC += ${c}) {
9257              int xC = xCCorner + wC;
9258
9259              if (xC < 0 || xC >= ${e.inWidth}) {
9260                continue;
9261              }
9262
9263              float value = getX(batch, xR, xC, d);
9264
9265              // If a min / max value has already been found, use it. If not,
9266              // use the current value.
9267              float currMinMaxValue = mix(
9268                  value, minMaxValue, minMaxValueFound);
9269              if (value ${N} currMinMaxValue) {
9270                minMaxValue = value;
9271                minMaxValueFound = 1.0;
9272                minMaxPosition = ${s?i?v:g:`wR * ${d} + wC`};
9273              }
9274            }
9275          }
9276          setOutput(float(minMaxPosition));
9277        }
9278      `;return}const w="max";let _=`${n}(${n}(${n}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;n==="avg"&&(_="avgValue / max(count, 1.0)");const T=Math.floor(o/4)*4,E=o%4,k=`
9279      if (${y}) {
9280        avgValue += dot(values, ones);
9281      } else {
9282        minMaxValue = ${w}(values, minMaxValue);
9283      }
9284    `;this.userCode=`
9285      const ivec2 strides = ivec2(${a}, ${u});
9286      const ivec2 pads = ivec2(${f}, ${p});
9287      const float initializationValue = ${x};
9288      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
9289
9290      float count = 0.0;
9291
9292      float getValue(int batch, int xR, int xC, int d) {
9293        if (xC < 0 || xC >= ${e.inWidth}) {
9294          return initializationValue;
9295        }
9296        count += 1.0;
9297        return getX(batch, xR, xC, d);
9298      }
9299
9300      void main() {
9301        ivec4 coords = getOutputCoords();
9302        int batch = coords[0];
9303        int d = coords[3];
9304
9305        ivec2 xRCCorner = coords.yz * strides - pads;
9306        int xRCorner = xRCCorner.x;
9307        int xCCorner = xRCCorner.y;
9308
9309        // max/min x(?, ?, d) to get y(yR, yC, d).
9310        // ? = to be determined
9311        vec4 minMaxValue = vec4(${x});
9312        float avgValue = 0.0;
9313        count = 0.0;
9314
9315        for (int wR = 0; wR < ${h};
9316            wR += ${l}) {
9317          int xR = xRCorner + wR;
9318
9319          if (xR < 0 || xR >= ${e.inHeight}) {
9320            continue;
9321          }
9322
9323          for (int wC = 0; wC < ${T}; wC += 4) {
9324            int xC = xCCorner + wC * ${c};
9325
9326            vec4 values = vec4(
9327              getValue(batch, xR, xC, d),
9328              getValue(batch, xR, xC + ${c}, d),
9329              getValue(batch, xR, xC + 2 * ${c}, d),
9330              getValue(batch, xR, xC + 3 * ${c}, d)
9331            );
9332
9333            ${k}
9334          }
9335
9336          int xC = xCCorner + ${T};
9337          if (${E===1}) {
9338            vec4 values = vec4(
9339              getValue(batch, xR, xC, d),
9340              initializationValue,
9341              initializationValue,
9342              initializationValue
9343            );
9344
9345            ${k}
9346          } else if (${E===2}) {
9347            vec4 values = vec4(
9348              getValue(batch, xR, xC, d),
9349              getValue(batch, xR, xC + ${c}, d),
9350              initializationValue,
9351              initializationValue
9352            );
9353
9354            ${k}
9355          } else if (${E===3}) {
9356            vec4 values = vec4(
9357              getValue(batch, xR, xC, d),
9358              getValue(batch, xR, xC + ${c}, d),
9359              getValue(batch, xR, xC + 2 * ${c}, d),
9360              initializationValue
9361            );
9362
9363            ${k}
9364          }
9365        }
9366        setOutput(${_});
9367      }
9368    `}}class mw{constructor(e,n,r,s=!1,i=!1){if(this.variableNames=["x"],n==="avg"&&r)throw new Error("Cannot compute positions for average pool.");const o=e.filterWidth,a=e.strideDepth,u=e.strideHeight,l=e.strideWidth,c=e.dilationDepth,h=e.dilationHeight,d=e.dilationWidth,f=e.effectiveFilterDepth,p=e.effectiveFilterHeight,y=e.effectiveFilterWidth,v=e.padInfo.front,g=e.padInfo.top,x=e.padInfo.left;this.outputShape=e.outShape;const w=n==="avg";let _="0.0";if(w||(_="-1.0 / 1e-20"),r){const R=">=";this.userCode=`
9369        const ivec3 strides =
9370            ivec3(${a}, ${u}, ${l});
9371        const ivec3 pads = ivec3(${v}, ${g}, ${x});
9372
9373        void main() {
9374          ivec5 coords = getOutputCoords();
9375          int batch = coords.x;
9376          int ch = coords.u;
9377
9378          ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
9379          int xDCorner = xCorner.x;
9380          int xRCorner = xCorner.y;
9381          int xCCorner = xCorner.z;
9382
9383          // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
9384          // ? = to be determined
9385          float minMaxValue = 0.0;
9386          float minMaxValueFound = 0.0;
9387          int minMaxPosition = 0;
9388
9389          for (int wD = 0; wD < ${f};
9390              wD += ${c}) {
9391            int xD = xDCorner + wD;
9392
9393            if (xD < 0 || xD >= ${e.inDepth}) {
9394              continue;
9395            }
9396
9397            for (int wR = 0; wR < ${p};
9398                wR += ${h}) {
9399              int xR = xRCorner + wR;
9400
9401              if (xR < 0 || xR >= ${e.inHeight}) {
9402                continue;
9403              }
9404
9405              for (int wC = 0; wC < ${y};
9406                  wC += ${d}) {
9407                int xC = xCCorner + wC;
9408
9409                if (xC < 0 || xC >= ${e.inWidth}) {
9410                  continue;
9411                }
9412
9413                float value = getX(batch, xD, xR, xC, ch);
9414
9415                // If a min / max value has already been found, use it. If not,
9416                // use the current value.
9417                float currMinMaxValue = mix(
9418                    value, minMaxValue, minMaxValueFound);
9419                if (value ${R} currMinMaxValue) {
9420                  minMaxValue = value;
9421                  minMaxValueFound = 1.0;
9422                  minMaxPosition = ${s?i?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${p} * ${y} +
9423                      wR * ${y} + wC`};
9424                }
9425              }
9426            }
9427          }
9428          setOutput(float(minMaxPosition));
9429        }
9430      `;return}const T="max";let E=`${n}(${n}(${n}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;n==="avg"&&(E="avgValue / max(count, 1.0)");const k=Math.floor(o/4)*4,N=o%4,O=`
9431      if (${w}) {
9432        avgValue += dot(values, ones);
9433      } else {
9434        minMaxValue = ${T}(values, minMaxValue);
9435      }
9436    `;this.userCode=`
9437      const ivec3 strides =
9438        ivec3(${a}, ${u}, ${l});
9439      const ivec3 pads = ivec3(${v}, ${g}, ${x});
9440      const float initializationValue = ${_};
9441      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
9442
9443      float count = 0.0;
9444
9445      float getValue(int batch, int xD, int xR, int xC, int ch) {
9446        if (xC < 0 || xC >= ${e.inWidth}) {
9447          return initializationValue;
9448        }
9449        count += 1.0;
9450        return getX(batch, xD, xR, xC, ch);
9451      }
9452
9453      void main() {
9454        ivec5 coords = getOutputCoords();
9455        int batch = coords.x;
9456        int ch = coords.u;
9457
9458        ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
9459        int xDCorner = xCorner.x;
9460        int xRCorner = xCorner.y;
9461        int xCCorner = xCorner.z;
9462
9463        // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).
9464        // ? = to be determined
9465        vec4 minMaxValue = vec4(${_});
9466        float avgValue = 0.0;
9467        count = 0.0;
9468
9469        for (int wD = 0; wD < ${f};
9470            wD += ${c}) {
9471          int xD = xDCorner + wD;
9472
9473          if (xD < 0 || xD >= ${e.inDepth}) {
9474            continue;
9475          }
9476
9477          for (int wR = 0; wR < ${p};
9478            wR += ${h}) {
9479            int xR = xRCorner + wR;
9480
9481            if (xR < 0 || xR >= ${e.inHeight}) {
9482              continue;
9483            }
9484
9485            for (int wC = 0; wC < ${k}; wC += 4) {
9486              int xC = xCCorner + wC * ${d};
9487
9488              vec4 values = vec4(
9489                getValue(batch, xD, xR, xC, ch),
9490                getValue(batch, xD, xR, xC + ${d}, ch),
9491                getValue(batch, xD, xR, xC + 2 * ${d}, ch),
9492                getValue(batch, xD, xR, xC + 3 * ${d}, ch)
9493              );
9494
9495              ${O}
9496            }
9497
9498            int xC = xCCorner + ${k};
9499            if (${N===1}) {
9500              vec4 values = vec4(
9501                getValue(batch, xD, xR, xC, ch),
9502                initializationValue,
9503                initializationValue,
9504                initializationValue
9505              );
9506
9507              ${O}
9508            } else if (${N===2}) {
9509              vec4 values = vec4(
9510                getValue(batch, xD, xR, xC, ch),
9511                getValue(batch, xD, xR, xC + ${d}, ch),
9512                initializationValue,
9513                initializationValue
9514              );
9515
9516              ${O}
9517            } else if (${N===3}) {
9518              vec4 values = vec4(
9519                getValue(batch, xD, xR, xC, ch),
9520                getValue(batch, xD, xR, xC + ${d}, ch),
9521                getValue(batch, xD, xR, xC + 2 * ${d}, ch),
9522                initializationValue
9523              );
9524
9525              ${O}
9526            }
9527          }
9528        }
9529        setOutput(${E});
9530      }
9531    `}}/**
9532 * @license
9533 * Copyright 2020 Google LLC. All Rights Reserved.
9534 * Licensed under the Apache License, Version 2.0 (the "License");
9535 * you may not use this file except in compliance with the License.
9536 * You may obtain a copy of the License at
9537 *
9538 * http://www.apache.org/licenses/LICENSE-2.0
9539 *
9540 * Unless required by applicable law or agreed to in writing, software
9541 * distributed under the License is distributed on an "AS IS" BASIS,
9542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9543 * See the License for the specific language governing permissions and
9544 * limitations under the License.
9545 * =============================================================================
9546 */function Yoe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e;Ch(s,"avgPool");const{filterSize:i,strides:o,pad:a,dimRoundingMode:u}=r,l=1;A(tr(o,l),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${l}'`);const c=Da(s.shape,i,o,l,a,u);if(c.filterWidth===1&&c.filterHeight===1&&xt(c.inShape,c.outShape))return Jn({inputs:{x:s},backend:n});const h=new Yc(c,"avg",!1);return n.runWebGLProgram(h,[s],"float32")}const Qoe={kernelName:X$,backendName:"webgl",kernelFunc:Yoe};/**
9547 * @license
9548 * Copyright 2020 Google LLC. All Rights Reserved.
9549 * Licensed under the Apache License, Version 2.0 (the "License");
9550 * you may not use this file except in compliance with the License.
9551 * You may obtain a copy of the License at
9552 *
9553 * http://www.apache.org/licenses/LICENSE-2.0
9554 *
9555 * Unless required by applicable law or agreed to in writing, software
9556 * distributed under the License is distributed on an "AS IS" BASIS,
9557 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9558 * See the License for the specific language governing permissions and
9559 * limitations under the License.
9560 * =============================================================================
9561 */function Zoe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:i,strides:o,pad:a,dimRoundingMode:u,dataFormat:l}=r,c=[1,1,1],h=wh(s.shape,i,o,c,a,u,l),d=new mw(h,"avg",!1);return n.runWebGLProgram(d,[s],"float32")}const Joe={kernelName:Y$,backendName:"webgl",kernelFunc:Zoe};/**
9562 * @license
9563 * Copyright 2017 Google LLC. All Rights Reserved.
9564 * Licensed under the Apache License, Version 2.0 (the "License");
9565 * you may not use this file except in compliance with the License.
9566 * You may obtain a copy of the License at
9567 *
9568 * http://www.apache.org/licenses/LICENSE-2.0
9569 *
9570 * Unless required by applicable law or agreed to in writing, software
9571 * distributed under the License is distributed on an "AS IS" BASIS,
9572 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9573 * See the License for the specific language governing permissions and
9574 * limitations under the License.
9575 * =============================================================================
9576 */class eae{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const n=e.filterHeight,r=e.filterWidth,s=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,u=e.effectiveFilterHeight,l=e.effectiveFilterWidth,c=u-1-e.padInfo.top,h=l-1-e.padInfo.left,d=1/(n*r);this.userCode=`
9577      const ivec2 pads = ivec2(${c}, ${h});
9578      const float avgMultiplier = float(${d});
9579
9580      void main() {
9581        ivec4 coords = getOutputCoords();
9582        int b = coords[0];
9583        int d = coords[3];
9584
9585        ivec2 dyRCCorner = coords.yz - pads;
9586        int dyRCorner = dyRCCorner.x;
9587        int dyCCorner = dyRCCorner.y;
9588
9589        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
9590        // ? = to be determined. : = across all values in that axis.
9591        float dotProd = 0.0;
9592        for (int wR = 0; wR < ${u};
9593            wR += ${o}) {
9594          float dyR = float(dyRCorner + wR) / ${s}.0;
9595
9596          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
9597            continue;
9598          }
9599          int idyR = int(dyR);
9600
9601          for (int wC = 0; wC < ${l};
9602            wC+= ${a}) {
9603            float dyC = float(dyCCorner + wC) / ${i}.0;
9604
9605            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
9606                fract(dyC) > 0.0) {
9607              continue;
9608            }
9609            int idyC = int(dyC);
9610
9611            float dyValue = getDy(b, idyR, idyC, d);
9612
9613            dotProd += dyValue * avgMultiplier;
9614          }
9615        }
9616        setOutput(dotProd);
9617      }
9618    `}}class tae{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const n=e.filterDepth,r=e.filterHeight,s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,a=e.strideWidth,u=e.dilationDepth,l=e.dilationHeight,c=e.dilationWidth,h=e.effectiveFilterDepth,d=e.effectiveFilterHeight,f=e.effectiveFilterWidth,p=h-1-e.padInfo.front,y=d-1-e.padInfo.top,v=f-1-e.padInfo.left,g=1/(n*r*s);this.userCode=`
9619      const ivec3 pads = ivec3(${p}, ${y}, ${v});
9620      const float avgMultiplier = float(${g});
9621
9622      void main() {
9623        ivec5 coords = getOutputCoords();
9624        int batch = coords.x;
9625        int ch = coords.u;
9626
9627        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
9628        int dyDCorner = dyCorner.x;
9629        int dyRCorner = dyCorner.y;
9630        int dyCCorner = dyCorner.z;
9631
9632        // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
9633        // dx(xD, xR, xC, ch).
9634        // ? = to be determined. : = across all values in that axis.
9635        float dotProd = 0.0;
9636
9637        for (int wD = 0; wD < ${h};
9638            wD += ${u}) {
9639          float dyD = float(dyDCorner + wD) / ${i}.0;
9640
9641          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {
9642            continue;
9643          }
9644          int idyD = int(dyD);
9645
9646          for (int wR = 0; wR < ${d};
9647              wR += ${l}) {
9648            float dyR = float(dyRCorner + wR) / ${o}.0;
9649
9650            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
9651                fract(dyR) > 0.0) {
9652              continue;
9653            }
9654            int idyR = int(dyR);
9655
9656            for (int wC = 0; wC < ${f};
9657                wC += ${c}) {
9658              float dyC = float(dyCCorner + wC) / ${a}.0;
9659
9660              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
9661                  fract(dyC) > 0.0) {
9662                continue;
9663              }
9664              int idyC = int(dyC);
9665
9666              float dyValue = getDy(batch, idyD, idyR, idyC, ch);
9667
9668              dotProd += dyValue * avgMultiplier;
9669            }
9670          }
9671        }
9672        setOutput(dotProd);
9673      }
9674    `}}/**
9675 * @license
9676 * Copyright 2020 Google LLC. All Rights Reserved.
9677 * Licensed under the Apache License, Version 2.0 (the "License");
9678 * you may not use this file except in compliance with the License.
9679 * You may obtain a copy of the License at
9680 *
9681 * http://www.apache.org/licenses/LICENSE-2.0
9682 *
9683 * Unless required by applicable law or agreed to in writing, software
9684 * distributed under the License is distributed on an "AS IS" BASIS,
9685 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9686 * See the License for the specific language governing permissions and
9687 * limitations under the License.
9688 * =============================================================================
9689 */function nae(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:i}=e,o=i,{filterSize:a,strides:u,pad:l,dimRoundingMode:c}=r,h=[1,1,1],d=wh(o.shape,a,u,h,l,c),f=new tae(d);return n.runWebGLProgram(f,[s],o.dtype)}const rae={kernelName:v5,backendName:"webgl",kernelFunc:nae};/**
9690 * @license
9691 * Copyright 2020 Google LLC. All Rights Reserved.
9692 * Licensed under the Apache License, Version 2.0 (the "License");
9693 * you may not use this file except in compliance with the License.
9694 * You may obtain a copy of the License at
9695 *
9696 * http://www.apache.org/licenses/LICENSE-2.0
9697 *
9698 * Unless required by applicable law or agreed to in writing, software
9699 * distributed under the License is distributed on an "AS IS" BASIS,
9700 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9701 * See the License for the specific language governing permissions and
9702 * limitations under the License.
9703 * =============================================================================
9704 */function sae(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:i}=e,o=i;Ch([s,i],"avgPoolGrad");const{filterSize:a,strides:u,pad:l}=r,c=Da(o.shape,a,u,1,l),h=new eae(c);return n.runWebGLProgram(h,[s],o.dtype)}const iae={kernelName:y5,backendName:"webgl",kernelFunc:sae};/**
9705 * @license
9706 * Copyright 2020 Google LLC. All Rights Reserved.
9707 * Licensed under the Apache License, Version 2.0 (the "License");
9708 * you may not use this file except in compliance with the License.
9709 * You may obtain a copy of the License at
9710 *
9711 * http://www.apache.org/licenses/LICENSE-2.0
9712 *
9713 * Unless required by applicable law or agreed to in writing, software
9714 * distributed under the License is distributed on an "AS IS" BASIS,
9715 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9716 * See the License for the specific language governing permissions and
9717 * limitations under the License.
9718 * =============================================================================
9719 */function oae(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:i}=e,{transposeA:o,transposeB:a}=r;return op({a:s,b:i,transposeA:o,transposeB:a,backend:n})}const aae={kernelName:Q$,backendName:"webgl",kernelFunc:oae};/**
9720 * @license
9721 * Copyright 2017 Google LLC. All Rights Reserved.
9722 * Licensed under the Apache License, Version 2.0 (the "License");
9723 * you may not use this file except in compliance with the License.
9724 * You may obtain a copy of the License at
9725 *
9726 * http://www.apache.org/licenses/LICENSE-2.0
9727 *
9728 * Unless required by applicable law or agreed to in writing, software
9729 * distributed under the License is distributed on an "AS IS" BASIS,
9730 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9731 * See the License for the specific language governing permissions and
9732 * limitations under the License.
9733 * =============================================================================
9734 */class uae{constructor(e,n,r,s,i,o){this.outputShape=[],this.variableNames=["x","mean","variance"],Le(e,n),Le(e,r);let a="0.0";s!=null&&(Le(e,s),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let u="1.0";i!=null&&(Le(e,i),this.variableNames.push("scale"),u="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`
9735      void main() {
9736        float x = getXAtOutCoords();
9737        float mean = getMeanAtOutCoords();
9738        float variance = getVarianceAtOutCoords();
9739        float offset = ${a};
9740        float scale = ${u};
9741        float inv = scale * inversesqrt(variance + float(${o}));
9742        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));
9743      }
9744    `}}/**
9745 * @license
9746 * Copyright 2018 Google LLC. All Rights Reserved.
9747 * Licensed under the Apache License, Version 2.0 (the "License");
9748 * you may not use this file except in compliance with the License.
9749 * You may obtain a copy of the License at
9750 *
9751 * http://www.apache.org/licenses/LICENSE-2.0
9752 *
9753 * Unless required by applicable law or agreed to in writing, software
9754 * distributed under the License is distributed on an "AS IS" BASIS,
9755 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9756 * See the License for the specific language governing permissions and
9757 * limitations under the License.
9758 * =============================================================================
9759 */class lae{constructor(e,n,r,s,i,o){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Le(e,n),Le(e,r);let a="vec4(0.0)";s!=null&&(Le(e,s),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let u="vec4(1.0)";
vendor: 4,905 bytes, lines 9759-9843
9759i!=null&&(Le(e,i),this.variableNames.push("scale"),u="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`
9760      void main() {
9761        vec4 offset = ${a};
9762        vec4 scale = ${u};
9763
9764        vec4 x = getXAtOutCoords();
9765        vec4 mean = getMeanAtOutCoords();
9766        vec4 variance = getVarianceAtOutCoords();
9767
9768        vec4 inv = scale * inversesqrt(variance + vec4(${o}));
9769
9770        setOutput((x - mean) * inv + offset);
9771      }
9772    `}}/**
9773 * @license
9774 * Copyright 2020 Google LLC. All Rights Reserved.
9775 * Licensed under the Apache License, Version 2.0 (the "License");
9776 * you may not use this file except in compliance with the License.
9777 * You may obtain a copy of the License at
9778 *
9779 * http://www.apache.org/licenses/LICENSE-2.0
9780 *
9781 * Unless required by applicable law or agreed to in writing, software
9782 * distributed under the License is distributed on an "AS IS" BASIS,
9783 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9784 * See the License for the specific language governing permissions and
9785 * limitations under the License.
9786 * =============================================================================
9787 */const cae=({inputs:t,backend:e,attrs:n})=>{const{x:r,mean:s,variance:i,offset:o,scale:a}=t;A(s.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),A(o==null||s.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),A(a==null||s.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:u}=n;u==null&&(u=.001);const l=[r,s,i];let c=null;o!=null&&(c=o.shape,l.push(o));let h=null;a!=null&&(h=a.shape,l.push(a));const d=U().getBool("WEBGL_PACK_NORMALIZATION")?new lae(r.shape,s.shape,i.shape,c,h,u):new uae(r.shape,s.shape,i.shape,c,h,u);return e.runWebGLProgram(d,l,l[0].dtype)},hae={kernelName:LI,backendName:"webgl",kernelFunc:cae};/**
9788 * @license
9789 * Copyright 2017 Google LLC. All Rights Reserved.
9790 * Licensed under the Apache License, Version 2.0 (the "License");
9791 * you may not use this file except in compliance with the License.
9792 * You may obtain a copy of the License at
9793 *
9794 * http://www.apache.org/licenses/LICENSE-2.0
9795 *
9796 * Unless required by applicable law or agreed to in writing, software
9797 * distributed under the License is distributed on an "AS IS" BASIS,
9798 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9799 * See the License for the specific language governing permissions and
9800 * limitations under the License.
9801 * =============================================================================
9802 */class dae{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const n=qe(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const r=fae(this.rank);let s;const i=e.map((o,a)=>`sourceLoc.${iv[a]} = start[${a}] + coords.${iv[a]};`);s=`
9803        ${n} sourceLoc;
9804        ${n} coords = getOutputCoords();
9805        ${i.join(`
9806`)}
9807      `,this.userCode=`
9808      void main() {
9809        ${s}
9810        setOutput(getSource(${r}));
9811      }
9812    `}}const iv=["x","y","z","w","u","v"];function fae(t){if(t===1)return"sourceLoc";if(t<=6)return iv.slice(0,t).map(e=>"sourceLoc."+e).join(",");throw Error(`Slicing for rank ${t} is not yet supported`)}/**
9813 * @license
9814 * Copyright 2019 Google LLC. All Rights Reserved.
9815 * Licensed under the Apache License, Version 2.0 (the "License");
9816 * you may not use this file except in compliance with the License.
9817 * You may obtain a copy of the License at
9818 *
9819 * http://www.apache.org/licenses/LICENSE-2.0
9820 *
9821 * Unless required by applicable law or agreed to in writing, software
9822 * distributed under the License is distributed on an "AS IS" BASIS,
9823 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9824 * See the License for the specific language governing permissions and
9825 * limitations under the License.
9826 * =============================================================================
9827 */class pae{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=qe(this.rank),r=bn("coords",this.rank),s=bn("sourceLoc",this.rank),i=this.rank===1?"sourceLoc":`vec2(${s.slice(-2).join()})`,o=`getChannel(getSource(${s.join()}), ${i})`,a=`
9828      result.x = ${o};
9829      if (++${r[this.rank-1]} < ${e[this.rank-1]}) {
9830        ++${s[this.rank-1]};
9831        result.y = ${o};
9832        --${s[this.rank-1]};
9833      }
9834    `,u=this.rank===1?"":`
9835      --${r[this.rank-1]};
9836      if (++${r[this.rank-2]} < ${e[this.rank-2]}) {
9837        ++${s[this.rank-2]};
9838        result.z = ${o};
9839        if (++${r[this.rank-1]} < ${e[this.rank-1]}) {
9840          ++${s[this.rank-1]};
9841          result.w = ${o};
9842        }
9843      }
9844    `,l=this.rank<=4?`sourceLoc = coords +
9845            ${n}(${e.map((c,h)=>`start[${h}]`).join()});`:e.map((c,h)=>`${s[h]} = ${r[h]} + start[${h}];`).join(`
9846`);this.userCode=`
9847      void main() {
9848        ${n} coords = getOutputCoords();
9849        ${n} sourceLoc;
9850        ${l}
9851        vec4 result = vec4(0.);
9852        ${a}
9853        ${u}
9854        setOutput(result);
9855      }
9856    `}}/**
9857 * @license
9858 * Copyright 2020 Google LLC. All Rights Reserved.
9859 * Licensed under the Apache License, Version 2.0 (the "License");
9860 * you may not use this file except in compliance with the License.
9861 * You may obtain a copy of the License at
9862 *
9863 * http://www.apache.org/licenses/LICENSE-2.0
9864 *
9865 * Unless required by applicable law or agreed to in writing, software
9866 * distributed under the License is distributed on an "AS IS" BASIS,
9867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9868 * See the License for the specific language governing permissions and
9869 * limitations under the License.
9870 * =============================================================================
9871 */function mae(t,e,n,r){const s=r.texData.get(t.dataId),i=r.makeTensorInfo(n,t.dtype),o=r.texData.get(i.dataId);Object.assign(o,s),o.refCount=1,o.shape=n,o.dtype=t.dtype;let a=nw(e,Zt(t.shape));s.slice&&(a+=s.slice.flatOffset),o.slice={flatOffset:a,origDataId:s.slice&&s.slice.origDataId||t.dataId};const u=r.dataRefCount.get(o.slice.origDataId)||1;return r.dataRefCount.set(o.slice.origDataId,u+1),i}function Cl(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{begin:i,size:o}=r,[a,u]=fD(s,i,o);if(rD(s,a,u),ne(u)===0)return n.makeTensorInfo(u,s.dtype,[]);if(n.shouldExecuteOnCPU([s])||s.dtype==="string"){const h=n.texData.get(s.dataId),d=aie(h.values,a,u,s.shape,s.dtype);return n.makeTensorInfo(u,s.dtype,d)}const{isPacked:l}=n.texData.get(s.dataId),c=tw(s.shape,a,u);if(l||!c){const h=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new pae(u):new dae(u),d=[a];return n.runWebGLProgram(h,[s],s.dtype,d)}return n.uploadToGPU(s.dataId),mae(s,a,u,n)}const gae={kernelName:HA,backendName:"webgl",kernelFunc:Cl};/**
9872 * @license
9873 * Copyright 2020 Google LLC. All Rights Reserved.
9874 * Licensed under the Apache License, Version 2.0 (the "License");
9875 * you may not use this file except in compliance with the License.
9876 * You may obtain a copy of the License at
9877 *
9878 * http://www.apache.org/licenses/LICENSE-2.0
9879 *
9880 * Unless required by applicable law or agreed to in writing, software
9881 * distributed under the License is distributed on an "AS IS" BASIS,
9882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9883 * See the License for the specific language governing permissions and
9884 * limitations under the License.
9885 * =============================================================================
9886 */const yae=t=>{const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockShape:i,crops:o}=r;A(s.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");const a=i.reduce((x,w)=>x*w),u=sw(s.shape,i,a),l=iw(u.length,i.length),c=ow(s.shape,i,a),h=bD(o,i.length),d=_D(c,o,i.length),f=[],p=se({inputs:{x:s},backend:n,attrs:{shape:u}}),y=Tn({inputs:{x:p},backend:n,attrs:{perm:l}}),v=se({inputs:{x:y},backend:n,attrs:{shape:c}}),g=Cl({inputs:{x:v},backend:n,attrs:{begin:h,size:d}});return f.push(p),f.push(y),f.push(v),f.forEach(x=>n.disposeIntermediateTensorInfo(x)),g},vae={kernelName:Z$,backendName:"webgl",kernelFunc:yae};/**
9887 * @license
9888 * Copyright 2020 Google LLC. All Rights Reserved.
9889 * Licensed under the Apache License, Version 2.0 (the "License");
9890 * you may not use this file except in compliance with the License.
9891 * You may obtain a copy of the License at
9892 *
9893 * http://www.apache.org/licenses/LICENSE-2.0
9894 *
9895 * Unless required by applicable law or agreed to in writing, software
9896 * distributed under the License is distributed on an "AS IS" BASIS,
9897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9898 * See the License for the specific language governing permissions and
9899 * limitations under the License.
9900 * =============================================================================
9901 */function xae(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,weights:i}=e,{size:o}=r,a=n.readSync(s.dataId),u=n.readSync(i.dataId),l=gP(a,u,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,l)}const wae={kernelName:J$,backendName:"webgl",kernelFunc:xae};/**
9902 * @license
9903 * Copyright 2023 Google LLC.
9904 * Licensed under the Apache License, Version 2.0 (the "License");
9905 * you may not use this file except in compliance with the License.
9906 * You may obtain a copy of the License at
9907 *
9908 * http://www.apache.org/licenses/LICENSE-2.0
9909 *
9910 * Unless required by applicable law or agreed to in writing, software
9911 * distributed under the License is distributed on an "AS IS" BASIS,
9912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9913 * See the License for the specific language governing permissions and
9914 * limitations under the License.
9915 * =============================================================================
9916 */const bae=`
9917  int r = int(a.r) & int(b.r);
9918  int g = int(a.g) & int(b.g);
9919  int rb = int(a.b) & int(b.b);
9920  int ra = int(a.a) & int(b.a);
9921  return vec4(r, g, rb, ra);
9922`,_ae=`
9923  return float(int(a.r) & int(b.r));
9924`;function Sae(t){const{inputs:e,backend:n}=t,{a:r,b:s}=e,i=U().getBool("WEBGL_PACK_BINARY_OPERATIONS"),o=U().getNumber("WEBGL_VERSION");if(n.shouldExecuteOnCPU([r,s])||o===1){const u=n.texData.get(r.dataId).values,l=n.texData.get(s.dataId).values,[c,h]=Ase(r.shape,s.shape,u,l,r.dtype),d=n.makeTensorInfo(h,r.dtype),f=n.texData.get(d.dataId);return f.values=c,d}let a;return i?a=new Sl(bae,r.shape,s.shape,!1):a=new Na(_ae,r.shape,s.shape),n.runWebGLProgram(a,[r,s],r.dtype)}const Tae={kernelName:eI,backendName:"webgl",kernelFunc:Sae};/**
9925 * @license
9926 * Copyright 2021 Google LLC. All Rights Reserved.
9927 * Licensed under the Apache License, Version 2.0 (the "License");
9928 * you may not use this file except in compliance with the License.
9929 * You may obtain a copy of the License at
9930 *
9931 * http://www.apache.org/licenses/LICENSE-2.0
9932 *
9933 * Unless required by applicable law or agreed to in writing, software
9934 * distributed under the License is distributed on an "AS IS" BASIS,
9935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9936 * See the License for the specific language governing permissions and
9937 * limitations under the License.
9938 * =============================================================================
9939 */function Cae(t){const{inputs:e,backend:n}=t,{s0:r,s1:s}=e,i=n.readSync(r.dataId),o=n.readSync(s.dataId),a=Le(Array.from(i),Array.from(o));return n.makeTensorInfo([a.length],"int32",Int32Array.from(a))}const Nae={kernelName:tI,backendName:"webgl",kernelFunc:Cae};/**
9940 * @license
9941 * Copyright 2020 Google LLC. All Rights Reserved.
9942 * Licensed under the Apache License, Version 2.0 (the "License");
9943 * you may not use this file except in compliance with the License.
9944 * You may obtain a copy of the License at
9945 *
9946 * http://www.apache.org/licenses/LICENSE-2.0
9947 *
9948 * Unless required by applicable law or agreed to in writing, software
9949 * distributed under the License is distributed on an "AS IS" BASIS,
9950 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9951 * See the License for the specific language governing permissions and
9952 * limitations under the License.
9953 * =============================================================================
9954 */const Eae="return float(a != b);",IP=tn({opSnippet:Eae,cpuKernelImpl:Zse,dtype:"bool"}),kae={kernelName:gA,backendName:"webgl",kernelFunc:IP};/**
9955 * @license
9956 * Copyright 2020 Google LLC. All Rights Reserved.
9957 * Licensed under the Apache License, Version 2.0 (the "License");
9958 * you may not use this file except in compliance with the License.
9959 * You may obtain a copy of the License at
9960 *
9961 * http://www.apache.org/licenses/LICENSE-2.0
9962 *
9963 * Unless required by applicable law or agreed to in writing, software
9964 * distributed under the License is distributed on an "AS IS" BASIS,
9965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9966 * See the License for the specific language governing permissions and
9967 * limitations under the License.
9968 * =============================================================================
9969 */function Eh(t){const{inputs:e,backend:n}=t,{input:r}=e,s=n.texData.get(r.dataId);return Jn({inputs:{x:s.complexTensorInfos.real},backend:n})}const $ae={kernelName:AA,backendName:"webgl",kernelFunc:Eh};/**
9970 * @license
9971 * Copyright 2020 Google LLC. All Rights Reserved.
9972 * Licensed under the Apache License, Version 2.0 (the "License");
9973 * you may not use this file except in compliance with the License.
9974 * You may obtain a copy of the License at
9975 *
9976 * http://www.apache.org/licenses/LICENSE-2.0
9977 *
9978 * Unless required by applicable law or agreed to in writing, software
9979 * distributed under the License is distributed on an "AS IS" BASIS,
9980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9981 * See the License for the specific language governing permissions and
9982 * limitations under the License.
9983 * =============================================================================
9984 */const Iae="return float(int(x));";function Aae(t,e){const n=new As(t.shape,Iae),r=e.runWebGLProgram(n,[t],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}/**
9985 * @license
9986 * Copyright 2020 Google LLC. All Rights Reserved.
9987 * Licensed under the Apache License, Version 2.0 (the "License");
9988 * you may not use this file except in compliance with the License.
9989 * You may obtain a copy of the License at
9990 *
9991 * http://www.apache.org/licenses/LICENSE-2.0
9992 *
9993 * Unless required by applicable law or agreed to in writing, software
9994 * distributed under the License is distributed on an "AS IS" BASIS,
9995 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9996 * See the License for the specific language governing permissions and
9997 * limitations under the License.
9998 * =============================================================================
9999 */function ov(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{dtype:i}=r;if(i==="complex64"){if(s.dtype==="complex64")return Jn({inputs:{x:s},backend:n});const o=ba(s.shape),a=ov({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),u=Co({inputs:{real:a,imag:o},backend:n});return o.dispose(),n.disposeIntermediateTensorInfo(a),u}if(s.dtype==="complex64"){const o=Eh({inputs:{input:s},backend:n}),a=ov({inputs:{x:o},backend:n,attrs:{dtype:i}});return n.disposeIntermediateTensorInfo(o),a}if(!a5(s.dtype,i)){const o=Jn({inputs:{x:s},backend:n});return{dataId:o.dataId,shape:o.shape,dtype:i}}if(n.shouldExecuteOnCPU([s])){const o=n.texData.get(s.dataId).values,[a,u,l]=Rse(o,s.shape,s.dtype,i);return n.makeTensorInfo(a,u,l)}if(i==="int32")return Aae(s,n);if(i==="bool"){const o=n.makeTensorInfo([],"bool",ho("bool",1)),u=IP({inputs:{a:s,b:o},backend:n});return n.disposeIntermediateTensorInfo(o),u}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${i}`)}const Rae={kernelName:N1,backendName:"webgl",kernelFunc:ov};/**
10000 * @license
10001 * Copyright 2020 Google LLC. All Rights Reserved.
10002 * Licensed under the Apache License, Version 2.0 (the "License");
10003 * you may not use this file except in compliance with the License.
10004 * You may obtain a copy of the License at
10005 *
10006 * http://www.apache.org/licenses/LICENSE-2.0
10007 *
10008 * Unless required by applicable law or agreed to in writing, software
10009 * distributed under the License is distributed on an "AS IS" BASIS,
10010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10011 * See the License for the specific language governing permissions and
10012 * limitations under the License.
10013 * =============================================================================
10014 */const lC="return ceil(x);",Oae=Pe({opSnippet:lC,packedOpSnippet:lC,cpuKernelImpl:Ose}),Dae={kernelName:nI,backendName:"webgl",kernelFunc:Oae};/**
10015 * @license
10016 * Copyright 2017 Google LLC. All Rights Reserved.
10017 * Licensed under the Apache License, Version 2.0 (the "License");
10018 * you may not use this file except in compliance with the License.
10019 * You may obtain a copy of the License at
10020 *
10021 * http://www.apache.org/licenses/LICENSE-2.0
10022 *
10023 * Unless required by applicable law or agreed to in writing, software
10024 * distributed under the License is distributed on an "AS IS" BASIS,
10025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10026 * See the License for the specific language governing permissions and
10027 * limitations under the License.
10028 * =============================================================================
10029 */class Pae{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=`
10030
10031      void main() {
10032        float value = getAAtOutCoords();
10033        if (isnan(value)) {
10034          setOutput(value);
10035          return;
10036        }
10037
10038        setOutput(clamp(value, minVal, maxVal));
10039      }
10040    `}}/**
10041 * @license
10042 * Copyright 2018 Google LLC. All Rights Reserved.
10043 * Licensed under the Apache License, Version 2.0 (the "License");
10044 * you may not use this file except in compliance with the License.
10045 * You may obtain a copy of the License at
10046 *
10047 * http://www.apache.org/licenses/LICENSE-2.0
10048 *
10049 * Unless required by applicable law or agreed to in writing, software
10050 * distributed under the License is distributed on an "AS IS" BASIS,
10051 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10052 * See the License for the specific language governing permissions and
10053 * limitations under the License.
10054 * =============================================================================
10055 */class Fae{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=`
10056      void main() {
10057        vec4 value = getAAtOutCoords();
10058
10059        if (any(isnan(value))) {
10060          setOutput(value);
10061          return;
10062        }
10063
10064        setOutput(clamp(value, vec4(minVal), vec4(maxVal)));
10065      }
10066    `}}/**
10067 * @license
10068 * Copyright 2020 Google LLC. All Rights Reserved.
10069 * Licensed under the Apache License, Version 2.0 (the "License");
10070 * you may not use this file except in compliance with the License.
10071 * You may obtain a copy of the License at
10072 *
10073 * http://www.apache.org/licenses/LICENSE-2.0
10074 *
10075 * Unless required by applicable law or agreed to in writing, software
10076 * distributed under the License is distributed on an "AS IS" BASIS,
10077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10078 * See the License for the specific language governing permissions and
10079 * limitations under the License.
10080 * =============================================================================
10081 */function Lae(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{clipValueMin:i,clipValueMax:o}=r;let a;U().getBool("WEBGL_PACK_CLIP")?a=new Fae(s.shape):a=new Pae(s.shape);const u=[[i],[o]];return n.runWebGLProgram(a,[s],s.dtype,u)}const Mae={kernelName:rI,backendName:"webgl",kernelFunc:Lae};/**
10082 * @license
10083 * Copyright 2018 Google LLC. All Rights Reserved.
10084 * Licensed under the Apache License, Version 2.0 (the "License");
10085 * you may not use this file except in compliance with the License.
10086 * You may obtain a copy of the License at
10087 *
10088 * http://www.apache.org/licenses/LICENSE-2.0
10089 *
10090 * Unless required by applicable law or agreed to in writing, software
10091 * distributed under the License is distributed on an "AS IS" BASIS,
10092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10093 * See the License for the specific language governing permissions and
10094 * limitations under the License.
10095 * =============================================================================
10096 */class Vae{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=`
10097      void main() {
10098        float re = abs(getRealAtOutCoords());
10099        float im = abs(getImagAtOutCoords());
10100        float mx = max(re, im);
10101
10102        // sadly the length function in glsl is not underflow-safe
10103        // (at least not on Intel GPUs). So the safe solution is
10104        // to ensure underflow-safety in all cases.
10105        setOutput(
10106          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))
10107        );
10108      }
10109    `}}/**
10110 * @license
10111 * Copyright 2020 Google LLC. All Rights Reserved.
10112 * Licensed under the Apache License, Version 2.0 (the "License");
10113 * you may not use this file except in compliance with the License.
10114 * You may obtain a copy of the License at
10115 *
10116 * http://www.apache.org/licenses/LICENSE-2.0
10117 *
10118 * Unless required by applicable law or agreed to in writing, software
10119 * distributed under the License is distributed on an "AS IS" BASIS,
10120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10121 * See the License for the specific language governing permissions and
10122 * limitations under the License.
10123 * =============================================================================
10124 */function cC(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}}function Bae(t){const{inputs:e,backend:n}=t,{x:r}=e,s=n.texData.get(r.dataId),i=new Vae(r.shape),o=[cC(r,s.complexTensorInfos.real),cC(r,s.complexTensorInfos.imag)];return n.runWebGLProgram(i,o,o[0].dtype)}const Wae={kernelName:iI,backendName:"webgl",kernelFunc:Bae};/**
10125 * @license
10126 * Copyright 2017 Google LLC. All Rights Reserved.
10127 * Licensed under the Apache License, Version 2.0 (the "License");
10128 * you may not use this file except in compliance with the License.
10129 * You may obtain a copy of the License at
10130 *
10131 * http://www.apache.org/licenses/LICENSE-2.0
10132 *
10133 * Unless required by applicable law or agreed to in writing, software
10134 * distributed under the License is distributed on an "AS IS" BASIS,
10135 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10136 * See the License for the specific language governing permissions and
10137 * limitations under the License.
10138 * =============================================================================
10139 */class Uae{constructor(e){this.outputShape=[],this.outputShape=Ta(e,1),this.variableNames=e.map((o,a)=>`T${a}`);const n=new Array(e.length-1);n[0]=e[0][1];for(let o=1;o<n.length;o++)n[o]=n[o-1]+e[o][1];const r=[`if (yC < ${n[0]}) setOutput(getT0(yR, yC));`];for(let o=1;o<n.length;o++){const a=n[o-1];r.push(`else if (yC < ${n[o]}) setOutput(getT${o}(yR, yC-${a}));`)}const s=n.length,i=n[n.length-1];r.push(`else setOutput(getT${s}(yR, yC-${i}));`),this.userCode=`
10140      void main() {
10141        ivec2 coords = getOutputCoords();
10142        int yR = coords.x;
10143        int yC = coords.y;
10144
10145        ${r.join(`
10146        `)}
10147      }
10148    `}}/**
10149 * @license
10150 * Copyright 2019 Google LLC. All Rights Reserved.
10151 * Licensed under the Apache License, Version 2.0 (the "License");
10152 * you may not use this file except in compliance with the License.
10153 * You may obtain a copy of the License at
10154 *
10155 * http://www.apache.org/licenses/LICENSE-2.0
10156 *
10157 * Unless required by applicable law or agreed to in writing, software
10158 * distributed under the License is distributed on an "AS IS" BASIS,
10159 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10160 * See the License for the specific language governing permissions and
10161 * limitations under the License.
10162 * =============================================================================
10163 */class zae{constructor(e,n){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=Ta(e,n);const r=this.outputShape,s=r.length,i=qe(s),o=bn("coords",s),a=["x","y","z","w","u","v"].slice(0,s);this.variableNames=e.map((y,v)=>`T${v}`);const u=new Array(e.length-1);u[0]=e[0][n];for(let y=1;y<u.length;y++)u[y]=u[y-1]+e[y][n];const l=a[n],c=a.slice(-2),h=a.join();let d=`if (${l} < ${u[0]}) {
10164        return getChannel(
10165            getT0(${h}), vec2(${c.join()}));
10166        }`;for(let y=1;y<u.length;y++){const v=u[y-1];d+=`
10167        if (${l} < ${u[y]}  && ${l} >= ${u[y-1]}) {
10168          return getChannel(
10169            getT${y}(${Sd(a,l,v)}),
10170            vec2(${Sd(c,l,v)}));
10171        }`}const f=u.length,p=u[u.length-1];d+=`
10172        return getChannel(
10173          getT${f}(${Sd(a,l,p)}),
10174          vec2(${Sd(c,l,p)}));`,this.userCode=`
10175      float getValue(${a.map(y=>"int "+y)}) {
10176        ${d}
10177      }
10178
10179      void main() {
10180        ${i} coords = getOutputCoords();
10181        vec4 result = vec4(getValue(${o}), 0., 0., 0.);
10182
10183        ${o[s-1]} = ${o[s-1]} + 1;
10184        if (${o[s-1]} < ${r[s-1]}) {
10185          result.g = getValue(${o});
10186        }
10187
10188        ${o[s-2]} = ${o[s-2]} + 1;
10189        if (${o[s-2]} < ${r[s-2]}) {
10190          result.a = getValue(${o});
10191        }
10192
10193        ${o[s-1]} = ${o[s-1]} - 1;
10194        if (${o[s-2]} < ${r[s-2]} &&
10195            ${o[s-1]} < ${r[s-1]}) {
10196          result.b = getValue(${o});
10197        }
10198        setOutput(result);
10199      }
10200    `}}function Sd(t,e,n){const r=t.indexOf(e);return t.map((i,o)=>o===r?`${i} - ${n}`:i).join()}/**
10201 * @license
10202 * Copyright 2020 Google LLC. All Rights Reserved.
10203 * Licensed under the Apache License, Version 2.0 (the "License");
10204 * you may not use this file except in compliance with the License.
10205 * You may obtain a copy of the License at
10206 *
10207 * http://www.apache.org/licenses/LICENSE-2.0
10208 *
10209 * Unless required by applicable law or agreed to in writing, software
10210 * distributed under the License is distributed on an "AS IS" BASIS,
10211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10212 * See the License for the specific language governing permissions and
10213 * limitations under the License.
10214 * =============================================================================
10215 */function Cm(t){const{inputs:e,backend:n}=t,{input:r}=e,s=n.texData.get(r.dataId);return Jn({inputs:{x:s.complexTensorInfos.imag},backend:n})}const jae={kernelName:zI,backendName:"webgl",kernelFunc:Cm};/**
10216 * @license
10217 * Copyright 2020 Google LLC. All Rights Reserved.
10218 * Licensed under the Apache License, Version 2.0 (the "License");
10219 * you may not use this file except in compliance with the License.
10220 * You may obtain a copy of the License at
10221 *
10222 * http://www.apache.org/licenses/LICENSE-2.0
10223 *
10224 * Unless required by applicable law or agreed to in writing, software
10225 * distributed under the License is distributed on an "AS IS" BASIS,
10226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10227 * See the License for the specific language governing permissions and
10228 * limitations under the License.
10229 * =============================================================================
10230 */function tc(t,e,n){const r=t[0].dtype;if(r==="complex64"){const f=t.map(x=>Eh({inputs:{input:x},backend:n})),p=t.map(x=>Cm({inputs:{input:x},backend:n})),y=tc(f,e,n),v=tc(p,e,n),g=Co({inputs:{real:y,imag:v},backend:n});return f.forEach(x=>n.disposeIntermediateTensorInfo(x)),p.forEach(x=>n.disposeIntermediateTensorInfo(x)),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),g}let s=n.shouldExecuteOnCPU(t);if(r==="string"&&(s=!0),s){const f=t.map(_=>{const E=[-1,ne(_.shape.slice(e))];return se({inputs:{x:_},backend:n,attrs:{shape:E}})}),p=f.map(_=>({vals:n.readSync(_.dataId),shape:_.shape})),y=Ta(f.map(_=>_.shape),1),v=f[0].shape[0]===1,g=Dse(p,y,r,v),x=Ta(t.map(_=>_.shape),e),w=n.makeTensorInfo(x,r,g);return f.forEach(_=>n.disposeIntermediateTensorInfo(_)),w}const i=t.filter(f=>ne(f.shape)>0),o=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&i[0].shape.length>1;if(i.length===1){const f=o?new As(t[0].shape,Mi):new Gi(t[0].shape,Mi);return n.runWebGLProgram(f,t,r)}const a=U().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(i.length>a){const f=[];for(let y=0;y<i.length;y+=a){const v=i.slice(y,y+a);f.push(tc(v,e,n))}const p=tc(f,e,n);for(const y of f)n.disposeIntermediateTensorInfo(y);return p}if(o){const f=new zae(i.map(p=>p.shape),e);return n.runWebGLProgram(f,i,r)}const{tensors2D:u,outShape:l}=Gae(i,e,n),c=new Uae(u.map(f=>f.shape)),h=n.runWebGLProgram(c,u,r);u.forEach(f=>n.disposeIntermediateTensorInfo(f));const d=se({inputs:{x:h},attrs:{shape:l},backend:n});return n.disposeIntermediateTensorInfo(h),d}function Gae(t,e,n){const r=Ta(t.map(i=>i.shape),e);return{tensors2D:t.map(i=>se({inputs:{x:i},attrs:{shape:[-1,ne(i.shape.slice(e))]},backend:n})),outShape:r}}/**
10231 * @license
10232 * Copyright 2020 Google LLC. All Rights Reserved.
10233 * Licensed under the Apache License, Version 2.0 (the "License");
10234 * you may not use this file except in compliance with the License.
10235 * You may obtain a copy of the License at
10236 *
10237 * http://www.apache.org/licenses/LICENSE-2.0
10238 *
10239 * Unless required by applicable law or agreed to in writing, software
10240 * distributed under the License is distributed on an "AS IS" BASIS,
10241 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10242 * See the License for the specific language governing permissions and
10243 * limitations under the License.
10244 * =============================================================================
10245 */function AP(t){const{inputs:e,backend:n,attrs:r}=t,{axis:s}=r,i=Gt(s,e[0].shape)[0],o=e.map(l=>l.shape);mD(o,i);const a=Ta(e.map(l=>l.shape),i);if(ne(a)===0)return n.makeTensorInfo(a,e[0].dtype,[]);const u=e.filter(l=>ne(l.shape)>0);return u.length===1?Jn({inputs:{x:u[0]},backend:n}):tc(u,i,n)}const Hae={kernelName:oI,backendName:"webgl",kernelFunc:AP};/**
10246 * @license
10247 * Copyright 2017 Google LLC. All Rights Reserved.
10248 * Licensed under the Apache License, Version 2.0 (the "License");
10249 * you may not use this file except in compliance with the License.
10250 * You may obtain a copy of the License at
10251 *
10252 * http://www.apache.org/licenses/LICENSE-2.0
10253 *
10254 * Unless required by applicable law or agreed to in writing, software
10255 * distributed under the License is distributed on an "AS IS" BASIS,
10256 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10257 * See the License for the specific language governing permissions and
10258 * limitations under the License.
10259 * =============================================================================
10260 */class RP{constructor(e,n=!1,r=null,s=!1,i=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;const o=e.padInfo.top,a=e.padInfo.left,u=e.strideHeight,l=e.strideWidth,c=e.dilationHeight,h=e.dilationWidth,d=e.filterHeight,f=e.filterWidth,p=Math.floor(e.inChannels/4)*4,y=e.inChannels%4,v=e.dataFormat==="channelsLast",g=v?1:2,x=v?2:3,w=v?3:1;let _="",T="";r&&(s?_=`float activation(float a) {
10261          float b = getPreluActivationWeightsAtOutCoords();
10262          ${r}
10263        }`:i?_=`float activation(float a) {
10264          float b = getLeakyreluAlphaAtOutCoords();
10265          ${r}
10266        }`:_=`
10267          float activation(float x) {
10268            ${r}
10269          }
10270        `,T="result = activation(result);");const E=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
10271      ${_}
10272
10273      const ivec2 strides = ivec2(${u}, ${l});
10274      const ivec2 pads = ivec2(${o}, ${a});
10275
10276      void main() {
10277        ivec4 coords = getOutputCoords();
10278        int batch = coords[0];
10279        int d2 = coords[${w}];
10280
10281        ivec2 xRCCorner =
10282            ivec2(coords[${g}], coords[${x}]) * strides - pads;
10283        int xRCorner = xRCCorner.x;
10284        int xCCorner = xRCCorner.y;
10285
10286        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
10287        // ? = to be determined. : = across all values in that axis.
10288        float dotProd = 0.0;
10289        for (int wR = 0; wR < ${d}; wR++) {
10290          int xR = xRCorner + wR * ${c};
10291
10292          if (xR < 0 || xR >= ${e.inHeight}) {
10293            continue;
10294          }
10295
10296          for (int wC = 0; wC < ${f}; wC++) {
10297            int xC = xCCorner + wC * ${h};
10298
10299            if (xC < 0 || xC >= ${e.inWidth}) {
10300              continue;
10301            }
10302
10303            for (int d1 = 0; d1 < ${p}; d1 += 4) {
10304              vec4 wValues = vec4(
10305                getW(wR, wC, d1, d2),
10306                getW(wR, wC, d1 + 1, d2),
10307                getW(wR, wC, d1 + 2, d2),
10308                getW(wR, wC, d1 + 3, d2)
10309              );
10310
10311              if (${v}) {
10312                vec4 xValues = vec4(
10313                  getX(batch, xR, xC, d1),
10314                  getX(batch, xR, xC, d1 + 1),
10315                  getX(batch, xR, xC, d1 + 2),
10316                  getX(batch, xR, xC, d1 + 3)
10317                );
10318                dotProd += dot(xValues, wValues);
10319              } else {
10320                vec4 xValues = vec4(
10321                  getX(batch, d1, xR, xC),
10322                  getX(batch, d1 + 1, xR, xC),
10323                  getX(batch, d1 + 2, xR, xC),
10324                  getX(batch, d1 + 3, xR, xC)
10325                );
10326                dotProd += dot(xValues, wValues);
10327              }
10328            }
10329
10330            if (${y===1}) {
10331
10332              if (${v}) {
10333                dotProd +=
10334                    getX(batch, xR, xC, ${p}) *
10335                    getW(wR, wC, ${p}, d2);
10336              } else {
10337                dotProd +=
10338                    getX(batch, ${p}, xR, xC) *
10339                    getW(wR, wC, ${p}, d2);
10340              }
10341
10342            } else if (${y===2}) {
10343              vec2 wValues = vec2(
10344                getW(wR, wC, ${p}, d2),
10345                getW(wR, wC, ${p} + 1, d2)
10346              );
10347
10348              if (${v}) {
10349                vec2 xValues = vec2(
10350                  getX(batch, xR, xC, ${p}),
10351                  getX(batch, xR, xC, ${p} + 1)
10352                );
10353                dotProd += dot(xValues, wValues);
10354              } else {
10355                vec2 xValues = vec2(
10356                  getX(batch, ${p}, xR, xC),
10357                  getX(batch, ${p} + 1, xR, xC)
10358                );
10359                dotProd += dot(xValues, wValues);
10360              }
10361
10362            } else if (${y===3}) {
10363              vec3 wValues = vec3(
10364                getW(wR, wC, ${p}, d2),
10365                getW(wR, wC, ${p} + 1, d2),
10366                getW(wR, wC, ${p} + 2, d2)
10367              );
10368
10369              if (${v}) {
10370                vec3 xValues = vec3(
10371                  getX(batch, xR, xC, ${p}),
10372                  getX(batch, xR, xC, ${p} + 1),
10373                  getX(batch, xR, xC, ${p} + 2)
10374                );
10375                dotProd += dot(xValues, wValues);
10376              } else {
10377                vec3 xValues = vec3(
10378                  getX(batch, ${p}, xR, xC),
10379                  getX(batch, ${p} + 1, xR, xC),
10380                  getX(batch, ${p} + 2, xR, xC)
10381                );
10382                dotProd += dot(xValues, wValues);
10383              }
10384
10385            }
10386          }
10387        }
10388
10389        float result = dotProd;
10390        ${E}
10391        ${T}
10392        setOutput(result);
10393      }
10394    `}}class qae{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const n=e.padInfo.front,r=e.padInfo.top,s=e.padInfo.left,i=e.strideDepth,o=e.strideHeight,a=e.strideWidth,u=e.dilationDepth,l=e.dilationHeight,c=e.dilationWidth,h=e.filterDepth,d=e.filterHeight,f=e.filterWidth,p=Math.floor(e.inChannels/4)*4,y=e.inChannels%4;this.userCode=`
10395      const ivec3 strides = ivec3(${i}, ${o}, ${a});
10396      const ivec3 pads = ivec3(${n}, ${r}, ${s});
10397
10398      void main() {
10399        ivec5 coords = getOutputCoords();
10400        int batch = coords.x;
10401        int d2 = coords.u;
10402
10403        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
10404        int xFCorner = xFRCCorner.x;
10405        int xRCorner = xFRCCorner.y;
10406        int xCCorner = xFRCCorner.z;
10407
10408        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
10409        // y(yF, yR, yC, d2). ? = to be determined. : = across all
10410        // values in that axis.
10411        float dotProd = 0.0;
10412        for (int wF = 0; wF < ${h}; wF++) {
10413          int xF = xFCorner + wF * ${u};
10414
10415          if (xF < 0 || xF >= ${e.inDepth}) {
10416            continue;
10417          }
10418
10419          for (int wR = 0; wR < ${d}; wR++) {
10420            int xR = xRCorner + wR * ${l};
10421
10422            if (xR < 0 || xR >= ${e.inHeight}) {
10423              continue;
10424            }
10425
10426            for (int wC = 0; wC < ${f}; wC++) {
10427              int xC = xCCorner + wC * ${c};
10428
10429              if (xC < 0 || xC >= ${e.inWidth}) {
10430                continue;
10431              }
10432
10433              for (int d1 = 0; d1 < ${p}; d1 += 4) {
10434                vec4 xValues = vec4(
10435                  getX(batch, xF, xR, xC, d1),
10436                  getX(batch, xF, xR, xC, d1 + 1),
10437                  getX(batch, xF, xR, xC, d1 + 2),
10438                  getX(batch, xF, xR, xC, d1 + 3)
10439                );
10440                vec4 wValues = vec4(
10441                  getW(wF, wR, wC, d1, d2),
10442                  getW(wF, wR, wC, d1 + 1, d2),
10443                  getW(wF, wR, wC, d1 + 2, d2),
10444                  getW(wF, wR, wC, d1 + 3, d2)
10445                );
10446
10447                dotProd += dot(xValues, wValues);
10448              }
10449
10450              if (${y===1}) {
10451                dotProd +=
10452                  getX(batch, xF, xR, xC, ${p}) *
10453                  getW(wF, wR, wC, ${p}, d2);
10454              } else if (${y===2}) {
10455                vec2 xValues = vec2(
10456                  getX(batch, xF, xR, xC, ${p}),
10457                  getX(batch, xF, xR, xC, ${p} + 1)
10458                );
10459                vec2 wValues = vec2(
10460                  getW(wF, wR, wC, ${p}, d2),
10461                  getW(wF, wR, wC, ${p} + 1, d2)
10462                );
10463                dotProd += dot(xValues, wValues);
10464              } else if (${y===3}) {
10465                vec3 xValues = vec3(
10466                  getX(batch, xF, xR, xC, ${p}),
10467                  getX(batch, xF, xR, xC, ${p} + 1),
10468                  getX(batch, xF, xR, xC, ${p} + 2)
10469                );
10470                vec3 wValues = vec3(
10471                  getW(wF, wR, wC, ${p}, d2),
10472                  getW(wF, wR, wC, ${p} + 1, d2),
10473                  getW(wF, wR, wC, ${p} + 2, d2)
10474                );
10475                dotProd += dot(xValues, wValues);
10476              }
10477            }
10478          }
10479        }
10480        setOutput(dotProd);
10481      }
10482    `}}/**
10483 * @license
10484 * Copyright 2022 Google LLC. All Rights Reserved.
10485 * Licensed under the Apache License, Version 2.0 (the "License");
10486 * you may not use this file except in compliance with the License.
10487 * You may obtain a copy of the License at
10488 *
10489 * http://www.apache.org/licenses/LICENSE-2.0
10490 *
10491 * Unless required by applicable law or agreed to in writing, software
10492 * distributed under the License is distributed on an "AS IS" BASIS,
10493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10494 * See the License for the specific language governing permissions and
10495 * limitations under the License.
10496 * =============================================================================
10497 */class OP{constructor(e,n=!1,r=null,s=!1,i=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=fn(this.outputShape.length);const o=e.padInfo.left,a=e.strideWidth,u=e.dilationWidth,l=e.filterHeight,c=e.filterWidth,h=c;let d=`
10498       int xR; int xC; int xCOffset;
10499       vec4 wTexel; vec4 previous; vec4 final;`;for(let v=0;v<c;v++)d+=`
10500           vec4 xTexelC${v*2};
10501           int xTexelC${v*2}Ready;
10502           vec4 xTexelC${v*2+1};
10503           int xTexelC${v*2+1}Ready;
10504           vec4 xC${v};`;d+=`
10505     for (int r = 0; r < ${l}; r++) {
10506      for (int d1 = 0; d1 < ${e.inChannels}; d1 += 2) {
10507       `;for(let v=0;v<c;v++)d+=`
10508           xTexelC${v*2} = vec4(0.0);
10509           xTexelC${v*2}Ready = 0;
10510           xTexelC${v*2+1} = vec4(0.0);
10511           xTexelC${v*2+1}Ready = 0;
10512           xC${v} = vec4(0.0);`;d+=`
10513         xR = xRCorner + r * dilations[0];
10514         if (xR >=0 && xR < inDims[0]) {
10515       `;for(let v=0;v<(h+1)/2;v++){const g=v*2;if(d+=`
10516           xC = xCCorner + ${g*u};
10517           `,a===1){if(g<c&&(o%2===1?(d+=`
10518                 xCOffset = xC + 1;
10519                 if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${g}Ready == 0) {
10520                   xTexelC${g} = getX(batch, xR, xCOffset, d1);
10521
10522                   // Need to manually clear unused channels in case
10523                   // we're reading from recycled texture.
10524                   if (xCOffset + 1 >= inDims[1]) {
10525                     xTexelC${g}.zw = vec2(0.0);
10526                   }
10527                   xTexelC${g}Ready = 1;
10528                 }
10529               `,u===1&&g>0?d+=`
10530                 xC${g} = vec4(xTexelC${g-2}.zw, xTexelC${g}.xy);
10531                 `:d+=`
10532                   xCOffset = xC + 1 - 2;
10533
10534                   if (xCOffset >= 0 && xCOffset < inDims[1]) {
10535                     previous = getX(batch, xR, xCOffset, d1);
10536
10537                     // Need to manually clear unused channels in case
10538                     // we're reading from recycled texture.
10539                     if (xCOffset + 1 >= inDims[1]) {
10540                       previous.zw = vec2(0.0);
10541                     }
10542
10543                     xC${g} = vec4(previous.zw, xTexelC${g}.xy);
10544                   } else {
10545                     xC${g} = vec4(0.0, 0.0, xTexelC${g}.xy);
10546                   }
10547                   `):d+=`
10548                 if (xC >= 0 && xC < inDims[1] && xTexelC${g}Ready == 0) {
10549                   xTexelC${g} = getX(batch, xR, xC, d1);
10550                   if (xC + 1 >= inDims[1]) {
10551                     xTexelC${g}.zw = vec2(0.0);
10552                   }
10553                   xTexelC${g}Ready = 1;
10554                 }
10555
10556                 xC${g} = xTexelC${g};
10557                 `,g+1<c)){const x=o%2===0?_1(u):u;u%2===0&&o%2===1||u%2!==0&&o%2!==1?(d+=`
10558                   xCOffset = xC + imod(pads[1], 2) + ${x};
10559
10560                   if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${g+1}Ready == 0) {
10561                     xTexelC${g+1} = getX(batch, xR, xCOffset, d1);
10562
10563                     // Need to manually clear unused channels in case
10564                     // we're reading from recycled texture.
10565                     if (xCOffset + 1 >= inDims[1]) {
10566                       xTexelC${g+1}.zw = vec2(0.0);
10567                     }
10568                     xTexelC${g+1}Ready = 1;
10569                   }
10570                   `,u>1?d+=`
10571                     xCOffset -= 2;
10572                     if (xCOffset >= 0 && xCOffset < inDims[1]) {
10573                      previous = getX(batch, xR, xCOffset, d1);
10574                      xC${g+1} = vec4(previous.zw, xTexelC${g+1}.xy);
10575                     } else {
10576                      xC${g+1} = vec4(0.0, 0.0, xTexelC${g+1}.xy);
10577                     }
10578                     `:d+=`
10579                     xC${g+1} = vec4(xTexelC${g}.zw, xTexelC${g+1}.xy);
10580                     `):x===1?d+=`
10581                     xC${g+1} = xTexelC${g};
10582                     `:d+=`
10583                     xCOffset = xC + ${x};
10584
10585                     if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${g+1}Ready == 0) {
10586                       xTexelC${g+1} = getX(batch, xR, xCOffset, d1);
10587                       if (xCOffset + 1 >= inDims[1]) {
10588                         xTexelC${g+1}.zw = vec2(0.0);
10589                       }
10590                       xTexelC${g+1}Ready = 1;
10591                     }
10592
10593                     xC${g+1} = xTexelC${g+1};
10594                     `}}else g<c&&(o%2===1?(d+=`
10595                 xCOffset = xC + 1 - strides[1];
10596                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${g}Ready == 0) {
10597                   xTexelC${g} = getX(batch, xR, xCOffset, d1);
10598                   // Need to manually clear unused channels in case
10599                   // we're reading from recycled texture.
10600                   if (xCOffset + 1 >= inDims[1]) {
10601                     xTexelC${g}.zw = vec2(0.0);
10602                   }
10603                   xTexelC${g}Ready = 1;
10604                 }
10605
10606                 if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${g+1}Ready == 0) {
10607                   xTexelC${g+1} = getX(batch, xR, xC + 1, d1);
10608                   // Need to manually clear unused channels in case
10609                   // we're reading from recycled texture.
10610                   if (xC + 2 >= inDims[1]) {
10611                     xTexelC${g+1}.zw = vec2(0.0);
10612                   }
10613                   xTexelC${g+1}Ready = 1;
10614                 }
10615
10616                 xC${g} = vec4(xTexelC${g}.zw, xTexelC${g+1}.zw);
10617               `,g+1<c&&(d+=`
10618                   final = vec4(0.0);
10619                   xCOffset = xC + 1 + strides[1];
10620                   if(xCOffset >= 0 && xCOffset < inDims[1]) {
10621                     final = getX(batch, xR, xCOffset, d1);
10622                   }
10623                   xC${g+1} = vec4(xTexelC${g+1}.xy, final.xy);
10624                 `)):(d+=`
10625                 if(xC >= 0 && xC < inDims[1] && xTexelC${g}Ready == 0) {
10626                   xTexelC${g} = getX(batch, xR, xC, d1);
10627                   if (xC + 1 >= inDims[1]) {
10628                     xTexelC${g}.zw = vec2(0.0);
10629                   }
10630                   xTexelC${g}Ready = 1;
10631                 }
10632
10633                 xCOffset = xC + strides[1];
10634                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${g+1}Ready == 0) {
10635                   xTexelC${g+1} = getX(batch, xR, xCOffset, d1);
10636                   if (xCOffset + 1 >= inDims[1]) {
10637                     xTexelC${g+1}.zw = vec2(0.);
10638                   }
10639                   xTexelC${g+1}Ready = 1;
10640                 }
10641
10642                 xC${g} = vec4(
10643                   xTexelC${g}.xy, xTexelC${g+1}.xy);
10644               `,g+1<c&&(d+=`
10645                   xC${g+1} = vec4(xTexelC${g}.zw, xTexelC${g+1}.zw);
10646                 `)));g<c&&(d+=`
10647             wTexel = getW(r, ${g}, d1, d2);
10648             dotProd += xC${g}.xxzz * vec4(wTexel.xy, wTexel.xy);
10649             if(d1 + 1 < ${e.inChannels}) {
10650               dotProd += xC${g}.yyww * vec4(wTexel.zw, wTexel.zw);
10651             }
10652           `,g+1<c&&(d+=`
10653               wTexel = getW(r, ${g+1}, d1, d2);
10654               dotProd += xC${g+1}.xxzz * vec4(wTexel.xy, wTexel.xy);
10655               if(d1 + 1 < ${e.inChannels}) {
10656                 dotProd += xC${g+1}.yyww * vec4(wTexel.zw, wTexel.zw);
10657               }
10658             `))}d+=`
10659     }
10660   `,d+=`
10661     }
10662   `,d+=`
10663     }
10664   `;let f="",p="";r&&(s?f=`vec4 activation(vec4 a) {
10665           vec4 b = getPreluActivationWeightsAtOutCoords();
10666           ${r}
10667         }`:i?f=`vec4 activation(vec4 a) {
10668           vec4 b = getLeakyreluAlphaAtOutCoords();
10669           ${r}
10670         }`:f=`vec4 activation(vec4 x) {
10671           ${r}
10672         }`,p="result = activation(result);");const y=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
10673       ${f}
10674
10675       void main() {
10676         ivec4 coords = getOutputCoords();
10677         int batch = coords.x;
10678         ivec2 xRCCorner = coords.yz * strides - pads;
10679         int d2 = coords.w;
10680         int xRCorner = xRCCorner.x;
10681         int xCCorner = xRCCorner.y;
10682
10683         //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
10684         vec4 dotProd = vec4(0.000000000000001);
10685
10686         ${d}
10687
10688         vec4 result = dotProd - vec4(0.000000000000001);
10689         ${y}
10690         ${p}
10691         setOutput(result);
10692       }
10693     `}}/**
10694 * @license
10695 * Copyright 2019 Google LLC. All Rights Reserved.
10696 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 15,574 bytes, lines 10697-10992
10697 * you may not use this file except in compliance with the License.
10698 * You may obtain a copy of the License at
10699 *
10700 * http://www.apache.org/licenses/LICENSE-2.0
10701 *
10702 * Unless required by applicable law or agreed to in writing, software
10703 * distributed under the License is distributed on an "AS IS" BASIS,
10704 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10705 * See the License for the specific language governing permissions and
10706 * limitations under the License.
10707 * =============================================================================
10708 */class Kae{constructor(e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=fn(this.outputShape.length);const{dataFormat:r}=n,s=Nn(),i=r==="channelsLast",o=i?1:2,a=i?2:3,u=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let l="";for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)l+=`
10709          blockIndex = rc.z + ${h};
10710          pos = rc.y + ${c};
10711
10712          ${u}
10713            offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];
10714            d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);
10715
10716            if(d0 < inputShape[${o}] && d0 >= 0) {
10717              // Use custom imod instead mod. On Intel GPU, mod may generate
10718              // unexpected value.
10719              // https://github.com/tensorflow/tfjs/issues/5447
10720              offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];
10721              d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /
10722                  inChannels);
10723
10724              if(d1 < inputShape[${a}] && d1 >= 0) {
10725
10726                ch = imod(pos, inChannels);
10727
10728                if (${i}) {
10729                  innerDims = vec2(d1, ch);
10730                  result[${c*2+h}] = getChannel(
10731                    getA(rc.x, d0, int(innerDims.x),
10732                    int(innerDims.y)), innerDims);
10733                } else {
10734                  innerDims = vec2(d0, d1);
10735                  result[${c*2+h}] = getChannel(
10736                    getA(rc.x, ch, int(innerDims.x),
10737                    int(innerDims.y)), innerDims);
10738                }
10739              }
10740            }
10741          }
10742        `;this.userCode=`
10743      void main() {
10744        ivec3 rc = getOutputCoords();
10745
10746        vec4 result = vec4(0);
10747
10748        int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
10749        vec2 innerDims;
10750
10751        ${l}
10752
10753        ${s.output} = result;
10754      }
10755    `}}/**
10756 * @license
10757 * Copyright 2020 Google LLC. All Rights Reserved.
10758 * Licensed under the Apache License, Version 2.0 (the "License");
10759 * you may not use this file except in compliance with the License.
10760 * You may obtain a copy of the License at
10761 *
10762 * http://www.apache.org/licenses/LICENSE-2.0
10763 *
10764 * Unless required by applicable law or agreed to in writing, software
10765 * distributed under the License is distributed on an "AS IS" BASIS,
10766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10767 * See the License for the specific language governing permissions and
10768 * limitations under the License.
10769 * =============================================================================
10770 */function ap(t,e){const n=t.length;return n>=3?e?[...t.slice(0,-3),t[n-3]*t[n-2],t[n-1]]:[...t.slice(0,-3),t[n-3],t[n-2]*t[n-1]]:!e&&n===1&&t[0]>1?[t[0],1]:null}function DP({x:t,filter:e,convInfo:n,backend:r,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:a=null}){const u=t.shape,l=r.texData.get(t.dataId),c=n.inChannels,h=u[0]*u[1]*u[2],d=n.outChannels,f=n.dataFormat==="channelsLast",p=!1,y=!1;let v;const g=[];if(i!=null){const _=ap(i.shape,f);_!=null&&(i=se({inputs:{x:i},backend:r,attrs:{shape:_}}),g.push(i))}if(s!=null){const _=ap(s.shape,f);_!=null&&(s=se({inputs:{x:s},backend:r,attrs:{shape:_}}),g.push(s))}if(!((h===1||d===1)&&c>NP)&&l.isPacked&&f&&l.texture!=null&&u[2]%2!==0&&xt(l.shape.slice(-3),u.slice(-3))){const _=u[0]*u[1]*(u[2]+1),T={dataId:t.dataId,shape:[1,_,n.inChannels],dtype:t.dtype},E=l.shape;l.shape=l.shape.slice(),l.shape[l.shape.length-2]++,A(sp(l.shape,T.shape),()=>`packed reshape ${l.shape} to ${T.shape} isn't free`);const k=se({inputs:{x:e},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}});g.push(k);const N=op({a:T,b:k,backend:r,transposeA:p,transposeB:y,bias:s,activation:a,preluActivationWeights:i,leakyreluAlpha:o}),O=r.texData.get(N.dataId);A(O.isPacked,()=>"batchMatMul result is expected to be packed"),l.shape=E,O.shape=n.outShape,v=Jn({inputs:{x:N},backend:r}),v.shape=n.outShape,g.push(N)}else{const _=n.outHeight*n.outWidth,T=se({inputs:{x:t},backend:r,attrs:{shape:f?[n.batchSize,_,n.inChannels]:[n.batchSize,n.inChannels,_]}}),E=se({inputs:{x:e},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}}),k=op({a:f?T:E,b:f?E:T,transposeA:!f,transposeB:y,backend:r,bias:s,activation:a,preluActivationWeights:i,leakyreluAlpha:o});v=se({inputs:{x:k},backend:r,attrs:{shape:n.outShape}}),g.push(T),g.push(E),g.push(k)}for(const _ of g)r.disposeIntermediateTensorInfo(_);return v}function PP({x:t,filter:e,convInfo:n,backend:r,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:a=null}){const{filterWidth:u,filterHeight:l,inChannels:c,outWidth:h,outHeight:d,dataFormat:f}=n,p=f==="channelsLast",y=u*l*c,v=d*h,g=[n.batchSize,y,v],x=!0,w=!1,_=[];if(i!=null){const j=ap(i.shape,p);j!=null&&(i=se({inputs:{x:i},backend:r,attrs:{shape:j}}),_.push(i))}if(s!=null){const j=ap(s.shape,p);j!=null&&(s=se({inputs:{x:s},backend:r,attrs:{shape:j}}),_.push(s))}const T=se({inputs:{x:e},backend:r,attrs:{shape:[1,y,ne(e.shape)/y]}});_.push(T);const E=new Kae(g,n),k=[t.shape,[n.padInfo.top,n.padInfo.left],[n.strideHeight,n.strideWidth],[n.dilationHeight,n.dilationWidth],[n.inChannels],[n.filterWidth*n.inChannels],[n.outWidth]],N=r.runWebGLProgram(E,[t],"float32",k),O=se({inputs:{x:N},backend:r,attrs:{shape:g}});_.push(N),_.push(O);const R=s!=null,L=i!=null,W=a==="leakyrelu",G=a?Xc(a,!0):null,H=new CP(p?O.shape:T.shape,p?T.shape:O.shape,p?[n.batchSize,v,n.outChannels]:[n.batchSize,n.outChannels,v],x,w,R,G,L,W),X=p?[O,T]:[T,O];if(s&&X.push(s),L&&X.push(i),W){const j=r.makeTensorInfo([],"float32",ml(o,"float32"));X.push(j),_.push(j)}const Q=r.runWebGLProgram(H,X,"float32"),Y=se({inputs:{x:Q},backend:r,attrs:{shape:n.outShape}});_.push(Q);for(const j of _)r.disposeIntermediateTensorInfo(j);return Y}/**
10771 * @license
10772 * Copyright 2020 Google LLC. All Rights Reserved.
10773 * Licensed under the Apache License, Version 2.0 (the "License");
10774 * you may not use this file except in compliance with the License.
10775 * You may obtain a copy of the License at
10776 *
10777 * http://www.apache.org/licenses/LICENSE-2.0
10778 *
10779 * Unless required by applicable law or agreed to in writing, software
10780 * distributed under the License is distributed on an "AS IS" BASIS,
10781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10782 * See the License for the specific language governing permissions and
10783 * limitations under the License.
10784 * =============================================================================
10785 */function Xae(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i}=e,{strides:o,pad:a,dataFormat:u,dilations:l,dimRoundingMode:c}=r,h=gl(u),d=yr(s.shape,i.shape,o,l,a,c,!1,h);let f;if(d.filterHeight===1&&d.filterWidth===1&&d.dilationHeight===1&&d.dilationWidth===1&&d.strideHeight===1&&d.strideWidth===1&&(d.padInfo.type==="SAME"||d.padInfo.type==="VALID"))f=DP({x:s,filter:i,convInfo:d,backend:n});else if(d.strideWidth<=2&&h==="channelsLast"&&U().getBool("WEBGL_EXP_CONV")){const y=new OP(d),v=[[d.padInfo.top,d.padInfo.left],[d.strideHeight,d.strideWidth],[d.dilationHeight,d.dilationWidth],[d.inHeight,d.inWidth]];f=n.runWebGLProgram(y,[s,i],"float32",v)}else if(U().getBool("WEBGL_CONV_IM2COL"))f=PP({x:s,filter:i,convInfo:d,backend:n});else{const y=new RP(d);f=n.runWebGLProgram(y,[s,i],"float32")}const p=se({inputs:{x:f},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(f),p}const Yae={kernelName:aI,backendName:"webgl",kernelFunc:Xae};/**
10786 * @license
10787 * Copyright 2017 Google LLC. All Rights Reserved.
10788 * Licensed under the Apache License, Version 2.0 (the "License");
10789 * you may not use this file except in compliance with the License.
10790 * You may obtain a copy of the License at
10791 *
10792 * http://www.apache.org/licenses/LICENSE-2.0
10793 *
10794 * Unless required by applicable law or agreed to in writing, software
10795 * distributed under the License is distributed on an "AS IS" BASIS,
10796 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10797 * See the License for the specific language governing permissions and
10798 * limitations under the License.
10799 * =============================================================================
10800 */class Qae{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const n=e.strideHeight,r=e.strideWidth,s=e.padInfo.top,i=e.padInfo.left,o=e.dataFormat==="channelsLast";this.userCode=`
10801      void main() {
10802        ivec4 coords = getOutputCoords();
10803        int wR = coords.x;
10804        int wC = coords.y;
10805        int d1 = coords.z;
10806        int d2 = coords.w;
10807
10808        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
10809        // ? = to be determined. : = across all values in that axis.
10810        float dotProd = 0.0;
10811
10812        for (int b = 0; b < ${e.batchSize}; b++) {
10813          for (int yR = 0; yR < ${e.outHeight}; yR++) {
10814            int xR = wR + yR * ${n} - ${s};
10815
10816            if (xR < 0 || xR >= ${e.inHeight}) {
10817              continue;
10818            }
10819
10820            for (int yC = 0; yC < ${e.outWidth}; yC++) {
10821              int xC = wC + yC * ${r} - ${i};
10822
10823              if (xC < 0 || xC >= ${e.inWidth}) {
10824                continue;
10825              }
10826
10827              ${o?`float dyValue = getDy(b, yR, yC, d2);
10828              float xValue = getX(b, xR, xC, d1);
10829              dotProd += (xValue * dyValue);`:`float dyValue = getDy(b, d2, yR, yC);
10830              float xValue = getX(b, d1, xR, xC);
10831              dotProd += (xValue * dyValue);`}
10832            }
10833          }
10834        }
10835        setOutput(dotProd);
10836      }
10837    `}}class Zae{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const n=e.filterHeight,r=e.filterWidth,s=e.strideHeight,i=e.strideWidth,o=e.dataFormat==="channelsLast",a=n-1-e.padInfo.top,u=r-1-e.padInfo.left,l=o?1:2,c=o?2:3,h=o?3:1;this.userCode=`
10838      const ivec2 pads = ivec2(${a}, ${u});
10839
10840      void main() {
10841        ivec4 coords = getOutputCoords();
10842        int batch = coords[0];
10843        int d1 = coords[${h}];
10844
10845        ivec2 dyCorner = ivec2(coords[${l}], coords[${c}]) - pads;
10846        int dyRCorner = dyCorner.x;
10847        int dyCCorner = dyCorner.y;
10848
10849        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
10850        // ? = to be determined. : = across all values in that axis.
10851        float dotProd = 0.0;
10852        for (int wR = 0; wR < ${n}; wR++) {
10853          float dyR = float(dyRCorner + wR) / ${s}.0;
10854
10855          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
10856            continue;
10857          }
10858          int idyR = int(dyR);
10859
10860          int wRPerm = ${n} - 1 - wR;
10861
10862          for (int wC = 0; wC < ${r}; wC++) {
10863            float dyC = float(dyCCorner + wC) / ${i}.0;
10864
10865            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
10866                fract(dyC) > 0.0) {
10867              continue;
10868            }
10869            int idyC = int(dyC);
10870
10871            int wCPerm = ${r} - 1 - wC;
10872
10873            for (int d2 = 0; d2 < ${e.outChannels}; d2++) {
10874
10875              if (${o}) {
10876                float xValue = getDy(batch, idyR, idyC, d2);
10877                float wValue = getW(wRPerm, wCPerm, d1, d2);
10878                dotProd += xValue * wValue;
10879              } else {
10880                float xValue = getDy(batch, d2, idyR, idyC);
10881                float wValue = getW(wRPerm, wCPerm, d1, d2);
10882                dotProd += xValue * wValue;
10883              }
10884
10885            }
10886          }
10887        }
10888        setOutput(dotProd);
10889      }
10890    `}}class Jae{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const n=e.strideDepth,r=e.strideHeight,s=e.strideWidth,i=e.padInfo.front,o=e.padInfo.top,a=e.padInfo.left;this.userCode=`
10891      void main() {
10892        ivec5 coords = getOutputCoords();
10893        int wF = coords.x;
10894        int wR = coords.y;
10895        int wC = coords.z;
10896        int d1 = coords.w;
10897        int d2 = coords.u;
10898
10899        float dotProd = 0.0;
10900
10901        for (int b = 0; b < ${e.batchSize}; b++) {
10902          for (int yF = 0; yF < ${e.outDepth}; yF++) {
10903            int xF = wF + yF * ${n} - ${i};
10904
10905            if (xF < 0 || xF >= ${e.inDepth}) {
10906              continue;
10907            }
10908
10909            for (int yR = 0; yR < ${e.outHeight}; yR++) {
10910              int xR = wR + yR * ${r} - ${o};
10911
10912              if (xR < 0 || xR >= ${e.inHeight}) {
10913                continue;
10914              }
10915
10916              for (int yC = 0; yC < ${e.outWidth}; yC++) {
10917                int xC = wC + yC * ${s} - ${a};
10918
10919                if (xC < 0 || xC >= ${e.inWidth}) {
10920                  continue;
10921                }
10922
10923                float dyValue = getDy(b, yF, yR, yC, d2);
10924                float xValue = getX(b, xF, xR, xC, d1);
10925                dotProd += (xValue * dyValue);
10926              }
10927            }
10928          }
10929        }
10930        setOutput(dotProd);
10931      }
10932    `}}class eue{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const n=e.filterDepth,r=e.filterHeight,s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,a=e.strideWidth,u=n-1-e.padInfo.front,l=r-1-e.padInfo.top,c=s-1-e.padInfo.left;this.userCode=`
10933      const ivec3 pads = ivec3(${u}, ${l}, ${c});
10934
10935      void main() {
10936        ivec5 coords = getOutputCoords();
10937        int batch = coords.x;
10938        int d1 = coords.u;
10939
10940
10941        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
10942        int dyFCorner = dyCorner.x;
10943        int dyRCorner = dyCorner.y;
10944        int dyCCorner = dyCorner.z;
10945
10946        float dotProd = 0.0;
10947        for (int wF = 0; wF < ${n}; wF++) {
10948          float dyF = float(dyFCorner + wF) / ${i}.0;
10949
10950          if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) {
10951            continue;
10952          }
10953          int idyF = int(dyF);
10954
10955          int wFPerm = ${n} - 1 - wF;
10956
10957          for (int wR = 0; wR < ${r}; wR++) {
10958            float dyR = float(dyRCorner + wR) / ${o}.0;
10959
10960            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
10961              fract(dyR) > 0.0) {
10962              continue;
10963            }
10964            int idyR = int(dyR);
10965
10966            int wRPerm = ${r} - 1 - wR;
10967
10968            for (int wC = 0; wC < ${s}; wC++) {
10969              float dyC = float(dyCCorner + wC) / ${a}.0;
10970
10971              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
10972                  fract(dyC) > 0.0) {
10973                continue;
10974              }
10975              int idyC = int(dyC);
10976
10977              int wCPerm = ${s} - 1 - wC;
10978
10979              for (int d2 = 0; d2 < ${e.outChannels}; d2++) {
10980                float xValue = getDy(batch, idyF, idyR, idyC, d2);
10981                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);
10982                dotProd += xValue * wValue;
10983              }
10984            }
10985          }
10986        }
10987        setOutput(dotProd);
10988      }
10989    `}}/**
10990 * @license
10991 * Copyright 2020 Google LLC. All Rights Reserved.
10992 * Licensed under the Apache License, Version 2.0 (the "License");
10993 * you may not use this file except in compliance with the License.
10994 * You may obtain a copy of the License at
10995 *
10996 * http://www.apache.org/licenses/LICENSE-2.0
10997 *
10998 * Unless required by applicable law or agreed to in writing, software
10999 * distributed under the License is distributed on an "AS IS" BASIS,
11000 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11001 * See the License for the specific language governing permissions and
11002 * limitations under the License.
11003 * =============================================================================
11004 */function tue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:i}=e,{strides:o,pad:a,dataFormat:u,dimRoundingMode:l,filterShape:c}=r,h=gl(u),d=yr(s.shape,c,o,1,a,l,!1,h),f=new Qae(d);return n.runWebGLProgram(f,[s,i],"float32")}const nue={kernelName:uI,backendName:"webgl",kernelFunc:tue};/**
11005 * @license
11006 * Copyright 2023 Google LLC.
11007 * Licensed under the Apache License, Version 2.0 (the "License");
11008 * you may not use this file except in compliance with the License.
11009 * You may obtain a copy of the License at
11010 *
11011 * http://www.apache.org/licenses/LICENSE-2.0
11012 *
11013 * Unless required by applicable law or agreed to in writing, software
11014 * distributed under the License is distributed on an "AS IS" BASIS,
11015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11016 * See the License for the specific language governing permissions and
11017 * limitations under the License.
11018 * =============================================================================
11019 */class rue{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=fn(this.outputShape.length);const n=e.filterHeight,r=e.filterWidth,s=n-1-e.padInfo.top,i=r-1-e.padInfo.left;this.userCode=`
11020      const ivec2 pads = ivec2(${s}, ${i});
11021
11022      void main() {
11023        ivec4 coords = getOutputCoords();
11024        int batch = coords[0];
11025        int d1 = coords[3];
11026
11027        ivec2 dyCorner = ivec2(coords[1], coords[2]) - pads;
11028        int dyRCorner = dyCorner.x;
11029        int dyCCorner = dyCorner.y;
11030
11031        vec4 result = vec4(0.);
11032        for (int wR = 0; wR < ${n}; wR++) {
11033          float dyR = float(dyRCorner + wR) / strides[0];
11034          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
11035            continue;
11036          }
11037          int idyR = int(dyR);
11038          int wRPerm = ${n} - 1 - wR;
11039
11040          for (int wC = 0; wC < ${r}; wC++) {
11041            int wCPerm = ${r} - 1 - wC;
11042
11043            float dyC = float(dyCCorner + wC) / strides[1];
11044            bool idyCVal = (dyC >= 0.0) && (dyC < ${e.outWidth}.0)
11045              && (fract(dyC) == 0.0);
11046            int idyC = int(dyC);
11047
11048            float dyC2 = float(dyCCorner + wC + 1) / strides[1];
11049            bool idyCVal2 = (dyC2 >= 0.0) && (dyC2 < ${e.outWidth}.0)
11050              && (fract(dyC2) == 0.0);
11051            int idyC2 = int(dyC2);
11052
11053            if (idyCVal && idyCVal2) {
11054              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
11055                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
11056                vec4 dySample = getDy(batch, idyR, idyC, d2);
11057                vec4 dySample2 = (idyC / 2 == idyC2 / 2) ?
11058                  dySample : getDy(batch, idyR, idyC2, d2);
11059
11060                vec2 dyValue = mod(float(idyC), 2.) == 0. ?
11061                  dySample.xy : dySample.zw;
11062                result.xy += vec2(dot(dyValue, wValue.xy),
11063                  dot(dyValue, wValue.zw));
11064
11065                dyValue = mod(float(idyC2), 2.) == 0. ?
11066                  dySample2.xy : dySample2.zw;
11067                result.zw += vec2(dot(dyValue, wValue.xy),
11068                  dot(dyValue, wValue.zw));
11069              }
11070            } else if (idyCVal) {
11071              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
11072                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
11073                vec4 dySample = getDy(batch, idyR, idyC, d2);
11074                vec2 dyValue = mod(float(idyC), 2.) == 0. ?
11075                  dySample.xy : dySample.zw;
11076                result.xy += vec2(dot(dyValue, wValue.xy),
11077                  dot(dyValue, wValue.zw));
11078              }
11079            } else if (idyCVal2) {
11080              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
11081                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
11082                vec4 dySample = getDy(batch, idyR, idyC2, d2);
11083                vec2 dyValue = mod(float(idyC2), 2.) == 0. ?
11084                  dySample.xy : dySample.zw;
11085                result.zw += vec2(dot(dyValue, wValue.xy),
11086                  dot(dyValue, wValue.zw));
11087              }
11088            }
11089          }
11090        }
11091        setOutput(result);
11092      }
11093    `}}/**
11094 * @license
11095 * Copyright 2020 Google LLC. All Rights Reserved.
11096 * Licensed under the Apache License, Version 2.0 (the "License");
11097 * you may not use this file except in compliance with the License.
11098 * You may obtain a copy of the License at
11099 *
11100 * http://www.apache.org/licenses/LICENSE-2.0
11101 *
11102 * Unless required by applicable law or agreed to in writing, software
11103 * distributed under the License is distributed on an "AS IS" BASIS,
11104 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11105 * See the License for the specific language governing permissions and
11106 * limitations under the License.
11107 * =============================================================================
11108 */function sue(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:i}=e,{inputShape:o,strides:a,pad:u,dataFormat:l,dimRoundingMode:c}=r,h=gl(l),d=yr(o,i.shape,a,1,u,c,!1,h);if(U().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&h==="channelsLast"){const f=[[d.strideHeight,d.strideWidth]],p=new rue(d);return n.runWebGLProgram(p,[s,i],"float32",f)}else{const f=new Zae(d);return n.runWebGLProgram(f,[s,i],"float32")}}const iue={kernelName:lI,backendName:"webgl",kernelFunc:sue};/**
11109 * @license
11110 * Copyright 2020 Google LLC. All Rights Reserved.
11111 * Licensed under the Apache License, Version 2.0 (the "License");
11112 * you may not use this file except in compliance with the License.
11113 * You may obtain a copy of the License at
11114 *
11115 * http://www.apache.org/licenses/LICENSE-2.0
11116 *
11117 * Unless required by applicable law or agreed to in writing, software
11118 * distributed under the License is distributed on an "AS IS" BASIS,
11119 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11120 * See the License for the specific language governing permissions and
11121 * limitations under the License.
11122 * =============================================================================
11123 */function oue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i}=e,{strides:o,pad:a,dilations:u}=r,l=bh(s.shape,i.shape,o,u,a),c=new qae(l);return n.runWebGLProgram(c,[s,i],"float32")}const aue={kernelName:cI,backendName:"webgl",kernelFunc:oue};/**
11124 * @license
11125 * Copyright 2020 Google LLC. All Rights Reserved.
11126 * Licensed under the Apache License, Version 2.0 (the "License");
11127 * you may not use this file except in compliance with the License.
11128 * You may obtain a copy of the License at
11129 *
11130 * http://www.apache.org/licenses/LICENSE-2.0
11131 *
11132 * Unless required by applicable law or agreed to in writing, software
11133 * distributed under the License is distributed on an "AS IS" BASIS,
11134 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11135 * See the License for the specific language governing permissions and
11136 * limitations under the License.
11137 * =============================================================================
11138 */function uue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:i}=e,{strides:o,pad:a,filterShape:u}=r,l=bh(s.shape,u,o,1,a),c=new Jae(l);return n.runWebGLProgram(c,[s,i],"float32")}const lue={kernelName:x5,backendName:"webgl",kernelFunc:uue};/**
11139 * @license
11140 * Copyright 2020 Google LLC. All Rights Reserved.
11141 * Licensed under the Apache License, Version 2.0 (the "License");
11142 * you may not use this file except in compliance with the License.
11143 * You may obtain a copy of the License at
11144 *
11145 * http://www.apache.org/licenses/LICENSE-2.0
11146 *
11147 * Unless required by applicable law or agreed to in writing, software
11148 * distributed under the License is distributed on an "AS IS" BASIS,
11149 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11150 * See the License for the specific language governing permissions and
11151 * limitations under the License.
11152 * =============================================================================
11153 */function cue(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:i}=e,{pad:o,strides:a,inputShape:u}=r,l=bh(u,i.shape,a,1,o),c=new eue(l);return n.runWebGLProgram(c,[s,i],"float32")}const hue={kernelName:hI,backendName:"webgl",kernelFunc:cue};/**
11154 * @license
11155 * Copyright 2020 Google LLC. All Rights Reserved.
11156 * Licensed under the Apache License, Version 2.0 (the "License");
11157 * you may not use this file except in compliance with the License.
11158 * You may obtain a copy of the License at
11159 *
11160 * http://www.apache.org/licenses/LICENSE-2.0
11161 *
11162 * Unless required by applicable law or agreed to in writing, softw
11162are
11163 * distributed under the License is distributed on an "AS IS" BASIS,
11164 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11165 * See the License for the specific language governing permissions and
11166 * limitations under the License.
11167 * =============================================================================
11168 */const due=Tl+`
11169  return cos(x);
11170`,fue=`
11171  vec4 result = cos(x);
11172  bvec4 isNaN = isnan(x);
11173  ${Ba}
11174  return result;
11175`,pue=Pe({opSnippet:due,packedOpSnippet:fue}),mue={kernelName:dI,backendName:"webgl",kernelFunc:pue};/**
11176 * @license
11177 * Copyright 2020 Google LLC. All Rights Reserved.
11178 * Licensed under the Apache License, Version 2.0 (the "License");
11179 * you may not use this file except in compliance with the License.
11180 * You may obtain a copy of the License at
11181 *
11182 * http://www.apache.org/licenses/LICENSE-2.0
11183 *
11184 * Unless required by applicable law or agreed to in writing, software
11185 * distributed under the License is distributed on an "AS IS" BASIS,
11186 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11187 * See the License for the specific language governing permissions and
11188 * limitations under the License.
11189 * =============================================================================
11190 */const gue=`
11191  float e2x = exp(-x);
11192  return (e2x + 1.0 / e2x) / 2.0;
11193`,yue=Pe({opSnippet:gue}),vue={kernelName:fI,backendName:"webgl",kernelFunc:yue};/**
11194 * @license
11195 * Copyright 2017 Google LLC. All Rights Reserved.
11196 * Licensed under the Apache License, Version 2.0 (the "License");
11197 * you may not use this file except in compliance with the License.
11198 * You may obtain a copy of the License at
11199 *
11200 * http://www.apache.org/licenses/LICENSE-2.0
11201 *
11202 * Unless required by applicable law or agreed to in writing, software
11203 * distributed under the License is distributed on an "AS IS" BASIS,
11204 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11205 * See the License for the specific language governing permissions and
11206 * limitations under the License.
11207 * =============================================================================
11208 */class xue{constructor(e,n,r,s,i){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[o,a,u,l]=e,[c]=n,[h,d]=r;this.outputShape=[c,h,d,l];const f=s==="bilinear"?1:0,[p,y]=[`${a-1}.0`,`${u-1}.0`],[v,g,x]=h>1?[`${(a-1)/(h-1)}`,"(y2-y1) * height_ratio",`y1*${p} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${p}`],[w,_,T]=d>1?[`${(u-1)/(d-1)}`,"(x2-x1) * width_ratio",`x1*${y} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${y}`];this.userCode=`
11209      const float height_ratio = float(${v});
11210      const float width_ratio = float(${w});
11211      void main() {
11212        ivec4 coords = getOutputCoords();
11213        int b = coords[0];
11214        int y = coords[1];
11215        int x = coords[2];
11216        int d = coords[3];
11217
11218        // get box vals
11219        float y1 = getBoxes(b,0);
11220        float x1 = getBoxes(b,1);
11221        float y2 = getBoxes(b,2);
11222        float x2 = getBoxes(b,3);
11223
11224        // get image in batch index
11225        int bInd = round(getBoxInd(b));
11226        if(bInd < 0 || bInd >= ${o}) {
11227          return;
11228        }
11229
11230        float height_scale = ${g};
11231        float width_scale = ${_};
11232
11233        float in_y = ${x};
11234        if( in_y < 0.0 || in_y > ${p} ) {
11235          setOutput(float(${i}));
11236          return;
11237        }
11238        float in_x = ${T};
11239        if( in_x < 0.0 || in_x > ${y} ) {
11240          setOutput(float(${i}));
11241          return;
11242        }
11243
11244        vec2 sourceFracIndexCR = vec2(in_x,in_y);
11245        if(${f} == 1) {
11246          // Compute the four integer indices.
11247          ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);
11248          ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));
11249
11250          float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);
11251          float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);
11252          float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);
11253          float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);
11254
11255          vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);
11256
11257          float top = topLeft + (topRight - topLeft) * fracCR.x;
11258          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;
11259          float newValue = top + (bottom - top) * fracCR.y;
11260          setOutput(newValue);
11261        } else {
11262          // Compute the coordinators of nearest neighbor point.
11263          ivec2 sourceNearestCR = ivec2(floor(
11264            sourceFracIndexCR + vec2(0.5,0.5)));
11265          float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);
11266          setOutput(newValue);
11267        }
11268      }
11269    `}}/**
11270 * @license
11271 * Copyright 2020 Google LLC. All Rights Reserved.
11272 * Licensed under the Apache License, Version 2.0 (the "License");
11273 * you may not use this file except in compliance with the License.
11274 * You may obtain a copy of the License at
11275 *
11276 * http://www.apache.org/licenses/LICENSE-2.0
11277 *
11278 * Unless required by applicable law or agreed to in writing, software
11279 * distributed under the License is distributed on an "AS IS" BASIS,
11280 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11281 * See the License for the specific language governing permissions and
11282 * limitations under the License.
11283 * =============================================================================
11284 */const wue=t=>{const{inputs:e,backend:n,attrs:r}=t,{image:s,boxes:i,boxInd:o}=e,{cropSize:a,method:u,extrapolationValue:l}=r,c=new xue(s.shape,i.shape,a,u,l);return n.runWebGLProgram(c,[s,i,o],"float32")},bue={kernelName:gI,backendName:"webgl",kernelFunc:wue};var Qc;(function(t){t.Prod="*",t.Sum="+"})(Qc||(Qc={}));class hC{constructor(e,n,r,s){this.op=e,this.outputShape=n,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const i=this.outputShape.length,o=this.op===Qc.Prod?"1.0":"0.0",a=r?o:`getX(${dC(i,"coords",this.op)})`,u=this.outputShape[this.outputShape.length-1];let l="",c="";r?(l=s?`end != ${u-1}`:"end != 0",c=s?"end + 1":"end - 1"):(l=s?`end + pow2 < ${u}`:"end >= pow2",c=s?"end + pow2":"end - pow2"),this.userCode=`
11285      void main() {
11286        ${qe(i)} coords = getOutputCoords();
11287        int end = ${fC(i,"coords",this.op)};
11288        float val = ${a};
11289        int pow2 = int(pow(2.0, index));
11290        if (${l}) {
11291          int idx = ${c};
11292          ${fC(i,"coords",this.op)} = idx;
11293          val ${this.op}= getX(${dC(i,"coords",this.op)});
11294        }
11295        setOutput(val);
11296      }
11297    `}}function dC(t,e,n){if(t===1)return`${e}`;if(t===2)return`${e}.x, ${e}.y`;if(t===3)return`${e}.x, ${e}.y, ${e}.z`;if(t===4)return`${e}.x, ${e}.y, ${e}.z, ${e}.w`;throw new Error(`Cumulative ${n} for rank ${t} is not yet supported`)}function fC(t,e,n){if(t===1)return`${e}`;if(t===2)return`${e}.y`;if(t===3)return`${e}.z`;if(t===4)return`${e}.w`;throw new Error(`Cumulative ${n} for rank ${t} is not yet supported`)}/**
11298 * @license
11299 * Copyright 2022 Google LLC. All Rights Reserved.
11300 * Licensed under the Apache License, Version 2.0 (the "License");
11301 * you may not use this file except in compliance with the License.
11302 * You may obtain a copy of the License at
11303 *
11304 * http://www.apache.org/licenses/LICENSE-2.0
11305 *
11306 * Unless required by applicable law or agreed to in writing, software
11307 * distributed under the License is distributed on an "AS IS" BASIS,
11308 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11309 * See the License for the specific language governing permissions and
11310 * limitations under the License.
11311 * =============================================================================
11312 */function FP(t,e,n,r,s,i){const o=e.shape.length,a=Ur([r],o);let u=e;a!=null&&(u=Tn({inputs:{x:e},backend:n,attrs:{perm:a}}));const l=zr(1,o)[0];if(l!==o-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${e.shape.length-1} but got axis=${r}`);const c=u.shape[l];let h=Jn({inputs:{x:u},backend:n});for(let d=0;d<=Math.ceil(Math.log2(c))-1;d++){const f=new hC(t,u.shape,!1,i),p=[[d]],y=h;h=n.runWebGLProgram(f,[h],h.dtype,p),n.disposeIntermediateTensorInfo(y)}if(s){const d=new hC(t,u.shape,s,i),f=h;h=n.runWebGLProgram(d,[h],h.dtype),n.disposeIntermediateTensorInfo(f)}if(a!=null){const d=F1(a),f=Tn({inputs:{x:h},backend:n,attrs:{perm:d}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(u),f}return h}/**
11313 * @license
11314 * Copyright 2022 Google LLC. All Rights Reserved.
11315 * Licensed under the Apache License, Version 2.0 (the "License");
11316 * you may not use this file except in compliance with the License.
11317 * You may obtain a copy of the License at
11318 *
11319 * http://www.apache.org/licenses/LICENSE-2.0
11320 *
11321 * Unless required by applicable law or agreed to in writing, software
11322 * distributed under the License is distributed on an "AS IS" BASIS,
11323 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11324 * See the License for the specific language governing permissions and
11325 * limitations under the License.
11326 * =============================================================================
11327 */function _ue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,exclusive:o,reverse:a}=r;return FP(Qc.Prod,s,n,i,o,a)}
vendor: 8,051 bytes, lines 11327-11477
11327const Sue={kernelName:pI,backendName:"webgl",kernelFunc:_ue};/**
11328 * @license
11329 * Copyright 2022 Google LLC. All Rights Reserved.
11330 * Licensed under the Apache License, Version 2.0 (the "License");
11331 * you may not use this file except in compliance with the License.
11332 * You may obtain a copy of the License at
11333 *
11334 * http://www.apache.org/licenses/LICENSE-2.0
11335 *
11336 * Unless required by applicable law or agreed to in writing, software
11337 * distributed under the License is distributed on an "AS IS" BASIS,
11338 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11339 * See the License for the specific language governing permissions and
11340 * limitations under the License.
11341 * =============================================================================
11342 */function Tue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,exclusive:o,reverse:a}=r;return FP(Qc.Sum,s,n,i,o,a)}const Cue={kernelName:mI,backendName:"webgl",kernelFunc:Tue};/**
11343 * @license
11344 * Copyright 2020 Google LLC. All Rights Reserved.
11345 * Licensed under the Apache License, Version 2.0 (the "License");
11346 * you may not use this file except in compliance with the License.
11347 * You may obtain a copy of the License at
11348 *
11349 * http://www.apache.org/licenses/LICENSE-2.0
11350 *
11351 * Unless required by applicable law or agreed to in writing, software
11352 * distributed under the License is distributed on an "AS IS" BASIS,
11353 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11354 * See the License for the specific language governing permissions and
11355 * limitations under the License.
11356 * =============================================================================
11357 */function Nue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,weights:i}=e,{size:o,binaryOutput:a}=r;if(s.shape.length===1){const u=n.readSync(s.dataId),l=n.readSync(i.dataId),c=gP(u,l,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,c)}else if(s.shape.length===2){const u=n.bufferSync(s),l=n.bufferSync(i),c=Ise(u,l,o,a);return n.makeTensorInfo(c.shape,i.dtype,c.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${s.shape.length}.`)}const Eue={kernelName:yI,backendName:"webgl",kernelFunc:Nue};/**
11358 * @license
11359 * Copyright 2018 Google LLC. All Rights Reserved.
11360 * Licensed under the Apache License, Version 2.0 (the "License");
11361 * you may not use this file except in compliance with the License.
11362 * You may obtain a copy of the License at
11363 *
11364 * http://www.apache.org/licenses/LICENSE-2.0
11365 *
11366 * Unless required by applicable law or agreed to in writing, software
11367 * distributed under the License is distributed on an "AS IS" BASIS,
11368 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11369 * See the License for the specific language governing permissions and
11370 * limitations under the License.
11371 * =============================================================================
11372 */class kue{constructor(e,n,r){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=n,this.dataFormat=r,this.userCode=`
11373    void main() {
11374      ivec4 coords = getOutputCoords();
11375      int b = coords[0];
11376      int h = ${this.getHeightCoordString()};
11377      int w = ${this.getWidthCoordString()};
11378      int d = ${this.getDepthCoordString()};
11379
11380      int in_h = h / ${n};
11381      int offset_h = imod(h, ${n});
11382      int in_w = w / ${n};
11383      int offset_w = imod(w, ${n});
11384      int offset_d = (offset_h * ${n} + offset_w) *
11385        ${this.getOutputDepthSize()};
11386      int in_d = d + offset_d;
11387
11388      float result = ${this.getInputSamplingString()};
11389      setOutput(result);
11390    }
11391  `}getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}/**
11392 * @license
11393 * Copyright 2020 Google LLC. All Rights Reserved.
11394 * Licensed under the Apache License, Version 2.0 (the "License");
11395 * you may not use this file except in compliance with the License.
11396 * You may obtain a copy of the License at
11397 *
11398 * http://www.apache.org/licenses/LICENSE-2.0
11399 *
11400 * Unless required by applicable law or agreed to in writing, software
11401 * distributed under the License is distributed on an "AS IS" BASIS,
11402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11403 * See the License for the specific language governing permissions and
11404 * limitations under the License.
11405 * =============================================================================
11406 */function $ue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockSize:i,dataFormat:o}=r,a=s.shape[0],u=o==="NHWC"?s.shape[1]:s.shape[2],l=o==="NHWC"?s.shape[2]:s.shape[3],c=o==="NHWC"?s.shape[3]:s.shape[1],h=u*i,d=l*i,f=c/(i*i),p=o==="NHWC"?[a,h,d,f]:[a,f,h,d],y=new kue(p,i,o);return n.runWebGLProgram(y,[s],s.dtype)}const Iue={kernelName:vI,backendName:"webgl",kernelFunc:$ue};/**
11407 * @license
11408 * Copyright 2017 Google LLC. All Rights Reserved.
11409 * Licensed under the Apache License, Version 2.0 (the "License");
11410 * you may not use this file except in compliance with the License.
11411 * You may obtain a copy of the License at
11412 *
11413 * http://www.apache.org/licenses/LICENSE-2.0
11414 *
11415 * Unless required by applicable law or agreed to in writing, software
11416 * distributed under the License is distributed on an "AS IS" BASIS,
11417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11418 * See the License for the specific language governing permissions and
11419 * limitations under the License.
11420 * =============================================================================
11421 */class LP{constructor(e,n=!1,r=null,s=!1,i=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=fn(this.outputShape.length);const o=e.filterHeight,a=e.filterWidth,u=e.outChannels/e.inChannels;let l="",c="";r&&(s?l=`float activation(float a) {
11422          float b = getPreluActivationWeightsAtOutCoords();
11423          ${r}
11424        }`:i?l=`float activation(float a) {
11425          float b = getLeakyreluAlphaAtOutCoords();
11426          ${r}
11427        }`:l=`
11428          float activation(float x) {
11429            ${r}
11430          }
11431        `,c="result = activation(result);");const h=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
11432      ${l}
11433
11434      void main() {
11435        ivec4 coords = getOutputCoords();
11436        int batch = coords.x;
11437        ivec2 xRCCorner = coords.yz * strides - pads;
11438        int d2 = coords.w;
11439        int d1 = d2 / ${u};
11440        int q = d2 - d1 * ${u};
11441
11442        int xRCorner = xRCCorner.x;
11443        int xCCorner = xRCCorner.y;
11444
11445        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
11446        // ? = to be determined. : = across all values in that axis.
11447        float dotProd = 0.0;
11448        // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
11449        for (int wR = 0; wR < ${o}; wR++) {
11450          int xR = xRCorner + wR * dilations[0];
11451
11452          if (xR < 0 || xR >= inDims[0]) {
11453            continue;
11454          }
11455
11456          for (int wC = 0; wC < ${a}; wC++) {
11457            int xC = xCCorner + wC * dilations[1];
11458
11459            if (xC < 0 || xC >= inDims[1]) {
11460              continue;
11461            }
11462
11463            float xVal = getX(batch, xR, xC, d1);
11464            float wVal = getW(wR, wC, d1, q);
11465            dotProd += xVal * wVal;
11466          }
11467        }
11468
11469        float result = dotProd;
11470        ${h}
11471        ${c}
11472        setOutput(result);
11473      }
11474    `}}/**
11475 * @license
11476 * Copyright 2018 Google LLC. All Rights Reserved.
11477 * Licensed under the Apache License, Version 2.0 (the "License");
11478 * you may not use this file except in compliance with the License.
11479 * You may obtain a copy of the License at
11480 *
11481 * http://www.apache.org/licenses/LICENSE-2.0
11482 *
11483 * Unless required by applicable law or agreed to in writing, software
11484 * distributed under the License is distributed on an "AS IS" BASIS,
11485 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11486 * See the License for the specific language governing permissions and
11487 * limitations under the License.
11488 * =============================================================================
11489 */class MP{constructor(e,n=!1,r=null,s=!1,i=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=fn(this.outputShape.length);const o=e.outChannels/e.inChannels,a=e.padInfo.left,u=e.strideWidth,l=e.dilationWidth,c=e.filterHeight,h=e.filterWidth,d=h;let f=`
11490      int xR; int xC; int xCOffset;
11491      vec4 wTexel; vec4 previous; vec4 final;`;for(let g=0;g<h;g++)f+=`
11492          vec4 xTexelC${g*2};
11493          int xTexelC${g*2}Ready;
11494          vec4 xTexelC${g*2+1};
11495          int xTexelC${g*2+1}Ready;
11496          vec4 xC${g};`;f+=`
11497    for (int r = 0; r < ${c}; r++) {
11498      `;for(let g=0;g<h;g++)f+=`
11499          xTexelC${g*2} = vec4(0.0);
11500          xTexelC${g*2}Ready = 0;
11501          xTexelC${g*2+1} = vec4(0.0);
11502          xTexelC${g*2+1}Ready = 0;
11503          xC${g} = vec4(0.0);`;f+=`
11504        xR = xRCorner + r * dilations[0];
11505        if (xR >=0 && xR < inDims[0]) {
11506      `;for(let g=0;g<(d+1)/2;g++){const x=g*2;if(f+=`
11507          xC = xCCorner + ${x*l};
11508          `,u===1){if(x<h&&(a%2===1?(f+=`
11509                xCOffset = xC + 1;
11510                if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${x}Ready == 0) {
11511                  xTexelC${x} = getX(batch, xR, xCOffset, d1);
11512
11513                  // Need to manually clear unused channels in case
11514                  // we're reading from recycled texture.
11515                  if (xCOffset + 1 >= inDims[1]) {
11516                    xTexelC${x}.zw = vec2(0.0);
11517                  }
11518                  xTexelC${x}Ready = 1;
11519                }
11520              `,l===1&&x>0?f+=`
11521                xC${x} = vec4(xTexelC${x-2}.zw, xTexelC${x}.xy);
11522                `:f+=`
11523                  xCOffset = xC + 1 - 2;
11524
11525                  if (xCOffset >= 0 && xCOffset < inDims[1]) {
11526                    previous = getX(batch, xR, xCOffset, d1);
11527
11528                    // Need to manually clear unused channels in case
11529                    // we're reading from recycled texture.
11530                    if (xCOffset + 1 >= inDims[1]) {
11531                      previous.zw = vec2(0.0);
11532                    }
11533
11534                    xC${x} = vec4(previous.zw, xTexelC${x}.xy);
11535                  } else {
11536                    xC${x} = vec4(0.0, 0.0, xTexelC${x}.xy);
11537                  }
11538                  `):f+=`
11539                if (xC >= 0 && xC < inDims[1] && xTexelC${x}Ready == 0) {
11540                  xTexelC${x} = getX(batch, xR, xC, d1);
11541                  if (xC + 1 >= inDims[1]) {
11542                    xTexelC${x}.zw = vec2(0.0);
11543                  }
11544                  xTexelC${x}Ready = 1;
11545                }
11546
11547                xC${x} = xTexelC${x};
11548                `,x+1<h)){const w=a%2===0?_1(l):l;l%2===0&&a%2===1||l%2!==0&&a%2!==1?(f+=`
11549                  xCOffset = xC + imod(pads[1], 2) + ${w};
11550
11551                  if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${x+1}Ready == 0) {
11552                    xTexelC${x+1} = getX(batch, xR, xCOffset, d1);
11553
11554                    // Need to manually clear unused channels in case
11555                    // we're reading from recycled texture.
11556                    if (xCOffset + 1 >= inDims[1]) {
11557                      xTexelC${x+1}.zw = vec2(0.0);
11558                    }
11559                    xTexelC${x+1}Ready = 1;
11560                  }
11561                  `,l>1?f+=`
11562                    xCOffset -= 2;
11563                    if (xCOffset >= 0 && xCOffset < inDims[1]) {
11564                     previous = getX(batch, xR, xCOffset, d1);
11565                     xC${x+1} = vec4(previous.zw, xTexelC${x+1}.xy);
11566                    } else {
11567                     xC${x+1} = vec4(0.0, 0.0, xTexelC${x+1}.xy);
11568                    }
11569                    `:f+=`
11570                    xC${x+1} = vec4(xTexelC${x}.zw, xTexelC${x+1}.xy);
11571                    `):w===1?f+=`
11572                    xC${x+1} = xTexelC${x};
11573                    `:f+=`
11574                    xCOffset = xC + ${w};
11575
11576                    if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${x+1}Ready == 0) {
11577                      xTexelC${x+1} = getX(batch, xR, xCOffset, d1);
11578                      if (xCOffset + 1 >= inDims[1]) {
11579                        xTexelC${x+1}.zw = vec2(0.0);
11580                      }
11581                      xTexelC${x+1}Ready = 1;
11582                    }
11583
11584                    xC${x+1} = xTexelC${x+1};
11585                    `}}else x<h&&(a%2===1?(f+=`
11586                xCOffset = xC + 1 - strides[1];
11587                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${x}Ready == 0) {
11588                  xTexelC${x} = getX(batch, xR, xCOffset, d1);
11589                  // Need to manually clear unused channels in case
11590                  // we're reading from recycled texture.
11591                  if (xCOffset + 1 >= inDims[1]) {
11592                    xTexelC${x}.zw = vec2(0.0);
11593                  }
11594                  xTexelC${x}Ready = 1;
11595                }
11596
11597                if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${x+1}Ready == 0) {
11598                  xTexelC${x+1} = getX(batch, xR, xC + 1, d1);
11599                  // Need to manually clear unused channels in case
11600                  // we're reading from recycled texture.
11601                  if (xC + 2 >= inDims[1]) {
11602                    xTexelC${x+1}.zw = vec2(0.0);
11603                  }
11604                  xTexelC${x+1}Ready = 1;
11605                }
11606
11607                xC${x} = vec4(xTexelC${x}.zw, xTexelC${x+1}.zw);
11608              `,x+1<h&&(f+=`
11609                  final = vec4(0.0);
11610                  xCOffset = xC + 1 + strides[1];
11611                  if(xCOffset >= 0 && xCOffset < inDims[1]) {
11612                    final = getX(batch, xR, xCOffset, d1);
11613                  }
11614                  xC${x+1} = vec4(xTexelC${x+1}.xy, final.xy);
11615                `)):(f+=`
11616                if(xC >= 0 && xC < inDims[1] && xTexelC${x}Ready == 0) {
11617                  xTexelC${x} = getX(batch, xR, xC, d1);
11618                  if (xC + 1 >= inDims[1]) {
11619                    xTexelC${x}.zw = vec2(0.0);
11620                  }
11621                  xTexelC${x}Ready = 1;
11622                }
11623
11624                xCOffset = xC + strides[1];
11625                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${x+1}Ready == 0) {
11626                  xTexelC${x+1} = getX(batch, xR, xCOffset, d1);
11627                  if (xCOffset + 1 >= inDims[1]) {
11628                    xTexelC${x+1}.zw = vec2(0.);
11629                  }
11630                  xTexelC${x+1}Ready = 1;
11631                }
11632
11633                xC${x} = vec4(
11634                  xTexelC${x}.xy, xTexelC${x+1}.xy);
11635              `,x+1<h&&(f+=`
11636                  xC${x+1} = vec4(xTexelC${x}.zw, xTexelC${x+1}.zw);
11637                `)));x<h&&(f+=`
11638            wTexel = getW(r, ${x}, d1, q);
11639            dotProd += xC${x} * vec4(wTexel.xz, wTexel.xz);
11640          `,x+1<h&&(f+=`
11641              wTexel = getW(r, ${x+1}, d1, q);
11642              dotProd += xC${x+1} * vec4(wTexel.xz, wTexel.xz);
11643            `))}f+=`
11644    }
11645  `,f+=`
11646      }
11647    `;let p="",y="";r&&(s?p=`vec4 activation(vec4 a) {
11648          vec4 b = getPreluActivationWeightsAtOutCoords();
11649          ${r}
11650        }`:i?p=`vec4 activation(vec4 a) {
11651          vec4 b = getLeakyreluAlphaAtOutCoords();
11652          ${r}
11653        }`:p=`vec4 activation(vec4 x) {
11654          ${r}
11655        }`,y="result = activation(result);");const v=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
11656      ${p}
11657
11658      void main() {
11659        ivec4 coords = getOutputCoords();
11660        int batch = coords.x;
11661        ivec2 xRCCorner = coords.yz * strides - pads;
11662        int d2 = coords.w;
11663        int d1 = d2 / ${o};
11664        int q = d2 - d1 * ${o};
11665        int xRCorner = xRCCorner.x;
11666        int xCCorner = xRCCorner.y;
11667
11668        //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
11669        vec4 dotProd = vec4(0.000000000000001);
11670
11671        ${f}
11672
11673        vec4 result = dotProd - vec4(0.000000000000001);
11674        ${v}
11675        ${y}
11676        setOutput(result);
11677      }
11678    `}}/**
11679 * @license
11680 * Copyright 2020 Google LLC. All Rights Reserved.
11681 * Licensed under the Apache License, Version 2.0 (the "License");
11682 * you may not use this file except in compliance with the License.
11683 * You may obtain a copy of the License at
11684 *
11685 * http://www.apache.org/licenses/LICENSE-2.0
11686 *
11687 * Unless required by applicable law or agreed to in writing, software
11688 * distributed under the License is distributed on an "AS IS" BASIS,
11689 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11690 * See the License for the specific language governing permissions and
11691 * limitations under the License.
11692 * =============================================================================
11693 */function Aue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i}=e,{strides:o,pad:a,dilations:u,dimRoundingMode:l}=r;let c=u;c==null&&(c=[1,1]),A(tr(o,c),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${c}'`);const h=yr(s.shape,i.shape,o,c,a,l,!0);let d;U().getBool("WEBGL_PACK_DEPTHWISECONV")&&h.strideWidth<=2&&h.outChannels/h.inChannels===1?d=new MP(h):d=new LP(h);const f=[[h.padInfo.top,h.padInfo.left],[h.strideHeight,h.strideWidth],[h.dilationHeight,h.dilationWidth],[h.inHeight,h.inWidth]];return n.runWebGLProgram(d,[s,i],"float32",f)}const Rue={kernelName:xI,backendName:"webgl",kernelFunc:Aue};/**
11694 * @license
11695 * Copyright 2018 Google LLC. All Rights Reserved.
11696 * Licensed under the Apache License, Version 2.0 (the "License");
11697 * you may not use this file except in compliance with the License.
11698 * You may obtain a copy of the License at
11699 *
11700 * http://www.apache.org/licenses/LICENSE-2.0
11701 *
11702 * Unless required by applicable law or agreed to in writing, software
11703 * distributed under the License is distributed on an "AS IS" BASIS,
11704 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11705 * See the License for the specific language governing permissions and
11706 * limitations under the License.
11707 * =============================================================================
11708 */class Oue{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const n=e.strideHeight,r=e.strideWidth,s=e.padInfo.top,i=e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=`
11709      void main() {
11710        ivec4 coords = getOutputCoords();
11711        int wR = coords.x;
11712        int wC = coords.y;
11713        int d1 = coords.z;
11714        int dm = coords.w;
11715        int d2 = d1 * ${o} + dm;
11716
11717        float dotProd = 0.0;
11718
11719        // TO DO: Vec4 over the batch size
11720        for (int b = 0; b < ${e.batchSize}; b++) {
11721          for (int yR = 0; yR < ${e.outHeight}; yR++) {
11722            int xR = wR + yR * ${n} - ${s};
11723
11724            if (xR < 0 || xR >= ${e.inHeight}) {
11725              continue;
11726            }
11727
11728            for (int yC = 0; yC < ${e.outWidth}; yC++) {
11729              int xC = wC + yC * ${r} - ${i};
11730
11731              if (xC < 0 || xC >= ${e.inWidth}) {
11732                continue;
11733              }
11734
11735              float dyValue = getDy(b, yR, yC, d2);
11736              float xValue = getX(b, xR, xC, d1);
11737              dotProd += (xValue * dyValue);
11738            }
11739          }
11740        }
11741        setOutput(dotProd);
11742      }
11743    `}}class Due{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const n=e.filterHeight,r=e.filterWidth,s=e.strideHeight,i=e.strideWidth,o=n-1-e.padInfo.top,a=r-1-e.padInfo.left,u=e.outChannels/e.inChannels;this.userCode=`
11744      const ivec2 pads = ivec2(${o}, ${a});
11745
11746      void main() {
11747        ivec4 coords = getOutputCoords();
11748        int batch = coords[0];
11749        int d1 = coords[3];
11750        ivec2 dyCorner = coords.yz - pads;
11751        int dyRCorner = dyCorner.x;
11752        int dyCCorner = dyCorner.y;
11753
11754        float dotProd = 0.0;
11755
11756        for (int wR = 0; wR < ${n}; wR++) {
11757          float dyR = float(dyRCorner + wR) / ${s}.0;
11758
11759          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
11760            continue;
11761          }
11762          int idyR = int(dyR);
11763
11764          int wRPerm = ${n} - 1 - wR;
11765
11766          for (int wC = 0; wC < ${r}; wC++) {
11767            float dyC = float(dyCCorner + wC) / ${i}.0;
11768
11769            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
11770                fract(dyC) > 0.0) {
11771              continue;
11772            }
11773            int idyC = int(dyC);
11774
11775            int wCPerm = ${r} - 1 - wC;
11776
11777            // TO DO: Vec4 over the channelMul
11778            for (int dm = 0; dm < ${u}; dm++) {
11779              int d2 = d1 * ${u} + dm;
11780              float xValue = getDy(batch, idyR, idyC, d2);
11781              float wValue = getW(wRPerm, wCPerm, d1, dm);
11782              dotProd += xValue * wValue;
11783            }
11784          }
11785        }
11786        setOutput(dotProd);
11787      }
11788    `}}/**
11789 * @license
11790 * Copyright 2020 Google LLC. All Rights Reserved.
11791 * Licensed under the Apache License, Version 2.0 (the "License");
11792 * you may not use this file except in compliance with the License.
11793 * You may obtain a copy of the License at
11794 *
11795 * http://www.apache.org/licenses/LICENSE-2.0
11796 *
11797 * Unless required by applicable law or agreed to in writing, software
11798 * distributed under the License is distributed on an "AS IS" BASIS,
11799 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11800 * See the License for the specific language governing permissions and
11801 * limitations under the License.
11802 * =============================================================================
11803 */function Pue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:i}=e,{strides:o,dilations:a,pad:u,dimRoundingMode:l,filterShape:c}=r,h=yr(s.shape,c,o,a,u,l,!0),d=new Oue(h);return n.runWebGLProgram(d,[s,i],"float32")}const Fue={kernelName:wI,backendName:"webgl",kernelFunc:Pue};/**
11804 * @license
11805 * Copyright 2020 Google LLC. All Rights Reserved.
11806 * Licensed under the Apache License, Version 2.0 (the "License");
11807 * you may not use this file except in compliance with the License.
11808 * You may obtain a copy of the License at
11809 *
11810 * http://www.apache.org/licenses/LICENSE-2.0
11811 *
11812 * Unless required by applicable law or agreed to in writing, software
11813 * distributed under the License is distributed on an "AS IS" BASIS,
11814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11815 * See the License for the specific language governing permissions and
11816 * limitations under the License.
11817 * =============================================================================
11818 */function Lue(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:i}=e,{strides:o,dilations:a,pad:u,dimRoundingMode:l,inputShape:c}=r,h=yr(c,i.shape,o,a,u,l,!0),d=new Due(h);return n.runWebGLProgram(d,[s,i],"float32")}const Mue={kernelName:bI,backendName:"webgl",kernelFunc:Lue};/**
11819 * @license
11820 * Copyright 2019 Google LLC. All Rights Reserved.
11821 * Licensed under the Apache License, Version 2.0 (the "License");
11822 * you may not use this file except in compliance with the License.
11823 * You may obtain a copy of the License at
11824 *
11825 * http://www.apache.org/licenses/LICENSE-2.0
11826 *
11827 * Unless required by applicable law or agreed to in writing, software
11828 * distributed under the License is distributed on an "AS IS" BASIS,
11829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11830 * See the License for the specific language governing permissions and
11831 * limitations under the License.
11832 * =============================================================================
11833 */class Vue{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=`
11834      void main() {
11835          ivec2 coords = getOutputCoords();
11836          float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;
11837          setOutput(val);
11838      }
11839    `}}/**
11840 * @license
11841 * Copyright 2020 Google LLC. All Rights Reserved.
11842 * Licensed under the Apache License, Version 2.0 (the "License");
11843 * you may not use this file except in compliance with the License.
11844 * You may obtain a copy of the License at
11845 *
11846 * http://www.apache.org/licenses/LICENSE-2.0
11847 *
11848 * Unless required by applicable law or agreed to in writing, software
11849 * distributed under the License is distributed on an "AS IS" BASIS,
11850 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11851 * See the License for the specific language governing permissions and
11852 * limitations under the License.
11853 * =============================================================================
11854 */function Bue(t){const{inputs:e,backend:n}=t,{x:r}=e,s=[...r.shape,...r.shape],i=ne(r.shape),o=se({inputs:{x:r},backend:n,attrs:{shape:[i]}}),a=new Vue(i),u=n.runWebGLProgram(a,[o],o.dtype),l=se({inputs:{x:u},backend:n,attrs:{shape:s}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),l}const Wue={kernelName:_I,backendName:"webgl",kernelFunc:Bue};/**
11855 * @license
11856 * Copyright 2017 Google LLC. All Rights Reserved.
11857 * Licensed under the Apache License, Version 2.0 (the "License");
11858 * you may not use this file except in compliance with the License.
11859 * You may obtain a copy of the License at
11860 *
11861 * http://www.apache.org/licenses/LICENSE-2.0
11862 *
11863 * Unless required by applicable law or agreed to in writing, softw
vendor: 4,362 bytes, lines 11863-11940
11863are
11864 * distributed under the License is distributed on an "AS IS" BASIS,
11865 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11866 * See the License for the specific language governing permissions and
11867 * limitations under the License.
11868 * =============================================================================
11869 */class Uue{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:n,inWidth:r,padInfo:s,strideHeight:i,strideWidth:o,filterHeight:a,filterWidth:u,dilationHeight:l,dilationWidth:c}=e,{top:h,left:d}=s;this.userCode=`
11870      const ivec2 strides = ivec2(${i}, ${o});
11871      const ivec2 pads = ivec2(${h}, ${d});
11872      const float neg_infinity = -3.4e38;
11873
11874      void main() {
11875        ivec4 coords = getOutputCoords();
11876        int batch = coords.x;
11877        int d1 = coords.w;
11878        ivec2 outTopLeftCorner =
11879            coords.yz * strides - pads;
11880        int hBeg = outTopLeftCorner.x;
11881        int wBeg = outTopLeftCorner.y;
11882
11883        float curVal = neg_infinity;
11884        for (int h = 0; h < ${a}; h++) {
11885          int hIn = hBeg + h * ${l};
11886
11887          if (hIn >= 0 && hIn < ${n}) {
11888            for (int w = 0; w < ${u}; w++) {
11889              int wIn = wBeg + w * ${c};
11890
11891              if (wIn >= 0 && wIn < ${r}) {
11892                float xVal = getX(batch, hIn, wIn, d1);
11893                float wVal = getW(h, w, d1);
11894
11895                float val = xVal + wVal;
11896                if (val > curVal) {
11897                  curVal = val;
11898                }
11899              }
11900            }
11901          }
11902        }
11903
11904        float result = curVal;
11905        setOutput(result);
11906      }
11907    `}}/**
11908 * @license
11909 * Copyright 2020 Google LLC. All Rights Reserved.
11910 * Licensed under the Apache License, Version 2.0 (the "License");
11911 * you may not use this file except in compliance with the License.
11912 * You may obtain a copy of the License at
11913 *
11914 * http://www.apache.org/licenses/LICENSE-2.0
11915 *
11916 * Unless required by applicable law or agreed to in writing, software
11917 * distributed under the License is distributed on an "AS IS" BASIS,
11918 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11919 * See the License for the specific language governing permissions and
11920 * limitations under the License.
11921 * =============================================================================
11922 */function zue(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i}=e,{strides:o,pad:a,dilations:u}=r,l=oO(s.shape,i.shape,o,a,"NHWC",u);let c;const h=new Uue(l);c=n.runWebGLProgram(h,[s,i],"float32");const d=se({inputs:{x:c},backend:n,attrs:{shape:l.outShape}});return n.disposeIntermediateTensorInfo(c),d}const jue={kernelName:SI,backendName:"webgl",kernelFunc:zue};/**
11923 * @license
11924 * Copyright 2021 Google LLC. All Rights Reserved.
11925 * Licensed under the Apache License, Version 2.0 (the "License");
11926 * you may not use this file except in compliance with the License.
11927 * You may obtain a copy of the License at
11928 *
11929 * http://www.apache.org/licenses/LICENSE-2.0
11930 *
11931 * Unless required by applicable law or agreed to in writing, software
11932 * distributed under the License is distributed on an "AS IS" BASIS,
11933 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11934 * See the License for the specific language governing permissions and
11935 * limitations under the License.
11936 * =============================================================================
11937 */function Gue(t){const{inputs:e,backend:n,attrs:r}=t,{equation:s}=r,i=e,{allDims:o,summedDims:a,idDims:u}=AD(s,i.length);OD(o.length,u,i);const{path:l,steps:c}=DD(a,u),h=c.length;let d=null,f=o.length;const p=[];for(let y=0;y<h;++y){for(const v of c[y]){const{permutationIndices:g,expandDims:x}=RD(f,u[v]);let w;PD(g)?w=i[v]:(w=Tn({inputs:{x:i[v]},backend:n,attrs:{perm:g}}),p.push(w));const _=w.shape.slice();for(let T=0;T<x.length;++T)_.splice(x[T],0,1);xt(w.shape,_)||(w=se({inputs:{x:w},backend:n,attrs:{shape:_}}),p.push(w)),d===null?d=w:(d=pw({inputs:{a:w,b:d},backend:n}),p.push(d))}y<h-1&&(l[y]>=0&&(d=Tm({inputs:{x:d},backend:n,attrs:{axis:l[y]-(o.length-f),keepDims:!1}}),p.push(d)),f--)}for(const y of p)y!==d&&n.disposeIntermediateTensorInfo(y);return d}const Hue={kernelName:CI,backendName:"webgl",kernelFunc:Gue};/**
11938 * @license
11939 * Copyright 2020 Google LLC. All Rights Reserved.
11940 * Licensed under the Apache License, Version 2.0 (the "License");
11941 * you may not use this file except in compliance with the License.
11942 * You may obtain a copy of the License at
11943 *
11944 * http://www.apache.org/licenses/LICENSE-2.0
11945 *
11946 * Unless required by applicable law or agreed to in writing, software
11947 * distributed under the License is distributed on an "AS IS" BASIS,
11948 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11949 * See the License for the specific language governing permissions and
11950 * limitations under the License.
11951 * =============================================================================
11952 */const que="return (x >= 0.0) ? x : (exp(x) - 1.0);",Kue=`
11953  vec4 result;
11954
11955  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
11956  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
11957  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
11958  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);
11959
11960  return result;
11961`,Xue=Pe({opSnippet:que,packedOpSnippet:Kue}),Yue={kernelName:NI,backendName:"webgl",kernelFunc:Xue};/**
11962 * @license
11963 * Copyright 2020 Google LLC. All Rights Reserved.
11964 * Licensed under the Apache License, Version 2.0 (the "License");
11965 * you may not use this file except in compliance with the License.
11966 * You may obtain a copy of the License at
11967 *
11968 * http://www.apache.org/licenses/LICENSE-2.0
11969 *
11970 * Unless required by applicable law or agreed to in writing, software
11971 * distributed under the License is distributed on an "AS IS" BASIS,
11972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11973 * See the License for the specific language governing permissions and
11974 * limitations under the License.
11975 * =============================================================================
11976 */const Que="return (b >= 0.0) ? a : a * (b + 1.0);",Zue=`
11977  vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
11978  return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));
11979`,Jue=t=>{const{inputs:e,backend:n}=t,{dy:r,y:s}=e,i=U().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Sl(Zue,r.shape,s.shape):new Na(Que,r.shape,s.shape);return n.runWebGLProgram(i,[r,s],r.dtype)},ele={kernelName:w5,backendName:"webgl",kernelFunc:Jue};/**
11980 * @license
11981 * Copyright 2020 Google LLC. All Rights Reserved.
11982 * Licensed under the Apache License, Version 2.0 (the "License");
11983 * you may not use this file except in compliance with the License.
11984 * You may obtain a copy of the License at
11985 *
11986 * http://www.apache.org/licenses/LICENSE-2.0
11987 *
11988 * Unless required by applicable law or agreed to in writing, software
11989 * distributed under the License is distributed on an "AS IS" BASIS,
11990 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11991 * See the License for the specific language governing permissions and
11992 * limitations under the License.
11993 * =============================================================================
11994 */const tle=`
11995  return vec4(equal(a, b));
11996`,nle="return float(a == b);",rle=tn({opSnippet:nle,packedOpSnippet:tle,dtype:"bool",cpuKernelImpl:Pse}),sle={kernelName:kI,backendName:"webgl",kernelFunc:rle};/**
11997 * @license
11998 * Copyright 2020 Google LLC. All Rights Reserved.
11999 * Licensed under the Apache License, Version 2.0 (the "License");
12000 * you may not use this file except in compliance with the License.
12001 * You may obtain a copy of the License at
12002 *
12003 * http://www.apache.org/licenses/LICENSE-2.0
12004 *
12005 * Unless required by applicable law or agreed to in writing, software
12006 * distributed under the License is distributed on an "AS IS" BASIS,
12007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12008 * See the License for the specific language governing permissions and
12009 * limitations under the License.
12010 * =============================================================================
12011 */const ile=`
12012  // Error function is calculated approximately with elementary function.
12013  // See "Handbook of Mathematical Functions with Formulas,
12014  // Graphs, and Mathematical Tables", Abramowitz and Stegun.
12015  float p = ${CD};
12016  float a1 = ${ND};
12017  float a2 = ${ED};
12018  float a3 = ${kD};
12019  float a4 = ${$D};
12020  float a5 = ${ID};
12021
12022  float sign = sign(x);
12023  x = abs(x);
12024  float t = 1.0 / (1.0 + p * x);
12025  return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));
12026`,ole=Pe({opSnippet:ile}),ale={kernelName:EI,backendName:"webgl",kernelFunc:ole};/**
12027 * @license
12028 * Copyright 2020 Google LLC. All Rights Reserved.
12029 * Licensed under the Apache License, Version 2.0 (the "License");
12030 * you may not use this file except in compliance with the License.
12031 * You may obtain a copy of the License at
12032 *
12033 * http://www.apache.org/licenses/LICENSE-2.0
12034 *
12035 * Unless required by applicable law or agreed to in writing, software
12036 * distributed under the License is distributed on an "AS IS" BASIS,
12037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12038 * See the License for the specific language governing permissions and
12039 * limitations under the License.
12040 * =============================================================================
12041 */const ule=Tl+`
12042  return exp(x);
12043`,lle=`
12044  vec4 result = exp(x);
12045  bvec4 isNaN = isnan(x);
12046  result.r = isNaN.r ? x.r : result.r;
12047  result.g = isNaN.g ? x.g : result.g;
12048  result.b = isNaN.b ? x.b : result.b;
12049  result.a = isNaN.a ? x.a : result.a;
12050
12051  return result;
12052`,VP=Pe({opSnippet:ule,packedOpSnippet:lle,cpuKernelImpl:Fse,dtype:"float32"}),cle={kernelName:$I,backendName:"webgl",kernelFunc:VP};/**
12053 * @license
12054 * Copyright 2020 Google LLC. All Rights Reserved.
12055 * Licensed under the Apache License, Version 2.0 (the License);
12056 * you may not use this file except in compliance with the License.
12057 * You may obtain a copy of the License at
12058 *
12059 * http://www.apache.org/licenses/LICENSE-2.0
12060 *
12061 * Unless required by applicable law or agreed to in writing, software
12062 * distributed under the License is distributed on an AS IS BASIS,
12063 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12064 * See the License for the specific language governing permissions and
12065 * limitations under the License.
12066 * =============================================================================
12067 */function av(t){const{inputs:e,attrs:n,backend:r}=t,{dim:s}=n,{input:i}=e,o=i.shape.length,a=i.shape.slice();let u=s;return s<0&&(A(-(o+1)<=s,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),u=o+s+1),a.splice(u,0,1),se({inputs:{x:i},backend:r,attrs:{shape:a}})}const hle={kernelName:II,backendName:"webgl",kernelFunc:av};/**
12068 * @license
12069 * Copyright 2020 Google LLC. All Rights Reserved.
12070 * Licensed under the Apache License, Version 2.0 (the "License");
12071 * you may not use this file except in compliance with the License.
12072 * You may obtain a copy of the License at
12073 *
12074 * http://www.apache.org/licenses/LICENSE-2.0
12075 *
12076 * Unless required by applicable law or agreed to in writing, software
12077 * distributed under the License is distributed on an "AS IS" BASIS,
12078 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12079 * See the License for the specific language governing permissions and
12080 * limitations under the License.
12081 * =============================================================================
12082 */const pC="return exp(x) - 1.0;",dle=Pe({opSnippet:pC,packedOpSnippet:pC,cpuKernelImpl:Lse}),fle={kernelName:AI,backendName:"webgl",kernelFunc:dle};/**
12083 * @license
12084 * Copyright 2018 Google LLC. All Rights Reserved.
12085 * Licensed under the Apache License, Version 2.0 (the "License");
12086 * you may not use this file except in compliance with the License.
12087 * You may obtain a copy of the License at
12088 *
12089 * http://www.apache.org/licenses/LICENSE-2.0
12090 *
12091 * Unless required by applicable law or agreed to in writing, software
12092 * distributed under the License is distributed on an "AS IS" BASIS,
12093 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094 * See the License for the specific language governing permissions and
12095 * limitations under the License.
12096 * =============================================================================
12097 */class mC{constructor(e,n,r){this.variableNames=["real","imag"];const s=n[1];this.outputShape=n;const i=r?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,o=r?`${s}.0`:"1.0";let a;if(e==="real")a="return real * expR - imag * expI;";else if(e==="imag")a="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=`
12098      const float exponentMultiplier = ${i};
12099
12100      float unaryOpComplex(float real, float expR, float imag, float expI) {
12101        ${a}
12102      }
12103
12104      float mulMatDFT(int batch, int index) {
12105        float indexRatio = float(index) / float(${s});
12106        float exponentMultiplierTimesIndexRatio =
12107            exponentMultiplier * indexRatio;
12108
12109        float result = 0.0;
12110
12111        for (int i = 0; i < ${s}; i++) {
12112          // x = (-2|2 * PI / N) * index * i;
12113          float x = exponentMultiplierTimesIndexRatio * float(i);
12114          float expR = cos(x);
12115          float expI = sin(x);
12116          float real = getReal(batch, i);
12117          float imag = getImag(batch, i);
12118
12119          result +=
12120              unaryOpComplex(real, expR, imag, expI) / ${o};
12121        }
12122
12123        return result;
12124      }
12125
12126      void main() {
12127        ivec2 coords = getOutputCoords();
12128        setOutput(mulMatDFT(coords[0], coords[1]));
12129      }
12130    `}}/**
12131 * @license
12132 * Copyright 2020 Google LLC. All Rights Reserved.
12133 * Licensed under the Apache License, Version 2.0 (the "License");
12134 * you may not use this file except in compliance with the License.
12135 * You may obtain a copy of the License at
12136 *
12137 * http://www.apache.org/licenses/LICENSE-2.0
12138 *
12139 * Unless required by applicable law or agreed to in writing, software
12140 * distributed under the License is distributed on an "AS IS" BASIS,
12141 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12142 * See the License for the specific language governing permissions and
12143 * limitations under the License.
12144 * =============================================================================
12145 */function BP(t,e,n){const r=n.texData.get(t.dataId),s=ne(t.shape),i=t.shape[t.shape.length-1],o=s/i,a=se({inputs:{x:t},backend:n,attrs:{shape:[o,i]}}),u=a.shape,l=new mC("real",u,e),c=new mC("imag",u,e),h=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:u},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:u}],d=n.runWebGLProgram(l,h,"float32"),f=n.runWebGLProgram(c,h,"float32"),p=Co({inputs:{real:d,imag:f},backend:n});n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f);const y=se({inputs:{x:p},backend:n,attrs:{shape:t.shape}});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(p),y}/**
12146 * @license
12147 * Copyright 2020 Google LLC. All Rights Reserved.
12148 * Licensed under the Apache License, Version 2.0 (the "License");
12149 * you may not use this file except in compliance with the License.
12150 * You may obtain a copy of the License at
12151 *
12152 * http://www.apache.org/licenses/LICENSE-2.0
12153 *
12154 * Unless required by applicable law or agreed to in writing, software
12155 * distributed under the License is distributed on an "AS IS" BASIS,
12156 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12157 * See the License for the specific language governing permissions and
12158 * limitations under the License.
12159 * =============================================================================
12160 */function ple(t){const{inputs:e,backend:n}=t,{input:r}=e;return BP(r,!1,n)}const mle={kernelName:RI,backendName:"webgl",kernelFunc:ple};/**
12161 * @license
12162 * Copyright 2019 Google LLC. All Rights Reserved.
12163 * Licensed under the Apache License, Version 2.0 (the "License");
12164 * you may not use this file except in compliance with the License.
12165 * You may obtain a copy of the License at
12166 *
12167 * http://www.apache.org/licenses/LICENSE-2.0
12168 *
12169 * Unless required by applicable law or agreed to in writing, software
12170 * distributed under the License is distributed on an "AS IS" BASIS,
12171 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12172 * See the License for the specific language governing permissions and
12173 * limitations under the License.
12174 * =============================================================================
12175 */class gle{constructor(e,n){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode=`
12176      void main() {
12177        // Input can be obtained from uniform value.
12178        setOutput(value);
12179      }
12180    `}}/**
12181 * @license
12182 * Copyright 2020 Google LLC. All Rights Reserved.
12183 * Licensed under the Apache License, Version 2.0 (the "License");
12184 * you may not use this file except in compliance with the License.
12185 * You may obtain a copy of the License at
12186 *
12187 * http://www.apache.org/licenses/LICENSE-2.0
12188 *
12189 * Unless required by applicable law or agreed to in writing, software
12190 * distributed under the License is distributed on an "AS IS" BASIS,
12191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12192 * See the License for the specific language governing permissions and
12193 * limitations under the License.
12194 * =============================================================================
12195 */function kh(t){const{backend:e,attrs:n}=t,{shape:r,value:s}=n;let{dtype:i}=n;if(i=i||vh(s),i==="string"){const o=zt(i,ne(r));return o.fill(s),e.makeTensorInfo(r,i,o)}else{const o=new gle(r,s),a=[[s]];return e.runWebGLProgram(o,[],i,a)}}const yle={kernelName:OI,backendName:"webgl",kernelFunc:kh};/**
12196 * @license
12197 * Copyright 2020 Google LLC. All Rights Reserved.
12198 * Licensed under the Apache License, Version 2.0 (the "License");
12199 * you may not use this file except in compliance with the License.
12200 * You may obtain a copy of the License at
12201 *
12202 * http://www.apache.org/licenses/LICENSE-2.0
12203 *
12204 * Unless required by applicable law or agreed to in writing, software
12205 * distributed under the License is distributed on an "AS IS" BASIS,
12206 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12207 * See the License for the specific language governing permissions and
12208 * limitations under the License.
12209 * =============================================================================
12210 */class vle{constructor(e){this.variableNames=["Image"],this.outputShape=[];const n=e[2];this.outputShape=e,this.userCode=`
12211        void main() {
12212          ivec4 coords = getOutputCoords();
12213          int x = coords[2];
12214
12215          int coordX = ${n} - x - 1;
12216          float outputValue;
12217          if(coordX >= 0 && coordX < ${n}) {
12218            outputValue = getImage(coords[0], coords[1], coordX, coords[3]);
12219          } else {
12220            outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);
12221          }
12222          setOutput(outputValue);
12223        }
12224    `}}/**
12225 * @license
12226 * Copyright 2020 Google LLC. All Rights Reserved.
12227 * Licensed under the Apache License, Version 2.0 (the "License");
12228 * you may not use this file except in compliance with the License.
12229 * You may obtain a copy of the License at
12230 *
12231 * http://www.apache.org/licenses/LICENSE-2.0
12232 *
12233 * Unless required by applicable law or agreed to in writing, softw
12233are
12234 * distributed under the License is distributed on an "AS IS" BASIS,
12235 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12236 * See the License for the specific language governing permissions and
12237 * limitations under the License.
12238 * =============================================================================
12239 */const xle={kernelName:DI,backendName:"webgl",kernelFunc:({inputs:t,backend:e})=>{const{image:n}=t,r=e,s=new vle(n.shape);return r.runWebGLProgram(s,[n],n.dtype)}};/**
12240 * @license
12241 * Copyright 2020 Google LLC. All Rights Reserved.
12242 * Licensed under the Apache License, Version 2.0 (the "License");
12243 * you may not use this file except in compliance with the License.
12244 * You may obtain a copy of the License at
12245 *
12246 * http://www.apache.org/licenses/LICENSE-2.0
12247 *
12248 * Unless required by applicable law or agreed to in writing, software
12249 * distributed under the License is distributed on an "AS IS" BASIS,
12250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12251 * See the License for the specific language governing permissions and
12252 * limitations under the License.
12253 * =============================================================================
12254 */const gC="return floor(x);",wle=Pe({opSnippet:gC,packedOpSnippet:gC,cpuKernelImpl:Mse}),ble={kernelName:PI,backendName:"webgl",kernelFunc:wle};/**
12255 * @license
12256 * Copyright 2020 Google LLC. All Rights Reserved.
12257 * Licensed under the Apache License, Version 2.0 (the "License");
12258 * you may not use this file except in compliance with the License.
12259 * You may obtain a copy of the License at
12260 *
12261 * http://www.apache.org/licenses/LICENSE-2.0
12262 *
12263 * Unless required by applicable law or agreed to in writing, software
12264 * distributed under the License is distributed on an "AS IS" BASIS,
12265 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12266 * See the License for the specific language governing permissions and
12267 * limitations under the License.
12268 * =============================================================================
12269 */const _le=`
12270  float s = sign(a) * sign(b);
12271  int ia = round(a);
12272  int ib = round(b);
12273  if (ib != 0) {
12274    // Windows (D3D) wants guaranteed non-zero int division at compile-time.
12275    return float(idiv(ia, ib, s));
12276  } else {
12277    return NAN;
12278  }
12279`,Sle=`
12280  ivec4 ia = round(a);
12281  ivec4 ib = round(b);
12282  bvec4 cond = notEqual(ib, ivec4(0));
12283  ivec4 result = ivec4(0);
12284  vec4 s = sign(a) * sign(b);
12285
12286  // Windows (D3D) wants guaranteed non-zero int division at compile-time.
12287  if (cond[0]) {
12288    result[0] = idiv(ia[0], ib[0], s[0]);
12289  }
12290  if (cond[1]) {
12291    result[1] = idiv(ia[1], ib[1], s[1]);
12292  }
12293  if (cond[2]) {
12294    result[2] = idiv(ia[2], ib[2], s[2]);
12295  }
12296  if (cond[3]) {
12297    result[3] = idiv(ia[3], ib[3], s[3]);
12298  }
12299  return vec4(result);
12300`,Tle=tn({opSnippet:_le,packedOpSnippet:Sle,dtype:"int32"}),Cle={kernelName:FI,backendName:"webgl",kernelFunc:Tle};/**
12301 * @license
12302 * Copyright 2018 Google LLC. All Rights Reserved.
12303 * Licensed under the Apache License, Version 2.0 (the "License");
12304 * you may not use this file except in compliance with the License.
12305 * You may obtain a copy of the License at
12306 *
12307 * http://www.apache.org/licenses/LICENSE-2.0
12308 *
12309 * Unless required by applicable law or agreed to in writing, software
12310 * distributed under the License is distributed on an "AS IS" BASIS,
12311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12312 * See the License for the specific language governing permissions and
12313 * limitations under the License.
12314 * =============================================================================
12315 */class Nle{constructor(e){this.variableNames=["A"];const n=Nn(),[r,s]=e;this.outputShape=e,this.userCode=`
12316      void main() {
12317        ivec3 coords = getOutputCoords();
12318        int texR = coords[0];
12319        int texC = coords[1];
12320        int depth = coords[2];
12321        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${s}.0, ${r}.0);
12322
12323        vec4 values = ${n.texture2D}(A, uv);
12324        float value;
12325        if (depth == 0) {
12326          value = values.r;
12327        } else if (depth == 1) {
12328          value = values.g;
12329        } else if (depth == 2) {
12330          value = values.b;
12331        } else if (depth == 3) {
12332          value = values.a;
12333        }
12334
12335        setOutput(floor(value * 255.0 + 0.5));
12336      }
12337    `}}/**
12338 * @license
12339 * Copyright 2018 Google LLC. All Rights Reserved.
12340 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 5,693 bytes, lines 12341-12419
12341 * you may not use this file except in compliance with the License.
12342 * You may obtain a copy of the License at
12343 *
12344 * http://www.apache.org/licenses/LICENSE-2.0
12345 *
12346 * Unless required by applicable law or agreed to in writing, software
12347 * distributed under the License is distributed on an "AS IS" BASIS,
12348 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12349 * See the License for the specific language governing permissions and
12350 * limitations under the License.
12351 * =============================================================================
12352 */class Ele{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const n=Nn(),[r,s]=e;this.outputShape=e,this.userCode=`
12353      void main() {
12354        ivec3 coords = getOutputCoords();
12355        int texR = coords[0];
12356        int texC = coords[1];
12357        int depth = coords[2];
12358
12359        vec4 result = vec4(0.);
12360
12361        for(int row=0; row<=1; row++) {
12362          for(int col=0; col<=1; col++) {
12363            texC = coords[1] + row;
12364            depth = coords[2] + col;
12365
12366            vec2 uv = (vec2(texC, texR) + halfCR) /
12367                       vec2(${s}.0, ${r}.0);
12368            vec4 values = ${n.texture2D}(A, uv);
12369            float value;
12370            if (depth == 0) {
12371              value = values.r;
12372            } else if (depth == 1) {
12373              value = values.g;
12374            } else if (depth == 2) {
12375              value = values.b;
12376            } else if (depth == 3) {
12377              value = values.a;
12378            }
12379
12380            result[row * 2 + col] = floor(value * 255.0 + 0.5);
12381          }
12382        }
12383
12384        ${n.output} = result;
12385      }
12386    `}}/**
12387 * @license
12388 * Copyright 2019 Google LLC. All Rights Reserved.
12389 * Licensed under the Apache License, Version 2.0 (the "License");
12390 * you may not use this file except in compliance with the License.
12391 * You may obtain a copy of the License at
12392 *
12393 * http://www.apache.org/licenses/LICENSE-2.0
12394 *
12395 * Unless required by applicable law or agreed to in writing, software
12396 * distributed under the License is distributed on an "AS IS" BASIS,
12397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12398 * See the License for the specific language governing permissions and
12399 * limitations under the License.
12400 * =============================================================================
12401 */const kle={kernelName:S0,backendName:"webgl",kernelFunc:$le};let Ka,Yg=U().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");function $le(t){const{inputs:e,backend:n,attrs:r}=t;let{pixels:s}=e;const{numChannels:i}=r,o=typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement,a=typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement,[u,l]=o?[s.videoWidth,s.videoHeight]:[s.width,s.height],c=[l,u],h=[l,u,i];if(a||o){const y=U().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");(Ka==null||y!==Yg)&&(Yg=y,Ka=document.createElement("canvas").getContext("2d",{willReadFrequently:Yg})),Ka.canvas.width=u,Ka.canvas.height=l,Ka.drawImage(s,0,0,u,l),s=Ka.canvas}const d=n.makeTensorInfo(c,"int32");n.texData.get(d.dataId).usage=ar.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(d.dataId),s);const f=U().getBool("WEBGL_PACK")?new Ele(h):new Nle(h),p=n.runWebGLProgram(f,[d],"int32");return n.disposeData(d.dataId),p}/**
12402 * @license
12403 * Copyright 2020 Google LLC. All Rights Reserved.
12404 * Licensed under the Apache License, Version 2.0 (the "License");
12405 * you may not use this file except in compliance with the License.
12406 * You may obtain a copy of the License at
12407 *
12408 * http://www.apache.org/licenses/LICENSE-2.0
12409 *
12410 * Unless required by applicable law or agreed to in writing, software
12411 * distributed under the License is distributed on an "AS IS" BASIS,
12412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12413 * See the License for the specific language governing permissions and
12414 * limitations under the License.
12415 * =============================================================================
12416 */function Ile(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i,bias:o,preluActivationWeights:a}=e,{strides:u,pad:l,dataFormat:c,dilations:h,dimRoundingMode:d,activation:f,leakyreluAlpha:p}=r,y=gl(c),v=yr(s.shape,i.shape,u,h,l,d,!1,y);let g;const x=[],w=o!=null,_=a!=null,T=f==="leakyrelu",E=()=>{const N=[s,i],O=(R,L)=>{if(L==="NCHW"&&R.shape.length===1&&R.shape[0]!==1){const W=se({inputs:{x:R},backend:n,attrs:{shape:[R.shape[0],1,1]}});return x.push(W),W}return R};if(w&&N.push(O(o,c)),_&&N.push(O(a,c)),T){const R=n.makeTensorInfo([],"float32",ml(p,"float32"));N.push(R),x.push(R)}return N};if(v.filterHeight===1&&v.filterWidth===1&&v.dilationHeight===1&&v.dilationWidth===1&&v.strideHeight===1&&v.strideWidth===1&&(v.padInfo.type==="SAME"||v.padInfo.type==="VALID"))g=DP({x:s,filter:i,convInfo:v,backend:n,bias:o,activation:f,preluActivationWeights:a,leakyreluAlpha:p});else if(v.strideWidth<=2&&y==="channelsLast"&&U().getBool("WEBGL_EXP_CONV")){const N=f?Xc(f,!0):null,O=new OP(v,w,N,_,T),R=[[v.padInfo.top,v.padInfo.left],[v.strideHeight,v.strideWidth],[v.dilationHeight,v.dilationWidth],[v.inHeight,v.inWidth]],L=E();g=n.runWebGLProgram(O,L,"float32",R)}else if(U().getBool("WEBGL_CONV_IM2COL"))g=PP({x:s,filter:i,convInfo:v,backend:n,bias:o,activation:f,preluActivationWeights:a,leakyreluAlpha:p});else{const N=f?Xc(f,!1):null,O=new RP(v,w,N,_,T),R=E();g=n.runWebGLProgram(O,R,"float32")}const k=se({inputs:{x:g},backend:n,attrs:{shape:v.outShape}});return x.push(g),x.forEach(N=>n.disposeIntermediateTensorInfo(N)),k}const Ale={kernelName:C0,backendName:"webgl",kernelFunc:Ile};/**
12417 * @license
12418 * Copyright 2020 Google LLC. All Rights Reserved.
12419 * Licensed under the Apache License, Version 2.0 (the "License");
12420 * you may not use this file except in compliance with the License.
12421 * You may obtain a copy of the License at
12422 *
12423 * http://www.apache.org/licenses/LICENSE-2.0
12424 *
12425 * Unless required by applicable law or agreed to in writing, software
12426 * distributed under the License is distributed on an "AS IS" BASIS,
12427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12428 * See the License for the specific language governing permissions and
12429 * limitations under the License.
12430 * =============================================================================
12431 */function Rle(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:i,bias:o,preluActivationWeights:a}=e,{strides:u,pad:l,dilations:c,dimRoundingMode:h,activation:d,leakyreluAlpha:f}=r,p=[];let y=c;y==null&&(y=[1,1]),A(tr(u,y),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${u} and dilations '${y}'`);const v=yr(s.shape,i.shape,u,y,l,h,!0),g=U().getBool("WEBGL_PACK_DEPTHWISECONV")&&v.strideWidth<=2&&v.outChannels/v.inChannels===1,x=d?Xc(d,g):null,w=[s,i],_=o!=null,T=a!=null,E=d==="leakyrelu";if(_&&w.push(o),T&&w.push(a),E){const R=n.makeTensorInfo([],"float32",ml(f,"float32"));w.push(R),p.push(R)}let k;g?k=new MP(v,_,x,T,E):k=new LP(v,_,x,T,E);const N=[[v.padInfo.top,v.padInfo.left],[v.strideHeight,v.strideWidth],[v.dilationHeight,v.dilationWidth],[v.inHeight,v.inWidth]],O=n.runWebGLProgram(k,w,"float32",N);return p.forEach(R=>n.disposeIntermediateTensorInfo(R)),O}const Ole={kernelName:N0,backendName:"webgl",kernelFunc:Rle};class Dle{constructor(e,n,r,s){this.sliceDim=e,this.strides=n,this.paramsShape=s,this.variableNames=["x","indices"],this.outputShape=r;const i=qe(r.length);let o=`
12432    int index;`;for(let a=0;a<this.sliceDim;a++)o+=`
12433          index = round(getIndices(coords[0], ${a}));
12434          out_of_bounds = out_of_bounds || index < 0;
12435          out_of_bounds = out_of_bounds || index >= ${this.paramsShape[a]};
12436          flattenIndex += index * ${this.strides[a]};`;this.userCode=`
12437         void main() {
12438          ${i} coords = getOutputCoords();
12439          int flattenIndex = 0;
12440          bool out_of_bounds = false;
12441
12442          ${o}
12443
12444          setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));
12445        }
12446      `}}/**
12447 * @license
12448 * Copyright 2020 Google LLC. All Rights Reserved.
12449 * Licensed under the Apache License, Version 2.0 (the "License");
12450 * you may not use this file except in compliance with the License.
12451 * You may obtain a copy of the License at
12452 *
12453 * http://www.apache.org/licenses/LICENSE-2.0
12454 *
12455 * Unless required by applicable law or agreed to in writing, software
12456 * distributed under the License is distributed on an "AS IS" BASIS,
12457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12458 * See the License for the specific language governing permissions and
12459 * limitations under the License.
12460 * =============================================================================
12461 */function Ple(t){const{inputs:e,backend:n}=t,{params:r,indices:s}=e,i=s.shape,o=i[i.length-1],a=ne(r.shape),[u,l,c,h]=nD(r,s),d=se({inputs:{x:s},backend:n,attrs:{shape:[l,o]}}),f=se({inputs:{x:r},backend:n,attrs:{shape:[ne(r.shape)/c,c]}});if(n.shouldExecuteOnCPU([r,s])||r.dtype==="string"){const g=n.readSync(s.dataId),x=n.bufferSync(r),w=Vse(g,x,r.dtype,l,o,c,h,r.shape,a);return n.makeTensorInfo(u,r.dtype,w.values)}const p=new Dle(o,h,[l,c],r.shape),y=n.runWebGLProgram(p,[f,d],f.dtype),v=se({inputs:{x:y},backend:n,attrs:{shape:u}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(y),v}const Fle={kernelName:VI,backendName:"webgl",kernelFunc:Ple};/**
12462 * @license
12463 * Copyright 2017 Google LLC. All Rights Reserved.
12464 * Licensed under the Apache License, Version 2.0 (the "License");
12465 * you may not use this file except in compliance with the License.
12466 * You may obtain a copy of the License at
12467 *
12468 * http://www.apache.org/licenses/LICENSE-2.0
12469 *
12470 * Unless required by applicable law or agreed to in writing, software
12471 * distributed under the License is distributed on an "AS IS" BASIS,
12472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12473 * See the License for the specific language governing permissions and
12474 * limitations under the License.
12475 * =============================================================================
12476 */class Lle{constructor(e,n){this.variableNames=["A","indices"],this.outputShape=n,this.rank=n.length;const r=qe(this.rank),s=Mle(e);this.userCode=`
12477      void main() {
12478        ${r} resRC = getOutputCoords();
12479        int index = int(getIndices(resRC.x, resRC.z));
12480        float inBounds = (index >= 0) && (index < ${e[2]}) ? 1.0 : 0.0;
12481        setOutput(inBounds * getA(${s}));
12482      }
12483    `}}function Mle(t,e){const n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[];for(let s=0;s<t.length;s++)s===2?r.push("index"):r.push(`${n[s]}`);return r.join()}/**
12484 * @license
12485 * Copyright 2020 Google LLC. All Rights Reserved.
12486 * Licensed under the Apache License, Version 2.0 (the "License");
12487 * you may not use this file except in compliance with the License.
12488 * You may obtain a copy of the License at
12489 *
12490 * http://www.apache.org/licenses/LICENSE-2.0
12491 *
12492 * Unless required by applicable law or agreed to in writing, software
12493 * distributed under the License is distributed on an "AS IS" BASIS,
12494 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12495 * See the License for the specific language governing permissions and
12496 * limitations under the License.
12497 * =============================================================================
12498 */function WP(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,indices:i}=e,{axis:o,batchDims:a}=r,u=Gt(o,s.shape)[0];if(U().get("DEBUG")){const x=n.readSync(i.dataId),w=s.shape[u];for(let _=0;_<x.length;++_){const T=x[_];A(T<=w-1&&T>=0,()=>`GatherV2: the index value ${T} is not in [0, ${w-1}]`)}}const l=YD(s,i,u,a),c=ne(i.shape),h=[],d=se({inputs:{x:s},backend:n,attrs:{shape:[l.batchSize,l.outerSize,l.dimSize,l.sliceSize]}}),f=se({inputs:{x:i},backend:n,attrs:{shape:[l.batchSize,c/l.batchSize]}});h.push(d),h.push(f);const p=[l.batchSize,l.outerSize,c/l.batchSize,l.sliceSize];if(n.shouldExecuteOnCPU([s,i])||s.dtype==="string"){const x=n.bufferSync(f),w=n.bufferSync(d),_=Bse(w,x,p);return h.forEach(T=>n.disposeIntermediateTensorInfo(T)),n.makeTensorInfo(l.outputShape,_.dtype,_.values)}const y=new Lle(d.shape,p),v=n.runWebGLProgram(y,[d,f],d.dtype);h.push(v);const g=se({inputs:{x:v},backend:n,attrs:{shape:l.outputShape}});return h.forEach(x=>n.disposeIntermediateTensorInfo(x)),g}const Vle={kernelName:MI,backendName:"webgl",kernelFunc:WP};/**
12499 * @license
12500 * Copyright 2020 Google LLC. All Rights Reserved.
12501 * Licensed under the Apache License, Version 2.0 (the "License");
12502 * you may not use this file except in compliance with the License.
12503 * You may obtain a copy of the License at
12504 *
12505 * http://www.apache.org/licenses/LICENSE-2.0
12506 *
12507 * Unless required by applicable law or agreed to in writing, software
12508 * distributed under the License is distributed on an "AS IS" BASIS,
12509 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12510 * See the License for the specific language governing permissions and
12511 * limitations under the License.
12512 * =============================================================================
12513 */const Ble="return float(a > b);",Wle=`
12514  return vec4(greaterThan(a, b));
12515`,Ule=tn({opSnippet:Ble,packedOpSnippet:Wle,cpuKernelImpl:Wse,dtype:"bool"}),zle={kernelName:BI,backendName:"webgl",kernelFunc:Ule};/**
12516 * @license
12517 * Copyright 2020 Google LLC. All Rights Reserved.
12518 * Licensed under the Apache License, Version 2.0 (the "License");
12519 * you may not use this file except in compliance with the License.
12520 * You may obtain a copy of the License at
12521 *
12522 * http://www.apache.org/licenses/LICENSE-2.0
12523 *
12524 * Unless required by applicable law or agreed to in writing, software
12525 * distributed under the License is distributed on an "AS IS" BASIS,
12526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12527 * See the License for the specific language governing permissions and
12528 * limitations under the License.
12529 * =============================================================================
12530 */const jle="return float(a >= b);",Gle=`
12531  return vec4(greaterThanEqual(a, b));
12532`,Hle=tn({opSnippet:jle,packedOpSnippet:Gle,dtype:"bool",cpuKernelImpl:Use}),qle={kernelName:WI,backendName:"webgl",kernelFunc:Hle};/**
12533 * @license
12534 * Copyright 2020 Google LLC. All Rights Reserved.
12535 * Licensed under the Apache License, Version 2.0 (the "License");
12536 * you may not use this file except in compliance with the License.
12537 * You may obtain a copy of the License at
12538 *
12539 * http://www.apache.org/licenses/LICENSE-2.0
12540 *
12541 * Unless required by applicable law or agreed to in writing, software
12542 * distributed under the License is distributed on an "AS IS" BASIS,
12543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12544 * See the License for the specific language governing permissions and
12545 * limitations under the License.
12546 * =============================================================================
12547 */function Kle(t){const{inputs:e,backend:n}=t,{input:r}=e;return BP(r,!0,n)}const Xle={kernelName:UI,backendName:"webgl",kernelFunc:Kle};/**
12548 * @license
12549 * Copyright 2020 Google LLC. All Rights Reserved.
12550 * Licensed under the Apache License, Version 2.0 (the "License");
12551 * you may not use this file except in compliance with the License.
12552 * You may obtain a copy of the License at
12553 *
12554 * http://www.apache.org/licenses/LICENSE-2.0
12555 *
12556 * Unless required by applicable law or agreed to in writing, software
12557 * distributed under the License is distributed on an "AS IS" BASIS,
12558 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12559 * See the License for the specific language governing permissions and
12560 * limitations under the License.
12561 * =============================================================================
12562 */const Yle="return float(!isnan(x) && !isinf(x));",Qle=Pe({opSnippet:Yle,dtype:"bool"}),Zle={kernelName:jI,backendName:"webgl",kernelFunc:Qle};/**
12563 * @license
12564 * Copyright 2020 Google LLC. All Rights Reserved.
12565 * Licensed under the Apache License, Version 2.0 (the "License");
12566 * you may not use this file except in compliance with the License.
12567 * You may obtain a copy of the License at
12568 *
12569 * http://www.apache.org/licenses/LICENSE-2.0
12570 *
12571 * Unless required by applicable law or agreed to in writing, software
12572 * distributed under the License is distributed on an "AS IS" BASIS,
12573 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12574 * See the License for the specific language governing permissions and
12575 * limitations under the License.
12576 * =============================================================================
12577 */const Jle="return float(isinf(x));",ece=Pe({opSnippet:Jle,dtype:"bool"}),tce={kernelName:GI,backendName:"webgl",kernelFunc:ece};/**
12578 * @license
12579 * Copyright 2020 Google LLC. All Rights Reserved.
12580 * Licensed under the Apache License, Version 2.0 (the "License");
12581 * you may not use this file except in compliance with the License.
12582 * You may obtain a copy of the License at
12583 *
12584 * http://www.apache.org/licenses/LICENSE-2.0
12585 *
12586 * Unless required by applicable law or agreed to in writing, software
12587 * distributed under the License is distributed on an "AS IS" BASIS,
12588 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12589 * See the License for the specific language governing permissions and
12590 * limitations under the License.
12591 * =============================================================================
12592 */const nce="return float(isnan(x));",rce=Pe({opSnippet:nce,dtype:"bool"}),sce={kernelName:HI,backendName:"webgl",kernelFunc:rce};/**
12593 * @license
12594 * Copyright 2020 Google LLC. All Rights Reserved.
12595 * Licensed under the Apache License, Version 2.0 (the "License");
12596 * you may not use this file except in compliance with the License.
12597 * You may obtain a copy of the License at
12598 *
12599 * http://www.apache.org/licenses/LICENSE-2.0
12600 *
12601 * Unless required by applicable law or agreed to in writing, software
12602 * distributed under the License is distributed on an "AS IS" BASIS,
12603 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12604 * See the License for the specific language governing permissions and
12605 * limitations under the License.
12606 * =============================================================================
12607 */const ice="return float(a < b);",oce=`
12608  return vec4(lessThan(a, b));
12609`,ace=tn({opSnippet:ice,packedOpSnippet:oce,cpuKernelImpl:zse,dtype:"bool"}),uce={kernelName:KI,backendName:"webgl",kernelFunc:ace};/**
12610 * @license
12611 * Copyright 2020 Google LLC. All Rights Reserved.
12612 * Licensed under the Apache License, Version 2.0 (the "License");
12613 * you may not use this file except in compliance with the License.
12614 * You may obtain a copy of the License at
12615 *
12616 * http://www.apache.org/licenses/LICENSE-2.0
12617 *
12618 * Unless required by applicable law or agreed to in writing, software
12619 * distributed under the License is distributed on an "AS IS" BASIS,
12620 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12621 * See the License for the specific language governing permissions and
12622 * limitations under the License.
12623 * =============================================================================
12624 */const lce="return float(a <= b);",cce=`
12625  return vec4(lessThanEqual(a, b));
12626`,hce=tn({opSnippet:lce,packedOpSnippet:cce,cpuKernelImpl:jse,dtype:"bool"}),dce={kernelName:XI,backendName:"webgl",kernelFunc:hce};/**
12627 * @license
12628 * Copyright 2020 Google LLC. All Rights Reserved.
12629 * Licensed under the Apache License, Version 2.0 (the "License");
12630 * you may not use this file except in compliance with the License.
12631 * You may obtain a copy of the License at
12632 *
12633 * http://www.apache.org/licenses/LICENSE-2.0
12634 *
12635 * Unless required by applicable law or agreed to in writing, software
12636 * distributed under the License is distributed on an "AS IS" BASIS,
12637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12638 * See the License for the specific language governing permissions and
12639 * limitations under the License.
12640 * =============================================================================
12641 */function fce(t){const{backend:e,attrs:n}=t,{start:r,stop:s,num:i}=n,o=Gse(r,s,i);return e.makeTensorInfo([o.length],"float32",o)}const pce={kernelName:YI,backendName:"webgl",kernelFunc:fce};/**
12642 * @license
12643 * Copyright 2020 Google LLC. All Rights Reserved.
12644 * Licensed under the Apache License, Version 2.0 (the "License");
12645 * you may not use this file except in compliance with the License.
12646 * You may obtain a copy of the License at
12647 *
12648 * http://www.apache.org/licenses/LICENSE-2.0
12649 *
12650 * Unless required by applicable law or agreed to in writing, software
12651 * distributed under the License is distributed on an "AS IS" BASIS,
12652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12653 * See the License for the specific language governing permissions and
12654 * limitations under the License.
12655 * =============================================================================
12656 */const mce=Tl+`
12657  return x < 0.0 ? 0./0. : log(x);
12658`,gce=`
12659  vec4 result = log(x);
12660  bvec4 isNaN = isnan(x);
12661  result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);
12662  result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);
12663  result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);
12664  result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);
12665  return result;
12666`,yce=Pe({opSnippet:mce,packedOpSnippet:gce,cpuKernelImpl:Hse}),vce={kernelName:QI,backendName:"webgl",kernelFunc:yce};/**
12667 * @license
12668 * Copyright 2020 Google LLC. All Rights Reserved.
12669 * Licensed under the Apache License, Version 2.0 (the "License");
12670 * you may not use this file except in compliance with the License.
12671 * You may obtain a copy of the License at
12672 *
12673 * http://www.apache.org/licenses/LICENSE-2.0
12674 *
12675 * Unless required by applicable law or agreed to in writing, software
12676 * distributed under the License is distributed on an "AS IS" BASIS,
12677 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12678 * See the License for the specific language governing permissions and
12679 * limitations under the License.
12680 * =============================================================================
12681 */const xce=Tl+`
12682  return log(1.0 + x);
12683`,wce=Pe({opSnippet:xce}),bce={kernelName:ZI,backendName:"webgl",kernelFunc:wce};/**
12684 * @license
12685 * Copyright 2020 Google LLC. All Rights Reserved.
12686 * Licensed under the Apache License, Version 2.0 (the "License");
12687 * you may not use this file except in compliance with the License.
12688 * You may obtain a copy of the License at
12689 *
12690 * http://www.apache.org/licenses/LICENSE-2.0
12691 *
12692 * Unless required by applicable law or agreed to in writing, software
12693 * distributed under the License is distributed on an "AS IS" BASIS,
12694 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12695 * See the License for the specific language governing permissions and
12696 * limitations under the License.
12697 * =============================================================================
12698 */const _ce="return float(a >= 1.0 && b >= 1.0);",Sce=`
12699  return vec4(
12700    vec4(greaterThanEqual(a, vec4(1.0))) *
12701    vec4(greaterThanEqual(b, vec4(1.0))));
12702`,Tce=tn({opSnippet:_ce,packedOpSnippet:Sce,dtype:"bool"}),Cce={kernelName:JI,backendName:"webgl",kernelFunc:Tce};/**
12703 * @license
12704 * Copyright 2020 Google LLC. All Rights Reserved.
12705 * Licensed under the Apache License, Version 2.0 (the "License");
12706 * you may not use this file except in compliance with the License.
12707 * You may obtain a copy of the License at
12708 *
12709 * http://www.apache.org/licenses/LICENSE-2.0
12710 *
12711 * Unless required by applicable law or agreed to in writing, softw
12711are
12712 * distributed under the License is distributed on an "AS IS" BASIS,
12713 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12714 * See the License for the specific language governing permissions and
12715 * limitations under the License.
12716 * =============================================================================
12717 */const Nce="return float(!(x >= 1.0));",Ece=Pe({opSnippet:Nce}),kce={kernelName:eA,backendName:"webgl",kernelFunc:Ece};/**
12718 * @license
12719 * Copyright 2020 Google LLC. All Rights Reserved.
12720 * Licensed under the Apache License, Version 2.0 (the "License");
12721 * you may not use this file except in compliance with the License.
12722 * You may obtain a copy of the License at
12723 *
12724 * http://www.apache.org/licenses/LICENSE-2.0
12725 *
12726 * Unless required by applicable law or agreed to in writing, software
12727 * distributed under the License is distributed on an "AS IS" BASIS,
12728 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12729 * See the License for the specific language governing permissions and
12730 * limitations under the License.
12731 * =============================================================================
12732 */const $ce="return float(a >= 1.0 || b >= 1.0);",Ice=`
12733  return min(
12734    vec4(greaterThanEqual(a, vec4(1.0))) +
12735    vec4(greaterThanEqual(b, vec4(1.0))),
12736    vec4(1.0));
12737`,Ace=tn({opSnippet:$ce,packedOpSnippet:Ice,dtype:"bool"}),Rce={kernelName:tA,backendName:"webgl",kernelFunc:Ace};/**
12738 * @license
12739 * Copyright 2017 Google LLC. All Rights Reserved.
12740 * Licensed under the Apache License, Version 2.0 (the "License");
12741 * you may not use this file except in compliance with the License.
12742 * You may obtain a copy of the License at
12743 *
12744 * http://www.apache.org/licenses/LICENSE-2.0
12745 *
12746 * Unless required by applicable law or agreed to in writing, software
12747 * distributed under the License is distributed on an "AS IS" BASIS,
12748 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12749 * See the License for the specific language governing permissions and
12750 * limitations under the License.
12751 * =============================================================================
12752 */class Oce{constructor(e,n,r,s,i){this.variableNames=["x"],this.outputShape=[];const o=n,a=e[3]-1;this.outputShape=e;let u;const l=`float(${r}) + float(${s}) * sum`;i===.5?u=`inversesqrt(${l})`:i===1?u=`1.0/(${l})`:u=`exp(log(${l}) * float(-${i}));`,this.userCode=`
12753      void main() {
12754        ivec4 coords = getOutputCoords();
12755        int b = coords[0];
12756        int r = coords[1];
12757        int c = coords[2];
12758        int d = coords[3];
12759        float x = getX(b, r, c, d);
12760        float sum = 0.0;
12761        for (int j = -${o}; j <= ${o}; j++) {
12762          int idx = d + j;
12763          if (idx >= 0 && idx <=  ${a}) {
12764            float z = getX(b, r, c, idx);
12765            sum += z * z;
12766          }
12767        }
12768        float val = x * ${u};
12769        setOutput(val);
12770      }
12771    `}}/**
12772 * @license
12773 * Copyright 2019 Google LLC. All Rights Reserved.
12774 * Licensed under the Apache License, Version 2.0 (the "License");
12775 * you may not use this file except in compliance with the License.
12776 * You may obtain a copy of the License at
12777 *
12778 * http://www.apache.org/licenses/LICENSE-2.0
12779 *
12780 * Unless required by applicable law or agreed to in writing, software
12781 * distributed under the License is distributed on an "AS IS" BASIS,
12782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12783 * See the License for the specific language governing permissions and
12784 * limitations under the License.
12785 * =============================================================================
12786 */class Dce{constructor(e,n,r,s,i){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const o=n,a=e[3]-1;this.outputShape=e;let u;const l=`float(${r}) + float(${s}) * sum`;i===.5?u=`inversesqrt(${l})`:i===1?u=`1.0/(${l})`:u=`exp(log(${l}) * float(-${i}));`,this.userCode=`
12787      void main() {
12788        ivec4 coords = getOutputCoords();
12789        int b = coords.x;
12790        int r = coords.y;
12791        int c = coords.z;
12792        int d = coords.w;
12793
12794        bool hasNextCol = d < ${this.outputShape[3]};
12795        bool hasNextRow = c < ${this.outputShape[2]};
12796
12797        vec4 sum = vec4(0.);
12798        vec4 xFragAtOutputCoords = getX(b, r, c, d);
12799
12800        vec4 xAtOutputCoords = vec4(
12801          getChannel(xFragAtOutputCoords, vec2(c, d)),
12802          hasNextCol ?
12803            getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,
12804          hasNextRow ?
12805            getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,
12806          (hasNextRow && hasNextCol) ?
12807            getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0
12808        );
12809
12810        int firstChannel = d - ${o};
12811        vec2 cache = vec2(0.);
12812        if(firstChannel >= 0){
12813          vec4 firstChannelFrag = getX(b, r, c, firstChannel);
12814          cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));
12815            if(hasNextRow){
12816              cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));
12817            }
12818        }
12819
12820        ivec2 depth = ivec2(d, d + 1);
12821        for (int j = - ${o}; j <= ${o}; j++) {
12822          ivec2 idx = depth + j;
12823          bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));
12824          bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${a}));
12825
12826          bool depthInRange = aboveLowerBound.x && belowUpperBound.x;
12827          bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;
12828
12829          if(depthInRange || depthPlusOneInRange){
12830            vec4 z = vec4(0.);
12831            vec4 xFragAtCurrentDepth;
12832            z.xz = cache.xy;
12833            if(depthPlusOneInRange && hasNextCol){
12834              xFragAtCurrentDepth = idx.y != d ?
12835                getX(b, r, c, idx.y) : xFragAtOutputCoords;
12836              z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));
12837              if(hasNextRow){
12838                z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));
12839              }
12840            }
12841            cache.xy = z.yw;
12842            sum += z * z;
12843          }
12844        }
12845        vec4 result = xAtOutputCoords * ${u};
12846        setOutput(result);
12847      }
12848    `}}/**
12849 * @license
12850 * Copyright 2020 Google LLC. All Rights Reserved.
12851 * Licensed under the Apache License, Version 2.0 (the "License");
12852 * you may not use this file except in compliance with the License.
12853 * You may obtain a copy of the License at
12854 *
12855 * http://www.apache.org/licenses/LICENSE-2.0
12856 *
12857 * Unless required by applicable law or agreed to in writing, software
12858 * distributed under the License is distributed on an "AS IS" BASIS,
12859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12860 * See the License for the specific language governing permissions and
12861 * limitations under the License.
12862 * =============================================================================
12863 */const Pce=t=>{const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{depthRadius:i,bias:o,alpha:a,beta:u}=r,l=U().getBool("WEBGL_PACK_NORMALIZATION")?new Dce(s.shape,i,o,a,u):new Oce(s.shape,i,o,a,u);return n.runWebGLProgram(l,[s],s.dtype)},Fce={kernelName:nA,backendName:"webgl",kernelFunc:Pce};/**
12864 * @license
12865 * Copyright 2018 Google LLC. All Rights Reserved.
12866 * Licensed under the Apache License, Version 2.0 (the "License");
12867 * you may not use this file except in compliance with the License.
12868 * You may obtain a copy of the License at
12869 *
12870 * http://www.apache.org/licenses/LICENSE-2.0
12871 *
12872 * Unless required by applicable law or agreed to in writing, software
12873 * distributed under the License is distributed on an "AS IS" BASIS,
12874 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12875 * See the License for the specific language governing permissions and
12876 * limitations under the License.
12877 * =============================================================================
12878 */class Lce{constructor(e,n,r,s,i){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=n,this.bias=r,this.alpha=s,this.beta=i,this.userCode=`
12879      void main() {
12880        ivec4 coords = getOutputCoords();
12881        int b = coords[0];
12882        int r = coords[1];
12883        int c = coords[2];
12884
12885        float result = 0.0;
12886        for (int d = 0; d < ${this.depth}; ++d) {
12887          int depthBegin = int(max(0.0, float(d - ${n})));
12888          int depthEnd = int(min(float(${this.depth}),
12889              float(d + ${n} + 1)));
12890
12891          const int MIN_DEPTH_BEGIN = 0;
12892          const int MAX_DEPTH_END = ${this.depth};
12893
12894          float norm = 0.0;
12895          for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {
12896            if (k < depthBegin){
12897              continue;
12898            }
12899            else if (k >= depthBegin && k < depthEnd) {
12900              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);
12901            }
12902            else {
12903              break;
12904            }
12905          }
12906
12907          norm = float(${s}) * norm + float(${r});
12908
12909          for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){
12910            if (k < depthBegin){
12911              continue;
12912            }
12913            else if (k >= depthBegin && k < depthEnd){
12914              float dyi = -2.0 * float(${s})
12915                * float(${i})
12916                * getInputImage(b, r, c, k) * getOutputImage(b, r, c, d)
12917                / norm;
12918              if (k == d) {
12919                dyi += pow(norm, -1.0 * ${i});
12920              }
12921              if (k == coords[3]) {
12922                dyi *= getDy(b, r, c, d);
12923                result += dyi;
12924              }
12925            }
12926            else {
12927              break;
12928            }
12929          }
12930      }
12931      setOutput(result);
12932      }
12933    `}}/**
12934 * @license
12935 * Copyright 2020 Google LLC. All Rights Reserved.
12936 * Licensed under the Apache License, Version 2.0 (the "License");
12937 * you may not use this file except in compliance with the License.
12938 * You may obtain a copy of the License at
12939 *
12940 * http://www.apache.org/licenses/LICENSE-2.0
12941 *
12942 * Unless required by applicable law or agreed to in writing, software
12943 * distributed under the License is distributed on an "AS IS" BASIS,
12944 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12945 * See the License for the specific language governing permissions and
12946 * limitations under the License.
12947 * =============================================================================
12948 */const Mce=t=>{const{inputs:e,backend:n,attrs:r}=t,{x:s,y:i,dy:o}=e,{depthRadius:a,bias:u,alpha:l,beta:c}=r,h=new Lce(s.shape,a,u,l,c);return n.runWebGLProgram(h,[s,i,o],s.dtype)},Vce={kernelName:b5,backendName:"webgl",kernelFunc:Mce};/**
12949 * @license
12950 * Copyright 2020 Google LLC. All Rights Reserved.
12951 * Licensed under the Apache License, Version 2.0 (the "License");
12952 * you may not use this file except in compliance with the License.
12953 * You may obtain a copy of the License at
12954 *
12955 * http://www.apache.org/licenses/LICENSE-2.0
12956 *
12957 * Unless required by applicable law or agreed to in writing, software
12958 * distributed under the License is distributed on an "AS IS" BASIS,
12959 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12960 * See the License for the specific language governing permissions and
12961 * limitations under the License.
12962 * =============================================================================
12963 */function Bce(t,e,n,r){const s=ne(e),o=ne(t.shape)/s,a=se({inputs:{x:t},attrs:{shape:[o,s]},backend:r}),u=Wa(a,t.dtype,"max",r),l=se({inputs:{x:u},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(a),r.disposeIntermediateTensorInfo(u),l}/**
12964 * @license
12965 * Copyright 2020 Google LLC. All Rights Reserved.
12966 * Licensed under the Apache License, Version 2.0 (the "License");
12967 * you may not use this file except in compliance with the License.
12968 * You may obtain a copy of the License at
12969 *
12970 * http://www.apache.org/licenses/LICENSE-2.0
12971 *
12972 * Unless required by applicable law or agreed to in writing, software
12973 * distributed under the License is distributed on an "AS IS" BASIS,
12974 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12975 * See the License for the specific language governing permissions and
12976 * limitations under the License.
12977 * =============================================================================
12978 */function UP(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{reductionIndices:i,keepDims:o}=r,a=s.shape.length,u=Gt(i,s.shape);let l=u;const c=Ur(l,a),h=c!=null,d=n.shouldExecuteOnCPU([s]);let f=s;if(h){if(d){const w=n.texData.get(f.dataId).values,_=new Array(a);for(let k=0;k<_.length;k++)_[k]=s.shape[c[k]];const T=dw(w,s.shape,s.dtype,c,_);f=n.makeTensorInfo(_,s.dtype);const E=n.texData.get(f.dataId);E.values=T}else f=Sm(s,c,n);l=zr(l.length,a)}ws("max",l,a);const[p,y]=qs(f.shape,l);let v=p;o&&(v=vr(p,u));let g;if(d){const w=n.texData.get(f.dataId).values,_=qse(w,ne(y),v,s.dtype);g=n.makeTensorInfo(v,s.dtype);const T=n.texData.get(g.dataId);T.values=_}else g=Bce(f,y,v,n);return h&&n.disposeIntermediateTensorInfo(f),g}const Wce={kernelName:rA,backendName:"webgl",kernelFunc:UP};/**
12979 * @license
12980 * Copyright 2020 Google LLC. All Rights Reserved.
12981 * Licensed under the Apache License, Version 2.0 (the "License");
12982 * you may not use this file except in compliance with the License.
12983 * You may obtain a copy of the License at
12984 *
12985 * http://www.apache.org/licenses/LICENSE-2.0
12986 *
12987 * Unless required by applicable law or agreed to in writing, software
12988 * distributed under the License is distributed on an "AS IS" BASIS,
12989 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12990 * See the License for the specific language governing permissions and
12991 * limitations under the License.
12992 * =============================================================================
12993 */const Uce=fw+`
12994  return max(a, b);
12995`,zce=`
12996  vec4 result = vec4(max(a, b));
12997  bvec4 isNaNA = isnan(a);
12998  bvec4 isNaNB = isnan(b);
12999  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
13000  `+Ba+`
13001  return result;
13002`,jce=tn({opSnippet:Uce,packedOpSnippet:zce,cpuKernelImpl:Kse}),Gce={kernelName:sA,backendName:"webgl",kernelFunc:jce};/**
13003 * @license
13004 * Copyright 2020 Google LLC. All Rights Reserved.
13005 * Licensed under the Apache License, Version 2.0 (the "License");
13006 * you may not use this file except in compliance with the License.
13007 * You may obtain a copy of the License at
13008 *
13009 * http://www.apache.org/licenses/LICENSE-2.0
13010 *
13011 * Unless required by applicable law or agreed to in writing, software
13012 * distributed under the License is distributed on an "AS IS" BASIS,
13013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13014 * See the License for the specific language governing permissions and
13015 * limitations under the License.
13016 * =============================================================================
13017 */function Hce(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e;Ch(s,"maxPool");const{filterSize:i,strides:o,pad:a,dimRoundingMode:u}=r,l=1;A(tr(o,l),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${o} and dilations '${l}'`);const c=Da(s.shape,i,o,l,a,u);if(c.filterWidth===1&&c.filterHeight===1&&xt(c.inShape,c.outShape))return Jn({inputs:{x:s},backend:n});const h=new Yc(c,"max",!1);return n.runWebGLProgram(h,[s],s.dtype)}const qce={kernelName:iA,backendName:"webgl",kernelFunc:Hce};/**
13018 * @license
13019 * Copyright 2020 Google LLC. All Rights Reserved.
13020 * Licensed under the Apache License, Version 2.0 (the "License");
13021 * you may not use this file except in compliance with the License.
13022 * You may obtain a copy of the License at
13023 *
13024 * http://www.apache.org/licenses/LICENSE-2.0
13025 *
13026 * Unless required by applicable law or agreed to in writing, software
13027 * distributed under the License is distributed on an "AS IS" BASIS,
13028 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13029 * See the License for the specific language governing permissions and
13030 * limitations under the License.
13031 * =============================================================================
13032 */function Kce(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:i,strides:o,pad:a,dataFormat:u,dimRoundingMode:l}=r,c=[1,1,1],h=wh(s.shape,i,o,c,a,l,u),d=new mw(h,"max",!1);return n.runWebGLProgram(d,[s],s.dtype)}const Xce={kernelName:oA,backendName:"webgl",kernelFunc:Kce};/**
13033 * @license
13034 * Copyright 2017 Google LLC. All Rights Reserved.
13035 * Licensed under the Apache License, Version 2.0 (the "License");
13036 * you may not use this file except in compliance with the License.
13037 * You may obtain a copy of the License at
13038 *
13039 * http://www.apache.org/licenses/LICENSE-2.0
13040 *
13041 * Unless required by applicable law or agreed to in writing, software
13042 * distributed under the License is distributed on an "AS IS" BASIS,
13043 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13044 * See the License for the specific language governing permissions and
13045 * limitations under the License.
13046 * =============================================================================
13047 */class Yce{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const n=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.effectiveFilterHeight,o=e.effectiveFilterWidth,a=i-1-e.padInfo.top,u=o-1-e.padInfo.left,l=i*o-1;this.userCode=`
13048      const ivec2 pads = ivec2(${a}, ${u});
13049
13050      void main() {
13051        ivec4 coords = getOutputCoords();
13052        int b = coords[0];
13053        int d = coords[3];
13054
13055        ivec2 dyRCCorner = coords.yz - pads;
13056        int dyRCorner = dyRCCorner.x;
13057        int dyCCorner = dyRCCorner.y;
13058
13059        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
13060        // ? = to be determined. : = across all values in that axis.
13061        float dotProd = 0.0;
13062        for (int wR = 0; wR < ${i};
13063          wR += ${s}) {
13064          float dyR = float(dyRCorner + wR) / ${n}.0;
13065
13066          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
13067            continue;
13068          }
13069          int idyR = int(dyR);
13070
13071          for (int wC = 0; wC < ${o}; wC++) {
13072            float dyC = float(dyCCorner + wC) / ${r}.0;
13073
13074            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
13075                fract(dyC) > 0.0) {
13076              continue;
13077            }
13078            int idyC = int(dyC);
13079
13080            float dyValue = getDy(b, idyR, idyC, d);
13081            int maxPosValue = ${l} - int(getMaxPos(b, idyR, idyC, d));
13082
13083            // Get the current value, check it against the value from the
13084            // position matrix.
13085            int curPosValue = wR * ${o} + wC;
13086            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
13087
13088            dotProd += dyValue * mask;
13089          }
13090        }
13091        setOutput(dotProd);
13092      }
13093    `}}class Qce{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const n=e.strideDepth,r=e.strideHeight,s=e.strideWidth,i=e.dilationDepth,o=e.dilationHeight,a=e.dilationWidth,u=e.effectiveFilterDepth,l=e.effectiveFilterHeight,c=e.effectiveFilterWidth,h=u-1-e.padInfo.front,d=l-1-e.padInfo.top,f=c-1-e.padInfo.left,p=u*l*c-1;this.userCode=`
13094      const ivec3 pads = ivec3(${h}, ${d}, ${f});
13095
13096      void main() {
13097        ivec5 coords = getOutputCoords();
13098        int batch = coords.x;
13099        int ch = coords.u;
13100
13101        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
13102        int dyDCorner = dyCorner.x;
13103        int dyRCorner = dyCorner.y;
13104        int dyCCorner = dyCorner.z;
13105
13106        // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
13107        // dx(xD, xR, xC, ch).
13108        // ? = to be determined. : = across all values in that axis.
13109        float dotProd = 0.0;
13110
13111        for (int wD = 0; wD < ${u};
13112           wD += ${i}) {
13113          float dyD = float(dyDCorner + wD) / ${n}.0;
13114
13115          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {
13116            continue;
13117          }
13118          int idyD = int(dyD);
13119
13120          for (int wR = 0; wR < ${l};
13121              wR += ${o}) {
13122            float dyR = float(dyRCorner + wR) / ${r}.0;
13123
13124            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
13125                fract(dyR) > 0.0) {
13126              continue;
13127            }
13128            int idyR = int(dyR);
13129
13130            for (int wC = 0; wC < ${c};
13131                wC += ${a}) {
13132              float dyC = float(dyCCorner + wC) / ${s}.0;
13133
13134              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
13135                  fract(dyC) > 0.0) {
13136                continue;
13137              }
13138              int idyC = int(dyC);
13139
13140              float dyValue = getDy(batch, idyD, idyR, idyC, ch);
13141              int maxPosValue = ${p} -
13142                  int(getMaxPos(batch, idyD, idyR, idyC, ch));
13143
13144              // Get the current value, check it against the value from the
13145              // position matrix.
13146              int curPosValue =
13147                  wD * ${l} * ${c} +
13148                  wR * ${c} + wC;
13149              float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
13150
13151              dotProd += dyValue * mask;
13152            }
13153          }
13154        }
13155        setOutput(dotProd);
13156      }
13157    `}}/**
13158 * @license
13159 * Copyright 2020 Google LLC. All Rights Reserved.
13160 * Licensed under the Apache License, Version 2.0 (the "License");
13161 * you may not use this file except in compliance with the License.
13162 * You may obtain a copy of the License at
13163 *
13164 * http://www.apache.org/licenses/LICENSE-2.0
13165 *
13166 * Unless required by applicable law or agreed to in writing, software
13167 * distributed under the License is distributed on an "AS IS" BASIS,
13168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13169 * See the License for the specific language governing permissions and
13170 * limitations under the License.
13171 * =============================================================================
13172 */function Zce(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:i}=e,o=i,{filterSize:a,strides:u,pad:l,dimRoundingMode:c}=r,h=[1,1,1],d=wh(o.shape,a,u,h,l,c),f=new mw(d,"max",!0),p=n.runWebGLProgram(f,[o],o.dtype),y=new Qce(d),v=n.runWebGLProgram(y,[s,p],o.dtype);return n.disposeIntermediateTensorInfo(p),v}const Jce={kernelName:S5,backendName:"webgl",kernelFunc:Zce};/**
13173 * @license
13174 * Copyright 2020 Google LLC. All Rights Reserved.
13175 * Licensed under the Apache License, Version 2.0 (the "License");
13176 * you may not use this file except in compliance with the License.
13177 * You may obtain a copy of the License at
13178 *
13179 * http://www.apache.org/licenses/LICENSE-2.0
13180 *
13181 * Unless required by applicable law or agreed to in writing, software
13182 * distributed under the License is distributed on an "AS IS" BASIS,
13183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13184 * See the License for the specific language governing permissions and
13185 * limitations under the License.
13186 * =============================================================================
13187 */function ehe(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:i,output:o}=e,a=i;Ch([i,o],"maxPoolGrad");const{filterSize:u,strides:l,pad:c,dimRoundingMode:h}=r,d=Da(a.shape,u,l,1,c,h),f=!0,p=new Yc(d,"max",f),y=n.runWebGLProgram(p,[a],a.dtype),v=new Yce(d),g=n.runWebGLProgram(v,[s,y],a.dtype);return n.disposeIntermediateTensorInfo(y),g}const the={kernelName:_5,backendName:"webgl",kernelFunc:ehe};/**
13188 * @license
13189 * Copyright 2020 Google LLC. All Rights Reserved.
13190 * Licensed under the Apache License, Version 2.0 (the "License");
13191 * you may not use this file except in compliance with the License.
13192 * You may obtain a copy of the License at
13193 *
13194 * http://www.apache.org/licenses/LICENSE-2.0
13195 *
13196 * Unless required by applicable law or agreed to in writing, software
13197 * distributed under the License is distributed on an "AS IS" BASIS,
13198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13199 * See the License for the specific language governing permissions and
13200 * limitations under the License.
13201 * =============================================================================
13202 */function nhe(t,e,n,r){let s=new Yc(n,"max",!1);const i=r.runWebGLProgram(s,[t],"float32");s=new Yc(n,"max",!0,!0,e);const o=r.runWebGLProgram(s,[t],"float32");return[i,o]}/**
13203 * @license
13204 * Copyright 2020 Google LLC. All Rights Reserved.
13205 * Licensed under the Apache License, Version 2.0 (the "License");
13206 * you may not use this file except in compliance with the License.
13207 * You may obtain a copy of the License at
13208 *
13209 * http://www.apache.org/licenses/LICENSE-2.0
13210 *
13211 * Unless required by applicable law or agreed to in writing, software
13212 * distributed under the License is distributed on an "AS IS" BASIS,
13213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13214 * See the License for the specific language governing permissions and
13215 * limitations under the License.
13216 * =============================================================================
13217 */const rhe={kernelName:aA,backendName:"webgl",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{x:r}=t,{filterSize:s,strides:i,pad:o,includeBatchInIndex:a}=e,u=n;A(r.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`);const l=[1,1];A(tr(i,l),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${l}'`);const c=Da(r.shape,s,i,l,o),[h,d]=nhe(r,a,c,u);return[h,d]}};/**
13218 * @license
13219 * Copyright 2020 Google LLC. All Rights Reserved.
13220 * Licensed under the Apache License, Version 2.0 (the "License");
13221 * you may not use this file except in compliance with the License.
13222 * You may obtain a copy of the License at
13223 *
13224 * http://www.apache.org/licenses/LICENSE-2.0
13225 *
13226 * Unless required by applicable law or agreed to in writing, software
13227 * distributed under the License is distributed on an "AS IS" BASIS,
13228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13229 * See the License for the specific language governing permissions and
13230 * limitations under the License.
13231 * =============================================================================
13232 */function she(t,e,n,r){const s=ne(e),o=ne(t.shape)/s,a=se({inputs:{x:t},attrs:{shape:[o,s]},backend:r}),u=Wa(a,"float32","mean",r),l=se({inputs:{x:u},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(a),r.disposeIntermediateTensorInfo(u),l}/**
13233 * @license
13234 * Copyright 2020 Google LLC. All Rights Reserved.
13235 * Licensed under the Apache License, Version 2.0 (the "License");
13236 * you may not use this file except in compliance with the License.
13237 * You may obtain a copy of the License at
13238 *
13239 * http://www.apache.org/licenses/LICENSE-2.0
13240 *
13241 * Unless required by applicable law or agreed to in writing, software
13242 * distributed under the License is distributed on an "AS IS" BASIS,
13243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13244 * See the License for the specific language governing permissions and
13245 * limitations under the License.
13246 * =============================================================================
13247 */const ihe={kernelName:uA,backendName:"webgl",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{x:r}=t,{keepDims:s,axis:i}=e,o=n,a=r.shape.length,u=Gt(i,r.shape);let l=u;const c=Ur(l,a),h=c!=null,d=o.shouldExecuteOnCPU([r]),f=[];let p=r;if(h){if(d){const _=o.texData.get(p.dataId).values,T=new Array(a);for(let N=0;N<T.length;N++)T[N]=r.shape[c[N]];const E=dw(_,r.shape,r.dtype,c,T);p=o.makeTensorInfo(T,r.dtype);const k=o.texData.get(p.dataId);k.values=E}else p=Sm(r,c,o);f.push(p),l=zr(l.length,a)}ws("sum",l,a);const[y,v]=qs(p.shape,l);let g=y;s&&(g=vr(y,u));const x=she(p,v,g,o);for(const w of f)o.disposeIntermediateTensorInfo(w);return x}};/**
13248 * @license
13249 * Copyright 2020 Google LLC. All Rights Reserved.
13250 * Licensed under the Apache License, Version 2.0 (the "License");
13251 * you may not use this file except in compliance with the License.
13252 * You may obtain a copy of the License at
13253 *
13254 * http://www.apache.org/licenses/LICENSE-2.0
13255 *
13256 * Unless required by applicable law or agreed to in writing, software
13257 * distributed under the License is distributed on an "AS IS" BASIS,
13258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13259 * See the License for the specific language governing permissions and
13260 * limitations under the License.
13261 * =============================================================================
13262 */function ohe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,keepDims:o}=r,a=s.shape.length,u=Gt(i,s.shape);let l=u;const c=Ur(l,a);let h=s;c!=null&&(h=Tn({inputs:{x:s},backend:n,attrs:{perm:c}}),l=zr(l.length,s.shape.length)),ws("min",l,a);const[d,f]=qs(h.shape,l),p=ne(f),y=se({inputs:{x:h},backend:n,attrs:{shape:[-1,p]}}),v=Wa(y,y.dtype,"min",n);let g;if(o){const x=vr(d,u);g=se({inputs:{x:v},backend:n,attrs:{shape:x}})}else g=se({inputs:{x:v},backend:n,attrs:{shape:d}});return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(v),c!=null&&n.disposeIntermediateTensorInfo(h),g}const ahe={kernelName:lA,backendName:"webgl",kernelFunc:ohe};/**
13263 * @license
13264 * Copyright 2020 Google LLC. All Rights Reserved.
13265 * Licensed under the Apache License, Version 2.0 (the "License");
13266 * you may not use this file except in compliance with the License.
13267 * You may obtain a copy of the License at
13268 *
13269 * http://www.apache.org/licenses/LICENSE-2.0
13270 *
13271 * Unless required by applicable law or agreed to in writing, software
13272 * distributed under the License is distributed on an "AS IS" BASIS,
13273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13274 * See the License for the specific language governing permissions and
13275 * limitations under the License.
13276 * =============================================================================
13277 */const uhe=fw+`
13278  return min(a, b);
13279`,lhe=`
13280  vec4 result = vec4(min(a, b));
13281  bvec4 isNaNA = isnan(a);
13282  bvec4 isNaNB = isnan(b);
13283  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
13284  `+Ba+`
13285  return result;
13286`,che=tn({opSnippet:uhe,packedOpSnippet:lhe,cpuKernelImpl:Xse}),hhe={kernelName:cA,backendName:"webgl",kernelFunc:che};/**
13287 * @license
13288 * Copyright 2020 Google LLC. All Rights Reserved.
13289 * Licensed under the Apache License, Version 2.0 (the "License");
13290 * you may not use this file except in compliance with the License.
13291 * You may obtain a copy of the License at
13292 *
13293 * http://www.apache.org/licenses/LICENSE-2.0
13294 *
13295 * Unless required by applicable law or agreed to in writing, software
13296 * distributed under the License is distributed on an "AS IS" BASIS,
13297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13298 * See the License for the specific language governing permissions and
13299 * limitations under the License.
13300 * =============================================================================
13301 */class dhe{constructor(e,n,r){this.variableNames=["x"],this.outputShape=n.map((c,h)=>c[0]+e[h]+c[1]);const s=e.length,i=qe(s),o=n.map(c=>c[0]).join(","),a=n.map((c,h)=>c[0]+e[h]).join(","),u=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,s),l=r==="reflect"?0:1;if(s===1){this.userCode=`
13302        int start = ${o};
13303        int end = ${a};
13304
13305        void main() {
13306          int outC = getOutputCoords();
13307          if (outC < start) {
13308            outC = start * 2 - outC - ${l};
13309          } else if(outC >= end) {
13310            outC = (end - 1) * 2 - outC + ${l};
13311          }
13312          setOutput(getX(outC - start));
13313        }
13314      `;return}this.userCode=`
13315      ${i} start = ${i}(${o});
13316      ${i} end = ${i}(${a});
13317
13318      void main() {
13319        ${i} outC = getOutputCoords();
13320        for (int i = 0; i < ${s}; i++) {
13321          if (outC[i] < start[i]) {
13322            outC[i] = start[i] * 2 - outC[i] - ${l};
13323          } else if(outC[i] >= end[i]) {
13324            outC[i] = (end[i] - 1) * 2 - outC[i] + ${l};
13325          }
13326        }
13327        ${i} coords = outC - start;
13328        setOutput(getX(${u}));
13329      }
13330    `}}/**
13331 * @license
13332 * Copyright 2020 Google LLC. All Rights Reserved.
13333 * Licensed under the Apache License, Version 2.0 (the "License");
13334 * you may not use this file except in compliance with the License.
13335 * You may obtain a copy of the License at
13336 *
13337 * http://www.apache.org/licenses/LICENSE-2.0
13338 *
13339 * Unless required by applicable law or agreed to in writing, software
13340 * distributed under the License is distributed on an "AS IS" BASIS,
13341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13342 * See the License for the specific language governing permissions and
13343 * limitations under the License.
13344 * =============================================================================
13345 */class fhe{constructor(e,n,r){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n.map((p,y)=>p[0]+e[y]+p[1]);const s=e.length,i=qe(s),o=n.map(p=>p[0]).join(","),a=n.map((p,y)=>p[0]+e[y]).join(","),u=bn("rc",s),l=bn("source",s),c=`${u[s-1]} < ${this.outputShape[s-1]}`,h=s===1?"source":`vec2(${l.slice(-2).join()})`,d=r==="reflect"?0:1;let f="";if(s===1){const p=`
13346        ${i} source = rc;
13347        if (source < start) {
13348          source = start * 2 - source - ${d};
13349        } else if (source >= end) {
13350          source = (end - 1) * 2 - source + ${d};
13351        }
13352        source -= start;
13353      `;f=`
13354        ${i} rc = outputLoc;
13355        ${p}
13356        result[0] = getChannel(getX(${l.join()}), ${h});
13357        ${u[s-1]} += 1;
13358        if(${c}) {
13359          ${p}
13360          result[1] = getChannel(getX(${l.join()}), ${h});
13361        }
13362      `}else{const p=`
13363        ${i} source = rc;
13364        ${i} lt = ${i}(lessThan(source, start));
13365        ${i} gte = ${i}(greaterThanEqual(source, end));
13366        ${i} orig = 1 - (lt + gte);
13367        source = orig * source +
13368                lt * (start * 2 - source - ${d}) +
13369                gte * ((end - 1) * 2 - source + ${d});
13370        source -= start;
13371      `;f=`
13372        ${i} rc = outputLoc;
13373        ${p}
13374        result[0] = getChannel(getX(${l.join()}), ${h});
13375        ${u[s-1]} += 1;
13376        if(${c}) {
13377          ${p}
13378          result[1] = getChannel(getX(${l.join()}), ${h});
13379        }
13380        rc = outputLoc;
13381        ${u[s-2]} += 1;
13382        if(${u[s-2]} < ${this.outputShape[s-2]}) {
13383          ${p}
13384          result[2] = getChannel(getX(${l.join()}), ${h});
13385          ${u[s-1]} += 1;
13386          if(${c}) {
13387            ${p}
13388            result[3] = getChannel(getX(${l.join()}), ${h});
13389          }
13390        }
13391      `}this.userCode=`
13392      const ${i} start = ${i}(${o});
13393      const ${i} end = ${i}(${a});
13394
13395      void main() {
13396        ${i} outputLoc = getOutputCoords();
13397        vec4 result = vec4(0.);
13398        ${f}
13399        setOutput(result);
13400      }
13401    `}}/**
13402 * @license
13403 * Copyright 2020 Google LLC. All Rights Reserved.
13404 * Licensed under the Apache License, Version 2.0 (the "License");
13405 * you may 
13405not use this file except in compliance with the License.
13406 * You may obtain a copy of the License at
13407 *
13408 * http://www.apache.org/licenses/LICENSE-2.0
13409 *
13410 * Unless required by applicable law or agreed to in writing, software
13411 * distributed under the License is distributed on an "AS IS" BASIS,
13412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13413 * See the License for the specific language governing permissions and
13414 * limitations under the License.
13415 * =============================================================================
13416 */const phe=({inputs:t,backend:e,attrs:n})=>{const{x:r}=t,{paddings:s,mode:i}=n,o=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new fhe(r.shape,s,i):new dhe(r.shape,s,i);return e.runWebGLProgram(o,[r],r.dtype)},mhe={kernelName:hA,backendName:"webgl",kernelFunc:phe};/**
13417 * @license
13418 * Copyright 2020 Google LLC. All Rights Reserved.
13419 * Licensed under the Apache License, Version 2.0 (the "License");
13420 * you may not use this file except in compliance with the License.
13421 * You may obtain a copy of the License at
13422 *
13423 * http://www.apache.org/licenses/LICENSE-2.0
13424 *
13425 * Unless required by applicable law or agreed to in writing, software
13426 * distributed under the License is distributed on an "AS IS" BASIS,
13427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13428 * See the License for the specific language governing permissions and
13429 * limitations under the License.
13430 * =============================================================================
13431 */const ghe=`if (b == 0.0) return NAN;
13432  return mod(a, b);`,yhe=`
13433  vec4 result = mod(a, b);
13434  bvec4 isNaN = equal(b, vec4(0.0));
13435  `+Ba+`
13436  return result;
13437`,vhe=tn({opSnippet:ghe,packedOpSnippet:yhe}),xhe={kernelName:dA,backendName:"webgl",kernelFunc:vhe};/**
13438 * @license
13439 * Copyright 2017 Google LLC. All Rights Reserved.
13440 * Licensed under the Apache License, Version 2.0 (the "License");
13441 * you may not use this file except in compliance with the License.
13442 * You may obtain a copy of the License at
13443 *
13444 * http://www.apache.org/licenses/LICENSE-2.0
13445 *
13446 * Unless required by applicable law or agreed to in writing, software
13447 * distributed under the License is distributed on an "AS IS" BASIS,
13448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13449 * See the License for the specific language governing permissions and
13450 * limitations under the License.
13451 * =============================================================================
13452 */class whe{constructor(e,n,r){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,r],this.userCode=`
13453      void main() {
13454        ivec2 coords = getOutputCoords();
13455        int batch = coords[0];
13456
13457        float r = random(seed);
13458        float cdf = 0.0;
13459
13460        for (int i = 0; i < ${n-1}; i++) {
13461          cdf += getProbs(batch, i);
13462
13463          if (r < cdf) {
13464            setOutput(float(i));
13465            return;
13466          }
13467        }
13468
13469        // If no other event happened, last event happened.
13470        setOutput(float(${n-1}));
13471      }
13472    `}}/**
13473 * @license
13474 * Copyright 2020 Google LLC. All Rights Reserved.
13475 * Licensed under the Apache License, Version 2.0 (the "License");
13476 * you may not use this file except in compliance with the License.
13477 * You may obtain a copy of the License at
13478 *
13479 * http://www.apache.org/licenses/LICENSE-2.0
13480 *
13481 * Unless required by applicable law or agreed to in writing, software
13482 * distributed under the License is distributed on an "AS IS" BASIS,
13483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13484 * See the License for the specific language governing permissions and
13485 * limitations under the License.
13486 * =============================================================================
13487 */const bhe=`
13488if (a == b) {
13489  return 1.0;
13490};
13491return a / b;`,_he=`
13492  // vec4 one = vec4(equal(a, b));
13493  // return one + (vec4(1.0) - one) * a / b;
13494  vec4 result = a / b;
13495  if(a.x == b.x) {
13496    result.x = 1.;
13497  }
13498  if(a.y == b.y) {
13499    result.y = 1.;
13500  }
13501  if(a.z == b.z) {
13502    result.z = 1.;
13503  }
13504  if(a.w == b.w) {
13505    result.w = 1.;
13506  }
13507
13508  return result;
13509`,zP=tn({opSnippet:bhe,packedOpSnippet:_he,checkOutOfBounds:!0}),She={kernelName:TI,backendName:"webgl",kernelFunc:zP};/**
13510 * @license
13511 * Copyright 2020 Google LLC. All Rights Reserved.
13512 * Licensed under the Apache License, Version 2.0 (the "License");
13513 * you may not use this file except in compliance with the License.
13514 * You may obtain a copy of the License at
13515 *
13516 * http://www.apache.org/licenses/LICENSE-2.0
13517 *
13518 * Unless required by applicable law or agreed to in writing, software
13519 * distributed under the License is distributed on an "AS IS" BASIS,
13520 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13521 * See the License for the specific language governing permissions and
13522 * limitations under the License.
13523 * =============================================================================
13524 */const yC="return a - b;",jP=tn({opSnippet:yC,packedOpSnippet:yC,supportsComplex:!0,cpuKernelImpl:gie}),The={kernelName:pR,backendName:"webgl",kernelFunc:jP};/**
13525 * @license
13526 * Copyright 2020 Google LLC. All Rights Reserved.
13527 * Licensed under the Apache License, Version 2.0 (the "License");
13528 * you may not use this file except in compliance with the License.
13529 * You may obtain a copy of the License at
13530 *
13531 * http://www.apache.org/licenses/LICENSE-2.0
13532 *
13533 * Unless required by applicable law or agreed to in writing, software
13534 * distributed under the License is distributed on an "AS IS" BASIS,
13535 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13536 * See the License for the specific language governing permissions and
13537 * limitations under the License.
13538 * =============================================================================
13539 */function GP(t){const{inputs:e,backend:n,attrs:r}=t,{logits:s}=e,{dim:i}=r,o=Gt([i],s.shape),a=UP({inputs:{x:s},backend:n,attrs:{reductionIndices:o,keepDims:!1}}),u=vr(a.shape,o),l=se({inputs:{x:a},backend:n,attrs:{shape:u}}),c=jP({inputs:{a:s,b:l},backend:n}),h=VP({inputs:{x:c},backend:n}),d=Tm({inputs:{x:h},backend:n,attrs:{axis:o,keepDims:!1}}),f=se({inputs:{x:d},backend:n,attrs:{shape:u}}),p=zP({inputs:{a:h,b:f},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),p}const Che={kernelName:nR,backendName:"webgl",kernelFunc:GP};/**
13540 * @license
13541 * Copyright 2020 Google LLC. All Rights Reserved.
13542 * Licensed under the Apache License, Version 2.0 (the "License");
13543 * you may not use this file except in compliance with the License.
13544 * You may obtain a copy of the License at
13545 *
13546 * http://www.apache.org/licenses/LICENSE-2.0
13547 *
13548 * Unless required by applicable law or agreed to in writing, software
13549 * distributed under the License is distributed on an "AS IS" BASIS,
13550 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13551 * See the License for the specific language governing permissions and
13552 * limitations under the License.
13553 * =============================================================================
13554 */function Nhe(t){const{inputs:e,backend:n,attrs:r}=t,{logits:s}=e,{numSamples:i,seed:o,normalized:a}=r,u=a?s:GP({inputs:{logits:s},backend:n,attrs:{dim:s.shape.length-1}}),l=u.shape[0],c=u.shape[1],h=new whe(l,c,i),d=[[o]],f=n.runWebGLProgram(h,[u],"int32",d);return a||n.disposeIntermediateTensorInfo(u),f}const Ehe={kernelName:fA,backendName:"webgl",kernelFunc:Nhe};/**
13555 * @license
13556 * Copyright 2020 Google LLC. All Rights Reserved.
13557 * Licensed under the Apache License, Version 2.0 (the "License");
13558 * you may not use this file except in compliance with the License.
13559 * You may obtain a copy of the License at
13560 *
13561 * http://www.apache.org/licenses/LICENSE-2.0
13562 *
13563 * Unless required by applicable law or agreed to in writing, software
13564 * distributed under the License is distributed on an "AS IS" BASIS,
13565 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13566 * See the License for the specific language governing permissions and
13567 * limitations under the License.
13568 * =============================================================================
13569 */const khe=jr+`
13570  return -x;
13571`,$he=`
13572  vec4 result = -x;
13573  bvec4 isNaN = isnan(x);
13574
13575  result.r = isNaN.r ? x.r : result.r;
13576  result.g = isNaN.g ? x.g : result.g;
13577  result.b = isNaN.b ? x.b : result.b;
13578  result.a = isNaN.a ? x.a : result.a;
13579
13580  return result;
13581`;function Ihe(t){const{inputs:e,backend:n}=t,{x:r}=e;if(n.shouldExecuteOnCPU([r])){const i=n.texData.get(r.dataId),[o,a]=Qse(i.values,r.shape,r.dtype);return n.makeTensorInfo(a,r.dtype,o)}let s;return U().getBool("WEBGL_PACK_UNARY_OPERATIONS")?s=new Gi(r.shape,$he):s=new As(r.shape,khe),n.runWebGLProgram(s,[r],r.dtype)}const Ahe={kernelName:mA,backendName:"webgl",kernelFunc:Ihe};/**
13582 * @license
13583 * Copyright 2020 Google LLC. All Rights Reserved.
13584 * Licensed under the Apache License, Version 2.0 (the "License");
13585 * you may not use this file except in compliance with the License.
13586 * You may obtain a copy of the License at
13587 *
13588 * http://www.apache.org/licenses/LICENSE-2.0
13589 *
13590 * Unless required by applicable law or agreed to in writing, software
13591 * distributed under the License is distributed on an "AS IS" BASIS,
13592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13593 * See the License for the specific language governing permissions and
13594 * limitations under the License.
13595 * =============================================================================
13596 */const Rhe=HO;function Ohe(t){ss("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:i}=e,{maxOutputSize:o,iouThreshold:a,scoreThreshold:u}=r,l=n.readSync(s.dataId),c=n.readSync(i.dataId),{selectedIndices:h}=Rhe(l,c,o,a,u);return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}const Dhe={kernelName:yA,backendName:"webgl",kernelFunc:Ohe};/**
13597 * @license
13598 * Copyright 2020 Google LLC. All Rights Reserved.
13599 * Licensed under the Apache License, Version 2.0 (the "License");
13600 * you may not use this file except in compliance with the License.
13601 * You may obtain a copy of the License at
13602 *
13603 * http://www.apache.org/licenses/LICENSE-2.0
13604 *
13605 * Unless required by applicable law or agreed to in writing, software
13606 * distributed under the License is distributed on an "AS IS" BASIS,
13607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13608 * See the License for the specific language governing permissions and
13609 * limitations under the License.
13610 * =============================================================================
13611 */const Phe=qO;function Fhe(t){ss("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:i}=e,{maxOutputSize:o,iouThreshold:a,scoreThreshold:u,padToMaxOutputSize:l}=r,c=n.readSync(s.dataId),h=n.readSync(i.dataId),{selectedIndices:d,validOutputs:f}=Phe(c,h,o,a,u,l);return[n.makeTensorInfo([d.length],"int32",new Int32Array(d)),n.makeTensorInfo([],"int32",new Int32Array([f]))]}const Lhe={kernelName:vA,backendName:"webgl",kernelFunc:Fhe};/**
13612 * @license
13613 * Copyright 2020 Google LLC. All Rights Reserved.
13614 * Licensed under the Apache License, Version 2.0 (the "License");
13615 * you may not use this file except in compliance with the License.
13616 * You may obtain a copy of the License at
13617 *
13618 * http://www.apache.org/licenses/LICENSE-2.0
13619 *
13620 * Unless required by applicable law or agreed to in writing, software
13621 * distributed under the License is distributed on an "AS IS" BASIS,
13622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13623 * See the License for the specific language governing permissions and
13624 * limitations under the License.
13625 * =============================================================================
13626 */const Mhe=KO;function Vhe(t){ss("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:i}=e,{maxOutputSize:o,iouThreshold:a,scoreThreshold:u,softNmsSigma:l}=r,c=n.readSync(s.dataId),h=n.readSync(i.dataId),d=o,f=a,p=u,y=l,{selectedIndices:v,selectedScores:g}=Mhe(c,h,d,f,p,y);return[n.makeTensorInfo([v.length],"int32",new Int32Array(v)),n.makeTensorInfo([g.length],"float32",new Float32Array(g))]}const Bhe={kernelName:xA,backendName:"webgl",kernelFunc:Vhe};/**
13627 * @license
13628 * Copyright 2017 Google LLC. All Rights Reserved.
13629 * Licensed under the Apache License, Version 2.0 (the "License");
13630 * you may not use this file except in compliance with the License.
13631 * You may obtain a copy of the License at
13632 *
13633 * http://www.apache.org/licenses/LICENSE-2.0
13634 *
13635 * Unless required by applicable law or agreed to in writing, software
13636 * distributed under the License is distributed on an "AS IS" BASIS,
13637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13638 * See the License for the specific language governing permissions and
13639 * limitations under the License.
13640 * =============================================================================
13641 */class Whe{constructor(e,n,r,s){this.variableNames=["indices"],this.outputShape=[e,n],this.userCode=`
13642      void main() {
13643        ivec2 coords = getOutputCoords();
13644        int index = round(getIndices(coords.x));
13645        setOutput(mix(float(${s}), float(${r}),
13646                      float(index == coords.y)));
13647      }
13648    `}}/**
13649 * @license
13650 * Copyright 2020 Google LLC. All Rights Reserved.
13651 * Licensed under the Apache License, Version 2.0 (the "License");
13652 * you may not use this file except in compliance with the License.
13653 * You may obtain a copy of the License at
13654 *
13655 * http://www.apache.org/licenses/LICENSE-2.0
13656 *
13657 * Unless required by applicable law or agreed to in writing, software
13658 * distributed under the License is distributed on an "AS IS" BASIS,
13659 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13660 * See the License for the specific language governing permissions and
13661 * limitations under the License.
13662 * =============================================================================
13663 */const Uhe=t=>{const{inputs:e,backend:n,attrs:r}=t,{indices:s}=e,{dtype:i,depth:o,onValue:a,offValue:u}=r,l=ne(s.shape),c=new Whe(l,o,a,u),h=se({inputs:{x:s},backend:n,attrs:{shape:[l]}}),d=n.runWebGLProgram(c,[h],i);n.disposeIntermediateTensorInfo(h);const f=[...s.shape,o],p=se({inputs:{x:d},backend:n,attrs:{shape:f}});return n.disposeIntermediateTensorInfo(d),p},zhe={kernelName:bA,backendName:"webgl",kernelFunc:Uhe};/**
13664 * @license
13665 * Copyright 2020 Google LLC. All Rights Reserved.
13666 * Licensed under the Apache License, Version 2.0 (the "License");
13667 * you may not use this file except in compliance with the License.
13668 * You may obtain a copy of the License at
13669 *
13670 * http://www.apache.org/licenses/LICENSE-2.0
13671 *
13672 * Unless required by applicable law or agreed to in writing, software
13673 * distributed under the License is distributed on an "AS IS" BASIS,
13674 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13675 * See the License for the specific language governing permissions and
13676 * limitations under the License.
13677 * =============================================================================
13678 */function up(t){const{inputs:e,backend:n}=t,{x:r}=e;if(r.dtype==="complex64"){const s=Eh({inputs:{input:r},backend:n}),i=up({inputs:{x:s},backend:n}),o=Cm({inputs:{input:r},backend:n}),a=up({inputs:{x:o},backend:n}),u=Co({inputs:{real:i,imag:a},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(a),u}else return kh({attrs:{shape:r.shape,dtype:r.dtype,value:r.dtype==="string"?"":0},backend:n})}const jhe={kernelName:_R,backendName:"webgl",kernelFunc:up};/**
13679 * @license
13680 * Copyright 2020 Google LLC. All Rights Reserved.
13681 * Licensed under the Apache License, Version 2.0 (the "License");
13682 * you may not use this file except in compliance with the License.
13683 * You may obtain a copy of the License at
13684 *
13685 * http://www.apache.org/licenses/LICENSE-2.0
13686 *
13687 * Unless required by applicable law or agreed to in writing, software
13688 * distributed under the License is distributed on an "AS IS" BASIS,
13689 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13690 * See the License for the specific language governing permissions and
13691 * limitations under the License.
13692 * =============================================================================
13693 */function HP(t){const{inputs:e,backend:n}=t,{x:r}=e;if(r.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(r.dtype==="complex64"){const s=Eh({inputs:{input:r},backend:n}),i=HP({inputs:{x:s},backend:n}),o=Cm({inputs:{input:r},backend:n}),a=up({inputs:{x:o},backend:n}),u=Co({inputs:{real:i,imag:a},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(a),u}else return kh({attrs:{shape:r.shape,dtype:r.dtype,value:1},backend:n})}const Ghe={kernelName:wA,backendName:"webgl",kernelFunc:HP};/**
13694 * @license
13695 * Copyright 2020 Google LLC. All Rights Reserved.
13696 * Licensed under the Apache License, Version 2.0 (the "License");
13697 * you may not use this file except in compliance with the License.
13698 * You may obtain a copy of the License at
13699 *
13700 * http://www.apache.org/licenses/LICENSE-2.0
13701 *
13702 * Unless required by applicable law or agreed to in writing, software
13703 * distributed under the License is distributed on an "AS IS" BASIS,
13704 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13705 * See the License for the specific language governing permissions and
13706 * limitations under the License.
13707 * =============================================================================
13708 */function Hhe(t){const{inputs:e,backend:n,attrs:r}=t,{axis:s}=r;if(e.length===1)return av({inputs:{input:e[0]},backend:n,attrs:{dim:s}});const i=e[0].shape,o=e[0].dtype;e.forEach(c=>{mr(i,c.shape,"All tensors passed to stack must have matching shapes"),A(
vendor: 4,306 bytes, lines 13708-13796
13708o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],u=e.map(c=>{const h=av({inputs:{input:c},backend:n,attrs:{dim:s}});return a.push(h),h}),l=AP({inputs:u,backend:n,attrs:{axis:s}});return a.forEach(c=>n.disposeIntermediateTensorInfo(c)),l}const qhe={kernelName:_A,backendName:"webgl",kernelFunc:Hhe};/**
13709 * @license
13710 * Copyright 2017 Google LLC. All Rights Reserved.
13711 * Licensed under the Apache License, Version 2.0 (the "License");
13712 * you may not use this file except in compliance with the License.
13713 * You may obtain a copy of the License at
13714 *
13715 * http://www.apache.org/licenses/LICENSE-2.0
13716 *
13717 * Unless required by applicable law or agreed to in writing, software
13718 * distributed under the License is distributed on an "AS IS" BASIS,
13719 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13720 * See the License for the specific language governing permissions and
13721 * limitations under the License.
13722 * =============================================================================
13723 */class Khe{constructor(e,n,r){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=n.map((l,c)=>l[0]+e[c]+l[1]);const s=e.length,i=qe(s),o=n.map(l=>l[0]).join(","),a=n.map((l,c)=>l[0]+e[c]).join(","),u=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,s);if(s===1){this.userCode=`
13724        int start = ${o};
13725        int end = ${a};
13726
13727        void main() {
13728          int outC = getOutputCoords();
13729          if (outC < start || outC >= end) {
13730            setOutput(value);
13731          } else {
13732            setOutput(getX(outC - start));
13733          }
13734        }
13735      `;return}this.userCode=`
13736      ${i} start = ${i}(${o});
13737      ${i} end = ${i}(${a});
13738
13739      void main() {
13740        ${i} outC = getOutputCoords();
13741        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {
13742          setOutput(value);
13743        } else {
13744          ${i} coords = outC - start;
13745          setOutput(getX(${u}));
13746        }
13747      }
13748    `}}/**
13749 * @license
13750 * Copyright 2019 Google LLC. All Rights Reserved.
13751 * Licensed under the Apache License, Version 2.0 (the "License");
13752 * you may not use this file except in compliance with the License.
13753 * You may obtain a copy of the License at
13754 *
13755 * http://www.apache.org/licenses/LICENSE-2.0
13756 *
13757 * Unless required by applicable law or agreed to in writing, software
13758 * distributed under the License is distributed on an "AS IS" BASIS,
13759 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13760 * See the License for the specific language governing permissions and
13761 * limitations under the License.
13762 * =============================================================================
13763 */class Xhe{constructor(e,n,r){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=n.map((y,v)=>y[0]+e[v]+y[1]);const s=e.length,i=qe(s),o=n.map(y=>y[0]).join(","),a=n.map((y,v)=>y[0]+e[v]).join(","),u=bn("rc",s),l=bn("source",s),c=`${u[s-1]} < ${this.outputShape[s-1]}`,h=s===1?"source":`vec2(${l.slice(-2).join()})`,d=[`${i} rc = outputLoc;`,`${u[s-1]} += 1;
13764       if(${c}) {
13765      `,s===1?"":`}
13766       rc = outputLoc;
13767       ${u[s-2]} += 1;
13768       if(${u[s-2]} < ${this.outputShape[s-2]}) {`,s===1?"":`  ${u[s-1]} += 1;
13769         if(${c}) {`],f=s===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))";let p="";for(let y=0,v=s===1?2:4;y<v;y++)p+=`
13770        ${d[y]}
13771        if (${f}) {
13772          result[${y}] = float(value);
13773        } else {
13774          ${i} source = rc - start;
13775          result[${y}] = getChannel(getX(${l.join()}), ${h});
13776        }
13777      `;p+=s===1?"} ":"}}",this.userCode=`
13778      const ${i} start = ${i}(${o});
13779      const ${i} end = ${i}(${a});
13780
13781      void main() {
13782        ${i} outputLoc = getOutputCoords();
13783        vec4 result = vec4(0.);
13784        ${p}
13785        setOutput(result);
13786      }
13787    `}}/**
13788 * @license
13789 * Copyright 2020 Google LLC. All Rights Reserved.
13790 * Licensed under the Apache License, Version 2.0 (the "License");
13791 * you may not use this file except in compliance with the License.
13792 * You may obtain a copy of the License at
13793 *
13794 * http://www.apache.org/licenses/LICENSE-2.0
13795 *
13796 * Unless required by applicable law or agreed to in writing, softw
13796are
13797 * distributed under the License is distributed on an "AS IS" BASIS,
13798 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13799 * See the License for the specific language governing permissions and
13800 * limitations under the License.
13801 * =============================================================================
13802 */const qP=t=>{const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{paddings:i,constantValue:o}=r;if(ne(s.shape)===0){const l=i.map((c,h)=>c[0]+s.shape[h]+c[1]);return kh({backend:n,attrs:{shape:l,value:o,dtype:s.dtype}})}const a=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Xhe(s.shape,i,o):new Khe(s.shape,i,o),u=[[o]];return n.runWebGLProgram(a,[s],s.dtype,u)},Yhe={kernelName:SA,backendName:"webgl",kernelFunc:qP};/**
13803 * @license
13804 * Copyright 2020 Google LLC. All Rights Reserved.
13805 * Licensed under the Apache License, Version 2.0 (the "License");
13806 * you may not use this file except in compliance with the License.
13807 * You may obtain a copy of the License at
13808 *
13809 * http://www.apache.org/licenses/LICENSE-2.0
13810 *
13811 * Unless required by applicable law or agreed to in writing, software
13812 * distributed under the License is distributed on an "AS IS" BASIS,
13813 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13814 * See the License for the specific language governing permissions and
13815 * limitations under the License.
13816 * =============================================================================
13817 */const Qhe=`
13818  if(a < 0.0 && floor(b) < b){
13819    return NAN;
13820  }
13821  if (b == 0.0) {
13822    return 1.0;
13823  }
13824  return (round(mod(b, 2.0)) != 1) ?
13825      pow(abs(a), b) : sign(a) * pow(abs(a), b);
13826`,Zhe=`
13827  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
13828  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
13829  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
13830  vec4 result = multiplier * pow(abs(a), b);
13831
13832  // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
13833  bvec4 isExpZero = equal(b, vec4(0.0));
13834  result.r = isExpZero.r ? 1.0 : result.r;
13835  result.g = isExpZero.g ? 1.0 : result.g;
13836  result.b = isExpZero.b ? 1.0 : result.b;
13837  result.a = isExpZero.a ? 1.0 : result.a;
13838
13839  bvec4 isNaN1 = lessThan(a, vec4(0.0));
13840  bvec4 isNaN2 = lessThan(floor(b), b);
13841  bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);
13842  `+Ba+`
13843  return result;
13844`,Jhe=tn({opSnippet:Qhe,packedOpSnippet:Zhe}),ede={kernelName:TA,backendName:"webgl",kernelFunc:Jhe};/**
13845 * @license
13846 * Copyright 2020 Google LLC. All Rights Reserved.
13847 * Licensed under the Apache License, Version 2.0 (the "License");
13848 * you may not use this file except in compliance with the License.
13849 * You may obtain a copy of the License at
13850 *
13851 * http://www.apache.org/licenses/LICENSE-2.0
13852 *
13853 * Unless required by applicable law or agreed to in writing, software
13854 * distributed under the License is distributed on an "AS IS" BASIS,
13855 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13856 * See the License for the specific language governing permissions and
13857 * limitations under the License.
13858 * =============================================================================
13859 */function tde(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:i,keepDims:o}=r,a=s.shape.length,u=[],l=Gt(i,s.shape);let c=l;const h=Ur(c,a);let d=s;h!=null&&(d=Tn({inputs:{x:s},backend:n,attrs:{perm:h}}),c=zr(c.length,a),u.push(d)),ws("prod",c,a);let f;if(n.shouldExecuteOnCPU([d])){const p=n.texData.get(d.dataId).values,{outVals:y,outShape:v,outDtype:g}=Jse(d.shape,d.dtype,p,c);f=n.makeTensorInfo(v,g,y)}else{const[p,y]=qs(d.shape,c),v=ne(y),g=se({inputs:{x:d},backend:n,attrs:{shape:[-1,v]}}),x=I1(s.dtype),w=Wa(g,x,"prod",n);f=se({inputs:{x:w},backend:n,attrs:{shape:p}}),u.push(g),u.push(w)}if(o){u.push(f);const p=vr(f.shape,l);f=se({inputs:{x:f},backend:n,attrs:{shape:p}})}return u.forEach(p=>n.disposeIntermediateTensorInfo(p)),f}const nde={kernelName:NA,backendName:"webgl",kernelFunc:tde};/**
13860 * @license
13861 * Copyright 2022 Google LLC. All Rights Reserved.
13862 * Licensed under the Apache License, Version 2.0 (the "License");
13863 * you may not use this file except in compliance with the License.
13864 * You may obtain a copy of the License at
13865 *
13866 * http://www.apache.org/licenses/LICENSE-2.0
13867 *
13868 * Unless required by applicable law or agreed to in writing, software
13869 * distributed under the License is distributed on an "AS IS" BASIS,
13870 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13871 * See the License for the specific language governing permissions and
13872 * limitations under the License.
13873 * =============================================================================
13874 */function rde(t){const{inputs:e,backend:n,attrs:r}=t,{paramsNestedSplits:s,paramsDenseValues:i,indices:o}=e,{outputRaggedRank:a}=r,u=s.map(g=>n.readSync(g.dataId)),l=s.map(g=>g.shape),c=n.readSync(i.dataId),h=n.readSync(o.dataId),[d,f,p]=eie(u,l,c,i.shape,i.dtype,h,o.shape,a),y=d.map(g=>n.makeTensorInfo([g.length],"int32",g)),v=n.makeTensorInfo(p,i.dtype,f);return y.concat([v])}const sde={kernelName:EA,backendName:"webgl",kernelFunc:rde};
vendor: 4,199 bytes, lines 13874-13943
13874/**
13875 * @license
13876 * Copyright 2022 Google LLC.
13877 * Licensed under the Apache License, Version 2.0 (the "License");
13878 * you may not use this file except in compliance with the License.
13879 * You may obtain a copy of the License at
13880 *
13881 * http://www.apache.org/licenses/LICENSE-2.0
13882 *
13883 * Unless required by applicable law or agreed to in writing, software
13884 * distributed under the License is distributed on an "AS IS" BASIS,
13885 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13886 * See the License for the specific language governing permissions and
13887 * limitations under the License.
13888 * =============================================================================
13889 */function ide(t){const{inputs:e,backend:n}=t,{starts:r,limits:s,deltas:i}=e,o=n.readSync(r.dataId),a=n.readSync(s.dataId),u=n.readSync(i.dataId),[l,c]=tie(o,r.shape,r.dtype,a,s.shape,u,i.shape),h=n.makeTensorInfo([l.length],"int32",l),d=n.makeTensorInfo([c.length],r.dtype,c);return[h,d]}const ode={kernelName:kA,backendName:"webgl",kernelFunc:ide};/**
13890 * @license
13891 * Copyright 2022 Google LLC. All Rights Reserved.
13892 * Licensed under the Apache License, Version 2.0 (the "License");
13893 * you may not use this file except in compliance with the License.
13894 * You may obtain a copy of the License at
13895 *
13896 * http://www.apache.org/licenses/LICENSE-2.0
13897 *
13898 * Unless required by applicable law or agreed to in writing, software
13899 * distributed under the License is distributed on an "AS IS" BASIS,
13900 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13901 * See the License for the specific language governing permissions and
13902 * limitations under the License.
13903 * =============================================================================
13904 */function ade(t){const{inputs:e,backend:n,attrs:r}=t,{shape:s,values:i,defaultValue:o,rowPartitionTensors:a}=e,{rowPartitionTypes:u}=r,l=n.readSync(s.dataId),c=n.readSync(i.dataId),h=n.readSync(o.dataId),d=a.map(v=>n.readSync(v.dataId)),f=a.map(v=>v.shape),[p,y]=nie(l,s.shape,c,i.shape,i.dtype,h,o.shape,d,f,u);return n.makeTensorInfo(p,i.dtype,y)}const ude={kernelName:$A,backendName:"webgl",kernelFunc:ade};/**
13905 * @license
13906 * Copyright 2020 Google LLC. All Rights Reserved.
13907 * Licensed under the Apache License, Version 2.0 (the "License");
13908 * you may not use this file except in compliance with the License.
13909 * You may obtain a copy of the License at
13910 *
13911 * http://www.apache.org/licenses/LICENSE-2.0
13912 *
13913 * Unless required by applicable law or agreed to in writing, software
13914 * distributed under the License is distributed on an "AS IS" BASIS,
13915 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13916 * See the License for the specific language governing permissions and
13917 * limitations under the License.
13918 * =============================================================================
13919 */const KP=t=>{const{backend:e,attrs:n}=t,{start:r,stop:s,step:i,dtype:o}=n,a=rie(r,s,i,o);return e.makeTensorInfo([a.length],o,a)},lde={kernelName:IA,backendName:"webgl",kernelFunc:KP};/**
13920 * @license
13921 * Copyright 2020 Google LLC. All Rights Reserved.
13922 * Licensed under the Apache License, Version 2.0 (the "License");
13923 * you may not use this file except in compliance with the License.
13924 * You may obtain a copy of the License at
13925 *
13926 * http://www.apache.org/licenses/LICENSE-2.0
13927 *
13928 * Unless required by applicable law or agreed to in writing, software
13929 * distributed under the License is distributed on an "AS IS" BASIS,
13930 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13931 * See the License for the specific language governing permissions and
13932 * limitations under the License.
13933 * =============================================================================
13934 */const cde="return 1.0 / x;",hde=Pe({opSnippet:cde}),dde={kernelName:RA,backendName:"webgl",kernelFunc:hde};/**
13935 * @license
13936 * Copyright 2020 Google LLC. All Rights Reserved.
13937 * Licensed under the Apache License, Version 2.0 (the "License");
13938 * you may not use this file except in compliance with the License.
13939 * You may obtain a copy of the License at
13940 *
13941 * http://www.apache.org/licenses/LICENSE-2.0
13942 *
13943 * Unless required by applicable law or agreed to in writing, softw
13943are
13944 * distributed under the License is distributed on an "AS IS" BASIS,
13945 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13946 * See the License for the specific language governing permissions and
13947 * limitations under the License.
13948 * =============================================================================
13949 */const fde=jr+`
13950  return (x < 0.0) ? 0.0 : x;
13951`,pde=`
13952  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
13953  bvec4 isNaN = isnan(x);
13954
13955  result.r = isNaN.r ? x.r : result.r;
13956  result.g = isNaN.g ? x.g : result.g;
13957  result.b = isNaN.b ? x.b : result.b;
13958  result.a = isNaN.a ? x.a : result.a;
13959
13960  return result;
13961`,mde=Pe({opSnippet:fde,packedOpSnippet:pde}),gde={kernelName:OA,backendName:"webgl",kernelFunc:mde};/**
13962 * @license
13963 * Copyright 2020 Google LLC. All Rights Reserved.
13964 * Licensed under the Apache License, Version 2.0 (the "License");
13965 * you may not use this file except in compliance with the License.
13966 * You may obtain a copy of the License at
13967 *
13968 * http://www.apache.org/licenses/LICENSE-2.0
13969 *
13970 * Unless required by applicable law or agreed to in writing, software
13971 * distributed under the License is distributed on an "AS IS" BASIS,
13972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13973 * See the License for the specific language governing permissions and
13974 * limitations under the License.
13975 * =============================================================================
13976 */const yde=jr+`
13977  return (x < 0.0) ? 0.0 : min(6.0, x);
13978`,vde=`
13979  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
13980  bvec4 isNaN = isnan(x);
13981
13982  result.r = isNaN.r ? x.r : result.r;
13983  result.g = isNaN.g ? x.g : result.g;
13984  result.b = isNaN.b ? x.b : result.b;
13985  result.a = isNaN.a ? x.a : result.a;
13986
13987  return result;
13988`,xde=Pe({opSnippet:yde,packedOpSnippet:vde}),wde={kernelName:LA,backendName:"webgl",kernelFunc:xde};/**
13989 * @license
13990 * Copyright 2017 Google LLC. All Rights Reserved.
13991 * Licensed under the Apache License, Version 2.0 (the "License");
13992 * you may not use this file except in compliance with the License.
13993 * You may obtain a copy of the License at
13994 *
13995 * http://www.apache.org/licenses/LICENSE-2.0
13996 *
13997 * Unless required by applicable law or agreed to in writing, software
13998 * distributed under the License is distributed on an "AS IS" BASIS,
13999 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14000 * See the License for the specific language governing permissions and
14001 * limitations under the License.
14002 * =============================================================================
14003 */class bde{constructor(e,n,r,s,i){this.variableNames=["A"],this.outputShape=[];const[o,a,u,l]=e;this.outputShape=[o,n,r,l];const c=[s&&n>1?a-1:a,s&&r>1?u-1:u],h=[s&&n>1?n-1:n,s&&r>1?r-1:r];let d;i?d="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":d="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
14004      const vec2 effectiveInputOverOutputRatioRC = vec2(
14005          ${c[0]/h[0]},
14006          ${c[1]/h[1]});
14007      const vec2 inputShapeRC = vec2(${a}.0, ${u}.0);
14008
14009      void main() {
14010        ivec4 coords = getOutputCoords();
14011        int b = coords[0];
14012        int d = coords[3];
14013        ivec2 yRC = coords.yz;
14014
14015        // Fractional source index.
14016        vec2 sourceFracIndexRC = ${d};
14017
14018        // Compute the four integer indices.
14019        ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));
14020        ivec2 sourceCeilRC = ivec2(
14021          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
14022
14023        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);
14024        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);
14025        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);
14026        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);
14027
14028        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);
14029
14030        float top = topLeft + (topRight - topLeft) * fracRC.y;
14031        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;
14032        float newValue = top + (bottom - top) * fracRC.x;
14033
14034        setOutput(newValue);
14035      }
14036    `}}/**
14037 * @license
14038 * Copyright 2019 Google LLC. All Rights Reserved.
14039 * Licensed under the Apache License, Version 2.0 (the "License");
14040 * you may not use this file except in compliance with the License.
14041 * You may obtain a copy of the License at
14042 *
14043 * http://www.apache.org/licenses/LICENSE-2.0
14044 *
14045 * Unless required by applicable law or agreed to in writing, software
14046 * distributed under the License is distributed on an "AS IS" BASIS,
14047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14048 * See the License for the specific language governing permissions and
14049 * limitations under the License.
14050 * =============================================================================
14051 */class _de{constructor(e,n,r,s,i){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[o,a,u,l]=e;this.outputShape=[o,n,r,l];const c=[s&&n>1?a-1:a,s&&r>1?u-1:u],h=[s&&n>1?n-1:n,s&&r>1?r-1:r];let d;i?d="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":d="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
14052      const vec3 effectiveInputOverOutputRatioRC = vec3(
14053          ${c[0]/h[0]},
14054          ${c[1]/h[1]},
14055          ${c[1]/h[1]});
14056      const vec3 inputShapeRC = vec3(${a}.0, ${u}.0,
14057                                     ${u}.0);
14058
14059      float getAValue(int b, int r, int c, int d) {
14060        return getChannel(getA(b, r, c, d), vec2(c, d));
14061      }
14062
14063      void main() {
14064        ivec4 coords = getOutputCoords();
14065        int b = coords[0];
14066        int d = coords[3];
14067        // Calculate values for next column in yRC.z.
14068        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
14069
14070        // Fractional source index.
14071        vec3 sourceFracIndexRC = ${d};
14072
14073        // Compute the four integer indices.
14074        ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));
14075        ivec3 sourceCeilRC = ivec3(
14076          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
14077
14078        // Should we calculate next column and row elements in 2x2 packed cell.
14079        bool hasNextCol = d < ${l-1};
14080        bool hasNextRow = coords.z < ${r-1};
14081
14082        // In parallel, construct four corners for all four components in
14083        // packed 2x2 cell.
14084        vec4 topLeft = vec4(
14085          getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),
14086          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)
14087                     : 0.0,
14088          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)
14089                     : 0.0,
14090          (hasNextRow && hasNextCol) ?
14091            getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);
14092
14093        vec4 bottomLeft = vec4(
14094          getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),
14095          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)
14096                     : 0.0,
14097          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)
14098                     : 0.0,
14099          (hasNextRow && hasNextCol) ?
14100            getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);
14101
14102        vec4 topRight = vec4(
14103          getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),
14104          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)
14105                     : 0.0,
14106          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)
14107                     : 0.0,
14108          (hasNextRow && hasNextCol) ?
14109            getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);
14110
14111        vec4 bottomRight = vec4(
14112          getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),
14113          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)
14114                     : 0.0,
14115          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)
14116                     : 0.0,
14117          (hasNextRow && hasNextCol) ?
14118            getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);
14119
14120        vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);
14121
14122        vec4 top = mix(topLeft, topRight, fracRC.yyzz);
14123        vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);
14124        vec4 newValue = mix(top, bottom, fracRC.x);
14125
14126        setOutput(newValue);
14127      }
14128    `}}/**
14129 * @license
14130 * Copyright 2020 Google LLC. All Rights Reserved.
14131 * Licensed under the Apache License, Version 2.0 (the "License");
14132 * you may not use this file except in compliance with the License.
14133 * You may obtain a copy of the License at
14134 *
14135 * http://www.apache.org/licenses/LICENSE-2.0
14136 *
14137 * Unless required by applicable law or agreed to in writing, software
14138 * distributed under the License is distributed on an "AS IS" BASIS,
14139 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14140 * See the License for the specific language governing permissions and
14141 * limitations under the License.
14142 * =============================================================================
14143 */function Sde(t){const{inputs:e,backend:n,attrs:r}=t,{images:s}=e,{alignCorners:i,halfPixelCenters:o,size:a}=r,[u,l]=a,c=U().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new _de(s.shape,u,l,i,o):new bde(s.shape,u,l,i,o);return n.runWebGLProgram(c,[s],"float32")}const Tde={kernelName:FA,backendName:"webgl",kernelFunc:Sde};/**
14144 * @license
14145 * Copyright 2018 Google LLC. All Rights Reserved.
14146 * Licensed under the Apache License, Version 2.0 (the "License");
14147 * you may not use this file except in compliance with the License.
14148 * You may obtain a copy of the License at
14149 *
14150 * http://www.apache.org/licenses/LICENSE-2.0
14151 *
14152 * Unless required by applicable law or agreed to in writing, software
14153 * distributed under the License is distributed on an "AS IS" BASIS,
14154 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14155 * See the License for the specific language governing permissions and
14156 * limitations under the License.
14157 * =============================================================================
14158 */class Cde{constructor(e,n,r){this.variableNames=["dy"],this.outputShape=[],this.outputShape=n;const[,s,i]=n,[,o,a]=e,u=[r&&o>1?s-1:s,r&&a>1?i-1:i],l=[r&&o>1?o-1:o,r&&a>1?a-1:a],c=u[0]/l[0],h=u[1]/l[1],d=1/c,f=1/h,p=Math.ceil(d)*2+2,y=Math.ceil(f)*2+2;this.userCode=`
14159      void main() {
14160        ivec4 coords = getOutputCoords();
14161        int b = coords[0];
14162        int d = coords[3];
14163        int r = coords[1];
14164        int c = coords[2];
14165
14166        float accumulator = 0.0;
14167
14168        const float heightScale = float(${c});
14169        const float widthScale = float(${h});
14170
14171        const float invHeightScale = float(${d});
14172        const float invWidthScale = float(${f});
14173
14174        const int winHeight = int(${p});
14175        const int winWidth = int(${y});
14176
14177        // Compute bounds for where in dy we will look
14178        float startRLerp = floor(float(r) * invHeightScale);
14179        int startDyR = int(startRLerp - float(winHeight / 2));
14180
14181        float startCLerp = floor(float(c) * invWidthScale);
14182        int startDyC = int(startCLerp - float(winWidth / 2));
14183
14184        // Loop over dy
14185        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
14186          int dyR = dyROffset + startDyR;
14187
14188          // Guard against the window exceeding the bounds of dy
14189          if (dyR < 0 || dyR >= ${o}) {
14190            continue;
14191          }
14192
14193          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
14194            int dyC = dyCOffset + startDyC;
14195
14196            // Guard against the window exceeding the bounds of dy
14197            if (dyC < 0 || dyC >= ${a}) {
14198              continue;
14199            }
14200
14201            float dxR = float(dyR) * heightScale;
14202            int topDxRIndex = int(floor(dxR));
14203            int bottomDxRIndex = int(min(ceil(dxR), ${s-1}.0));
14204            float dxRLerp = dxR - float(topDxRIndex);
14205            float inverseDxRLerp = 1.0 - dxRLerp;
14206
14207            float dxC = float(dyC) * widthScale;
14208            int leftDxCIndex = int(floor(dxC));
14209            int rightDxCIndex = int(min(ceil(dxC), ${i-1}.0));
14210            float dxCLerp = dxC - float(leftDxCIndex);
14211            float inverseDxCLerp = 1.0 - dxCLerp;
14212
14213            if (r == topDxRIndex && c == leftDxCIndex) {
14214              // topLeft
14215              accumulator +=
14216                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;
14217            }
14218
14219            if (r == topDxRIndex && c == rightDxCIndex) {
14220              // topRight
14221              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;
14222            }
14223
14224            if (r == bottomDxRIndex && c == leftDxCIndex) {
14225              // bottomLeft
14226              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;
14227            }
14228
14229            if (r == bottomDxRIndex && c == rightDxCIndex) {
14230              // bottomRight
14231              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;
14232            }
14233          }
14234        }
14235        // End loop over dy
14236
14237        setOutput(accumulator);
14238      }
14239    `}}/**
14240 * @license
14241 * Copyright 2020 Google LLC. All Rights Reserved.
14242 * Licensed under the Apache License, Version 2.0 (the "License");
14243 * you may not use this file except in compliance with the License.
14244 * You may obtain a copy of the License at
14245 *
14246 * http://www.apache.org/licenses/LICENSE-2.0
14247 *
14248 * Unless required by applicable law or agreed to in writing, software
14249 * distributed under the License is distributed on an "AS IS" BASIS,
14250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14251 * See the License for the specific language governing permissions and
14252 * limitations under the License.
14253 * =============================================================================
14254 */function Nde(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:i}=e,{alignCorners:o}=r,a=new Cde(i.shape,s.shape,o);return n.runWebGLProgram(a,[i],i.dtype)}const Ede={kernelName:C5,backendName:"webgl",kernelFunc:Nde};/**
14255 * @license
14256 * Copyright 2018 Google LLC. All Rights Reserved.
14257 * Licensed under the Apache License, Version 2.0 (the "License");
14258 * you may not use this file except in compliance with the License.
14259 * You may obtain a copy of the License at
14260 *
14261 * http://www.apache.org/licenses/LICENSE-2.0
14262 *
14263 * Unless required by applicable law or agreed to in writing, software
14264 * distributed under the License is distributed on an "AS IS" BASIS,
14265 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14266 * See the License for the specific language governing permissions and
14267 * limitations under the License.
14268 * =============================================================================
14269 */class kde{constructor(e,n,r,s,i){this.variableNames=["A"],this.outputShape=[];const[o,a,u,l]=e;this.outputShape=[o,n,r,l];const c=[s&&n>1?a-1:a,s&&r>1?u-1:u],h=[s&&n>1?n-1:n,s&&r>1?r-1:r],d=s?"0.5":"0.0";let f;i?f="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":f="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
14270      const vec2 effectiveInputOverOutputRatioRC = vec2(
14271          ${c[0]/h[0]},
14272          ${c[1]/h[1]});
14273      const vec2 inputShapeRC = vec2(${a}.0, ${u}.0);
14274
14275      void main() {
14276        ivec4 coords = getOutputCoords();
14277        int b = coords[0];
14278        int d = coords[3];
14279        ivec2 yRC = coords.yz;
14280
14281        // Fractional source index.
14282        vec2 sourceFracIndexRC = ${f};
14283
14284        // Compute the coordinators of nearest neighbor point.
14285        ivec2 sourceNearestRC = ivec2(
14286          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));
14287        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);
14288
14289        setOutput(newValue);
14290      }
14291    `}}/**
14292 * @license
14293 * Copyright 2019 Google LLC. All Rights Reserved.
14294 * Licensed under the Apache License, Version 2.0 (the "License");
14295 * you may not use this file except in compliance with the License.
14296 * You may obtain a copy of the License at
14297 *
14298 * http://www.apache.org/licenses/LICENSE-2.0
14299 *
14300 * Unless required by applicable law or agreed to in writing, software
14301 * distributed under the License is distributed on an "AS IS" BASIS,
14302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14303 * See the License for the specific language governing permissions and
14304 * limitations under the License.
14305 * =============================================================================
14306 */class $de{constructor(e,n,r,s,i){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[o,a,u,l]=e;this.outputShape=[o,n,r,l];const c=[s&&n>1?a-1:a,s&&r>1?u-1:u],h=[s&&n>1?n-1:n,s&&r>1?r-1:r],d=s?"0.5":"0.0";let f;i?f="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":f="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
14307      const vec3 effectiveInputOverOutputRatioRC = vec3(
14308          ${c[0]/h[0]},
14309          ${c[1]/h[1]},
14310          ${c[1]/h[1]});
14311      const vec3 inputShapeRC = vec3(${a}.0, ${u}.0,
14312                                     ${u}.0);
14313
14314      float getAValue(int b, int r, int c, int d) {
14315        return getChannel(getA(b, r, c, d), vec2(c, d));
14316      }
14317
14318      void main() {
14319        ivec4 coords = getOutputCoords();
14320        int b = coords[0];
14321        int d = coords[3];
14322        // Calculate values for next column in yRC.z.
14323        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
14324
14325        // Fractional source index.
14326        vec3 sourceFracIndexRC = ${f};
14327
14328        // Compute the coordinators of nearest neighbor point.
14329        ivec3 sourceNearestRC = ivec3(
14330          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));
14331
14332        // Should we calculate next column and row elements in 2x2 packed cell.
14333        bool hasNextCol = d < ${l-1};
14334        bool hasNextRow = coords.z < ${r-1};
14335
14336        vec4 newValue = vec4(
14337          getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),
14338          hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)
14339                     : 0.0,
14340          hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)
14341                     : 0.0,
14342          (hasNextRow && hasNextCol) ?
14343            getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);
14344
14345        setOutput(newValue);
14346      }
14347    `}}/**
14348 * @license
14349 * Copyright 2020 Google LLC. All Rights Reserved.
14350 * Licensed under the Apache License, Version 2.0 (the "License");
14351 * you may not use this file except in compliance with the License.
14352 * You may obtain a copy of the License at
14353 *
14354 * http://www.apache.org/licenses/LICENSE-2.0
14355 *
14356 * Unless required by applicable law or agreed to in writing, software
14357 * distributed under the License is distributed on an "AS IS" BASIS,
14358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14359 * See the License for the specific language governing permissions and
14360 * limitations under the License.
14361 * =============================================================================
14362 */function Ide(t){const{inputs:e,backend:n,attrs:r}=t,{images:s}=e,{alignCorners:i,halfPixelCenters:o,size:a}=r,[u,l]=a,c=U().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new $de(s.shape,u,l,i,o):new kde(s.shape,u,l,i,o);return n.runWebGLProgram(c,[s],s.dtype)}const Ade={kernelName:PA,backendName:"webgl",kernelFunc:Ide};/**
14363 * @license
14364 * Copyright 2018 Google LLC. All Rights Reserved.
14365 * Licensed under the Apache License, Version 2.0 (the "License");
14366 * you may not use this file except in compliance with the License.
14367 * You may obtain a copy of the License at
14368 *
14369 * http://www.apache.org/licenses/LICENSE-2.0
14370 *
14371 * Unless required by applicable law or agreed to in writing, software
14372 * distributed under the License is distributed on an "AS IS" BASIS,
14373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14374 * See the License for the specific language governing permissions and
14375 * limitations under the License.
14376 * =============================================================================
14377 */class Rde{constructor(e,n,r){this.variableNames=["dy"],this.outputShape=[],this.outputShape=n;const[,s,i]=n,[,o,a]=e,u=[r&&o>1?s-1:s,r&&a>1?i-1:i],l=[r&&o>1?o-1:o,r&&a>1?a-1:a],c=u[0]/l[0],h=u[1]/l[1],d=1/c,f=1/h,p=Math.ceil(d)*2+2,y=Math.ceil(f)*2+2;this.userCode=`
14378      void main() {
14379        ivec4 coords = getOutputCoords();
14380        int b = coords[0];
14381        int d = coords[3];
14382        int r = coords[1];
14383        int c = coords[2];
14384
14385        float accumulator = 0.0;
14386
14387        const float heightScale = float(${c});
14388        const float widthScale = float(${h});
14389
14390        const float invHeightScale = float(${d});
14391        const float invWidthScale = float(${f});
14392
14393        const int winHeight = int(${p});
14394        const int winWidth = int(${y});
14395
14396        // Compute bounds for where in dy we will look
14397        float startRLerp = floor(float(r) * invHeightScale);
14398        int startDyR = int(floor(startRLerp - float(winHeight / 2)));
14399
14400        float startCLerp = floor(float(c) * invWidthScale);
14401        int startDyC = int(floor(startCLerp - float(winWidth / 2)));
14402
14403        // Loop over dy
14404        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
14405          int dyR = dyROffset + startDyR;
14406
14407          // Guard against the window exceeding the bounds of dy
14408          if (dyR < 0 || dyR >= ${o}) {
14409            continue;
14410          }
14411
14412          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
14413            int dyC = dyCOffset + startDyC;
14414
14415            // Guard against the window exceeding the bounds of dy
14416            if (dyC < 0 || dyC >= ${a}) {
14417              continue;
14418            }
14419
14420            float sourceFracRow =
14421              float(${u[0]}) *
14422                (float(dyR) / float(${l[0]}));
14423
14424            float sourceFracCol =
14425                float(${u[1]}) *
14426                  (float(dyC) / float(${l[1]}));
14427
14428            int sourceNearestRow = int(min(
14429                float(int(${s}) - 1),
14430                ${r} ? float(round(sourceFracRow)) :
14431                                  float(floor(sourceFracRow))));
14432
14433            int sourceNearestCol = int(min(
14434                float(int(${i}) - 1),
14435                ${r} ? float(round(sourceFracCol)) :
14436                                  float(floor(sourceFracCol))));
14437
14438            if (r == sourceNearestRow && c == sourceNearestCol) {
14439              accumulator += getDy(b, dyR, dyC, d);
14440            }
14441          }
14442        }
14443        // End loop over dy
14444
14445        setOutput(accumulator);
14446      }
14447    `}}/**
14448 * @license
14449 * Copyright 2020 Google LLC. All Rights Reserved.
14450 * Licensed under the Apache License, Version 2.0 (the "License");
14451 * you may not use this file except in compliance with the License.
14452 * You may obtain a copy of the License at
14453 *
14454 * http://www.apache.org/licenses/LICENSE-2.0
14455 *
14456 * Unless required by applicable law or agreed to in writing, software
14457 * distributed under the License is distributed on an "AS IS" BASIS,
14458 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14459 * See the License for the specific language governing permissions and
14460 * limitations under the License.
14461 * =============================================================================
14462 */function Ode(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:i}=e,{alignCorners:o}=r,a=new Rde(i.shape,s.shape,o);return n.runWebGLProgram(a,[i],i.dtype)}const Dde={kernelName:T5,backendName:"webgl",kernelFunc:Ode};/**
14463 * @license
14464 * Copyright 2017 Google LLC. All Rights Reserved.
14465 * Licensed under the Apache License, Version 2.0 (the "License");
14466 * you may not use this file except in compliance with the License.
14467 * You may obtain a copy of the License at
14468 *
14469 * http://www.apache.org/licenses/LICENSE-2.0
14470 *
14471 * Unless required by applicable law or agreed to in writing, software
14472 * distributed under the License is distributed on an "AS IS" BASIS,
14473 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14474 * See the License for the specific language governing permissions and
14475 * limitations under the License.
14476 * =============================================================================
14477 */class Pde{constructor(e,n){this.variableNames=["x"];const r=e.length;if(r>4)throw new Error(`WebGL backend: Reverse of rank-${r} tensor is not yet supported`);if(this.outputShape=e,r===1){this.userCode=`
14478        void main() {
14479          int coord = getOutputCoords();
14480          setOutput(getX(${e[0]} - coord - 1));
14481        }
14482      `;return}const s=a=>n.indexOf(a)!==-1&&e[a]!==1?`${e[a]} - coords[${a}] - 1`:`coords[${a}]`,i=e.map((a,u)=>s(u)).join(","),o=qe(r);this.userCode=`
14483      void main() {
14484        ${o} coords = getOutputCoords();
14485        setOutput(getX(${i}));
14486      }
14487    `}}/**
14488 * @license
14489 * Copyright 2019 Google LLC. All Rights Reserved.
14490 * Licensed under the Apache License, Version 2.0 (the "License");
14491 * you may not use this file except in compliance with the License.
14492 * You may obtain a copy of the License at
14493 *
14494 * http://www.apache.org/licenses/LICENSE-2.0
14495 *
14496 * Unless required by applicable law or agreed to in writing, software
14497 * distributed under the License is distributed on an "AS IS" BASIS,
14498 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14499 * See the License for the specific language governing permissions and
14500 * limitations under the License.
14501 * =============================================================================
14502 */class Fde{constructor(e,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const r=e.length;if(r>4)throw new Error(`WebGL backend: Reverse of rank-${r} tensor is not yet supported`);this.outputShape=e;const s=bn("rc",r),i=`${s[r-1]} + 1 < ${this.outputShape[r-1]}`,o=`${s[r-2]} + 1 < ${this.outputShape[r-2]}`,a=qe(r);r===1?this.userCode=`
14503        void main(){
14504          int rc = getOutputCoords();
14505          vec4 result = vec4(0.);
14506          result.r = getChannel(getX(${e[0]} - rc - 1),
14507            ${e[0]} - rc - 1);
14508          if(${i}){
14509              result.g = getChannel(getX(${e[0]} - (rc  + 1) - 1),
14510                ${e[0]} - (rc  + 1) - 1);
14511          }
14512          setOutput(result);
14513        }
14514      `:this.userCode=`
14515        void main() {
14516          ${a} rc = getOutputCoords();
14517          vec4 result = vec4(0.);
14518          result.r = ${u(s.slice())};
14519          if(${i}){
14520            result.g = ${l(s.slice())};
14521          }
14522          if(${o}) {
14523            result.b = ${c(s.slice())};
14524            if(${i}) {
14525              result.a = ${h(s.slice())};
14526            }
14527          }
14528          setOutput(result);
14529        }
14530    `;function u(p){return d(p)}function l(p){return p[r-1]="("+p[r-1]+" + 1)",d(p)}function c(p){return p[r-2]="("+p[r-2]+" + 1)",d(p)}function h(p){return p[r-1]="("+p[r-1]+" + 1)",p[r-2]="("+p[r-2]+" + 1)",d(p)}function d(p){const y=e.map((x,w)=>f(w,p)),v=y.join(","),g=y.slice(-2).join(",");return`getChannel(getX(${v}), vec2(${g}))`}function f(p,y){return n.indexOf(p)!==-1&&e[p]!==1?`${e[p]} - ${y[p]} - 1`:`${y[p]}`}}}/**
14531 * @license
14532 * Copyright 2020 Google LLC. All Rights Reserved.
14533 * Licensed under the Apache License, Version 2.0 (the "License");
14534 * you may not use this file except in compliance with the License.
14535 * You may obtain a copy of the License at
14536 *
14537 * http://www.apache.org/licenses/LICENSE-2.0
14538 *
14539 * Unless required by applicable law or agreed to in writing, software
14540 * distributed under the License is distributed on an "AS IS" BASIS,
14541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14542 * See the License for the specific language governing permissions and
14543 * limitations under the License.
14544 * =============================================================================
14545 */function Lde(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{dims:i}=r,o=s.shape.length,a=Gt(i,s.shape);if(o===0)return Jn({inputs:{x:s},backend:n});const u=U().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Fde(s.shape,a):new Pde(s.shape,a);return n.runWebGLProgram(u,[s],s.dtype)}const Mde={kernelName:MA,backendName:"webgl",kernelFunc:Lde};/**
14546 * @license
14547 * Copyright 2020 Google LLC. All Rights Reserved.
14548 * Licensed under the Apache License, Version 2.0 (the "License");
14549 * you may not use this file except in compliance with the License.
14550 * You may obtain a copy of the License at
14551 *
14552 * http://www.apache.org/licenses/LICENSE-2.0
14553 *
14554 * Unless required by applicable law or agreed to in writing, software
14555 * distributed under the License is distributed on an "AS IS" BASIS,
14556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14557 * See the License for the specific language governing permissions and
14558 * limitations under the License.
14559 * =============================================================================
14560 */class Vde{constructor(e,n){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const r=e[1],s=e[2];this.outputShape=e;let i="";typeof n=="number"?i=`float outputValue = ${n.toFixed(2)};`:i=`
14561        vec3 fill = vec3(${n.join(",")});
14562        float outputValue = fill[coords[3]];`,this.userCode=`
14563        void main() {
14564          ivec4 coords = getOutputCoords();
14565          int x = coords[2];
14566          int y = coords[1];
14567          float coordXFloat = (float(x) - params[0]) * params[3] -
14568            (float(y) - params[1]) * params[2];
14569          float coordYFloat = (float(x) - params[0]) * params[2] +
14570            (float(y) - params[1]) * params[3];
14571          int coordX = int(round(coordXFloat + params[0]));
14572          int coordY = int(round(coordYFloat + params[1]));
14573          ${i}
14574          if(coordX >= 0 && coordX < ${s} && coordY >= 0 && coordY < ${r}) {
14575            outputValue = getImage(coords[0], coordY, coordX, coords[3]);
14576          }
14577          setOutput(outputValue);
14578        }
14579    `}}/**
14580 * @license
14581 * Copyright 2020 Google LLC. All Rights Reserved.
14582 * Licensed under the Apache License, Version 2.0 (the "License");
14583 * you may not use this file except in compliance with the License.
14584 * You may obtain a copy of the License at
14585 *
14586 * http://www.apache.org/licenses/LICENSE-2.0
14587 *
14588 * Unless required by applicable law or agreed to in writing, software
14589 * distributed under the License is distributed on an "AS IS" BASIS,
14590 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14591 * See the License for the specific language governing permissions and
14592 * limitations under the License.
14593 * =============================================================================
14594 */const Bde={kernelName:TR,backendName:"webgl",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{image:r}=t,{radians:s,fillValue:i,center:o}=e,a=n,u=new Vde(r.shape,i),[l,c]=wD(o,r.shape[1],r.shape[2]),h=[[l,c,Math.sin(s),Math.cos(s)]];return a.runWebGLProgram(u,[r],r.dtype,h)}};/**
14595 * @license
14596 * Copyright 2020 Google LLC. All Rights Reserved.
14597 * Licensed under the Apache License, Version 2.0 (the "License");
14598 * you may not use this file except in compliance with the License.
14599 * You may obtain a copy of the License at
14600 *
14601 * http://www.apache.org/licenses/LICENSE-2.0
14602 *
14603 * Unless required by applicable law or agreed to in writing, software
14604 * distributed under the License is distributed on an "AS IS" BASIS,
14605 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14606 * See the License for the specific language governing permissions and
14607 * limitations under the License.
14608 * =============================================================================
14609 */const Wde=`
14610  // OpenGL ES does not support round function.
14611  // The algorithm is based on banker's rounding.
14612  float base = floor(x);
14613  if ((x - base) < 0.5) {
14614    return floor(x);
14615  } else if ((x - base) > 0.5) {
14616    return ceil(x);
14617  } else {
14618    if (mod(base, 2.0) == 0.0) {
14619      return base;
14620    } else {
14621      return base + 1.0;
14622    }
14623  }
14624`,Ude=Pe({opSnippet:Wde}),zde={kernelName:VA,backendName:"webgl",kernelFunc:Ude};/**
14625 * @license
14626 * Copyright 2020 Google LLC. All Rights Reserved.
14627 * Licensed under the Apache License, Version 2.0 (the "License");
14628 * you may not use this file except in compliance with the License.
14629 * You may obtain a copy of the License at
14630 *
14631 * http://www.apache.org/licenses/LICENSE-2.0
14632 *
14633 * Unless required by applicable law or agreed to in writing, software
14634 * distributed under the License is distributed on an "AS IS" BASIS,
14635 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14636 * See the License for the specific language governing permissions and
14637 * limitations under the License.
14638 * =============================================================================
14639 */const jde="return inversesqrt(x);",Gde=Pe({opSnippet:jde,cpuKernelImpl:sie}),Hde={kernelName:BA,backendName:"webgl",kernelFunc:Gde};/**
14640 * @license
14641 * Copyright 2018 Google LLC. All Rights Reserved.
14642 * Licensed under the Apache License, Version 2.0 (the "License");
14643 * you may not use this file except in compliance with the License.
14644 * You may obtain a copy of the License at
14645 *
14646 * http://www.apache.org/licenses/LICENSE-2.0
14647 *
14648 * Unless required by applicable law or agreed to in writing, software
14649 * distributed under the License is distributed on an "AS IS" BASIS,
14650 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14651 * See the License for the specific language governing permissions and
14652 * limitations under the License.
14653 * =============================================================================
14654 */class gw{constructor(e,n,r,s,i,o,a=!0,u=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;const l=qe(i.length),c=qe(o.length);let h="";r===1?h="i":r===2&&(h="i, j");const d=`getIndices(${h})`;let f="";s===1?f="i":s===2&&(f="i, coords[1]");const p=`getUpdates(${f})`;let y="";u&&(y="coords[0], coords[1]");const v=`getDefaultValue(${y})`,g=n>1?"strides[j]":"strides";this.userCode=`
14655        ${l} strides = ${l}(${i});
14656
14657        void main() {
14658          ${c} coords = getOutputCoords();
14659          float sum = 0.0;
14660          bool found = false;
14661          for (int i = 0; i < ${e}; i++) {
14662            int flattenedIndex = 0;
14663            for (int j = 0; j < ${n}; j++) {
14664              int index = round(${d});
14665              flattenedIndex += index * ${g};
14666            }
14667            if (flattenedIndex == coords[0]) {
14668              sum += ${p};
14669              found = true;
14670            }
14671          }
14672          setOutput(mix(${v}, sum, float(found)));
14673        }
14674      `}}/**
14675 * @license
14676 * Copyright 2023 Google LLC.
14677 * Licensed under the Apache License, Version 2.0 (the "License");
14678 * you may not use this file except in compliance with the License.
14679 * You may obtain a copy of the License at
14680 *
14681 * http://www.apache.org/licenses/LICENSE-2.0
14682 *
14683 * Unless required by applicable law or agreed to in writing, software
14684 * distributed under the License is distributed on an "AS IS" BASIS,
14685 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14686 * See the License for the specific language governing permissions and
14687 * limitations under the License.
14688 * =============================================================================
14689 */class qde{constructor(e,n,r,s,i,o,a=!0,u=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=o;const l=qe(i.length),c=qe(o.length);let h="";r===1?h="i":r===2&&(h="i, j");const d=`getIndices(${h})`;let f="";s===1?f="i":s===2&&(f="i, coords[1]");const p=`getUpdates(${f})`;let y="";u&&(y="coords[0], coords[1]");const v=`getDefaultValue(${y})`,g=n>1?"strides[j]":"strides",x=n>1?"strides[j + 1]":"strides";this.userCode=`
14690        ${l} strides = ${l}(${i});
14691
14692        void main() {
14693          ${c} coords = getOutputCoords();
14694          vec4 sum = vec4(0.);
14695          vec4 found = vec4(0.);
14696          for (int i = 0; i < ${e}; i+=2) {
14697            ivec2 flattenedIndex = ivec2(0);
14698            for (int j = 0; j < ${n}; j+=2) {
14699              ivec4 index = round(${d});
14700              flattenedIndex += index.xz * ${g};
14701              if (j + 1 < ${n}) {
14702                flattenedIndex += index.yw * ${x};
14703              }
14704            }
14705            if (flattenedIndex[0] == coords[0] || flattenedIndex[1] == coords[0] ||
14706                flattenedIndex[0] == coords[0] + 1 || flattenedIndex[1] == coords[0] + 1) {
14707              vec4 updVals = ${p};
14708              if (flattenedIndex[0] == coords[0]) {
14709                sum.xy += updVals.xy;
14710                found.xy = vec2(1.);
14711              } else if (flattenedIndex[0] == coords[0] + 1) {
14712                sum.zw += updVals.xy;
14713                found.zw = vec2(1.);
14714              }
14715              if (flattenedIndex[1] == coords[0]) {
14716                sum.xy += updVals.zw;
14717                found.xy = vec2(1.);
14718              } else if (flattenedIndex[1] == coords[0] + 1) {
14719                sum.zw += updVals.zw;
14720                found.zw = vec2(1.);
14721              }
14722            }
14723          }
14724          setOutput(mix(${v}, sum, found));
14725        }
14726      `}}/**
14727 * @license
14728 * Copyright 2020 Google LLC. All Rights Reserved.
14729 * Licensed under the Apache License, Version 2.0 (the "License");
14730 * you may not use this file except in compliance with the License.
14731 * You may obtain a copy of the License at
14732 *
14733 * http://www.apache.org/licenses/LICENSE-2.0
14734 *
14735 * Unless required by applicable law or agreed to in writing, software
14736 * distributed under the License is distributed on an "AS IS" BASIS,
14737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14738 * See the License for the specific language governing permissions and
14739 * limitations under the License.
14740 * =============================================================================
14741 */function Kde(t){const{inputs:e,backend:n,attrs:r}=t,{indices:s,updates:i}=e,{shape:o}=r,{sliceRank:a,numUpdates:u,sliceSize:l,strides:c,outputSize:h}=pm(i,s,o),d=[h/l,l];if(h===0)return n.makeTensorInfo(o,s.dtype);const f=se({inputs:{x:s},backend:n,attrs:{shape:[u,a]}}),p=se({inputs:{x:i},backend:n,attrs:{shape:[u,l]}}),y=n.makeTensorInfo([],"float32",new Float32Array([0]));let v;U().getBool("WEBGL_PACK")?v=new qde(u,a,f.shape.length,p.shape.length,c,d):v=new gw(u,a,f.shape.length,p.shape.length,c,d);const g=n.runWebGLProgram(v,[p,f,y],p.dtype),x=se({inputs:{x:g},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(y),x}const Xde={kernelName:WA,backendName:"webgl",kernelFunc:Kde};/**
14742 * @license
14743 * Copyright 2022 Google LLC. All Rights Reserved.
14744 * Licensed under the Apache License, Version 2.0 (the "License");
14745 * you may not use this file except in compliance with the License.
14746 * You may obtain a copy of the License at
14747 *
14748 * http://www.apache.org/licenses/LICENSE-2.0
14749 *
14750 * Unless required by applicable law or agreed to in writing, software
14751 * distributed under the License is distributed on an "AS IS" BASIS,
14752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14753 * See the License for the specific language governing permissions and
14754 * limitations under the License.
14755 * =============================================================================
14756 */class Yde{constructor(e,n,r,s){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,r];const i="while (left < right) {",o=`for (int i = 0; i < ${Math.ceil(Math.log2(n+1))}; ++i) { if (left >= right) break;`,a=U().getNumber("WEBGL_VERSION")===2?i:o,u=s==="left"?"<":"<=";this.userCode=`
14757       int findBound(int batch, float value) {
14758         int left = 0;
14759         int right = numInputs;
14760         int mid;
14761         ${a}
14762           mid = (left + right) / 2;
14763           if (getSortedSequence(batch, mid) ${u} value) {
14764             left = mid + 1;
14765           } else {
14766             right = mid;
14767           }
14768         }
14769         return right;
14770       }
14771
14772       void main() {
14773         ivec2 coords = getOutputCoords();
14774         int batch = coords[0];
14775         int valueIndex = coords[1];
14776
14777         float value = getValues(batch, valueIndex);
14778
14779         setOutput(float(findBound(batch, value)));
14780       }
14781     `}}/**
14782 * @license
14783 * Copyright 2022 Google LLC. All Rights Reserved.
14784 * Licensed under the Apache License, Version 2.0 (the "License");
14785 * you may not use this file except in compliance with the License.
14786 * You may obtain a copy of the License at
14787 *
14788 * http://www.apache.org/licenses/LICENSE-2.0
14789 *
14790 * Unless required by applicable law or agreed to in writing, software
14791 * distributed under the License is distributed on an "AS IS" BASIS,
14792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14793 * See the License for the specific language governing permissions and
14794 * limitations under the License.
14795 * =============================================================================
14796 */function Qde(t){const{inputs:e,backend:n,attrs:r}=t,{sortedSequence:s,values:i}=e,{side:o}=r,a=new Yde(s.shape[0],s.shape[1],i.shape[1],o),u=[[s.shape[1]]];return n.runWebGLProgram(a,[s,i],"int32",u)}const Zde={kernelName:zA,backendName:"webgl",kernelFunc:Qde};/**
14797 * @license
14798 * Copyright 2017 Google LLC. All Rights Reserved.
14799 * Licensed under the Apache License, Version 2.0 (the "License");
14800 * you may not use this file except in compliance with the License.
14801 * You may obtain a copy of the License at
14802 *
14803 * http://www.apache.org/licenses/LICENSE-2.0
14804 *
14805 * Unless required by applicable law or agreed to in writing, software
14806 * distributed under the License is distributed on an "AS IS" BASIS,
14807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14808 * See the License for the specific language governing permissions and
14809 * limitations under the License.
14810 * =============================================================================
14811 */class Jde{constructor(e,n,r){this.variableNames=["c","a","b"],this.outputShape=n;let s,i;if(r>4)throw Error(`Where for rank ${r} is not yet supported`);if(r===1)i="resRC",s="resRC";else{const a=["resRC.x","resRC.y","resRC.z","resRC.w"],u=[],l=[];for(let c=0;c<n.length;c++)l.push(`${a[c]}`),c<e&&u.push(`${a[c]}`);s=u.join(),i=l.join()}const o=qe(r);this.userCode=`
14812      void main() {
14813        ${o} resRC = getOutputCoords();
14814        float cVal = getC(${s});
14815        if (cVal >= 1.0) {
14816          setOutput(getA(${i}));
14817        } else {
14818          setOutput(getB(${i}));
14819        }
14820      }
14821    `}}/**
14822 * @license
14823 * Copyright 2020 Google LLC. All Rights Reserved.
14824 * Licensed under the Apache License, Version 2.0 (the "License");
14825 * you may not use this file except in compliance with the License.
14826 * You may obtain a copy of the License at
14827 *
14828 * http://www.apache.org/licenses/LICENSE-2.0
14829 *
14830 * Unless required by applicable law or agreed to in writing, softw
14830are
14831 * distributed under the License is distributed on an "AS IS" BASIS,
14832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14833 * See the License for the specific language governing permissions and
14834 * limitations under the License.
14835 * =============================================================================
14836 */function efe(t){const{inputs:e,backend:n}=t,{condition:r,t:s,e:i}=e,o=new Jde(r.shape.length,s.shape,s.shape.length);return n.runWebGLProgram(o,[r,s,i],zs(s.dtype,i.dtype))}const tfe={kernelName:jA,backendName:"webgl",kernelFunc:efe};/**
14837 * @license
14838 * Copyright 2020 Google LLC. All Rights Reserved.
14839 * Licensed under the Apache License, Version 2.0 (the "License");
14840 * you may not use this file except in compliance with the License.
14841 * You may obtain a copy of the License at
14842 *
14843 * http://www.apache.org/licenses/LICENSE-2.0
14844 *
14845 * Unless required by applicable law or agreed to in writing, software
14846 * distributed under the License is distributed on an "AS IS" BASIS,
14847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14848 * See the License for the specific language governing permissions and
14849 * limitations under the License.
14850 * =============================================================================
14851 */const nfe=`
14852  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
14853  // see: https://arxiv.org/abs/1706.02515
14854  float scaleAlpha = ${SD};
14855  float scale = ${TD};
14856  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
14857`,rfe=Pe({opSnippet:nfe}),sfe={kernelName:GA,backendName:"webgl",kernelFunc:rfe};/**
14858 * @license
14859 * Copyright 2020 Google LLC. All Rights Reserved.
14860 * Licensed under the Apache License, Version 2.0 (the "License");
14861 * you may not use this file except in compliance with the License.
14862 * You may obtain a copy of the License at
14863 *
14864 * http://www.apache.org/licenses/LICENSE-2.0
14865 *
14866 * Unless required by applicable law or agreed to in writing, software
14867 * distributed under the License is distributed on an "AS IS" BASIS,
14868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14869 * See the License for the specific language governing permissions and
14870 * limitations under the License.
14871 * =============================================================================
14872 */const ife=Tl+`
14873  return 1.0 / (1.0 + exp(-1.0 * x));
14874`,ofe=`
14875  vec4 result = 1.0 / (1.0 + exp(-1.0 * x));
14876  bvec4 isNaN = isnan(x);
14877
14878  result.r = isNaN.r ? x.r : result.r;
14879  result.g = isNaN.g ? x.g : result.g;
14880  result.b = isNaN.b ? x.b : result.b;
14881  result.a = isNaN.a ? x.a : result.a;
14882
14883  return result;
14884`,afe=Pe({opSnippet:ife,packedOpSnippet:ofe,cpuKernelImpl:oie}),ufe={kernelName:YA,backendName:"webgl",kernelFunc:afe};/**
14885 * @license
14886 * Copyright 2020 Google LLC. All Rights Reserved.
14887 * Licensed under the Apache License, Version 2.0 (the "License");
14888 * you may not use this file except in compliance with the License.
14889 * You may obtain a copy of the License at
14890 *
14891 * http://www.apache.org/licenses/LICENSE-2.0
14892 *
14893 * Unless required by applicable law or agreed to in writing, software
14894 * distributed under the License is distributed on an "AS IS" BASIS,
14895 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14896 * See the License for the specific language governing permissions and
14897 * limitations under the License.
14898 * =============================================================================
14899 */const lfe=`
14900  if (isnan(x)) { return 0.0; }
14901  return sign(x);
14902`,cfe=Pe({opSnippet:lfe}),hfe={kernelName:XA,backendName:"webgl",kernelFunc:cfe};/**
14903 * @license
14904 * Copyright 2020 Google LLC. All Rights Reserved.
14905 * Licensed under the Apache License, Version 2.0 (the "License");
14906 * you may not use this file except in compliance with the License.
14907 * You may obtain a copy of the License at
14908 *
14909 * http://www.apache.org/licenses/LICENSE-2.0
14910 *
14911 * Unless required by applicable law or agreed to in writing, software
14912 * distributed under the License is distributed on an "AS IS" BASIS,
14913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14914 * See the License for the specific language governing permissions and
14915 * limitations under the License.
14916 * =============================================================================
14917 */const dfe=Tl+`
14918  return sin(x);
14919`,ffe=`
14920  vec4 result = sin(x);
14921  bvec4 isNaN = isnan(x);
14922  ${Ba}
14923  return result;
14924`,pfe=Pe({opSnippet:dfe,packedOpSnippet:ffe}),mfe={kernelName:qA,backendName:"webgl",kernelFunc:pfe};/**
14925 * @license
14926 * Copyright 2020 Google LLC. All Rights Reserved.
14927 * Licensed under the Apache License, Version 2.0 (the "License");
14928 * you may not use this file except in compliance with the License.
14929 * You may obtain a copy of the License at
14930 *
14931 * http://www.apache.org/licenses/LICENSE-2.0
14932 *
14933 * Unless required by applicable law or agreed to in writing, software
14934 * distributed under the License is distributed on an "AS IS" BASIS,
14935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14936 * See the License for the specific language governing permissions and
14937 * limitations under the License.
14938 * =============================================================================
14939 */const gfe=`
14940  float e2x = exp(x);
14941  return (e2x - 1.0 / e2x) / 2.0;
14942`,yfe=Pe({opSnippet:gfe}),vfe={kernelName:KA,backendName:"webgl",kernelFunc:yfe};/**
14943 * @license
14944 * Copyright 2020 Google LLC. All Rights Reserved.
14945 * Licensed under the Apache License, Version 2.0 (the "License");
14946 * you may not use this file except in compliance with the License.
14947 * You may obtain a copy of the License at
14948 *
14949 * http://www.apache.org/licenses/LICENSE-2.0
14950 *
14951 * Unless required by applicable law or agreed to in writing, software
14952 * distributed under the License is distributed on an "AS IS" BASIS,
14953 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14954 * See the License for the specific language governing permissions and
14955 * limitations under the License.
14956 * =============================================================================
14957 */const xfe=`
14958  float epsilon = 1.1920928955078125e-7;
14959  float threshold = log(epsilon) + 2.0;
14960
14961  bool too_large = x > -threshold;
14962  bool too_small = x < threshold;
14963
14964  float result;
14965  float exp_x = exp(x);
14966
14967  if (too_large){
14968    result = x;
14969  }
14970  else if (too_small){
14971    result = exp_x;
14972  }
14973  else{
14974    result = log(exp_x + 1.0);
14975  }
14976  return result;
14977`,wfe=Pe({opSnippet:xfe}),bfe={kernelName:QA,backendName:"webgl",kernelFunc:wfe};/**
14978 * @license
14979 * Copyright 2020 Google LLC. All Rights Reserved.
14980 * Licensed under the Apache License, Version 2.0 (the "License");
14981 * you may not use this file except in compliance with the License.
14982 * You may obtain a copy of the License at
14983 *
14984 * http://www.apache.org/licenses/LICENSE-2.0
14985 *
14986 * Unless required by applicable law or agreed to in writing, software
14987 * distributed under the License is distributed on an "AS IS" BASIS,
14988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14989 * See the License for the specific language governing permissions and
14990 * limitations under the License.
14991 * =============================================================================
14992 */const _fe=t=>{const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockShape:i,paddings:o}=r;A(s.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");const a=i.reduce((g,x)=>g*x),u=[[0,0]];u.push(...o);for(let g=1+i.length;g<s.shape.length;++g)u.push([0,0]);const l=[],c=qP({inputs:{x:s},backend:n,attrs:{paddings:u,constantValue:0}}),h=sw(c.shape,i,a,!1),d=iw(h.length,i.length,!1),f=ow(c.shape,i,a,!1),p=se({inputs:{x:c},backend:n,attrs:{shape:h}}),y=Tn({inputs:{x:p},backend:n,attrs:{perm:d}}),v=se({inputs:{x:y},backend:n,attrs:{shape:f}});return l.push(c),l.push(p),l.push(y),l.forEach(g=>n.disposeIntermediateTensorInfo(g)),v},Sfe={kernelName:eR,backendName:"webgl",kernelFunc:_fe};/**
14993 * @license
14994 * Copyright 2021 Google LLC. All Rights Reserved.
14995 * Licensed under the Apache License, Version 2.0 (the "License");
14996 * you may not use this file except in compliance with the License.
14997 * You may obtain a copy of the License at
14998 *
14999 * http://www.apache.org/licenses/LICENSE-2.0
15000 *
15001 * Unless required by applicable law or agreed to in writing, software
15002 * distributed under the License is distributed on an "AS IS" BASIS,
15003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15004 * See the License for the specific language governing permissions and
15005 * limitations under the License.
15006 * =============================================================================
15007 */function Tfe(t){const{inputs:e,backend:n}=t,{indices:r,values:s,denseShape:i,defaultValue:o}=e;if(i.shape.length!==1)throw new Error(`Dense shape must be a vector, saw:
15008         ${i.shape}`);if(r.shape.length!==2)throw new Error(`Indices must be a matrix, saw:
15009         ${r.shape}`);if(s.shape.length!==1)throw new Error(`Values must be a vector, saw:
15010         ${s.shape}`);if(o.shape.length!==0)throw new Error(`Default value must be a scalar, saw:
15011        ${o.shape}`);const a=n.readSync(r.dataId),u=n.readSync(s.dataId),l=n.readSync(i.dataId),c=n.readSync(o.dataId)[0],[h,d,f,p,y]=uie(a,r.shape,r.dtype,u,s.dtype,l,c);return[n.makeTensorInfo(d,r.dtype,h),n.makeTensorInfo([d[0]],s.dtype,f),n.makeTensorInfo([p.length],"bool",new Uint8Array(p.map(v=>Number(v)))),n.makeTensorInfo([y.length],r.dtype,new Int32Array(y))]}const Cfe={kernelName:rR,backendName:"webgl",kernelFunc:Tfe};/**
15012 * @license
15013 * Copyright 2021 Google LLC. All Rights Reserved.
15014 * Licensed under the Apache License, Version 2.0 (the "License");
15015 * you may not use this file except in compliance with the License.
15016 * You may obtain a copy of the License at
15017 *
15018 * http://www.apache.org/licenses/LICENSE-2.0
15019 *
15020 * Unless required by applicable law or agreed to in writing, software
15021 * distributed under the License is distributed on an "AS IS" BASIS,
15022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15023 * See the License for the specific language governing permissions and
15024 * limitations under the License.
15025 * =============================================================================
15026 */function Nfe(t){const{inputs:e,backend:n}=t,{inputIndices:r,inputShape:s,newShape:i}=e;if(r.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${s.shape}`);if(i.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${i.shape}`);const o=Array.from(n.readSync(s.dataId)),a=n.readSync(r.dataId),u=Array.from(n.readSync(i.dataId)),[l,c,h]=lie(a,r.shape,r.dtype,o,u);return[n.makeTensorInfo(c,r.dtype,l),n.makeTensorInfo([h.length],i.dtype,new Int32Array(h))]}const Efe={kernelName:sR,backendName:"webgl",kernelFunc:Nfe};/**
15027 * @license
15028 * Copyright 2021 Google LLC. All Rights Reserved.
15029 * Licensed under the Apache License, Version 2.0 (the "License");
15030 * you may not use this file except in compliance with the License.
15031 * You may obtain a copy of the License at
15032 *
15033 * http://www.apache.org/licenses/LICENSE-2.0
15034 *
15035 * Unless required by applicable law or agreed to in writing, software
15036 * distributed under the License is distributed on an "AS IS" BASIS,
15037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15038 * See the License for the specific language governing permissions and
15039 * limitations under the License.
15040 * =============================================================================
15041 */function kfe(t){const{inputs:e,backend:n}=t,{data:r,indices:s,segmentIds:i}=e;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape
15042              ${s.shape}`);if(i.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
15043              ${i.shape}`);const o=n.readSync(r.dataId),a=n.readSync(s.dataId),u=n.readSync(i.dataId),[l,c]=vP(o,r.shape,r.dtype,a,u,!0);return n.makeTensorInfo(c,r.dtype,l)}const $fe={kernelName:iR,backendName:"webgl",kernelFunc:kfe};/**
15044 * @license
15045 * Copyright 2021 Google LLC. All Rights Reserved.
15046 * Licensed under the Apache License, Version 2.0 (the "License");
15047 * you may not use this file except in compliance with the License.
15048 * You may obtain a copy of the License at
15049 *
15050 * http://www.apache.org/licenses/LICENSE-2.0
15051 *
15052 * Unless required by applicable law or agreed to in writing, software
15053 * distributed under the License is distributed on an "AS IS" BASIS,
15054 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15055 * See the License for the specific language governing permissions and
15056 * limitations under the License.
15057 * =============================================================================
15058 */function Ife(t){const{inputs:e,backend:n}=t,{data:r,indices:s,segmentIds:i}=e;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error(`Indices should be a vector but received shape
15059             ${s.shape}`);if(i.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
15060             ${i.shape}`);const o=n.readSync(r.dataId),a=n.readSync(s.dataId),u=n.readSync(i.dataId),[l,c]=vP(o,r.shape,r.dtype,a,u);return n.makeTensorInfo(c,r.dtype,l)}const Afe={kernelName:oR,backendName:"webgl",kernelFunc:Ife};/**
15061 * @license
15062 * Copyright 2020 Google LLC. All Rights Reserved.
15063 * Licensed under the Apache License, Version 2.0 (the "License");
15064 * you may not use this file except in compliance with the License.
15065 * You may obtain a copy of the License at
15066 *
15067 * http://www.apache.org/licenses/LICENSE-2.0
15068 *
15069 * Unless required by applicable law or agreed to in writing, softw
15069are
15070 * distributed under the License is distributed on an "AS IS" BASIS,
15071 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15072 * See the License for the specific language governing permissions and
15073 * limitations under the License.
15074 * =============================================================================
15075 */function Rfe(t){const{inputs:e,backend:n,attrs:r}=t,{sparseIndices:s,sparseValues:i,defaultValue:o}=e,{outputShape:a}=r,{sliceRank:u,numUpdates:l,sliceSize:c,strides:h,outputSize:d}=pm(i,s,a),f=!1;if(i.dtype==="string"){const g=n.bufferSync(s),x=n.bufferSync(i),w=Qu(n.readSync(o.dataId)[0]),_=iie(g,x,a,d,c,l,u,h,w,f);return n.makeTensorInfo(a,_.dtype,_.values)}const p=new gw(l,u,s.shape.length,i.shape.length,h,[d,1],f),y=n.runWebGLProgram(p,[i,s,o],i.dtype),v=se({inputs:{x:y},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(y),v}const Ofe={kernelName:aR,backendName:"webgl",kernelFunc:Rfe};/**
15076 * @license
15077 * Copyright 2020 Google LLC. All Rights Reserved.
15078 * Licensed under the Apache License, Version 2.0 (the "License");
15079 * you may not use this file except in compliance with the License.
15080 * You may obtain a copy of the License at
15081 *
15082 * http://www.apache.org/licenses/LICENSE-2.0
15083 *
15084 * Unless required by applicable law or agreed to in writing, software
15085 * distributed under the License is distributed on an "AS IS" BASIS,
15086 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15087 * See the License for the specific language governing permissions and
15088 * limitations under the License.
15089 * =============================================================================
15090 */function Dfe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{numOrSizeSplits:i,axis:o}=r,a=Gt(o,s.shape)[0],u=FD(s,i,a),l=s.shape.length,c=new Array(l).fill(0),h=s.shape.slice();return u.map(d=>{const f=[...h];f[a]=d;const p=Cl({inputs:{x:s},backend:n,attrs:{begin:c,size:f}});return c[a]+=d,p})}const Pfe={kernelName:tR,backendName:"webgl",kernelFunc:Dfe};/**
15091 * @license
15092 * Copyright 2020 Google LLC. All Rights Reserved.
15093 * Licensed under the Apache License, Version 2.0 (the "License");
15094 * you may not use this file except in compliance with the License.
15095 * You may obtain a copy of the License at
15096 *
15097 * http://www.apache.org/licenses/LICENSE-2.0
15098 *
15099 * Unless required by applicable law or agreed to in writing, software
15100 * distributed under the License is distributed on an "AS IS" BASIS,
15101 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15102 * See the License for the specific language governing permissions and
15103 * limitations under the License.
15104 * =============================================================================
15105 */const vC="return sqrt(x);",Ffe=Pe({opSnippet:vC,packedOpSnippet:vC,cpuKernelImpl:cie}),Lfe={kernelName:ZA,backendName:"webgl",kernelFunc:Ffe};/**
15106 * @license
15107 * Copyright 2019 Google LLC. All Rights Reserved.
15108 * Licensed under the Apache License, Version 2.0 (the "License");
15109 * you may not use this file except in compliance with the License.
15110 * You may obtain a copy of the License at
15111 *
15112 * http://www.apache.org/licenses/LICENSE-2.0
15113 *
15114 * Unless required by applicable law or agreed to in writing, software
15115 * distributed under the License is distributed on an "AS IS" BASIS,
15116 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15117 * See the License for the specific language governing permissions and
15118 * limitations under the License.
15119 * =============================================================================
15120 */const Mfe="return x * x;",Vfe=Pe({opSnippet:Mfe}),Bfe={kernelName:N5,backendName:"webgl",kernelFunc:Vfe};/**
15121 * @license
15122 * Copyright 2020 Google LLC. All Rights Reserved.
15123 * Licensed under the Apache License, Version 2.0 (the "License");
15124 * you may not use this file except in compliance with the License.
15125 * You may obtain a copy of the License at
15126 *
15127 * http://www.apache.org/licenses/LICENSE-2.0
15128 *
15129 * Unless required by applicable law or agreed to in writing, software
15130 * distributed under the License is distributed on an "AS IS" BASIS,
15131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15132 * See the License for the specific language governing permissions and
15133 * limitations under the License.
15134 * =============================================================================
15135 */const xC="return (a - b) * (a - b);",Wfe=tn({opSnippet:xC,packedOpSnippet:xC}),Ufe={kernelName:uR,backendName:"webgl",kernelFunc:Wfe};/**
15136 * @license
15137 * Copyright 2023 Google LLC.
15138 * Licensed under the Apache License, Version 2.0 (the "License");
15139 * you may not use this file except in compliance with the License.
15140 * You may obtain a copy of the License at
15141 *
15142 * http://www.apache.org/licenses/LICENSE-2.0
15143 *
15144 * Unless required by applicable law or agreed to in writing, software
15145 * distributed under the License is distributed on an "AS IS" BASIS,
15146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15147 * See the License for the specific language governing permissions and
15148 * limitations under the License.
15149 * =============================================================================
15150 */function zfe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e;if(s.dtype!=="string")throw new Error("Input must be of datatype string");const i=n.readSync(s.dataId),o=el(i),a=hie(o,"string",r);return n.makeTensorInfo(s.shape,"string",a)}const jfe={kernelName:lR,backendName:"webgl",kernelFunc:zfe};/**
15151 * @license
15152 * Copyright 2020 Google LLC. All Rights Reserved.
15153 * Licensed under the Apache License, Version 2.0 (the "License");
15154 * you may not use this file except in compliance with the License.
15155 * You may obtain a copy of the License at
15156 *
15157 * http://www.apache.org/licenses/LICENSE-2.0
15158 *
15159 * Unless required by applicable law or agreed to in writing, software
15160 * distributed under the License is distributed on an "AS IS" BASIS,
15161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15162 * See the License for the specific language governing permissions and
15163 * limitations under the License.
15164 * =============================================================================
15165 */function Gfe({inputs:t,attrs:e,backend:n}){const{x:r}=t,s=jr+`
15166    return x > 0.0 ? 1.0 : float(${e.alpha});
15167  `,i=new As(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}const Hfe={kernelName:SR,backendName:"webgl",kernelFunc:Gfe};/**
15168 * @license
15169 * Copyright 2017 Google LLC. All Rights Reserved.
15170 * Licensed under the Apache License, Version 2.0 (the "License");
15171 * you may not use this file except in compliance with the License.
15172 * You may obtain a copy of the License at
15173 *
15174 * http://www.apache.org/licenses/LICENSE-2.0
15175 *
15176 * Unless required by applicable law or agreed to in writing, software
15177 * distributed under the License is distributed on an "AS IS" BASIS,
15178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15179 * See the License for the specific language governing permissions and
15180 * limitations under the License.
15181 * =============================================================================
15182 */class qfe{constructor(e,n,r){this.variableNames=["x"],this.outputShape=r;const s=r.length,i=qe(r.length),o=qe(r.length);let a="";if(s===1)a="coords * strides + begin";else{let u=0;a=r.map((l,c)=>(u++,r.length===1?`coords * strides[${c}] + begin[${c}]`:`coords[${u-1}] * strides[${c}] + begin[${c}]`)).join(",")}this.userCode=`
15183      ${i} begin = ${i}(${e});
15184      ${i} strides = ${i}(${n});
15185
15186      void main() {
15187        ${o} coords = getOutputCoords();
15188        setOutput(getX(${a}));
15189      }
15190    `}}/**
15191 * @license
15192 * Copyright 2020 Google LLC. All Rights Reserved.
15193 * Licensed under the Apache License, Version 2.0 (the "License");
15194 * you may not use this file except in compliance with the License.
15195 * You may obtain a copy of the License at
15196 *
15197 * http://www.apache.org/licenses/LICENSE-2.0
15198 *
15199 * Unless required by applicable law or agreed to in writing, software
15200 * distributed under the License is distributed on an "AS IS" BASIS,
15201 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15202 * See the License for the specific language governing permissions and
15203 * limitations under the License.
15204 * =============================================================================
15205 */function Kfe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{begin:i,end:o,strides:a,beginMask:u,endMask:l,ellipsisMask:c,newAxisMask:h,shrinkAxisMask:d}=r,{finalShapeSparse:f,finalShape:p,isIdentity:y,sliceDim0:v,isSimpleSlice:g,begin:x,end:w,strides:_}=pD(s.shape,i,o,a,u,l,c,h,d);let T;if(y)T=se({inputs:{x:s},backend:n,attrs:{shape:p}});else if(v||g){A(s.shape.length>=1,()=>`Input must have rank at least 1, got: ${s.shape.length}`);const k=sD(x,w,_),N=Cl({inputs:{x:s},backend:n,attrs:{begin:x,size:k}});T=se({inputs:{x:N},backend:n,attrs:{shape:p}}),n.disposeIntermediateTensorInfo(N)}else if(n.shouldExecuteOnCPU([s])){const N=n.readSync(s.dataId),O=wt(s.shape,s.dtype,N),R=die(f,O,_,x);T=n.makeTensorInfo(p,s.dtype,R.values)}else{const N=new qfe(x,_,f);T=n.runWebGLProgram(N,[s],s.dtype)}const E=se({inputs:{x:T},backend:n,attrs:{shape:p}});return n.disposeIntermediateTensorInfo(T),E}const Xfe={kernelName:cR,backendName:"webgl",kernelFunc:Kfe};/**
15206 * @license
15207 * Copyright 2021 Google LLC. All Rights Reserved.
15208 * Licensed under the Apache License, Version 2.0 (the "License");
15209 * you may not use this file except in compliance with the License.
15210 * You may obtain a copy of the License at
15211 *
15212 * http://www.apache.org/licenses/LICENSE-2.0
15213 *
15214 * Unless required by applicable law or agreed to in writing, software
15215 * distributed under the License is distributed on an "AS IS" BASIS,
15216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15217 * See the License for the specific language governing permissions and
15218 * limitations under the License.
15219 * =============================================================================
15220 */function Yfe(t){const{inputs:e,backend:n,attrs:r}=t,{separator:s,nGramWidths:i,leftPad:o,rightPad:a,padWidth:u,preserveShortSequences:l}=r,{data:c,dataSplits:h}=e,d=n.readSync(c.dataId),f=n.readSync(h.dataId),[p,y]=fie(d,f,s,i,o,a,u,l);return[n.makeTensorInfo([p.length],"string",p),n.makeTensorInfo(h.shape,"int32",y)]}const Qfe={kernelName:hR,backendName:"webgl",kernelFunc:Yfe};/**
15221 * @license
15222 * Copyright 2021 Google LLC. All Rights Reserved.
15223 * Licensed under the Apache License, Version 2.0 (the "License");
15224 * you may not use this file except in compliance with the License.
15225 * You may obtain a copy of the License at
15226 *
15227 * http://www.apache.org/licenses/LICENSE-2.0
15228 *
15229 * Unless required by applicable law or agreed to in writing, software
15230 * distributed under the License is distributed on an "AS IS" BASIS,
15231 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15232 * See the License for the specific language governing permissions and
15233 * limitations under the License.
15234 * =============================================================================
15235 */function Zfe(t){const{inputs:e,backend:n,attrs:r}=t,{skipEmpty:s}=r,{input:i,delimiter:o}=e;if(i.dtype!=="string")throw new Error("Input must be of datatype string");if(i.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${i.shape}`);if(o.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);const a=n.readSync(i.dataId),u=n.readSync(o.dataId)[0],[l,c,h]=pie(a,u,s),d=c.length;return[n.makeTensorInfo([d,2],"int32",l),n.makeTensorInfo([d],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(h))]}const Jfe={kernelName:dR,backendName:"webgl",kernelFunc:Zfe};/**
15236 * @license
15237 * Copyright 2021 Google LLC. All Rights Reserved.
15238 * Licensed under the Apache License, Version 2.0 (the "License");
15239 * you may not use this file except in compliance with the License.
15240 * You may obtain a copy of the License at
15241 *
15242 * http://www.apache.org/licenses/LICENSE-2.0
15243 *
15244 * Unless required by applicable law or agreed to in writing, software
15245 * distributed under the License is distributed on an "AS IS" BASIS,
15246 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15247 * See the License for the specific language governing permissions and
15248 * limitations under the License.
15249 * =============================================================================
15250 */function epe(t){const{inputs:e,backend:n,attrs:r}=t,{numBuckets:s}=r,{input:i}=e;if(i.dtype!=="string")throw new Error("Input must be of datatype string");if(s<=0)throw new Error("Number of buckets must be at least 1");const o=n.readSync(i.dataId),a=mie(o,s);return n.makeTensorInfo(i.shape,"int32",a)}const tpe={kernelName:fR,backendName:"webgl",kernelFunc:epe};/**
15251 * @license
15252 * Copyright 2020 Google LLC. All Rights Reserved.
15253 * Licensed under the Apache License, Version 2.0 (the "License");
15254 * you may not use this file except in compliance with the License.
15255 * You may obtain a copy of the License at
15256 *
15257 * http://www.apache.org/licenses/LICENSE-2.0
15258 *
15259 * Unless required by applicable law or agreed to in writing, software
15260 * distributed under the License is distributed on an "AS IS" BASIS,
15261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15262 * See the License for the specific language governing permissions and
15263 * limitations under the License.
15264 * =============================================================================
15265 */const npe="return tan(x);",rpe=Pe({opSnippet:npe}),spe={kernelName:mR,backendName:"webgl",kernelFunc:rpe};/**
15266 * @license
15267 * Copyright 2020 Google LLC. All Rights Reserved.
15268 * Licensed under the Apache License, Version 2.0 (the "License");
15269 * you may not use this file except in compliance with the License.
15270 * You may obtain a copy of the License at
15271 *
15272 * http://www.apache.org/licenses/LICENSE-2.0
15273 *
15274 * Unless required by applicable law or agreed to in writing, software
15275 * distributed under the License is distributed on an "AS IS" BASIS,
15276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15277 * See the License for the specific language governing permissions and
15278 * limitations under the License.
15279 * =============================================================================
15280 */const ipe=`
15281  float e2x = exp(-2.0 * abs(x));
15282  return sign(x) * (1.0 - e2x) / (1.0 + e2x);
15283`,ope=Pe({opSnippet:ipe}),ape={kernelName:gR,backendName:"webgl",kernelFunc:ope};/**
15284 * @license
15285 * Copyright 2022 Google LLC. All Rights Reserved.
15286 * Licensed under the Apache License, Version 2.0 (the "License");
15287 * you may not use this file except in compliance with the License.
15288 * You may obtain a copy of the License at
15289 *
15290 * http://www.apache.org/licenses/LICENSE-2.0
15291 *
15292 * Unless required by applicable law or agreed to in writing, software
15293 * distributed under the License is distributed on an "AS IS" BASIS,
15294 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15295 * See the License for the specific language governing permissions and
15296 * limitations under the License.
15297 * =============================================================================
15298 */function upe(t){const{inputs:e,backend:n,attrs:r}=t,{tensor:s,indices:i,updates:o}=e,{sliceRank:a,numUpdates:u,sliceSize:l,strides:c,outputSize:h}=pm(o,i,s.shape),d=[h/l,l];if(h===0)return n.makeTensorInfo(s.shape,i.dtype);const f=se({inputs:{x:i},backend:n,attrs:{shape:[u,a]}}),p=se({inputs:{x:o},backend:n,attrs:{shape:[u,l]}}),y=se({inputs:{x:s},backend:n,attrs:{shape:d}}),v=new gw(u,a,f.shape.length,p.shape.length,c,d,!1,!0),g=n.runWebGLProgram(v,[p,f,y],y.dtype),x=se({inputs:{x:g},backend:n,attrs:{shape:s.shape}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(g),x}const lpe={kernelName:UA,backendName:"webgl",kernelFunc:upe};/**
15299 * @license
15300 * Copyright 2017 Google LLC. All Rights Reserved.
15301 * Licensed under the Apache License, Version 2.0 (the "License");
15302 * you may not use this file except in compliance with the License.
15303 * You may obtain a copy of the License at
15304 *
15305 * http://www.apache.org/licenses/LICENSE-2.0
15306 *
15307 * Unless required by applicable law or agreed to in writing, software
15308 * distributed under the License is distributed on an "AS IS" BASIS,
15309 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15310 * See the License for the specific language governing permissions and
15311 * limitations under the License.
15312 * =============================================================================
15313 */class cpe{constructor(e,n){this.variableNames=["A"];const r=new Array(e.length);for(let o=0;o<r.length;o++)r[o]=e[o]*n[o];this.outputShape=r,this.rank=r.length;const s=qe(this.rank),i=hpe(e);this.userCode=`
15314      void main() {
15315        ${s} resRC = getOutputCoords();
15316        setOutput(getA(${i}));
15317      }
15318    `}}function hpe(t){const e=t.length;if(e>5)throw Error(`Tile for rank ${e} is not yet supported`);if(e===1)return`imod(resRC, ${t[0]})`;const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[];for(let s=0;s<t.length;s++)r.push(`imod(${n[s]}, ${t[s]})`);return r.join()}/**
15319 * @license
15320 * Copyright 2020 Google LLC. All Rights Reserved.
15321 * Licensed under the Apache License, Version 2.0 (the "License");
15322 * you may not use this file except in compliance with the License.
15323 * You may obtain a copy of the License at
15324 *
15325 * http://www.apache.org/licenses/LICENSE-2.0
15326 *
15327 * Unless required by applicable law or agreed to in writing, software
15328 * distributed under the License is distributed on an "AS IS" BASIS,
15329 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15330 * See the License for the specific language governing permissions and
15331 * limitations under the License.
15332 * =============================================================================
15333 */function XP(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{reps:i}=r;if(s.dtype==="string"||s.shape.length>5){const u=n.readSync(s.dataId),l=s.dtype==="string"?u.map(d=>Qu(d)):u,c=wt(s.shape,s.dtype,l),h=yie(c,i);return n.makeTensorInfo(h.shape,h.dtype,h.values)}const o=new cpe(s.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}const dpe={kernelName:k1,backendName:"webgl",kernelFunc:XP};class fpe{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode=`
15334       void main() {
15335         ivec2 coords = getOutputCoords();
15336         int batch = coords[0];
15337         int elemIdx = coords[1];
15338
15339         // We compare elements pair-wise within a group of size 2 * inc.
15340         // The comparing rule for each group alternates between ascending
15341         // and descending. Within each group, we compare each pair at
15342         // positions i and i+inc. To decide whether an element at position i
15343         // is x0 or x1, we mod it by 2 * inc, if the result is smaller than
15344         // inc, it is in the first half of the group, we denote it as x0,
15345         // otherwise we denote it as x1.
15346         // For example, as shown in the Bitonic top K paper referenced above,
15347         // Figure5(a) shows that element[1] is in the
15348         // second half of the group when group size is 2, but it is in the
15349         // first half of the group when group size is 4.
15350
15351         bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;
15352         int i = isFirstInPair ? elemIdx : elemIdx - inc;
15353
15354         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
15355         int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));
15356         float x0 = i0 < n ? getX(batch, i0) : negativeInf;
15357         float x1 = i1 < n ? getX(batch, i1) : negativeInf;
15358
15359         // Denotes which direction indices are in (ascending or descending).
15360         bool reverse = imod(elemIdx, 2 * dir) >= dir;
15361         bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);
15362         if (reverse == isGreater) { // Elements in opposite order of direction
15363           int iTemp = i0;
15364           i0 = i1;
15365           i1 = iTemp;
15366         }
15367         if (isFirstInPair) {
15368            setOutput(float(i0));
15369         } else {
15370            setOutput(float(i1));
15371         }
15372       }
15373     `}}class ppe{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode=`
15374    void main() {
15375         // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...
15376         ivec2 coords = getOutputCoords();
15377         int batch = coords[0];
15378         int elemIdx = coords[1];
15379
15380         // The output size is half of the previous size.
15381         // If the previous sequence is | | | | _ _ _ _  | | | |  _ _ _ _ (k=4),
15382         // we only need to output the indices at positions |, the indices at
15383         // positions _ can be thrown away, see Figure5(b) After Phase 2
15384         // (Merge phase) in the Bitonic Top K paper referenced above.
15385         // For example, the paper shows we only need to output the orange bars.
15386         // The output sequence should look like this | | | | | | | |.
15387         // Because the sequence is halved, to map the output index back
15388         // to the previous sequence to find the corresponding value,
15389         // we need to double the index. When we double the index,
15390         // we basically interpolate a position, so 2i looks like
15391         // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position
15392         // of each 2k positions by - elemIdx % k. E.g. for output at
15393         // index 4,5,6,7, we want to get the corresponding element at
15394         // original index 8,9,10,11, for output at index 8,9,10,11,
15395         // we want to get the corresponding element at original index
15396         // 16,17,18,19, so on and so forth.
15397
15398         int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));
15399         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
15400         int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));
15401
15402         float x0 = getX(batch, i0);
15403         float x1 = i1 < n ? getX(batch, i1) : x0;
15404
15405         setOutput(x0 >= x1 ? float(i0) : float(i1));
15406       }
15407     `}}/**
15408 * @license
15409 * Copyright 2020 Google LLC. All Rights Reserved.
15410 * Licensed under the Apache License, Version 2.0 (the "License");
15411 * you may not use this file except in compliance with the License.
15412 * You may obtain a copy of the License at
15413 *
15414 * http://www.apache.org/licenses/LICENSE-2.0
15415 *
15416 * Unless required by applicable law or agreed to in writing, software
15417 * distributed under the License is distributed on an "AS IS" BASIS,
15418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15419 * See the License for the specific language governing permissions and
15420 * limitations under the License.
15421 * =============================================================================
vendor: 6,120 bytes, lines 15422-15525
15422 */function Ao(t,e){e!==null&&t.disposeIntermediateTensorInfo(e)}function wC(t){let e=1;for(;e<t;)e*=2;return e}function mpe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{k:i,sorted:o}=r,a=U().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),u=U().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),l=s.shape,c=l[l.length-1];if(n.shouldExecuteOnCPU([s])||c<a||i>u){const R=n.readSync(s.dataId),[L,W]=vie(R,l,s.dtype,i,o);return[n.makeTensorInfo(L.shape,L.dtype,L.values),n.makeTensorInfo(W.shape,W.dtype,W.values)]}if(i===0)return l[l.length-1]=0,[n.makeTensorInfo(l,s.dtype,[]),n.makeTensorInfo(l,"int32",[])];if(c===1)return[s,kh({attrs:{shape:l,dtype:"int32",value:0},backend:n})];const h=n.texData.get(s.dataId),d=h!==null&&h.isPacked,f=d?n.unpackTensor(s):s,y=ne(l)/c,v=se({inputs:{x:f},attrs:{shape:[y,c]},backend:n});d&&Ao(n,f);const g=wC(i),x=wC(c);let w=null;const _=()=>w===null?[v,v]:[v,w],T=(R,L,W)=>{const G=_(),H=new fpe(W),Q=[[c],[w===null?1:0],[Number.NEGATIVE_INFINITY],[R],[L]],Y=w;w=n.runWebGLProgram(H,G,"int32",Q),Ao(n,Y)};for(let R=1;R<g;R*=2){const L=R*2;for(let W=R;W>=1;W/=2)T(L,W,[y,x])}for(let R=x;R>g;R/=2){const L=_(),W=new ppe([y,R/2]),H=[[c],[w===null?1:0],[g]],X=w;w=n.runWebGLProgram(W,L,"int32",H),Ao(n,X);const Q=g/2,Y=Q*2;for(let j=Q;j>=1;j/=2)T(Y,j,w.shape)}let E=w;w=Cl({inputs:{x:w},backend:n,attrs:{begin:0,size:[y,i]}}),Ao(n,E);let k=WP({inputs:{x:v,indices:w},backend:n,attrs:{axis:1,batchDims:1}});Ao(n,v);const N=l.slice(0,-1);N.push(i),E=w,w=se({inputs:{x:w},attrs:{shape:N},backend:n}),Ao(n,E);const O=k;return k=se({inputs:{x:k},attrs:{shape:N},backend:n}),Ao(n,O),[k,w]}const gpe={kernelName:yR,backendName:"webgl",kernelFunc:mpe};/**
15423 * @license
15424 * Copyright 2021 Google LLC. All Rights Reserved.
15425 * Licensed under the Apache License, Version 2.0 (the "License");
15426 * you may not use this file except in compliance with the License.
15427 * You may obtain a copy of the License at
15428 *
15429 * http://www.apache.org/licenses/LICENSE-2.0
15430 *
15431 * Unless required by applicable law or agreed to in writing, software
15432 * distributed under the License is distributed on an "AS IS" BASIS,
15433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15434 * See the License for the specific language governing permissions and
15435 * limitations under the License.
15436 * =============================================================================
15437 */class ype{constructor(e,n,r,s,i,o){this.variableNames=["Image","Transforms"],this.outputShape=o;const a=r==="nearest"?1:2;let u;switch(s){case"constant":u=1;break;case"reflect":u=2;break;case"wrap":u=3;break;case"nearest":u=4;break;default:u=1;break}this.userCode=`
15438            float mapCoord(float outCoord, float len) {
15439              float inCoord = outCoord;
15440              if(${u} == 2) {
15441                if (inCoord < 0.0) {
15442                  if (len <= 1.0) {
15443                    inCoord = 0.0;
15444                  } else {
15445                    float sz2 = 2.0 * len;
15446                    if (inCoord < sz2) {
15447                      inCoord = sz2 * float(int(float(-inCoord / sz2))) +
15448                      inCoord;
15449                    }
15450                    inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;
15451                  }
15452                } else if (inCoord > len - 1.0) {
15453                  if (len <= 1.0) {
15454                    inCoord = 0.0;
15455                  } else {
15456                    float sz2 = 2.0 * len;
15457                    inCoord -= sz2 * float(int(float(inCoord / sz2)));
15458                    if (inCoord >= len) {
15459                      inCoord = sz2 - inCoord - 1.0;
15460                    }
15461                  }
15462                }
15463                return clamp(inCoord, 0.0, len - 1.0);
15464              } else if (${u} == 3) {
15465                if (inCoord < 0.0) {
15466                  if (len <= 1.0) {
15467                    inCoord = 0.0;
15468                  } else {
15469                    float sz = len - 1.0;
15470                    inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);
15471                  }
15472                } else if (inCoord > len - 1.0) {
15473                  if (len <= 1.0) {
15474                    inCoord = 0.0;
15475                  } else {
15476                    float sz = len - 1.0;
15477                    inCoord -= len * float(int(float(inCoord / sz)));
15478                  }
15479                }
15480                return clamp(inCoord, 0.0, len - 1.0);
15481              } else if (${u} == 4) {
15482                return clamp(outCoord, 0.0, len - 1.0);
15483              } else {
15484                return outCoord;
15485              }
15486            }
15487
15488            float readWithFillValue(int batch, int coordY, int coordX,
15489              int channel) {
15490              float outputValue;
15491              if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${n}) {
15492                  outputValue = getImage(batch, coordY, coordX, channel);
15493              } else {
15494                outputValue = float(${i});
15495              }
15496              return outputValue;
15497            }
15498
15499            void main() {
15500              ivec4 coords = getOutputCoords();
15501              float outputValue;
15502              int batch = coords[0];
15503              int x = coords[2];
15504              int y = coords[1];
15505              int channel = coords[3];
15506              float xf = float(x);
15507              float yf = float(y);
15508              float a1 = getTransforms(batch, 0);
15509              float a2 = getTransforms(batch, 1);
15510              float a3 = getTransforms(batch, 2);
15511              float b1 = getTransforms(batch, 3);
15512              float b2 = getTransforms(batch, 4);
15513              float b3 = getTransforms(batch, 5);
15514              float c1 = getTransforms(batch, 6);
15515              float c2 = getTransforms(batch, 7);
15516              float projection = c1 * xf + c2 * yf + 1.0;
15517              if (projection == 0.0) {
15518                outputValue = float(${i});
15519              } else {
15520                float inX = (a1 * xf + a2 * yf + a3) / projection;
15521                float inY = (b1 * xf + b2 * yf + b3) / projection;
15522                float mapX = mapCoord(inX, float(${n}));
15523                float mapY = mapCoord(inY, float(${e}));
15524
15525                if (${a} == 1) {
15526                  int coordY = int(round(mapY));
15527                  int coordX = int(round(mapX));
15528                  outputValue = readWithFillValue(batch, coordY, coordX,
15529                    channel);
15530                } else {
15531                  float yFloor = floor(mapY);
15532                  float xFloor = floor(mapX);
15533                  float yCeil = yFloor + 1.0;
15534                  float xCeil = xFloor + 1.0;
15535                  float valueYFloor = (xCeil - mapX) *
15536                  readWithFillValue(batch, int(yFloor), int(xFloor), channel) +
15537                  (mapX - xFloor) *
15538                  readWithFillValue(batch, int(yFloor), int(xCeil), channel);
15539                  float valueYCeil = (xCeil - mapX) *
15540                  readWithFillValue(batch, int(yCeil), int(xFloor), channel) +
15541                  (mapX - xFloor) *
15542                  readWithFillValue(batch, int(yCeil), int(xCeil), channel);
15543                  outputValue = (yCeil - mapY) * valueYFloor +
15544                  (mapY - yFloor) * valueYCeil;
15545                }
15546              }
15547              setOutput(outputValue);
15548            }
15549        `}}/**
15550 * @license
15551 * Copyright 2021 Google LLC. All Rights Reserved.
15552 * Licensed under the Apache License, Version 2.0 (the "License");
15553 * you may not use this file except in compliance with the License.
15554 * You may obtain a copy of the License at
15555 *
15556 * http://www.apache.org/licenses/LICENSE-2.0
15557 *
15558 * Unless required by applicable law or agreed to in writing, software
15559 * distributed under the License is distributed on an "AS IS" BASIS,
15560 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15561 * See the License for the specific language governing permissions and
15562 * limitations under the License.
15563 * =============================================================================
15564 */function vpe(t){const{inputs:e,backend:n,attrs:r}=t,{image:s,transforms:i}=e,{interpolation:o,fillMode:a,fillValue:u,outputShape:l}=r,[c,h,d,f]=s.shape,[p,y]=l??[h,d],v=[c,p,y,f],g=new ype(h,d,o,a,u,v);return n.runWebGLProgram(g,[s,i],"float32")}const xpe={kernelName:vR,backendName:"webgl",kernelFunc:vpe};
vendor: 6,403 bytes, lines 15564-15718
15564/**
15565 * @license
15566 * Copyright 2020 Google LLC. All Rights Reserved.
15567 * Licensed under the Apache License, Version 2.0 (the License);
15568 * you may not use this file except in compliance with the License.
15569 * You may obtain a copy of the License at
15570 *
15571 * http://www.apache.org/licenses/LICENSE-2.0
15572 *
15573 * Unless required by applicable law or agreed to in writing, software
15574 * distributed under the License is distributed on an AS IS BASIS,
15575 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15576 * See the License for the specific language governing permissions and
15577 * limitations under the License.
15578 * =============================================================================
15579 */function wpe(t){const{inputs:e,attrs:n,backend:r}=t,{axis:s}=n,{x:i}=e;Ch(i,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const o=r.readSync(i.dataId),{outputValues:a,outputShape:u,indices:l}=xie(o,s,i.shape,i.dtype);return[r.makeTensorInfo(u,i.dtype,a),r.makeTensorInfo([l.length],"int32",l)]}const bpe={kernelName:xR,backendName:"webgl",kernelFunc:wpe};/**
15580 * @license
15581 * Copyright 2020 Google LLC. All Rights Reserved.
15582 * Licensed under the Apache License, Version 2.0 (the "License");
15583 * you may not use this file except in compliance with the License.
15584 * You may obtain a copy of the License at
15585 *
15586 * http://www.apache.org/licenses/LICENSE-2.0
15587 *
15588 * Unless required by applicable law or agreed to in writing, software
15589 * distributed under the License is distributed on an "AS IS" BASIS,
15590 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15591 * See the License for the specific language governing permissions and
15592 * limitations under the License.
15593 * =============================================================================
15594 */function _pe(t){const{inputs:e,backend:n,attrs:r}=t,{value:s}=e;let{axis:i}=r;i<0&&(i+=s.shape.length);const o=s,a=o.shape.length,u=s.shape[i],l=new Array(a-1);let c=0;for(let y=0;y<a;y++)y!==i&&(l[c++]=o.shape[y]);const h=[],d=new Array(a).fill(0),f=o.shape.slice();f[i]=1;const p=new Array(u);for(let y=0;y<p.length;y++){d[i]=y;const v=Cl({inputs:{x:o},backend:n,attrs:{begin:d,size:f}}),g=se({inputs:{x:v},backend:n,attrs:{shape:l}});p[y]=g,h.push(v)}return h.forEach(y=>n.disposeIntermediateTensorInfo(y)),p}const Spe={kernelName:wR,backendName:"webgl",kernelFunc:_pe};/**
15595 * @license
15596 * Copyright 2018 Google LLC. All Rights Reserved.
15597 * Licensed under the Apache License, Version 2.0 (the "License");
15598 * you may not use this file except in compliance with the License.
15599 * You may obtain a copy of the License at
15600 *
15601 * http://www.apache.org/licenses/LICENSE-2.0
15602 *
15603 * Unless required by applicable law or agreed to in writing, software
15604 * distributed under the License is distributed on an "AS IS" BASIS,
15605 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15606 * See the License for the specific language governing permissions and
15607 * limitations under the License.
15608 * =============================================================================
15609 */class Tpe{constructor(e,n){this.variableNames=["x","segmentIds"];const r=e.windowSize,s=e.batchSize,i=e.inSize,o=e.numSegments,a=o*Math.ceil(i/r);this.outputShape=[s,a];const u="0.0",l="sumValue",c=Math.floor(r/4)*4,h=r%4,d=`
15610        sumValue += dot(values, segFilter);
15611    `;let f="";i%r>0&&(f=`
15612        if (inIdx < 0 || inIdx >= ${i}) {
15613          return initializationValue;
15614        }
15615      `);let p="";i%r>0&&(p=`
15616        if (inIdx < 0 || inIdx >= ${i}) {
15617          return -1.0;
15618        }
15619      `),this.userCode=`
15620      const float initializationValue = ${u};
15621
15622      float getValue(int batch, int inIdx) {
15623        ${f}
15624        return getX(batch, inIdx);
15625      }
15626
15627      float getSegmentIdAtIndex(int inIdx) {
15628        ${p}
15629        return getSegmentIds(inIdx);
15630      }
15631
15632      void main() {
15633        ivec2 coords = getOutputCoords();
15634        int batch = coords[0];
15635        int outIdx = coords[1];
15636        int inOffset = int(floor(float(outIdx) / float(
15637          ${o})) * float(${r}));
15638        int currentSeg = int(mod(float(outIdx), float(${o})));
15639
15640        float sumValue = 0.0;
15641
15642        for (int i = 0; i < ${c}; i += 4) {
15643          int inIdx = inOffset + i;
15644          vec4 values = vec4(
15645            getValue(batch, inIdx),
15646            getValue(batch, inIdx + 1),
15647            getValue(batch, inIdx + 2),
15648            getValue(batch, inIdx + 3)
15649          );
15650
15651          vec4 segFilter = vec4(
15652            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
15653            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
15654            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
15655            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0
15656          );
15657
15658          ${d}
15659        }
15660
15661        int inIdx = inOffset + ${c};
15662        if (${h===1}) {
15663          vec4 values = vec4(
15664            getValue(batch, inIdx),
15665            initializationValue,
15666            initializationValue,
15667            initializationValue
15668          );
15669
15670          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));
15671
15672          vec4 segFilter = vec4(
15673            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
15674            0,
15675            0,
15676            0
15677          );
15678
15679          ${d}
15680        } else if (${h===2}) {
15681          vec4 values = vec4(
15682            getValue(batch, inIdx),
15683            getValue(batch, inIdx + 1),
15684            initializationValue,
15685            initializationValue
15686          );
15687
15688          vec4 segFilter = vec4(
15689            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
15690            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
15691              0,
15692              0
15693          );
15694
15695          ${d}
15696        } else if (${h===3}) {
15697          vec4 values = vec4(
15698            getValue(batch, inIdx),
15699            getValue(batch, inIdx + 1),
15700            getValue(batch, inIdx + 2),
15701            initializationValue
15702          );
15703
15704          vec4 segFilter = vec4(
15705            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
15706            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
15707            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
15708            0
15709          );
15710
15711          ${d}
15712        }
15713        setOutput(${l});
15714      }
15715    `}}/**
15716 * @license
15717 * Copyright 2020 Google LLC. All Rights Reserved.
15718 * Licensed under the Apache License, Version 2.0 (the "License");
15719 * you may not use this file except in compliance with the License.
15720 * You may obtain a copy of the License at
15721 *
15722 * http://www.apache.org/licenses/LICENSE-2.0
15723 *
15724 * Unless required by applicable law or agreed to in writing, software
15725 * distributed under the License is distributed on an "AS IS" BASIS,
15726 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15727 * See the License for the specific language governing permissions and
15728 * limitations under the License.
15729 * =============================================================================
15730 */function Cpe(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,segmentIds:i}=e,{numSegments:o}=r,a=s.shape.length,u=[];let l=0;const c=Ur([l],a);let h=s;c!=null&&(h=Tn({inputs:{x:s},backend:n,attrs:{perm:c}}),u.push(h),l=zr(1,a)[0]);const d=XD(h.shape,l,o),f=ne([h.shape[l]]),p=se({inputs:{x:h},backend:n,attrs:{shape:[-1,f]}});u.push(p);const y=I1(s.dtype),v=(_,T,E,k,N)=>{const O=_.shape[0],R=_.shape[1],L=KD(R,N),W={windowSize:L,inSize:R,batchSize:O,numSegments:N},G=new Tpe(W,T),H=n.compileAndRun(G,[_,E],k);if(u.push(H),H.shape[1]===N)return H;const X=KP({backend:n,attrs:{start:0,stop:N,step:1,dtype:"float32"}}),Q=XP({inputs:{x:X},backend:n,attrs:{reps:[R/L]}});return u.push(X),u.push(Q),v(H,T,Q,k,N)},g=v(p,"unsortedSegmentSum",i,y,o),x=se({inputs:{x:g},backend:n,attrs:{shape:d}});let w=x;if(c!=null){u.push(x);const _=F1(c);w=Tn({inputs:{x:w},backend:n,attrs:{perm:_}})}return u.forEach(_=>n.disposeIntermediateTensorInfo(_)),w}const Npe={kernelName:bR,backendName:"webgl",kernelFunc:Cpe};/**
15731 * @license
15732 * Copyright 2020 Google LLC. All Rights Reserved.
15733 * Licensed under the Apache License, Version 2.0 (the "License");
15734 * you may not use this file except in compliance with the License.
15735 * You may obtain a copy of the License at
15736 *
15737 * http://www.apache.org/licenses/LICENSE-2.0
15738 *
15739 * Unless required by applicable law or agreed to in writing, software
15740 * distributed under the License is distributed on an "AS IS" BASIS,
15741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15742 * See the License for the specific language governing permissions and
15743 * limitations under the License.
15744 * =============================================================================
15745 */const Epe=[coe,doe,moe,voe,woe,Soe,Coe,Eoe,Aoe,Ooe,Foe,Voe,Uoe,Hoe,Xoe,Qoe,Joe,rae,iae,aae,hae,vae,wae,Tae,Nae,Rae,Dae,Mae,qie,Wae,Hae,Yae,nue,iue,aue,lue,hue,mue,vue,bue,Sue,Cue,Eue,Iue,Rue,Fue,Mue,Wue,jue,Hue,Yue,ele,sle,ale,cle,hle,fle,mle,yle,xle,ble,Cle,kle,Ale,Ole,Fle,Vle,zle,qle,Hie,Xle,jae,Zle,tce,sce,Xie,uce,dce,pce,vce,bce,Cce,kce,Rce,Fce,Vce,Wce,Gce,qce,Xce,Jce,the,rhe,ihe,ahe,hhe,mhe,xhe,Ehe,Zie,Ahe,Dhe,Lhe,Bhe,kae,zhe,Ghe,qhe,Yhe,ede,Qie,nde,sde,ode,ude,lde,$ae,She,dde,gde,wde,eoe,Tde,Ede,Ade,Dde,Mde,Bde,zde,Hde,Xde,Zde,tfe,sfe,ufe,hfe,mfe,vfe,gae,Che,bfe,Sfe,Cfe,Efe,$fe,Afe,Ofe,Pfe,Lfe,Bfe,Ufe,jfe,Hfe,Xfe,Qfe,Jfe,tpe,The,aoe,spe,ape,lpe,dpe,gpe,xpe,uoe,bpe,Spe,Npe,jhe];for(const t of Epe)$5(t);const Nr={ScaleFactor:.75,RotateAngleDegrees:20,SegmentAnimationDurationSec:.01,Levels:5,BaseStrokeWidth:1,StrokeWidthScale:.5,MovementThreshold:60,TimeThresholdMsec:60,HandSpanThreshold:12},Td={orange:"hsl(36, 100%, 60%)",sky:"hsl(237, 100%, 10%)",blue:"hsl(227, 54%, 55%)"},Qg={SkyProgressTimingSec:240,SkyResetTimingSec:3,SkyIdleWindowSec:5},kpe=12,Zg=[0,4,5,7,10],$pe=36,Vi={indexFingerTip:8,thumbTip:4,pinkyTip:20,middle:9,middleTip:12},Ipe=["C922","C920","C615"];let Jg=null;const YP=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Ape=async()=>{const t=rp.MediaPipeHands;return Jg||(Jg=await Ote(t,{runtime:"tfjs",maxHands:2,modelType:"lite"})),Jg},Rpe=()=>{const t=ee.useRef(null),e=ee.useRef(null),[n,r]=ee.useState([]),[s,i]=ee.useState({width:0,height:0}),[o,a]=ee.useState(!1),[u,l]=ee.useState(!1);return ee.useEffect(()=>{Ape().then(d=>{console.log("Detector is ready",d),t.current=d,a(!0)}).catch(d=>console.error("Detector initialization failed:",d))},[]),ee.useEffect(()=>{e.current=document.createElement("video"),(async()=>{var x;const f=await navigator.mediaDevices.enumerateDevices();console.log("devices",f);const p=f.filter(w=>w.kind=="videoinput"),y=p.find(w=>Ipe.some(_=>w.label.includes(_))),v=p.find(w=>w.label.includes("FaceTime")),g=(y==null?void 0:y.deviceId)||(v==null?void 0:v.deviceId)||((x=p==null?void 0:p[0])==null?void 0:x.deviceId);console.log(p),console.log("DeviceId",g),navigator.mediaDevices.getUserMedia({video:{facingMode:"user",deviceId:g},audio:!1}).then(w=>
15745{const _=w.getVideoTracks(),{width:T,height:E}=_[0].getSettings();console.log("Got video device",_[0].getSettings()),e.current.srcObject=w,e.current.width=T,e.current.height=E,i({width:T,height:E}),e.current.onloadedmetadata=()=>{e.current.play(),l(!0)}})})()},[]),ee.useEffect(()=>{const d=async()=>{if(t.current&&e.current&&e.current.readyState===4){const p=await t.current.estimateHands(e.current,{flipHorizontal:!0});r(p)}},f=async()=>{await d(),requestAnimationFrame(f)};return f(),()=>{cancelAnimationFrame(f)}},[]),{hands:n.filter(d=>YP(d.keypoints[Vi.thumbTip],d.keypoints[Vi.pinkyTip])>Nr.HandSpanThreshold).map(d=>({...d,keypoints:d.keypoints.map(f=>({...f,x:f.x*window.innerWidth/s.width,y:f.y*window.innerHeight/s.height}))})),loading:!o||!u}},QP={container:{initial:{},animate:{}},tree:{visible:{opacity:1},fadeOut:{opacity:0,transition:{duration:2,delay:1.5}}},line:{initial:{pathLength:0},animate:{pathLength:1,transition:{duration:Nr.SegmentAnimationDurationSec,type:"tween",ease:"linear",when:"beforeChildren"}}}},Ope=({width:t,height:e,children:n})=>Ce.jsx(rs.svg,{variants:QP.container,initial:"initial",animate:"animate",width:t,height:e,stroke:"black",viewBox:`0 0 ${t} ${e}`,strokeWidth:2,children:n});var Dpe=Object.defineProperty,Ppe=(t,e,n)=>e in t?Dpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Me=(t,e,n)=>Ppe(t,typeof e!="symbol"?e+"":e,n),Nm=class{},Fpe=class ZP extends Nm{constructor(e){var n;super(),Me(this,"_name"),Me(this,"_rngFn"),this._name=(n=e.name)!=null?n:"function",this._rngFn=e}get name(){return this._name}next(){return this._rngFn()}clone(){return new ZP(this._rngFn)}};function bC(t){switch(typeof t){case"object":if(t instanceof Nm)return t;break;case"function":return new Fpe(t);default:return new Upe(t)}throw new Error(`invalid RNG seed or instance "${t}"`)}function Lpe(t){if(t===void 0&&(t=crypto.randomUUID()),typeof t=="number")return t;const e=`${t}`;let n=0;for(let r=0;r<e.length;++r)n^=e.charCodeAt(r)|0;return n}function Mpe(t,e){var n;const r=`${t}`;let s=0,i=0;for(;i<r.length;)e[255&i]=255&(s^=((n=e[255&i])!=null?n:0)*19)+r.charCodeAt(i++);return e.length?e:[0]}var Vpe=281474976710656,Bpe=4503599627370496,Wpe=9007199254740992,Upe=class JP extends Nm{constructor(e){super(),Me(this,"_seed"),Me(this,"i"),Me(this,"j"),Me(this,"S");const n=Lpe(e);this._seed=n;const r=Mpe(n,[]),s=[],i=r.length;this.i=0,this.j=0,this.S=s;let o=0;for(;o<=255;)s[o]=o++;for(let a=0,u=0;a<=255;a++){const l=s[a];u=255&u+r[a%i]+l,s[a]=s[u],s[u]=l}this.g(256)}get name(){return"arc4"}next(){let e=this.g(6),n=Vpe,r=0;for(;e<Bpe;)e=(e+r)*256,n*=256,r=this.g(1);for(;e>=Wpe;)e/=2,n/=2,r>>>=1;return(e+r)/n}g(e){const{S:n}=this;let{i:r,j:s}=this,i=0;for(;e--;){r=255&r+1;const o=n[r];n[s]=o,s=255&s+o,n[r]=n[s],i=i*256+n[255&n[r]+o]}return this.i=r,this.j=s,i}clone(){return new JP(this._seed)}},zpe=class eF extends Nm{get name(){return"Math.random"}next(){return Math.random()}clone(){return new eF}};function ps(t){return new jpe(t)}var jpe=class{constructor(t){Me(this,"n"),Me(this,"isInt",()=>{if(Number.isInteger(this.n))return this;throw new Error(`Expected number to be an integer, got ${this.n}`)}),Me(this,"isPositive",()=>{if(this.n>0)return this;throw new Error(`Expected number to be positive, got ${this.n}`)}),Me(this,"lessThan",e=>{if(this.n<e)return this;throw new Error(`Expected number to be less than ${e}, got ${this.n}`)}),Me(this,"greaterThanOrEqual",e=>{if(this.n>=e)return this;throw new Error(`Expected number to be greater than or equal to ${e}, got ${this.n}`)}),Me(this,"greaterThan",e=>{if(this.n>e)return this;throw new Error(`Expected number to be greater than ${e}, got ${this.n}`)}),this.n=t}};function Gpe(t,e=1){ps(e).isInt().isPositive();const n=t.irwinHall(e);return()=>n()/e}function Hpe(t,e=.5){return ps(e).greaterThanOrEqual(0).lessThan(1),()=>Math.floor(t.next()+e)}function qpe(t,e=1,n=.5){return ps(e).isInt().isPositive(),ps(n).greaterThanOrEqual(0).lessThan(1),()=>{let r=0,s=0;for(;r++<e;)t.next()<n&&s++;return s}}function Kpe(t,e=1){return ps(e).isPositive(),()=>-Math.log(1-t.next())/e}function Xpe(t,e=.5){ps(e).greaterThan(0).lessThan(1);const n=1/Math.log(1-e);return()=>Math.floor(1+Math.log(t.next())*n)}function Ype(t,e=1){return ps(e).isInt().greaterThanOrEqual(0),()=>{let n=0;for(let r=0;r<e;++r)n+=t.next();return n}}function Qpe(t,e=0,n=1){const r=t.normal(e,n);return()=>Math.exp(r())}function Zpe(t,e=0,n=1){return()=>{let r,s,i;do r=t.next()*2-1,s=t.next()*2-1,i=r*r+s*s;
15745while(!i||i>1);return e+n*s*Math.sqrt(-2*Math.log(i)/i)}}function Jpe(t,e=1){ps(e).greaterThanOrEqual(0);const n=1/e;return()=>1/Math.pow(1-t.next(),n)}var eme=[0,0,.6931471805599453,1.791759469228055,3.1780538303479458,4.787491742782046,6.579251212010101,8.525161361065415,10.60460290274525,12.801827480081469],tme=t=>eme[t],nme=.9189385332046727;function rme(t,e=1){if(ps(e).isPositive(),e<10){const n=Math.exp(-e);return()=>{let r=n,s=0,i=t.next();for(;i>r;)i=i-r,r=e*r/++s;return s}}else{const n=Math.sqrt(e),r=.931+2.53*n,s=-.059+.02483*r,i=1.1239+1.1328/(r-3.4),o=.9277-3.6224/(r-2);return()=>{for(var a;;){let u,l=t.next();if(l<=.86*o)return u=l/o-.43,Math.floor((2*s/(.5-Math.abs(u))+r)*u+e+.445);l>=o?u=t.next()-.5:(u=l/o-.93,u=(u<0?-.5:.5)-u,l=t.next()*o);const c=.5-Math.abs(u);if(c<.013&&l>c)continue;const h=Math.floor((2*s/c+r)*u+e+.445);if(l=l*i/(s/(c*c)+r),h>=10){const d=(h+.5)*Math.log(e/h)-e-nme+h-(.08333333333333333-(.002777777777777778-1/(1260*h*h))/(h*h))/h;if(Math.log(l*n)<=d)return h}else if(h>=0){const d=(a=tme(h))!=null?a:0;if(Math.log(l)<=h*Math.log(e)-e-d)return h}}}}}function sme(t,e=0,n=1){return()=>t.next()*(n-e)+e}function ime(t){return()=>t.next()>=.5}function ome(t,e=0,n=1){return n===void 0&&(n=e===void 0?1:e,e=0),ps(e).isInt(),ps(n).isInt(),()=>Math.floor(t.next()*(n-e+1)+e)}var ame=class tF{constructor(e=new zpe){Me(this,"_rng"),Me(this,"_cache",{}),Me(this,"next",()=>this._rng.next()),Me(this,"float",(n,r)=>this.uniform(n,r)()),Me(this,"int",(n,r)=>this.uniformInt(n,r)()),Me(this,"integer",(n,r)=>this.uniformInt(n,r)()),Me(this,"bool",()=>this.uniformBoolean()()),Me(this,"boolean",()=>this.uniformBoolean()()),Me(this,"uniform",(n,r)=>this._memoize("uniform",sme,n,r)),Me(this,"uniformInt",(n,r)=>this._memoize("uniformInt",ome,n,r)),Me(this,"uniformBoolean",()=>this._memoize("uniformBoolean",ime)),Me(this,"normal",(n,r)=>Zpe(this,n,r)),Me(this,"logNormal",(n,r)=>Qpe(this,n,r)),Me(this,"bernoulli",n=>Hpe(this,n)),Me(this,"binomial",(n,r)=>qpe(this,n,r)),Me(this,"geometric",n=>Xpe(this,n)),Me(this,"poisson",n=>rme(this,n)),Me(this,"exponential",n=>Kpe(this,n)),Me(this,"irwinHall",n=>Ype(this,n)),Me(this,"bates",n=>Gpe(this,n)),Me(this,"pareto",n=>Jpe(this,n)),this._rng=bC(e)}get rng(){return this._rng}clone(e=this.rng.clone()){return new tF(e)}use(e){this._rng=bC(e)}choice(e){if(!Array.isArray(e))throw new TypeError(`Random.choice expected input to be an array, got ${typeof e}`);const n=e.length;if(n>0){const r=this.uniformInt(0,n-1)();return e[r]}else return}_memoize(e,n,...r){const s=`${r.join(";")}`;let i=this._cache[e];return(i===void 0||i.key!==s)&&(i={key:s,distribution:n(this,...r)},this._cache[e]=i),i.distribution}},Cd=new ame;const nF=ee.memo(({x:t,y:e,height:n,onFadeOut:r})=>Ce.jsx(rs.g,{variants:QP.tree,initial:["initial","visible"],animate:["animate","fadeOut"],onAnimationComplete:s=>s==="fadeOut"&&r(),children:Ce.jsx(lp,{origin:{x:t,y:e},height:n,levels:Nr.Levels})}));nF.displayName="Tree";const lp=ee.memo(({origin:t,height:e,levels:n})=>{const r=ee.useRef(Nr.RotateAngleDegrees+Cd.normal(0,4)()),s=ee.useRef(Nr.RotateAngleDegrees+Cd.normal(0,4)()),i=ee.useRef(Nr.ScaleFactor*Cd.normal(1,.1)()),o=ee.useRef(Nr.ScaleFactor*Cd.normal(1,.1)());return n===1?Ce.jsx(rs.line,{variants:void 0,x2:t.x,x1:t.x,y1:t.y,y2:t.y-e,strokeWidth:Nr.BaseStrokeWidth}):Ce.jsxs(Ce.Fragment,{children:[Ce.jsx(rs.line,{variants:void 0,x2:t.x,x1:t.x,y1:t.y,y2:t.y-e,strokeWidth:Nr.BaseStrokeWidth+n*Nr.StrokeWidthScale}),Ce.jsx(rs.g,{variants:void 0,transform:`rotate(${0-r.current}, ${t.x}, ${t.y-e})`,children:Ce.jsx(lp,{origin:{x:t.x,y:t.y-e},height:e*i.current,levels:n-1})}),Ce.jsx(rs.g,{variants:void 0,transform:`rotate(${s.current}, ${t.x}, ${t.y-e})`,children:Ce.jsx(lp,{origin:{x:t.x,y:t.y-e},height:e*o.current,levels:n-1})})]})},(t,e)=>t.origin.x===e.origin.x&&t.origin.y===e.origin.y&&t.height===e.height&&t.levels===e.levels);lp.displayName="TreeSegment";const _C={loading:"Loading your Enchanted Fractal Forest experience...",welcome:"Hold two hands up to say hello to the Enchanted Fractal Forest."};var rF={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},SC=Yo.createContext&&Yo.createContext(rF),ume=["attr","size","title"];function lme(t,e){if(t==null)return{};var n=cme(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function cp(){return cp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cp.apply(this,arguments)}function TC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
15745e%2?TC(Object(n),!0).forEach(function(r){hme(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TC(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hme(t,e,n){return e=dme(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dme(t){var e=fme(t,"string");return typeof e=="symbol"?e:e+""}function fme(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sF(t){return t&&t.map((e,n)=>Yo.createElement(e.tag,hp({key:n},e.attr),sF(e.child)))}function pme(t){return e=>Yo.createElement(mme,cp({attr:hp({},t.attr)},e),sF(t.child))}function mme(t){var e=n=>{var{attr:r,size:s,title:i}=t,o=lme(t,ume),a=s||n.size||"1em",u;return n.className&&(u=n.className),t.className&&(u=(u?u+" ":"")+t.className),Yo.createElement("svg",cp({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:u,style:hp(hp({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Yo.createElement("title",null,i),t.children)};return SC!==void 0?Yo.createElement(SC.Consumer,null,n=>e(n)):e(rF)}function CC(t){return pme({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M13 24c-3.26 0-6.19-1.99-7.4-5.02l-3.03-7.61a1 1 0 0 1 1.24-1.32l.79.26c.56.18 1.02.61 1.24 1.16L7.25 15H8V3.25a1.25 1.25 0 0 1 2.5 0V12h1V1.25a1.25 1.25 0 0 1 2.5 0V12h1V2.75a1.25 1.25 0 0 1 2.5 0V12h1V5.75a1.25 1.25 0 0 1 2.5 0V16c0 4.42-3.58 8-8 8z"},child:[]}]})(t)}const gme="_message_1a72b_1",yme="_onboarding_1a72b_23",Gl={message:gme,onboarding:yme,"left-hand":"_left-hand_1a72b_31","wave-l":"_wave-l_1a72b_1","right-hand":"_right-hand_1a72b_38","wave-r":"_wave-r_1a72b_1"},NC=({variant:t})=>Ce.jsx("div",{className:Gl.onboarding,children:t==="loading"?Ce.jsx("div",{className:Gl.message,children:_C.loading}):Ce.jsxs(Ce.Fragment,{children:[Ce.jsx("div",{className:Gl["left-hand"],children:Ce.jsx(CC,{size:32})}),Ce.jsx("div",{className:Gl.message,children:_C.welcome}),Ce.jsx("div",{className:Gl["right-hand"],children:Ce.jsx(CC,{size:32})})]})}),vme="_App_1tlee_1",xme="_forest_1tlee_9",wme="_onboarding_1tlee_13",Nd={App:vme,forest:xme,onboarding:wme},bme=()=>{const[t,e]=ee.useState();if(!t){const n=new g1(p1);n.maxPolyphony=24,n.set({harmonicity:5.2,modulationIndex:1,oscillator:{type:"sine"},envelope:{attack:0,decay:.9,sustain:0,release:.1},modulation:{type:"sine"},modulationEnvelope:{attack:0,decay:.4,sustain:0,release:.1}}),n.toDestination();const r=new w1({decay:20});r.generate();const s=new f1({frequency:800,type:"lowpass"}).toDestination();n.connect(r),r.connect(s),e(n)}return t},_me=Array(25).fill(null).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*3,opacity:Math.random()*.5+.5})),Sme=t=>$pe+Zg[t%Zg.length]+Math.floor(t/Zg.length)*kpe,Tme=()=>{const{hands:t,loading:e}=Rpe(),[n,r]=ee.useState([]),s=ee.useRef(),i=ee.useRef(),o=window.innerWidth,a=window.innerHeight,[u,l]=ee.useState("idle"),c=ee.useRef(),h=ee.useRef(),d=wk(Td.orange),f=bme(),p=ee.useCallback(()=>{h.current&&h.current.stop(),h.current=OS(d,Td.blue,{duration:Qg.SkyProgressTimingSec}),h.current.then(()=>l("complete"))},[d]),y=FW`linear-gradient(to bottom, ${Td.sky}, ${d})`,v=ee.useCallback(()=>{l("resetting"),h.current&&h.current.stop(),h.current=OS(d,Td.orange,{duration:Qg.SkyResetTimingSec}),h.current.then(()=>l("idle"))},[d]),g=ee.useCallback(()=>{clearTimeout(c.current),c.current=setTimeout(()=>{v()},Qg.SkyIdleWindowSec*1e3)},[v]),x=ee.useCallback((k,N,O)=>{const R=Math.round(rT(k,0,o,0,20)),L=rT(N,a,0,.2,1),W=Sme(R);console.log("PLAYING NOTE",R,W,O),f.triggerAttackRelease(DH(W,"midi"),.125,QH(),L)},[a,o,f]),w=ee.useCallback(({x:k,y:N,i:O})=>{var H,X;const R=k-((H=s.current)==null?void 0:H.x),L=N-((X=s.current)==null?void 0:X.y),W=Date.now(),G=W-i.current;(!s.current||!i.current||Math.sqrt(R*R*L*L)>Nr.MovementThreshold&&G>Nr.TimeThresholdMsec)&&(s.current={x:k,y:N},i.current=W,r(Q=>[...Q,{x:k,height:(a-N)/4}]),x(k,N,O),g(),(u==="idle"||u==="resetting")&&(l("in-progress"),p()))},[x,g,u,p,a]),_=k=>{r(N=>
15745{const O=[...N];return delete O[k],O})},T=k=>w({x:k.clientX,y:k.clientY}),E=k=>{k.buttons>0&&w({x:k.clientX,y:k.clientY})};return ee.useEffect(()=>{for(let k=0;k<t.length;k++){const N=t[k],O=N.keypoints[Vi.middleTip].x,R=N.keypoints[Vi.middleTip].y;w({x:O,y:R,i:k})}},[t,w]),Ce.jsxs(rs.div,{className:Nd.App,style:{background:y},onMouseDown:T,onMouseMove:E,children:[Ce.jsx("div",{className:Nd.forest,children:Ce.jsx(Ope,{width:o,height:a,children:n.map((k,N)=>k?Ce.jsx(nF,{x:k.x,y:a,height:k.height,onFadeOut:()=>_(N)},N):null)})}),Ce.jsxs($S,{mode:"wait",children:[u==="idle"&&e&&Ce.jsx(rs.div,{className:Nd.onboarding,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:Ce.jsx(NC,{variant:"loading"})},"loading"),u==="idle"&&!e&&Ce.jsx(rs.div,{className:Nd.onboarding,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:Ce.jsx(NC,{variant:"welcome"})},"welcome")]}),Ce.jsxs("svg",{style:{position:"absolute",top:0,left:0,width:o,height:a},width:o,height:a,viewBox:`0 0 ${o} ${a}`,children:[Ce.jsx("g",{children:_me.map((k,N)=>Ce.jsx("circle",{cx:k.x,cy:k.y,r:k.r,fill:"white",fillOpacity:k.opacity},N))}),Ce.jsx($S,{children:t.map((k,N)=>Ce.jsx(rs.g,{initial:{opacity:0}
15745,animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},children:Ce.jsx(rs.circle,{animate:{cx:k.keypoints[Vi.middle].x,cy:k.keypoints[Vi.middle].y,r:.5*YP(k.keypoints[Vi.thumbTip],k.keypoints[Vi.pinkyTip])},transition:{duration:.1},stroke:"white",strokeWidth:"2",fill:"white",fillOpacity:.25},N)},N))})]})]})};B2(document.getElementById("root")).render(Ce.jsx(ee.StrictMode,{children:Ce.jsx(Tme,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.