PageSourceSearch

https://soltaai.com/assets/index-C-mli9vH.js

js soltaai.com collected 2026-09-29 16:54:52 UTC 2,498,429 bytes, 5,103 lines download raw bytes

vendor: 7,474 bytes, line 1
1function vq(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const s=Object.getOwnPropertyDescriptor(a,r);s&&Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();var y7e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lF(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function b7e(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}),n}var Pk={exports:{}},Ax={};var kR;function wq(){if(kR)return Ax;kR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,r,s){var i=null;if(s!==void 0&&(i=""+s),r.key!==void 0&&(i=""+r.key),"key"in r){s={};for(var o in r)o!=="key"&&(s[o]=r[o])}else s=r;return r=s.ref,{$$typeof:e,type:a,key:i,ref:r!==void 0?r:null,props:s}}return Ax.Fragment=t,Ax.jsx=n,Ax.jsxs=n,Ax}var NR;function Sq(){return NR||(NR=1,Pk.exports=wq()),Pk.exports}var u=Sq(),zk={exports:{}},nn={};var CR;function kq(){if(CR)return nn;CR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),i=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),f=Symbol.iterator;function m(B){return B===null||typeof B!="object"?null:(B=f&&B[f]||B["@@iterator"],typeof B=="function"?B:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function w(B,Y,ne){this.props=B,this.context=Y,this.refs=b,this.updater=ne||x}w.prototype.isReactComponent={},w.prototype.setState=function(B,Y){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,Y,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function S(){}S.prototype=w.prototype;function k(B,Y,ne){this.props=B,this.context=Y,this.refs=b,this.updater=ne||x}var C=k.prototype=new S;C.constructor=k,y(C,w.prototype),C.isPureReactComponent=!0;var E=Array.isArray,T={H:null,A:null,T:null,S:null,V:null},_=Object.prototype.hasOwnProperty;function A(B,Y,ne,ee,U,oe){return ne=oe.ref,{$$typeof:e,type:B,key:Y,ref:ne!==void 0?ne:null,props:oe}}function $(B,Y){return A(B.type,Y,void 0,void 0,void 0,B.props)}function O(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function z(B){var Y={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ne){return Y[ne]})}var P=/\/+/g;function j(B,Y){return typeof B=="object"&&B!==null&&B.key!=null?z(""+B.key):Y.toString(36)}function G(){}function X(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(G,G):(B.status="pending",B.then(function(Y){B.status==="pending"&&(B.status="fulfilled",B.value=Y)},function(Y){B.status==="pending"&&(B.status="rejected",B.reason=Y)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function J(B,Y,ne,ee,U){var oe=typeof B;(oe==="undefined"||oe==="boolean")&&(B=null);var pe=!1;if(B===null)pe=!0;else switch(oe){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(B.$$typeof){case e:case t:pe=!0;break;case c:return pe=B._init,J(pe(B._payload),Y,ne,ee,U)}}if(pe)return U=U(B),pe=ee===""?"."+j(B,0):ee,E(U)?(ne="",pe!=null&&(ne=pe.replace(P,"$&/")+"/"),J(U,Y,ne,"",function(Ie){return Ie})):U!=null&&(O(U)&&(U=$(U,ne+(U.key==null||B&&B.key===U.key?"":(""+U.key).replace(P,"$&/")+"/")+pe)),Y.push(U)),1;pe=0;var he=ee===""?".":ee+":";if(E(B))for(var xe=0;xe<B.length;xe++)ee=B[xe],oe=he+j(ee,xe),pe+=J(ee,Y,ne,oe,U);else if(xe=m(B),typeof xe=="function")for(B=xe.call(B),xe=0;!(ee=B.next()).done;)ee=ee.value,oe=he+j(ee,xe++),pe+=J(ee,Y,ne,oe,U);else if(oe==="object"){if(typeof B.then=="function")return J(X(B),Y,ne,ee,U);throw Y=String(B),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return pe}function V(B,Y,ne){if(B==null)return B;var ee=[],U=0;return J(B,ee,"","",function(oe){return Y.call(ne,oe,U++)}),ee}function Q(B){if(B._status===-1){var Y=B._result;Y=Y(),Y.then(function(ne){(B._status===0||B._status===-1)&&(B._status=1,B._result=ne)},function(ne){(B._status===0||B._status===-1)&&(B._status=2,B._result=ne)}),B._status===-1&&(B._status=0,B._result=Y)}if(B._status===1)return B._result.default;throw B._result}var F=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)};function H(){}return nn.Children={map:V,forEach:function(B,Y,ne){V(B,function(){Y.apply(this,arguments)},ne)},count:function(B){var Y=0;return V(B,function(){Y++}),Y},toArray:function(B){return V(B,function(Y){return Y})||[]},only:function(B){if(!O(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},nn.Component=w,nn.Fragment=n,nn.Profiler=r,nn.PureComponent=k,nn.StrictMode=a,nn.Suspense=l,nn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,nn.__COMPILER_RUNTIME={__proto__:null,c:function(B){return T.H.useMemoCache(B)}},nn.cache=function(B){return function(){return B.apply(null,arguments)}},nn.cloneElement=function(B,Y,ne){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ee=y({},B.props),U=B.key,oe=void 0;if(Y!=null)for(pe in Y.ref!==void 0&&(oe=void 0),Y.key!==void 0&&(U=""+Y.key),Y)!_.call(Y,pe)||pe==="key"||pe==="__self"||pe
vendor: 2,829 bytes, line 1
1==="__source"||pe==="ref"&&Y.ref===void 0||(ee[pe]=Y[pe]);var pe=arguments.length-2;if(pe===1)ee.children=ne;else if(1<pe){for(var he=Array(pe),xe=0;xe<pe;xe++)he[xe]=arguments[xe+2];ee.children=he}return A(B.type,U,void 0,void 0,oe,ee)},nn.createContext=function(B){return B={$$typeof:i,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:s,_context:B},B},nn.createElement=function(B,Y,ne){var ee,U={},oe=null;if(Y!=null)for(ee in Y.key!==void 0&&(oe=""+Y.key),Y)_.call(Y,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(U[ee]=Y[ee]);var pe=arguments.length-2;if(pe===1)U.children=ne;else if(1<pe){for(var he=Array(pe),xe=0;xe<pe;xe++)he[xe]=arguments[xe+2];U.children=he}if(B&&B.defaultProps)for(ee in pe=B.defaultProps,pe)U[ee]===void 0&&(U[ee]=pe[ee]);return A(B,oe,void 0,void 0,null,U)},nn.createRef=function(){return{current:null}},nn.forwardRef=function(B){return{$$typeof:o,render:B}},nn.isValidElement=O,nn.lazy=function(B){return{$$typeof:c,_payload:{_status:-1,_result:B},_init:Q}},nn.memo=function(B,Y){return{$$typeof:d,type:B,compare:Y===void 0?null:Y}},nn.startTransition=function(B){var Y=T.T,ne={};T.T=ne;try{var ee=B(),U=T.S;U!==null&&U(ne,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(H,F)}catch(oe){F(oe)}finally{T.T=Y}},nn.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},nn.use=function(B){return T.H.use(B)},nn.useActionState=function(B,Y,ne){return T.H.useActionState(B,Y,ne)},nn.useCallback=function(B,Y){return T.H.useCallback(B,Y)},nn.useContext=function(B){return T.H.useContext(B)},nn.useDebugValue=function(){},nn.useDeferredValue=function(B,Y){return T.H.useDeferredValue(B,Y)},nn.useEffect=function(B,Y,ne){var ee=T.H;if(typeof ne=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return ee.useEffect(B,Y)},nn.useId=function(){return T.H.useId()},nn.useImperativeHandle=function(B,Y,ne){return T.H.useImperativeHandle(B,Y,ne)},nn.useInsertionEffect=function(B,Y){return T.H.useInsertionEffect(B,Y)},nn.useLayoutEffect=function(B,Y){return T.H.useLayoutEffect(B,Y)},nn.useMemo=function(B,Y){return T.H.useMemo(B,Y)},nn.useOptimistic=function(B,Y){return T.H.useOptimistic(B,Y)},nn.useReducer=function(B,Y,ne){return T.H.useReducer(B,Y,ne)},nn.useRef=function(B){return T.H.useRef(B)},nn.useState=function(B){return T.H.useState(B)},nn.useSyncExternalStore=function(B,Y,ne){return T.H.useSyncExternalStore(B,Y,ne)},nn.useTransition=function(){return T.H.useTransition()},nn.version="19.1.1",nn}var ER;function YE(){return ER||(ER=1,zk.exports=kq()),zk.exports}var D=YE();const uF=lF(D),Nq=vq({__proto__:null,default:uF},[D]);var Uk={exports:{}},_x={},Wk={exports:{}},Vk={};var IR;function Cq(){return IR||(IR=1,(function(e){function t(V,Q){var F=V.length;
vendor: 7,189 bytes, line 1
1V.push(Q);e:for(;0<F;){var H=F-1>>>1,B=V[H];if(0<r(B,Q))V[H]=Q,V[F]=B,F=H;else break e}}function n(V){return V.length===0?null:V[0]}function a(V){if(V.length===0)return null;var Q=V[0],F=V.pop();if(F!==Q){V[0]=F;e:for(var H=0,B=V.length,Y=B>>>1;H<Y;){var ne=2*(H+1)-1,ee=V[ne],U=ne+1,oe=V[U];if(0>r(ee,F))U<B&&0>r(oe,ee)?(V[H]=oe,V[U]=F,H=U):(V[H]=ee,V[ne]=F,H=ne);else if(U<B&&0>r(oe,F))V[H]=oe,V[U]=F,H=U;else break e}}return Q}function r(V,Q){var F=V.sortIndex-Q.sortIndex;return F!==0?F:V.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var l=[],d=[],c=1,f=null,m=3,x=!1,y=!1,b=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function E(V){for(var Q=n(d);Q!==null;){if(Q.callback===null)a(d);else if(Q.startTime<=V)a(d),Q.sortIndex=Q.expirationTime,t(l,Q);else break;Q=n(d)}}function T(V){if(b=!1,E(V),!y)if(n(l)!==null)y=!0,_||(_=!0,j());else{var Q=n(d);Q!==null&&J(T,Q.startTime-V)}}var _=!1,A=-1,$=5,O=-1;function z(){return w?!0:!(e.unstable_now()-O<$)}function P(){if(w=!1,_){var V=e.unstable_now();O=V;var Q=!0;try{e:{y=!1,b&&(b=!1,k(A),A=-1),x=!0;var F=m;try{t:{for(E(V),f=n(l);f!==null&&!(f.expirationTime>V&&z());){var H=f.callback;if(typeof H=="function"){f.callback=null,m=f.priorityLevel;var B=H(f.expirationTime<=V);if(V=e.unstable_now(),typeof B=="function"){f.callback=B,E(V),Q=!0;break t}f===n(l)&&a(l),E(V)}else a(l);f=n(l)}if(f!==null)Q=!0;else{var Y=n(d);Y!==null&&J(T,Y.startTime-V),Q=!1}}break e}finally{f=null,m=F,x=!1}Q=void 0}}finally{Q?j():_=!1}}}var j;if(typeof C=="function")j=function(){C(P)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,X=G.port2;G.port1.onmessage=P,j=function(){X.postMessage(null)}}else j=function(){S(P,0)};function J(V,Q){A=S(function(){V(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(V){switch(m){case 1:case 2:case 3:var Q=3;break;default:Q=m}var F=m;m=Q;try{return V()}finally{m=F}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var F=m;m=V;try{return Q()}finally{m=F}},e.unstable_scheduleCallback=function(V,Q,F){var H=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?H+F:H):F=H,V){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=F+B,V={id:c++,callback:Q,priorityLevel:V,startTime:F,expirationTime:B,sortIndex:-1},F>H?(V.sortIndex=F,t(d,V),n(l)===null&&V===n(d)&&(b?(k(A),A=-1):b=!0,J(T,F-H))):(V.sortIndex=B,t(l,V),y||x||(y=!0,_||(_=!0,j()))),V},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(V){var Q=m;return function(){var F=m;m=Q;try{return V.apply(this,arguments)}finally{m=F}}}})(Vk)),Vk}var TR;function Eq(){return TR||(TR=1,Wk.exports=Cq()),Wk.exports}var Hk={exports:{}},ps={};var AR;function Iq(){if(AR)return ps;AR=1;var e=YE();function t(l){var d="https://react.dev/errors/"+l;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)d+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+l+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function s(l,d,c){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:f==null?null:""+f,children:l,containerInfo:d,implementation:c}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,d){if(l==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return ps.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,ps.createPortal=function(l,d){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return s(l,d,null,c)},ps.flushSync=function(l){var d=i.T,c=a.p;try{if(i.T=null,a.p=2,l)return l()}finally{i.T=d,a.p=c,a.d.f()}},ps.preconnect=function(l,d){typeof l=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(l,d))},ps.prefetchDNS=function(l){typeof l=="string"&&a.d.D(l)},ps.preinit=function(l,d){if(typeof l=="string"&&d&&typeof d.as=="string"){var c=d.as,f=o(c,d.crossOrigin),m=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;c==="style"?a.d.S(l,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:f,integrity:m,fetchPriority:x}):c==="script"&&a.d.X(l,{crossOrigin:f,integrity:m,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},ps.preinitModule=function(l,d){if(typeof l=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var c=o(d.as,d.crossOrigin);a.d.M(l,{crossOrigin:c,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&a.d.M(l)},ps.preload=function(l,d){if(typeof l=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var c=d.as,f=o(c,d.crossOrigin);a.d.L(l,c,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},ps.preloadModule=function(l,d){if(typeof l=="string")if(d){var c=o(d.as,d.crossOrigin);a.d.m(l,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:c,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else a.d.m(l)},ps.requestFormReset=function(l){a.d.r(l)},ps.unstable_batchedUpdates=function(l,d){return l(d)},ps.useFormState=function(l,d,c){return i.H.useFormState(l,d,c)},ps.useFormStatus=function(){return i.H.useHostTransitionStatus()},ps.version="19.1.1",ps}var _R;function cF(){if(_R)return Hk.exports;_R=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hk.exports=Iq(),Hk.exports}var jR;function Tq(){if(jR)return _x;jR=1;
vendor: 17,941 bytes, lines 1-8
1var e=Eq(),t=YE(),n=cF();function a(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function s(h){var p=h,g=h;if(h.alternate)for(;p.return;)p=p.return;else{h=p;do p=h,(p.flags&4098)!==0&&(g=p.return),h=p.return;while(h)}return p.tag===3?g:null}function i(h){if(h.tag===13){var p=h.memoizedState;if(p===null&&(h=h.alternate,h!==null&&(p=h.memoizedState)),p!==null)return p.dehydrated}return null}function o(h){if(s(h)!==h)throw Error(a(188))}function l(h){var p=h.alternate;if(!p){if(p=s(h),p===null)throw Error(a(188));return p!==h?null:h}for(var g=h,v=p;;){var N=g.return;if(N===null)break;var I=N.alternate;if(I===null){if(v=N.return,v!==null){g=v;continue}break}if(N.child===I.child){for(I=N.child;I;){if(I===g)return o(N),h;if(I===v)return o(N),p;I=I.sibling}throw Error(a(188))}if(g.return!==v.return)g=N,v=I;else{for(var L=!1,K=N.child;K;){if(K===g){L=!0,g=N,v=I;break}if(K===v){L=!0,v=N,g=I;break}K=K.sibling}if(!L){for(K=I.child;K;){if(K===g){L=!0,g=I,v=N;break}if(K===v){L=!0,v=I,g=N;break}K=K.sibling}if(!L)throw Error(a(189))}}if(g.alternate!==v)throw Error(a(190))}if(g.tag!==3)throw Error(a(188));return g.stateNode.current===g?h:p}function d(h){var p=h.tag;if(p===5||p===26||p===27||p===6)return h;for(h=h.child;h!==null;){if(p=d(h),p!==null)return p;h=h.sibling}return null}var c=Object.assign,f=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),k=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function j(h){return h===null||typeof h!="object"?null:(h=P&&h[P]||h["@@iterator"],typeof h=="function"?h:null)}var G=Symbol.for("react.client.reference");function X(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===G?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case y:return"Fragment";case w:return"Profiler";case b:return"StrictMode";case T:return"Suspense";case _:return"SuspenseList";case O:return"Activity"}if(typeof h=="object")switch(h.$$typeof){case x:return"Portal";case C:return(h.displayName||"Context")+".Provider";case k:return(h._context.displayName||"Context")+".Consumer";case E:var p=h.render;return h=h.displayName,h||(h=p.displayName||p.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case A:return p=h.displayName||null,p!==null?p:X(h.type)||"Memo";case $:p=h._payload,h=h._init;try{return X(h(p))}catch{}}return null}var J=Array.isArray,V=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},H=[],B=-1;function Y(h){return{current:h}}function ne(h){0>B||(h.current=H[B],H[B]=null,B--)}function ee(h,p){B++,H[B]=h.current,h.current=p}var U=Y(null),oe=Y(null),pe=Y(null),he=Y(null);function xe(h,p){switch(ee(pe,p),ee(oe,h),ee(U,null),p.nodeType){case 9:case 11:h=(h=p.documentElement)&&(h=h.namespaceURI)?JD(h):0;break;default:if(h=p.tagName,p=p.namespaceURI)p=JD(p),h=QD(p,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}ne(U),ee(U,h)}function Ie(){ne(U),ne(oe),ne(pe)}function _e(h){h.memoizedState!==null&&ee(he,h);var p=U.current,g=QD(p,h.type);p!==g&&(ee(oe,h),ee(U,g))}function Oe(h){oe.current===h&&(ne(U),ne(oe)),he.current===h&&(ne(he),Nx._currentValue=F)}var Ye=Object.prototype.hasOwnProperty,ft=e.unstable_scheduleCallback,ze=e.unstable_cancelCallback,ct=e.unstable_shouldYield,ot=e.unstable_requestPaint,tt=e.unstable_now,Tt=e.unstable_getCurrentPriorityLevel,bn=e.unstable_ImmediatePriority,Ut=e.unstable_UserBlockingPriority,Tn=e.unstable_NormalPriority,Nn=e.unstable_LowPriority,Pn=e.unstable_IdlePriority,sa=e.log,pa=e.unstable_setDisableYieldValue,Be=null,lt=null;function $e(h){if(typeof sa=="function"&&pa(h),lt&&typeof lt.setStrictMode=="function")try{lt.setStrictMode(Be,h)}catch{}}var Ue=Math.clz32?Math.clz32:An,dt=Math.log,Qe=Math.LN2;function An(h){return h>>>=0,h===0?32:31-(dt(h)/Qe|0)|0}var Bn=256,Ga=4194304;function _n(h){var p=h&42;if(p!==0)return p;switch(h&-h){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:return 64;case 128:return 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 h&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return h&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return h}}function di(h,p,g){var v=h.pendingLanes;if(v===0)return 0;var N=0,I=h.suspendedLanes,L=h.pingedLanes;h=h.warmLanes;var K=v&134217727;return K!==0?(v=K&~I,v!==0?N=_n(v):(L&=K,L!==0?N=_n(L):g||(g=K&~h,g!==0&&(N=_n(g))))):(K=v&~I,K!==0?N=_n(K):L!==0?N=_n(L):g||(g=v&~h,g!==0&&(N=_n(g)))),N===0?0:p!==0&&p!==N&&(p&I)===0&&(I=N&-N,g=p&-p,I>=g||I===32&&(g&4194048)!==0)?p:N}function qr(h,p){return(h.pendingLanes&~(h.suspendedLanes&~h.pingedLanes)&p)===0}function hi(h,p){switch(h){case 1:case 2:case 4:case 8:case 64:return p+250;case 16:case 32: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 p+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pi(){var h=Bn;return Bn<<=1,(Bn&4194048)===0&&(Bn=256),h}function qa(){var h=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),h}function is(h){for(var p=[],g=0;31>g;g++)p.push(h);return p}function Kr(h,p){h.pendingLanes|=p,p!==268435456&&(h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0)}function lr(h,p,g,v,N,I){var L=h.pendingLanes;h.pendingLanes=g,h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0,h.expiredLanes&=g,h.entangledLanes&=g,h.errorRecoveryDisabledLanes&=g,h.shellSuspendCounter=0;var K=h.entanglements,se=h.expirationTimes,be=h.hiddenUpdates;for(g=L&~g;0<g;){var Te=31-Ue(g),Re=1<<Te;K[Te]=0,se[Te]=-1;var ve=be[Te];if(ve!==null)for(be[Te]=null,Te=0;Te<ve.length;Te++){var Se=ve[Te];Se!==null&&(Se.lane&=-536870913)}g&=~Re}v!==0&&Ba(h,v,0),I!==0&&N===0&&h.tag!==0&&(h.suspendedLanes|=I&~(L&~p))}function Ba(h,p,g){h.pendingLanes|=p,h.suspendedLanes&=~p;var v=31-Ue(p);h.entangledLanes|=p,h.entanglements[v]=h.entanglements[v]|1073741824|g&4194090}function fi(h,p){var g=h.entangledLanes|=p;for(h=h.entanglements;g;){var v=31-Ue(g),N=1<<v;N&p|h[v]&p&&(h[v]|=p),g&=~N}}function we(h){switch(h){case 2:h=1;break;case 8:h=4;break;case 32:h=16;break;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:h=128;break;case 268435456:h=134217728;break;default:h=0}return h}function Fe(h){return h&=-h,2<h?8<h?(h&134217727)!==0?32:268435456:8:2}function xt(){var h=Q.p;return h!==0?h:(h=window.event,h===void 0?32:xR(h.type))}function Xe(h,p){var g=Q.p;try{return Q.p=h,p()}finally{Q.p=g}}var qt=Math.random().toString(36).slice(2),$t="__reactFiber$"+qt,It="__reactProps$"+qt,vt="__reactContainer$"+qt,vn="__reactEvents$"+qt,Na="__reactListeners$"+qt,Fa="__reactHandles$"+qt,Xr="__reactResources$"+qt,fa="__reactMarker$"+qt;function os(h){delete h[$t],delete h[It],delete h[vn],delete h[Na],delete h[Fa]}function sn(h){var p=h[$t];if(p)return p;for(var g=h.parentNode;g;){if(p=g[vt]||g[$t]){if(g=p.alternate,p.child!==null||g!==null&&g.child!==null)for(h=nR(h);h!==null;){if(g=h[$t])return g;h=nR(h)}return p}h=g,g=h.parentNode}return null}function wn(h){if(h=h[$t]||h[vt]){var p=h.tag;if(p===5||p===6||p===13||p===26||p===27||p===3)return h}return null}function Ka(h){var p=h.tag;if(p===5||p===26||p===27||p===6)return h.stateNode;throw Error(a(33))}function Ca(h){var p=h[Xr];return p||(p=h[Xr]={hoistableStyles:new Map,hoistableScripts:new Map}),p}function Rn(h){h[fa]=!0}var Or=new Set,ls={};function Hs(h,p){ur(h,p),ur(h+"Capture",p)}function ur(h,p){for(ls[h]=p,h=0;h<p.length;h++)Or.add(p[h])}var cr=RegExp("^[: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]*$"),us={},Xa={};function Bi(h){return Ye.call(Xa,h)?!0:Ye.call(us,h)?!1:cr.test(h)?Xa[h]=!0:(us[h]=!0,!1)}function Ee(h,p,g){if(Bi(p))if(g===null)h.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":h.removeAttribute(p);return;case"boolean":var v=p.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){h.removeAttribute(p);return}}h.setAttribute(p,""+g)}}function Le(h,p,g){if(g===null)h.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(p);return}h.setAttribute(p,""+g)}}function Ke(h,p,g,v){if(v===null)h.removeAttribute(g);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(g);return}h.setAttributeNS(p,g,""+v)}}var Je,Ze;function ut(h){if(Je===void 0)try{throw Error()}catch(g){var p=g.stack.trim().match(/\n( *(at )?)/);Je=p&&p[1]||"",Ze=-1<g.stack.indexOf(`
2    at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
3`+Je+h+Ze}var mt=!1;function Yt(h,p){if(!h||mt)return"";mt=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(p){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(Se){var ve=Se}Reflect.construct(h,[],Re)}else{try{Re.call()}catch(Se){ve=Se}h.call(Re.prototype)}}else{try{throw Error()}catch(Se){ve=Se}(Re=h())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(Se){if(Se&&ve&&typeof Se.stack=="string")return[Se.stack,ve.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var I=v.DetermineComponentFrameRoot(),L=I[0],K=I[1];if(L&&K){var se=L.split(`
4`),be=K.split(`
5`);for(N=v=0;v<se.length&&!se[v].includes("DetermineComponentFrameRoot");)v++;for(;N<be.length&&!be[N].includes("DetermineComponentFrameRoot");)N++;if(v===se.length||N===be.length)for(v=se.length-1,N=be.length-1;1<=v&&0<=N&&se[v]!==be[N];)N--;for(;1<=v&&0<=N;v--,N--)if(se[v]!==be[N]){if(v!==1||N!==1)do if(v--,N--,0>N||se[v]!==be[N]){var Te=`
6`+se[v].replace(" at new "," at ");return h.displayName&&Te.includes("<anonymous>")&&(Te=Te.replace("<anonymous>",h.displayName)),Te}while(1<=v&&0<=N);break}}}finally{mt=!1,Error.prepareStackTrace=g}return(g=h?h.displayName||h.name:"")?ut(g):""}function Wt(h){switch(h.tag){case 26:case 27:case 5:return ut(h.type);case 16:return ut("Lazy");case 13:return ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return Yt(h.type,!1);case 11:return Yt(h.type.render,!1);case 1:return Yt(h.type,!0);case 31:return ut("Activity");default:return""}}function fn(h){try{var p="";do p+=Wt(h),h=h.return;while(h);return p}catch(g){return`
7Error generating stack: `+g.message+`
8`+g.stack}}function Dt(h){switch(typeof h){case"bigint":case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function Sn(h){var p=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function qn(h){var p=Sn(h)?"checked":"value",g=Object.getOwnPropertyDescriptor(h.constructor.prototype,p),v=""+h[p];if(!h.hasOwnProperty(p)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var N=g.get,I=g.set;return Object.defineProperty(h,p,{configurable:!0,get:function(){return N.call(this)},set:function(L){v=""+L,I.call(this,L)}}),Object.defineProperty(h,p,{enumerable:g.enumerable}),{getValue:function(){return v},setValue:function(L){v=""+L},stopTracking:function(){h._valueTracker=null,delete h[p]}}}}function Ea(h){h._valueTracker||(h._valueTracker=qn(h))}function Ia(h){if(!h)return!1;var p=h._valueTracker;if(!p)return!0;var g=p.getValue(),v="";return h&&(v=Sn(h)?h.checked?"true":"false":h.value),h=v,h!==g?(p.setValue(h),!0):!1}function mn(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}var Mn=/[\n"\\]/g;function jn(h){return h.replace(Mn,function(p){return"\\"+p.charCodeAt(0).toString(16)+" "})}function Ta(h,p,g,v,N,I,L,K){h.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?h.type=L:h.removeAttribute("type"),p!=null?L==="number"?(p===0&&h.value===""||h.value!=p)&&(h.value=""+Dt(p)):h.value!==""+Dt(p)&&(h.value=""+Dt(p)):L!=="submit"&&L!=="reset"||h.removeAttribute("value"),p!=null?Ts(h,L,Dt(p)):g!=null?Ts(h,L,Dt(g)):v!=null&&h.removeAttribute("value"),N==null&&I!=null&&(h.defaultChecked=!!I),N!=null&&(h.checked=N&&typeof N!="function"&&typeof N!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?h.name=""+Dt(K):h.removeAttribute("name")}function cs(h,p,g,v,N,I,L,K){if(I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(h.type=I),p!=null||g!=null){if(!(I!=="submit"&&I!=="reset"||p!=null))return;g=g!=null?""+Dt(g):"",p=p!=null?""+Dt(p):g,K||p===h.value||(h.value=p),h.defaultValue=p}v=v??N,v=typeof v!="function"&&typeof v!="symbol"&&!!v,h.checked=K?h.checked:!!v,h.defaultChecked=!!v,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(h.name=L)}function Ts(h,p,g){p==="number"&&mn(h.ownerDocument)===h||h.defaultValue===""+g||(h.defaultValue=""+g)}function Oa(h,p,g,v){if(h=h.options,p){p={};for(var N=0;N<g.length;N++)p["$"+g[N]]=!0;for(g=0;g<h.length;g++)N=p.hasOwnProperty("$"+h[g].value),h[g].selected!==N&&(h[g].selected=N),N&&v&&(h[g].defaultSelected=!0)}else{for(g=""+Dt(g),p=null,N=0;N<h.length;N++){if(h[N].value===g){h[N].selected=!0,v&&(h[N].defaultSelected=!0);return}p!==null||h[N].disabled||(p=h[N])}p!==null&&(p.selected=!0)}}function Ya(h,p,g){if(p!=null&&(p=""+Dt(p),p!==h.value&&(h.value=p),g==null)){h.defaultValue!==p&&(h.defaultValue=p);return}h.defaultValue=g!=null?""+Dt(g):""}function Fi(h,p,g,v){if(p==null){if(v!=null){if(g!=null)throw Error(a(92));if(J(v)){if(1<v.length)throw Error(a(93));v=v[0]}g=v}g==null&&(g=""),p=g}g=Dt(p),h.defaultValue=g,v=h.textContent,v===g&&v!==""&&v!==null&&(h.value=v)}function ds(h,p){if(p){var g=h.firstChild;if(g&&g===h.lastChild&&g.nodeType===3){g.nodeValue=p;return}}h.textContent=p}var io=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function oo(h,p,g){var v=p.indexOf("--")===0;g==null||typeof g=="boolean"||g===""?v?h.setProperty(p,""):p==="float"?h.cssFloat="":h[p]="":v?h.setProperty(p,g):typeof g!="number"||g===0||io.has(p)?p==="float"?h.cssFloat=g:h[p]=(""+g).trim():h[p]=g+"px"}function hl(h,p,g){if(p!=null&&typeof p!="object")throw Error(a(62));if(h=h.style,g!=null){for(var v in g)!g.hasOwnProperty(v)||p!=null&&p.hasOwnProperty(v)||(v.indexOf("--")===0?h.setProperty(v,""):v==="float"?h.cssFloat="":h[v]="");for(var N in p)v=p[N],p.hasOwnProperty(N)&&g[N]!==v&&oo(h,N,v)}else for(var I in p)p.hasOwnProperty(I)&&oo(h,I,p[I])}function Oi(h){if(h.indexOf("-")===-1)return!1;switch(h){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 lo=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
8dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uo=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function As(h){return uo.test(""+h)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":h}var _s=null;function co(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var mi=null,$o=null;function te(h){var p=wn(h);if(p&&(h=p.stateNode)){var g=h[It]||null;e:switch(h=p.stateNode,p.type){case"input":if(Ta(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name),p=g.name,g.type==="radio"&&p!=null){for(g=h;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll('input[name="'+jn(""+p)+'"][type="radio"]'),p=0;p<g.length;p++){var v=g[p];if(v!==h&&v.form===h.form){var N=v[It]||null;if(!N)throw Error(a(90));Ta(v,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(p=0;p<g.length;p++)v=g[p],v.form===h.form&&Ia(v)}break e;case"textarea":Ya(h,g.value,g.defaultValue);break e;case"select":p=g.value,p!=null&&Oa(h,!!g.multiple,p,!1)}}}var ge=!1;function We(h,p,g){if(ge)return h(p,g);ge=!0;try{var v=h(p);return v}finally{if(ge=!1,(mi!==null||$o!==null)&&(J0(),mi&&(p=mi,h=$o,$o=mi=null,te(p),h)))for(p=0;p<h.length;p++)te(h[p])}}function At(h,p){var g=h.stateNode;if(g===null)return null;var v=g[It]||null;if(v===null)return null;g=v[p];e:switch(p){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(h=h.type,v=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!v;break e;default:h=!1}if(h)return null;if(g&&typeof g!="function")throw Error(a(231,p,typeof g));return g}var Rt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ft=!1;if(Rt)try{var rt={};Object.defineProperty(rt,"passive",{get:function(){Ft=!0}}),window.addEventListener("test",rt,rt),window.removeEventListener("test",rt,rt)}catch{Ft=!1}var gt=null,Dn=null,Ja=null;function Gs(){if(Ja)return Ja;var h,p=Dn,g=p.length,v,N="value"in gt?gt.value:gt.textContent,I=N.length;for(h=0;h<g&&p[h]===N[h];h++);var L=g-h;for(v=1;v<=L&&p[g-v]===N[I-v];v++);return Ja=N.slice(h,1<v?1-v:void 0)}function ho(h){var p=h.keyCode;
vendor: 5,232 bytes, line 8
8return"charCode"in h?(h=h.charCode,h===0&&p===13&&(h=13)):h=p,h===10&&(h=13),32<=h||h===13?h:0}function Bo(){return!0}function Tc(){return!1}function zn(h){function p(g,v,N,I,L){this._reactName=g,this._targetInst=N,this.type=v,this.nativeEvent=I,this.target=L,this.currentTarget=null;for(var K in h)h.hasOwnProperty(K)&&(g=h[K],this[K]=g?g(I):I[K]);return this.isDefaultPrevented=(I.defaultPrevented!=null?I.defaultPrevented:I.returnValue===!1)?Bo:Tc,this.isPropagationStopped=Tc,this}return c(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Bo)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Bo)},persist:function(){},isPersistent:Bo}),p}var Aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pl=zn(Aa),eu=c({},Aa,{view:0,detail:0}),h0=zn(eu),Og,Sp,Ac,kp=c({},eu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ge,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==Ac&&(Ac&&h.type==="mousemove"?(Og=h.screenX-Ac.screenX,Sp=h.screenY-Ac.screenY):Sp=Og=0,Ac=h),Og)},movementY:function(h){return"movementY"in h?h.movementY:Sp}}),p0=zn(kp),G2=c({},kp,{dataTransfer:0}),q2=zn(G2),f0=c({},eu,{relatedTarget:0}),Np=zn(f0),Lg=c({},Aa,{animationName:0,elapsedTime:0,pseudoElement:0}),K2=zn(Lg),Pg=c({},Aa,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),m0=zn(Pg),zg=c({},Aa,{data:0}),Cp=zn(zg),X2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ne={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"},Pe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ve(h){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(h):(h=Pe[h])?!!p[h]:!1}function Ge(){return Ve}var Ct=c({},eu,{key:function(h){if(h.key){var p=X2[h.key]||h.key;if(p!=="Unidentified")return p}return h.type==="keypress"?(h=ho(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?Ne[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ge,charCode:function(h){return h.type==="keypress"?ho(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?ho(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),nt=zn(Ct),pt=c({},kp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),it=zn(pt),Mt=c({},eu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ge}),Vt=zn(Mt),gn=c({},Aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),_a=zn(gn),tn=c({},kp,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),Fn=zn(tn),ja=c({},Aa,{newState:0,oldState:0}),fl=zn(ja),_c=[9,13,27,32],gi=Rt&&"CompositionEvent"in window,xn=null;Rt&&"documentMode"in document&&(xn=document.documentMode);var Un=Rt&&"TextEvent"in window&&!xn,Li=Rt&&(!gi||xn&&8<xn&&11>=xn),jc=" ",Dc=!1;function g0(h,p){switch(h){case"keyup":return _c.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function x0(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var tu=!1;function c3(h,p){switch(h){case"compositionend":return x0(p);case"keypress":return p.which!==32?null:(Dc=!0,jc);case"textInput":return h=p.data,h===jc&&Dc?null:h;default:return null}}function qH(h,p){if(tu)return h==="compositionend"||!gi&&g0(h,p)?(h=Gs(),Ja=Dn=gt=null,tu=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return Li&&p.locale!=="ko"?null:p.data;default:return null}}var KH={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 d3(h){var p=h&&h.nodeName&&h.nodeName.toLowerCase();return p==="input"?!!KH[h.type]:p==="textarea"}
vendor: 56,661 bytes, line 8
8function h3(h,p,g,v){mi?$o?$o.push(v):$o=[v]:mi=v,p=a1(p,"onChange"),0<p.length&&(g=new pl("onChange","change",null,g,v),h.push({event:g,listeners:p}))}var Ug=null,Wg=null;function XH(h){GD(h,0)}function y0(h){var p=Ka(h);if(Ia(p))return h}function p3(h,p){if(h==="change")return p}var f3=!1;if(Rt){var Y2;if(Rt){var J2="oninput"in document;if(!J2){var m3=document.createElement("div");m3.setAttribute("oninput","return;"),J2=typeof m3.oninput=="function"}Y2=J2}else Y2=!1;f3=Y2&&(!document.documentMode||9<document.documentMode)}function g3(){Ug&&(Ug.detachEvent("onpropertychange",x3),Wg=Ug=null)}function x3(h){if(h.propertyName==="value"&&y0(Wg)){var p=[];h3(p,Wg,h,co(h)),We(XH,p)}}function YH(h,p,g){h==="focusin"?(g3(),Ug=p,Wg=g,Ug.attachEvent("onpropertychange",x3)):h==="focusout"&&g3()}function JH(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return y0(Wg)}function QH(h,p){if(h==="click")return y0(p)}function ZH(h,p){if(h==="input"||h==="change")return y0(p)}function eG(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var xi=typeof Object.is=="function"?Object.is:eG;function Vg(h,p){if(xi(h,p))return!0;if(typeof h!="object"||h===null||typeof p!="object"||p===null)return!1;var g=Object.keys(h),v=Object.keys(p);if(g.length!==v.length)return!1;for(v=0;v<g.length;v++){var N=g[v];if(!Ye.call(p,N)||!xi(h[N],p[N]))return!1}return!0}function y3(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function b3(h,p){var g=y3(h);h=0;for(var v;g;){if(g.nodeType===3){if(v=h+g.textContent.length,h<=p&&v>=p)return{node:g,offset:p-h};h=v}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=y3(g)}}function v3(h,p){return h&&p?h===p?!0:h&&h.nodeType===3?!1:p&&p.nodeType===3?v3(h,p.parentNode):"contains"in h?h.contains(p):h.compareDocumentPosition?!!(h.compareDocumentPosition(p)&16):!1:!1}function w3(h){h=h!=null&&h.ownerDocument!=null&&h.ownerDocument.defaultView!=null?h.ownerDocument.defaultView:window;for(var p=mn(h.document);p instanceof h.HTMLIFrameElement;){try{var g=typeof p.contentWindow.location.href=="string"}catch{g=!1}if(g)h=p.contentWindow;else break;p=mn(h.document)}return p}function Q2(h){var p=h&&h.nodeName&&h.nodeName.toLowerCase();return p&&(p==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||p==="textarea"||h.contentEditable==="true")}var tG=Rt&&"documentMode"in document&&11>=document.documentMode,Ep=null,Z2=null,Hg=null,eS=!1;function S3(h,p,g){var v=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;eS||Ep==null||Ep!==mn(v)||(v=Ep,"selectionStart"in v&&Q2(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Hg&&Vg(Hg,v)||(Hg=v,v=a1(Z2,"onSelect"),0<v.length&&(p=new pl("onSelect","select",null,p,g),h.push({event:p,listeners:v}),p.target=Ep)))}function Rc(h,p){var g={};return g[h.toLowerCase()]=p.toLowerCase(),g["Webkit"+h]="webkit"+p,g["Moz"+h]="moz"+p,g}var Ip={animationend:Rc("Animation","AnimationEnd"),animationiteration:Rc("Animation","AnimationIteration"),animationstart:Rc("Animation","AnimationStart"),transitionrun:Rc("Transition","TransitionRun"),transitionstart:Rc("Transition","TransitionStart"),transitioncancel:Rc("Transition","TransitionCancel"),transitionend:Rc("Transition","TransitionEnd")},tS={},k3={};Rt&&(k3=document.createElement("div").style,"AnimationEvent"in window||(delete Ip.animationend.animation,delete Ip.animationiteration.animation,delete Ip.animationstart.animation),"TransitionEvent"in window||delete Ip.transitionend.transition);function Mc(h){if(tS[h])return tS[h];if(!Ip[h])return h;var p=Ip[h],g;for(g in p)if(p.hasOwnProperty(g)&&g in k3)return tS[h]=p[g];return h}var N3=Mc("animationend"),C3=Mc("animationiteration"),E3=Mc("animationstart"),nG=Mc("transitionrun"),aG=Mc("transitionstart"),rG=Mc("transitioncancel"),I3=Mc("transitionend"),T3=new Map,nS="abort auxClick beforeToggle 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(" ");nS.push("scrollEnd");function po(h,p){T3.set(h,p),Hs(p,[h])}var A3=new WeakMap;function Pi(h,p){if(typeof h=="object"&&h!==null){var g=A3.get(h);return g!==void 0?g:(p={value:h,source:p,stack:fn(p)},A3.set(h,p),p)}return{value:h,source:p,stack:fn(p)}}var zi=[],Tp=0,aS=0;function b0(){for(var h=Tp,p=aS=Tp=0;p<h;){var g=zi[p];zi[p++]=null;var v=zi[p];zi[p++]=null;var N=zi[p];zi[p++]=null;var I=zi[p];if(zi[p++]=null,v!==null&&N!==null){var L=v.pending;L===null?N.next=N:(N.next=L.next,L.next=N),v.pending=N}I!==0&&_3(g,N,I)}}function v0(h,p,g,v){zi[Tp++]=h,zi[Tp++]=p,zi[Tp++]=g,zi[Tp++]=v,aS|=v,h.lanes|=v,h=h.alternate,h!==null&&(h.lanes|=v)}function rS(h,p,g,v){return v0(h,p,g,v),w0(h)}function Ap(h,p){return v0(h,null,null,p),w0(h)}function _3(h,p,g){h.lanes|=g;var v=h.alternate;v!==null&&(v.lanes|=g);for(var N=!1,I=h.return;I!==null;)I.childLanes|=g,v=I.alternate,v!==null&&(v.childLanes|=g),I.tag===22&&(h=I.stateNode,h===null||h._visibility&1||(N=!0)),h=I,I=I.return;return h.tag===3?(I=h.stateNode,N&&p!==null&&(N=31-Ue(g),h=I.hiddenUpdates,v=h[N],v===null?h[N]=[p]:v.push(p),p.lane=g|536870912),I):null}function w0(h){if(50<gx)throw gx=0,ck=null,Error(a(185));for(var p=h.return;p!==null;)h=p,p=h.return;return h.tag===3?h.stateNode:null}var _p={};function sG(h,p,g,v){this.tag=h,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(h,p,g,v){return new sG(h,p,g,v)}function sS(h){return h=h.prototype,!(!h||!h.isReactComponent)}function ml(h,p){var g=h.alternate;return g===null?(g=yi(h.tag,p,h.key,h.mode),g.elementType=h.elementType,g.type=h.type,g.stateNode=h.stateNode,g.alternate=h,h.alternate=g):(g.pendingProps=p,g.type=h.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=h.flags&65011712,g.childLanes=h.childLanes,g.lanes=h.lanes,g.child=h.child,g.memoizedProps=h.memoizedProps,g.memoizedState=h.memoizedState,g.updateQueue=h.updateQueue,p=h.dependencies,g.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},g.sibling=h.sibling,g.index=h.index,g.ref=h.ref,g.refCleanup=h.refCleanup,g}function j3(h,p){h.flags&=65011714;var g=h.alternate;return g===null?(h.childLanes=0,h.lanes=p,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=g.childLanes,h.lanes=g.lanes,h.child=g.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=g.memoizedProps,h.memoizedState=g.memoizedState,h.updateQueue=g.updateQueue,h.type=g.type,p=g.dependencies,h.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext}),h}function S0(h,p,g,v,N,I){var L=0;if(v=h,typeof h=="function")sS(h)&&(L=1);else if(typeof h=="string")L=oq(h,g,U.current)?26:h==="html"||h==="head"||h==="body"?27:5;else e:switch(h){case O:return h=yi(31,g,p,N),h.elementType=O,h.lanes=I,h;case y:return $c(g.children,N,I,p);case b:L=8,N|=24;break;case w:return h=yi(12,g,p,N|2),h.elementType=w,h.lanes=I,h;case T:return h=yi(13,g,p,N),h.elementType=T,h.lanes=I,h;case _:return h=yi(19,g,p,N),h.elementType=_,h.lanes=I,h;default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case S:case C:L=10;break e;case k:L=9;break e;case E:L=11;break e;case A:L=14;break e;case $:L=16,v=null;break e}L=29,g=Error(a(130,h===null?"null":typeof h,"")),v=null}return p=yi(L,g,p,N),p.elementType=h,p.type=v,p.lanes=I,p}function $c(h,p,g,v){return h=yi(7,h,v,p),h.lanes=g,h}function iS(h,p,g){return h=yi(6,h,null,p),h.lanes=g,h}function oS(h,p,g){return p=yi(4,h.children!==null?h.children:[],h.key,p),p.lanes=g,p.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},p}var jp=[],Dp=0,k0=null,N0=0,Ui=[],Wi=0,Bc=null,gl=1,xl="";function Fc(h,p){jp[Dp++]=N0,jp[Dp++]=k0,k0=h,N0=p}function D3(h,p,g){Ui[Wi++]=gl,Ui[Wi++]=xl,Ui[Wi++]=Bc,Bc=h;var v=gl;h=xl;var N=32-Ue(v)-1;v&=~(1<<N),g+=1;var I=32-Ue(p)+N;if(30<I){var L=N-N%5;I=(v&(1<<L)-1).toString(32),v>>=L,N-=L,gl=1<<32-Ue(p)+N|g<<N|v,xl=I+h}else gl=1<<I|g<<N|v,xl=h}function lS(h){h.return!==null&&(Fc(h,1),D3(h,1,0))}function uS(h){for(;h===k0;)k0=jp[--Dp],jp[Dp]=null,N0=jp[--Dp],jp[Dp]=null;for(;h===Bc;)Bc=Ui[--Wi],Ui[Wi]=null,xl=Ui[--Wi],Ui[Wi]=null,gl=Ui[--Wi],Ui[Wi]=null}var js=null,La=null,On=!1,Oc=null,Fo=!1,cS=Error(a(519));function Lc(h){var p=Error(a(418,""));throw Kg(Pi(p,h)),cS}function R3(h){var p=h.stateNode,g=h.type,v=h.memoizedProps;switch(p[$t]=h,p[It]=v,g){case"dialog":hn("cancel",p),hn("close",p);break;case"iframe":case"object":case"embed":hn("load",p);break;case"video":case"audio":for(g=0;g<yx.length;g++)hn(yx[g],p);break;case"source":hn("error",p);break;case"img":case"image":case"link":hn("error",p),hn("load",p);break;case"details":hn("toggle",p);break;case"input":hn("invalid",p),cs(p,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0),Ea(p);break;case"select":hn("invalid",p);break;case"textarea":hn("invalid",p),Fi(p,v.value,v.defaultValue,v.children),Ea(p)}g=v.children,typeof g!="string"&&typeof g!="number"&&typeof g!="bigint"||p.textContent===""+g||v.suppressHydrationWarning===!0||YD(p.textContent,g)?(v.popover!=null&&(hn("beforetoggle",p),hn("toggle",p)),v.onScroll!=null&&hn("scroll",p),v.onScrollEnd!=null&&hn("scrollend",p),v.onClick!=null&&(p.onclick=r1),p=!0):p=!1,p||Lc(h)}function M3(h){for(js=h.return;js;)switch(js.tag){case 5:case 13:Fo=!1;return;case 27:case 3:Fo=!0;return;default:js=js.return}}function Gg(h){if(h!==js)return!1;if(!On)return M3(h),On=!0,!1;var p=h.tag,g;if((g=p!==3&&p!==27)&&((g=p===5)&&(g=h.type,g=!(g!=="form"&&g!=="button")||Ek(h.type,h.memoizedProps)),g=!g),g&&La&&Lc(h),M3(h),p===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));e:{for(h=h.nextSibling,p=0;h;){if(h.nodeType===8)if(g=h.data,g==="/$"){if(p===0){La=mo(h.nextSibling);break e}p--}else g!=="$"&&g!=="$!"&&g!=="$?"||p++;h=h.nextSibling}La=null}}else p===27?(p=La,xu(h.type)?(h=_k,_k=null,La=h):La=p):La=js?mo(h.stateNode.nextSibling):null;return!0}function qg(){La=js=null,On=!1}function $3(){var h=Oc;return h!==null&&(Xs===null?Xs=h:Xs.push.apply(Xs,h),Oc=null),h}function Kg(h){Oc===null?Oc=[h]:Oc.push(h)}var dS=Y(null),Pc=null,yl=null;function nu(h,p,g){ee(dS,p._currentValue),p._currentValue=g}function bl(h){h._currentValue=dS.current,ne(dS)}function hS(h,p,g){for(;h!==null;){var v=h.alternate;if((h.childLanes&p)!==p?(h.childLanes|=p,v!==null&&(v.childLanes|=p)):v!==null&&(v.childLanes&p)!==p&&(v.childLanes|=p),h===g)break;h=h.return}}function pS(h,p,g,v){var N=h.child;for(N!==null&&(N.return=h);N!==null;){var I=N.dependencies;if(I!==null){var L=N.child;I=I.firstContext;e:for(;I!==null;){var K=I;I=N;for(var se=0;se<p.length;se++)if(K.context===p[se]){I.lanes|=g,K=I.alternate,K!==null&&(K.lanes|=g),hS(I.return,g,h),v||(L=null);break e}I=K.next}}else if(N.tag===18){if(L=N.return,L===null)throw Error(a(341));L.lanes|=g,I=L.alternate,I!==null&&(I.lanes|=g),hS(L,g,h),L=null}else L=N.child;if(L!==null)L.return=N;else for(L=N;L!==null;){if(L===h){L=null;break}if(N=L.sibling,N!==null){N.return=L.return,L=N;break}L=L.return}N=L}}function Xg(h,p,g,v){h=null;for(var N=p,I=!1;N!==null;){if(!I){if((N.flags&524288)!==0)I=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var L=N.alternate;if(L===null)throw Error(a(387));if(L=L.memoizedProps,L!==null){var K=N.type;xi(N.pendingProps.value,L.value)||(h!==null?h.push(K):h=[K])}}else if(N===he.current){if(L=N.alternate,L===null)throw Error(a(387));L.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(h!==null?h.push(Nx):h=[Nx])}N=N.return}h!==null&&pS(p,h,g,v),p.flags|=262144}function C0(h){for(h=h.firstContext;h!==null;){if(!xi(h.context._currentValue,h.memoizedValue))return!0;h=h.next}return!1}function zc(h){Pc=h,yl=null,h=h.dependencies,h!==null&&(h.firstContext=null)}function hs(h){return B3(Pc,h)}function E0(h,p){return Pc===null&&zc(h),B3(h,p)}function B3(h,p){var g=p._currentValue;if(p={context:p,memoizedValue:g,next:null},yl===null){if(h===null)throw Error(a(308));yl=p,h.dependencies={lanes:0,firstContext:p},h.flags|=524288}else yl=yl.next=p;return g}var iG=typeof AbortController<"u"?AbortController:function(){var h=[],p=this.signal={aborted:!1,addEventListener:function(g,v){h.push(v)}};this.abort=function(){p.aborted=!0,h.forEach(function(g){return g()})}},oG=e.unstable_scheduleCallback,lG=e.unstable_NormalPriority,Nr={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fS(){return{controller:new iG,data:new Map,refCount:0}}function Yg(h){h.refCount--,h.refCount===0&&oG(lG,function(){h.controller.abort()})}var Jg=null,mS=0,Rp=0,Mp=null;function uG(h,p){if(Jg===null){var g=Jg=[];mS=0,Rp=xk(),Mp={status:"pending",value:void 0,then:function(v){g.push(v)}}}return mS++,p.then(F3,F3),p}function F3(){if(--mS===0&&Jg!==null){Mp!==null&&(Mp.status="fulfilled");var h=Jg;Jg=null,Rp=0,Mp=null;for(var p=0;p<h.length;p++)(0,h[p])()}}function cG(h,p){var g=[],v={status:"pending",value:null,reason:null,then:function(N){g.push(N)}};return h.then(function(){v.status="fulfilled",v.value=p;for(var N=0;N<g.length;N++)(0,g[N])(p)},function(N){for(v.status="rejected",v.reason=N,N=0;N<g.length;N++)(0,g[N])(void 0)}),v}var O3=V.S;V.S=function(h,p){typeof p=="object"&&p!==null&&typeof p.then=="function"&&uG(h,p),O3!==null&&O3(h,p)};var Uc=Y(null);function gS(){var h=Uc.current;return h!==null?h:da.pooledCache}function I0(h,p){p===null?ee(Uc,Uc.current):ee(Uc,p.pool)}function L3(){var h=gS();return h===null?null:{parent:Nr._currentValue,pool:h}}var Qg=Error(a(460)),P3=Error(a(474)),T0=Error(a(542)),xS={then:function(){}};function z3(h){return h=h.status,h==="fulfilled"||h==="rejected"}function A0(){}function U3(h,p,g){switch(g=h[g],g===void 0?h.push(p):g!==p&&(p.then(A0,A0),p=g),p.status){case"fulfilled":return p.value;case"rejected":throw h=p.reason,V3(h),h;default:if(typeof p.status=="string")p.then(A0,A0);else{if(h=da,h!==null&&100<h.shellSuspendCounter)throw Error(a(482));h=p,h.status="pending",h.then(function(v){if(p.status==="pending"){var N=p;N.status="fulfilled",N.value=v}},function(v){if(p.status==="pending"){var N=p;N.status="rejected",N.reason=v}})}switch(p.status){case"fulfilled":return p.value;case"rejected":throw h=p.reason,V3(h),h}throw Zg=p,Qg}}var Zg=null;function W3(){if(Zg===null)throw Error(a(459));var h=Zg;return Zg=null,h}function V3(h){if(h===Qg||h===T0)throw Error(a(483))}var au=!1;function yS(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bS(h,p){h=h.updateQueue,p.updateQueue===h&&(p.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,callbacks:null})}function ru(h){return{lane:h,tag:0,payload:null,callback:null,next:null}}function su(h,p,g){var v=h.updateQueue;if(v===null)return null;if(v=v.shared,(Kn&2)!==0){var N=v.pending;return N===null?p.next=p:(p.next=N.next,N.next=p),v.pending=p,p=w0(h),_3(h,null,g),p}return v0(h,v,p,g),w0(h)}function ex(h,p,g){if(p=p.updateQueue,p!==null&&(p=p.shared,(g&4194048)!==0)){var v=p.lanes;v&=h.pendingLanes,g|=v,p.lanes=g,fi(h,g)}}function vS(h,p){var g=h.updateQueue,v=h.alternate;if(v!==null&&(v=v.updateQueue,g===v)){var N=null,I=null;if(g=g.firstBaseUpdate,g!==null){do{var L={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};I===null?N=I=L:I=I.next=L,g=g.next}while(g!==null);I===null?N=I=p:I=I.next=p}else N=I=p;g={baseState:v.baseState,firstBaseUpdate:N,lastBaseUpdate:I,shared:v.shared,callbacks:v.callbacks},h.updateQueue=g;return}h=g.lastBaseUpdate,h===null?g.firstBaseUpdate=p:h.next=p,g.lastBaseUpdate=p}var wS=!1;function tx(){if(wS){var h=Mp;if(h!==null)throw h}}function nx(h,p,g,v){wS=!1;var N=h.updateQueue;au=!1;var I=N.firstBaseUpdate,L=N.lastBaseUpdate,K=N.shared.pending;if(K!==null){N.shared.pending=null;var se=K,be=se.next;se.next=null,L===null?I=be:L.next=be,L=se;var Te=h.alternate;Te!==null&&(Te=Te.updateQueue,K=Te.lastBaseUpdate,K!==L&&(K===null?Te.firstBaseUpdate=be:K.next=be,Te.lastBaseUpdate=se))}if(I!==null){var Re=N.baseState;L=0,Te=be=se=null,K=I;do{var ve=K.lane&-536870913,Se=ve!==K.lane;if(Se?(Cn&ve)===ve:(v&ve)===ve){ve!==0&&ve===Rp&&(wS=!0),Te!==null&&(Te=Te.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Ht=h,Bt=K;ve=p;var aa=g;switch(Bt.tag){case 1:if(Ht=Bt.payload,typeof Ht=="function"){Re=Ht.call(aa,Re,ve);break e}Re=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=Bt.payload,ve=typeof Ht=="function"?Ht.call(aa,Re,ve):Ht,ve==null)break e;Re=c({},Re,ve);break e;case 2:au=!0}}ve=K.callback,ve!==null&&(h.flags|=64,Se&&(h.flags|=8192),Se=N.callbacks,Se===null?N.callbacks=[ve]:Se.push(ve))}else Se={lane:ve,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Te===null?(be=Te=Se,se=Re):Te=Te.next=Se,L|=ve;if(K=K.next,K===null){if(K=N.shared.pending,K===null)break;Se=K,K=Se.next,Se.next=null,N.lastBaseUpdate=Se,N.shared.pending=null}}while(!0);Te===null&&(se=Re),N.baseState=se,N.firstBaseUpdate=be,N.lastBaseUpdate=Te,I===null&&(N.shared.lanes=0),pu|=L,h.lanes=L,h.memoizedState=Re}}function H3(h,p){if(typeof h!="function")throw Error(a(191,h));h.call(p)}function G3(h,p){var g=h.callbacks;if(g!==null)for(h.callbacks=null,h=0;h<g.length;h++)H3(g[h],p)}var $p=Y(null),_0=Y(0);function q3(h,p){h=El,ee(_0,h),ee($p,p),El=h|p.baseLanes}function SS(){ee(_0,El),ee($p,$p.current)}function kS(){El=_0.current,ne($p),ne(_0)}var iu=0,on=null,ta=null,dr=null,j0=!1,Bp=!1,Wc=!1,D0=0,ax=0,Fp=null,dG=0;function Qa(){throw Error(a(321))}function NS(h,p){if(p===null)return!1;for(var g=0;g<p.length&&g<h.length;g++)if(!xi(h[g],p[g]))return!1;return!0}function CS(h,p,g,v,N,I){return iu=I,on=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,V.H=h===null||h.memoizedState===null?_j:jj,Wc=!1,I=g(v,N),Wc=!1,Bp&&(I=X3(p,g,v,N)),K3(h),I}function K3(h){V.H=O0;var p=ta!==null&&ta.next!==null;if(iu=0,dr=ta=on=null,j0=!1,ax=0,Fp=null,p)throw Error(a(300));h===null||Lr||(h=h.dependencies,h!==null&&C0(h)&&(Lr=!0))}function X3(h,p,g,v){on=h;var N=0;do{if(Bp&&(Fp=null),ax=0,Bp=!1,25<=N)throw Error(a(301));if(N+=1,dr=ta=null,h.updateQueue!=null){var I=h.updateQueue;I.lastEffect=null,I.events=null,I.stores=null,I.memoCache!=null&&(I.memoCache.index=0)}V.H=yG,I=p(g,v)}while(Bp);return I}function hG(){var h=V.H,p=h.useState()[0];return p=typeof p.then=="function"?rx(p):p,h=h.useState()[0],(ta!==null?ta.memoizedState:null)!==h&&(on.flags|=1024),p}function ES(){var h=D0!==0;return D0=0,h}function IS(h,p,g){p.updateQueue=h.updateQueue,p.flags&=-2053,h.lanes&=~g}function TS(h){if(j0){for(h=h.memoizedState;h!==null;){var p=h.queue;p!==null&&(p.pending=null),h=h.next}j0=!1}iu=0,dr=ta=on=null,Bp=!1,ax=D0=0,Fp=null}function qs(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dr===null?on.memoizedState=dr=h:dr=dr.next=h,dr}function hr(){if(ta===null){var h=on.alternate;h=h!==null?h.memoizedState:null}else h=ta.next;var p=dr===null?on.memoizedState:dr.next;if(p!==null)dr=p,ta=h;else{if(h===null)throw on.alternate===null?Error(a(467)):Error(a(310));ta=h,h={memoizedState:ta.memoizedState,baseState:ta.baseState,baseQueue:ta.baseQueue,queue:ta.queue,next:null},dr===null?on.memoizedState=dr=h:dr=dr.next=h}return dr}function AS(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rx(h){var p=ax;return ax+=1,Fp===null&&(Fp=[]),h=U3(Fp,h,p),p=on,(dr===null?p.memoizedState:dr.next)===null&&(p=p.alternate,V.H=p===null||p.memoizedState===null?_j:jj),h}function R0(h){if(h!==null&&typeof h=="object"){if(typeof h.then=="function")return rx(h);if(h.$$typeof===C)return hs(h)}throw Error(a(438,String(h)))}function _S(h){var p=null,g=on.updateQueue;if(g!==null&&(p=g.memoCache),p==null){var v=on.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(p={data:v.data.map(function(N){return N.slice()}),index:0})))}if(p==null&&(p={data:[],index:0}),g===null&&(g=AS(),on.updateQueue=g),g.memoCache=p,g=p.data[p.index],g===void 0)for(g=p.data[p.index]=Array(h),v=0;v<h;v++)g[v]=z;return p.index++,g}function vl(h,p){return typeof p=="function"?p(h):p}function M0(h){var p=hr();return jS(p,ta,h)}function jS(h,p,g){var v=h.queue;if(v===null)throw Error(a(311));v.lastRenderedReducer=g;var N=h.baseQueue,I=v.pending;if(I!==null){if(N!==null){var L=N.next;N.next=I.next,I.next=L}p.baseQueue=N=I,v.pending=null}if(I=h.baseState,N===null)h.memoizedState=I;else{p=N.next;var K=L=null,se=null,be=p,Te=!1;do{var Re=be.lane&-536870913;if(Re!==be.lane?(Cn&Re)===Re:(iu&Re)===Re){var ve=be.revertLane;if(ve===0)se!==null&&(se=se.next={lane:0,revertLane:0,action:be.action,hasEagerState:be.hasEagerState,eagerState:be.eagerState,next:null}),Re===Rp&&(Te=!0);else if((iu&ve)===ve){be=be.next,ve===Rp&&(Te=!0);continue}else Re={lane:0,revertLane:be.revertLane,action:be.action,hasEagerState:be.hasEagerState,eagerState:be.eagerState,next:null},se===null?(K=se=Re,L=I):se=se.next=Re,on.lanes|=ve,pu|=ve;Re=be.action,Wc&&g(I,Re),I=be.hasEagerState?be.eagerState:g(I,Re)}else ve={lane:Re,revertLane:be.revertLane,action:be.action,hasEagerState:be.hasEagerState,eagerState:be.eagerState,next:null},se===null?(K=se=ve,L=I):se=se.next=ve,on.lanes|=Re,pu|=Re;be=be.next}while(be!==null&&be!==p);if(se===null?L=I:se.next=K,!xi(I,h.memoizedState)&&(Lr=!0,Te&&(g=Mp,g!==null)))throw g;h.memoizedState=I,h.baseState=L,h.baseQueue=se,v.lastRenderedState=I}return N===null&&(v.lanes=0),[h.memoizedState,v.dispatch]}function DS(h){var p=hr(),g=p.queue;if(g===null)throw Error(a(311));g.lastRenderedReducer=h;var v=g.dispatch,N=g.pending,I=p.memoizedState;if(N!==null){g.pending=null;var L=N=N.next;do I=h(I,L.action),L=L.next;while(L!==N);xi(I,p.memoizedState)||(Lr=!0),p.memoizedState=I,p.baseQueue===null&&(p.baseState=I),g.lastRenderedState=I}return[I,v]}function Y3(h,p,g){var v=on,N=hr(),I=On;if(I){if(g===void 0)throw Error(a(407));g=g()}else g=p();var L=!xi((ta||N).memoizedState,g);L&&(N.memoizedState=g,Lr=!0),N=N.queue;var K=Z3.bind(null,v,N,h);if(sx(2048,8,K,[h]),N.getSnapshot!==p||L||dr!==null&&dr.memoizedState.tag&1){if(v.flags|=2048,Op(9,$0(),Q3.bind(null,v,N,g,p),null),da===null)throw Error(a(349));I||(iu&124)!==0||J3(v,p,g)}return g}function J3(h,p,g){h.flags|=16384,h={getSnapshot:p,value:g},p=on.updateQueue,p===null?(p=AS(),on.updateQueue=p,p.stores=[h]):(g=p.stores,g===null?p.stores=[h]:g.push(h))}function Q3(h,p,g,v){p.value=g,p.getSnapshot=v,ej(p)&&tj(h)}function Z3(h,p,g){return g(function(){ej(p)&&tj(h)})}function ej(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!xi(h,g)}catch{return!0}}function tj(h){var p=Ap(h,2);p!==null&&ki(p,h,2)}function RS(h){var p=qs();if(typeof h=="function"){var g=h;if(h=g(),Wc){$e(!0);try{g()}finally{$e(!1)}}}return p.memoizedState=p.baseState=h,p.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:h},p}function nj(h,p,g,v){return h.baseState=g,jS(h,ta,typeof v=="function"?v:vl)}function pG(h,p,g,v,N){if(F0(h))throw Error(a(485));if(h=p.action,h!==null){var I={payload:N,action:h,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){I.listeners.push(L)}};V.T!==null?g(!0):I.isTransition=!1,v(I),g=p.pending,g===null?(I.next=p.pending=I,aj(p,I)):(I.next=g.next,p.pending=g.next=I)}}function aj(h,p){var g=p.action,v=p.payload,N=h.state;if(p.isTransition){var I=V.T,L={};V.T=L;try{var K=g(N,v),se=V.S;se!==null&&se(L,K),rj(h,p,K)}catch(be){MS(h,p,be)}finally{V.T=I}}else try{I=g(N,v),rj(h,p,I)}catch(be){MS(h,p,be)}}function rj(h,p,g){g!==null&&typeof g=="object"&&typeof g.then=="function"?g.then(function(v){sj(h,p,v)},function(v){return MS(h,p,v)}):sj(h,p,g)}function sj(h,p,g){p.status="fulfilled",p.value=g,ij(p),h.state=g,p=h.pending,p!==null&&(g=p.next,g===p?h.pending=null:(g=g.next,p.next=g,aj(h,g)))}function MS(h,p,g){var v=h.pending;if(h.pending=null,v!==null){v=v.next;do p.status="rejected",p.reason=g,ij(p),p=p.next;while(p!==v)}h.action=null}function ij(h){h=h.listeners;for(var p=0;p<h.length;p++)(0,h[p])()}function oj(h,p){return p}function lj(h,p){if(On){var g=da.formState;if(g!==null){e:{var v=on;if(On){if(La){t:{for(var N=La,I=Fo;N.nodeType!==8;){if(!I){N=null;break t}if(N=mo(N.nextSibling),N===null){N=null;break t}}I=N.data,N=I==="F!"||I==="F"?N:null}if(N){La=mo(N.nextSibling),v=N.data==="F!";break e}}Lc(v)}v=!1}v&&(p=g[0])}}return g=qs(),g.memoizedState=g.baseState=p,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oj,lastRenderedState:p},g.queue=v,g=Ij.bind(null,on,v),v.dispatch=g,v=RS(!1),I=LS.bind(null,on,!1,v.queue),v=qs(),N={state:p,dispatch:null,action:h,pending:null},v.queue=N,g=pG.bind(null,on,N,I,g),N.dispatch=g,v.memoizedState=h,[p,g,!1]}function uj(h){var p=hr();return cj(p,ta,h)}function cj(h,p,g){if(p=jS(h,p,oj)[0],h=M0(vl)[0],typeof p=="object"&&p!==null&&typeof p.then=="function")try{var v=rx(p)}catch(L){throw L===Qg?T0:L}else v=p;p=hr();var N=p.queue,I=N.dispatch;return g!==p.memoizedState&&(on.flags|=2048,Op(9,$0(),fG.bind(null,N,g),null)),[v,I,h]}function fG(h,p){h.action=p}function dj(h){var p=hr(),g=ta;if(g!==null)return cj(p,g,h);hr(),p=p.memoizedState,g=hr();var v=g.queue.dispatch;return g.memoizedState=h,[p,v,!1]}function Op(h,p,g,v){return h={tag:h,create:g,deps:v,inst:p,next:null},p=on.updateQueue,p===null&&(p=AS(),on.updateQueue=p),g=p.lastEffect,g===null?p.lastEffect=h.next=h:(v=g.next,g.next=h,h.next=v,p.lastEffect=h),h}function $0(){return{destroy:void 0,resource:void 0}}function hj(){return hr().memoizedState}function B0(h,p,g,v){var N=qs();v=v===void 0?null:v,on.flags|=h,N.memoizedState=Op(1|p,$0(),g,v)}function sx(h,p,g,v){var N=hr();v=v===void 0?null:v;var I=N.memoizedState.inst;ta!==null&&v!==null&&NS(v,ta.memoizedState.deps)?N.memoizedState=Op(p,I,g,v):(on.flags|=h,N.memoizedState=Op(1|p,I,g,v))}function pj(h,p){B0(8390656,8,h,p)}function fj(h,p){sx(2048,8,h,p)}function mj(h,p){return sx(4,2,h,p)}function gj(h,p){return sx(4,4,h,p)}function xj(h,p){if(typeof p=="function"){h=h();var g=p(h);return function(){typeof g=="function"?g():p(null)}}if(p!=null)return h=h(),p.current=h,function(){p.current=null}}function yj(h,p,g){g=g!=null?g.concat([h]):null,sx(4,4,xj.bind(null,p,h),g)}function $S(){}function bj(h,p){var g=hr();p=p===void 0?null:p;var v=g.memoizedState;return p!==null&&NS(p,v[1])?v[0]:(g.memoizedState=[h,p],h)}function vj(h,p){var g=hr();p=p===void 0?null:p;var v=g.memoizedState;if(p!==null&&NS(p,v[1]))return v[0];if(v=h(),Wc){$e(!0);try{h()}finally{$e(!1)}}return g.memoizedState=[v,p],v}function BS(h,p,g){return g===void 0||(iu&1073741824)!==0?h.memoizedState=p:(h.memoizedState=g,h=kD(),on.lanes|=h,pu|=h,g)}function wj(h,p,g,v){return xi(g,p)?g:$p.current!==null?(h=BS(h,g,v),xi(h,p)||(Lr=!0),h):(iu&42)===0?(Lr=!0,h.memoizedState=g):(h=kD(),on.lanes|=h,pu|=h,p)}function Sj(h,p,g,v,N){var I=Q.p;Q.p=I!==0&&8>I?I:8;var L=V.T,K={};V.T=K,LS(h,!1,p,g);try{var se=N(),be=V.S;if(be!==null&&be(K,se),se!==null&&typeof se=="object"&&typeof se.then=="function"){var Te=cG(se,v);ix(h,p,Te,Si(h))}else ix(h,p,v,Si(h))}catch(Re){ix(h,p,{then:function(){},status:"rejected",reason:Re},Si())}finally{Q.p=I,V.T=L}}function mG(){}function FS(h,p,g,v){if(h.tag!==5)throw Error(a(476));var N=kj(h).queue;Sj(h,N,p,F,g===null?mG:function(){return Nj(h),g(v)})}function kj(h){var p=h.memoizedState;if(p!==null)return p;p={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:F},next:null};var g={};return p.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:g},next:null},h.memoizedState=p,h=h.alternate,h!==null&&(h.memoizedState=p),p}function Nj(h){var p=kj(h).next.queue;ix(h,p,{},Si())}function OS(){return hs(Nx)}function Cj(){return hr().memoizedState}function Ej(){return hr().memoizedState}function gG(h){for(var p=h.return;p!==null;){switch(p.tag){case 24:case 3:var g=Si();h=ru(g);var v=su(p,h,g);v!==null&&(ki(v,p,g),ex(v,p,g)),p={cache:fS()},h.payload=p;return}p=p.return}}function xG(h,p,g){var v=Si();g={lane:v,revertLane:0,action:g,hasEagerState:!1,eagerState:null,next:null},F0(h)?Tj(p,g):(g=rS(h,p,g,v),g!==null&&(ki(g,h,v),Aj(g,p,v)))}function Ij(h,p,g){var v=Si();ix(h,p,g,v)}function ix(h,p,g,v){var N={lane:v,revertLane:0,action:g,hasEagerState:!1,eagerState:null,next:null};if(F0(h))Tj(p,N);else{var I=h.alternate;if(h.lanes===0&&(I===null||I.lanes===0)&&(I=p.lastRenderedReducer,I!==null))try{var L=p.lastRenderedState,K=I(L,g);if(N.hasEagerState=!0,N.eagerState=K,xi(K,L))return v0(h,p,N,0),da===null&&b0(),!1}catch{}if(g=rS(h,p,N,v),g!==null)return ki(g,h,v),Aj(g,p,v),!0}return!1}function LS(h,p,g,v){if(v={lane:2,revertLane:xk(),action:v,hasEagerState:!1,eagerState:null,next:null},F0(h)){if(p)throw Error(a(479))}else p=rS(h,g,v,2),p!==null&&ki(p,h,2)}function F0(h){var p=h.alternate;return h===on||p!==null&&p===on}function Tj(h,p){Bp=j0=!0;var g=h.pending;g===null?p.next=p:(p.next=g.next,g.next=p),h.pending=p}function Aj(h,p,g){if((g&4194048)!==0){var v=p.lanes;v&=h.pendingLanes,g|=v,p.lanes=g,fi(h,g)}}var O0={readContext:hs,use:R0,useCallback:Qa,useContext:Qa,useEffect:Qa,useImperativeHandle:Qa,useLayoutEffect:Qa,useInsertionEffect:Qa,useMemo:Qa,useReducer:Qa,useRef:Qa,useState:Qa,useDebugValue:Qa,useDeferredValue:Qa,useTransition:Qa,useSyncExternalStore:Qa,useId:Qa,useHostTransitionStatus:Qa,useFormState:Qa,useActionState:Qa,useOptimistic:Qa,useMemoCache:Qa,useCacheRefresh:Qa},_j={readContext:hs,use:R0,useCallback:function(h,p){return qs().memoizedState=[h,p===void 0?null:p],h},useContext:hs,useEffect:pj,useImperativeHandle:function(h,p,g){g=g!=null?g.concat([h]):null,B0(4194308,4,xj.bind(null,p,h),g)},useLayoutEffect:function(h,p){return B0(4194308,4,h,p)},useInsertionEffect:function(h,p){B0(4,2,h,p)},useMemo:function(h,p){var g=qs();p=p===void 0?null:p;var v=h();if(Wc){$e(!0);try{h()}finally{$e(!1)}}return g.memoizedState=[v,p],v},useReducer:function(h,p,g){var v=qs();if(g!==void 0){var N=g(p);if(Wc){$e(!0);try{g(p)}finally{$e(!1)}}}else N=p;return v.memoizedState=v.baseState=N,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:N},v.queue=h,h=h.dispatch=xG.bind(null,on,h),[v.memoizedState,h]},useRef:function(h){var p=qs();return h={current:h},p.memoizedState=h},useState:function(h){h=RS(h);var p=h.queue,g=Ij.bind(null,on,p);return p.dispatch=g,[h.memoizedState,g]},useDebugValue:$S,useDeferredValue:function(h,p){var g=qs();return BS(g,h,p)},useTransition:function(){var h=RS(!1);return h=Sj.bind(null,on,h.queue,!0,!1),qs().memoizedState=h,[!1,h]},useSyncExternalStore:function(h,p,g){var v=on,N=qs();if(On){if(g===void 0)throw Error(a(407));g=g()}else{if(g=p(),da===null)throw Error(a(349));(Cn&124)!==0||J3(v,p,g)}N.memoizedState=g;var I={value:g,getSnapshot:p};return N.queue=I,pj(Z3.bind(null,v,I,h),[h]),v.flags|=2048,Op(9,$0(),Q3.bind(null,v,I,g,p),null),g},useId:function(){var h=qs(),p=da.identifierPrefix;if(On){var g=xl,v=gl;g=(v&~(1<<32-Ue(v)-1)).toString(32)+g,p="«"+p+"R"+g,g=D0++,0<g&&(p+="H"+g.toString(32)),p+="»"}else g=dG++,p="«"+p+"r"+g.toString(32)+"»";return h.memoizedState=p},useHostTransitionStatus:OS,useFormState:lj,useActionState:lj,useOptimistic:function(h){var p=qs();p.memoizedState=p.baseState=h;var g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return p.queue=g,p=LS.bind(null,on,!0,g),g.dispatch=p,[h,p]},useMemoCache:_S,useCacheRefresh:function(){return qs().memoizedState=gG.bind(null,on)}},jj={readContext:hs,use:R0,useCallback:bj,useContext:hs,useEffect:fj,useImperativeHandle:yj,useInsertionEffect:mj,useLayoutEffect:gj,useMemo:vj,useReducer:M0,useRef:hj,useState:function(){return M0(vl)},useDebugValue:$S,useDeferredValue:function(h,p){var g=hr();return wj(g,ta.memoizedState,h,p)},useTransition:function(){var h=M0(vl)[0],p=hr().memoizedState;return[typeof h=="boolean"?h:rx(h),p]},useSyncExternalStore:Y3,useId:Cj,useHostTransitionStatus:OS,useFormState:uj,useActionState:uj,useOptimistic:function(h,p){var g=hr();return nj(g,ta,h,p)},useMemoCache:_S,useCacheRefresh:Ej},yG={readContext:hs,use:R0,useCallback:bj,useContext:hs,useEffect:fj,useImperativeHandle:yj,useInsertionEffect:mj,useLayoutEffect:gj,useMemo:vj,useReducer:DS,useRef:hj,useState:function(){return DS(vl)},useDebugValue:$S,useDeferredValue:function(h,p){var g=hr();return ta===null?BS(g,h,p):wj(g,ta.memoizedState,h,p)},useTransition:function(){var h=DS(vl)[0],p=hr().memoizedState;return[typeof h=="boolean"?h:rx(h),p]},useSyncExternalStore:Y3,useId:Cj,useHostTransitionStatus:OS,useFormState:dj,useActionState:dj,useOptimistic:function(h,p){var g=hr();return ta!==null?nj(g,ta,h,p):(g.baseState=h,[h,g.queue.dispatch])},useMemoCache:_S,useCacheRefresh:Ej},Lp=null,ox=0;function L0(h){var p=ox;return ox+=1,Lp===null&&(Lp=[]),U3(Lp,h,p)}function lx(h,p){p=p.props.ref,h.ref=p!==void 0?p:null}function P0(h,p){throw p.$$typeof===f?Error(a(525)):(h=Object.prototype.toString.call(p),Error(a(31,h==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":h)))}function Dj(h){var p=h._init;return p(h._payload)}function Rj(h){function p(me,de){if(h){var ye=me.deletions;ye===null?(me.deletions=[de],me.flags|=16):ye.push(de)}}function g(me,de){if(!h)return null;for(;de!==null;)p(me,de),de=de.sibling;return null}function v(me){for(var de=new Map;me!==null;)me.key!==null?de.set(me.key,me):de.set(me.index,me),me=me.sibling;return de}function N(me,de){return me=ml(me,de),me.index=0,me.sibling=null,me}function I(me,de,ye){return me.index=ye,h?(ye=me.alternate,ye!==null?(ye=ye.index,ye<de?(me.flags|=67108866,de):ye):(me.flags|=67108866,de)):(me.flags|=1048576,de)}function L(me){return h&&me.alternate===null&&(me.flags|=67108866),me}function K(me,de,ye,je){return de===null||de.tag!==6?(de=iS(ye,me.mode,je),de.return=me,de):(de=N(de,ye),de.return=me,de)}function se(me,de,ye,je){var wt=ye.type;return wt===y?Te(me,de,ye.props.children,je,ye.key):de!==null&&(de.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===$&&Dj(wt)===de.type)?(de=N(de,ye.props),lx(de,ye),de.return=me,de):(de=S0(ye.type,ye.key,ye.props,null,me.mode,je),lx(de,ye),de.return=me,de)}function be(me,de,ye,je){return de===null||de.tag!==4||de.stateNode.containerInfo!==ye.containerInfo||de.stateNode.implementation!==ye.implementation?(de=oS(ye,me.mode,je),de.return=me,de):(de=N(de,ye.children||[]),de.return=me,de)}function Te(me,de,ye,je,wt){return de===null||de.tag!==7?(de=$c(ye,me.mode,je,wt),de.return=me,de):(de=N(de,ye),de.return=me,de)}function Re(me,de,ye){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return de=iS(""+de,me.mode,ye),de.return=me,de;if(typeof de=="object"&&de!==null){switch(de.$$typeof){case m:return ye=S0(de.type,de.key,de.props,null,me.mode,ye),lx(ye,de),ye.return=me,ye;case x:return de=oS(de,me.mode,ye),de.return=me,de;case $:var je=de._init;return de=je(de._payload),Re(me,de,ye)}if(J(de)||j(de))return de=$c(de,me.mode,ye,null),de.return=me,de;if(typeof de.then=="function")return Re(me,L0(de),ye);if(de.$$typeof===C)return Re(me,E0(me,de),ye);P0(me,de)}return null}function ve(me,de,ye,je){var wt=de!==null?de.key:null;if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return wt!==null?null:K(me,de,""+ye,je);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case m:return ye.key===wt?se(me,de,ye,je):null;case x:return ye.key===wt?be(me,de,ye,je):null;case $:return wt=ye._init,ye=wt(ye._payload),ve(me,de,ye,je)}if(J(ye)||j(ye))return wt!==null?null:Te(me,de,ye,je,null);if(typeof ye.then=="function")return ve(me,de,L0(ye),je);if(ye.$$typeof===C)return ve(me,de,E0(me,ye),je);P0(me,ye)}return null}function Se(me,de,ye,je,wt){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return me=me.get(ye)||null,K(de,me,""+je,wt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case m:return me=me.get(je.key===null?ye:je.key)||null,se(de,me,je,wt);case x:return me=me.get(je.key===null?ye:je.key)||null,be(de,me,je,wt);case $:var cn=je._init;return je=cn(je._payload),Se(me,de,ye,je,wt)}if(J(je)||j(je))return me=me.get(ye)||null,Te(de,me,je,wt,null);if(typeof je.then=="function")return Se(me,de,ye,L0(je),wt);if(je.$$typeof===C)return Se(me,de,ye,E0(de,je),wt);P0(de,je)}return null}function Ht(me,de,ye,je){for(var wt=null,cn=null,jt=de,Ot=de=0,zr=null;jt!==null&&Ot<ye.length;Ot++){jt.index>Ot?(zr=jt,jt=null):zr=jt.sibling;var $n=ve(me,jt,ye[Ot],je);if($n===null){jt===null&&(jt=zr);break}h&&jt&&$n.alternate===null&&p(me,jt),de=I($n,de,Ot),cn===null?wt=$n:cn.sibling=$n,cn=$n,jt=zr}if(Ot===ye.length)return g(me,jt),On&&Fc(me,Ot),wt;if(jt===null){for(;Ot<ye.length;Ot++)jt=Re(me,ye[Ot],je),jt!==null&&(de=I(jt,de,Ot),cn===null?wt=jt:cn.sibling=jt,cn=jt);return On&&Fc(me,Ot),wt}for(jt=v(jt);Ot<ye.length;Ot++)zr=Se(jt,me,Ot,ye[Ot],je),zr!==null&&(h&&zr.alternate!==null&&jt.delete(zr.key===null?Ot:zr.key),de=I(zr,de,Ot),cn===null?wt=zr:cn.sibling=zr,cn=zr);return h&&jt.forEach(function(Su){return p(me,Su)}),On&&Fc(me,Ot),wt}function Bt(me,de,ye,je){if(ye==null)throw Error(a(151));for(var wt=null,cn=null,jt=de,Ot=de=0,zr=null,$n=ye.next();jt!==null&&!$n.done;Ot++,$n=ye.next()){jt.index>Ot?(zr=jt,jt=null):zr=jt.sibling;var Su=ve(me,jt,$n.value,je);if(Su===null){jt===null&&(jt=zr);break}h&&jt&&Su.alternate===null&&p(me,jt),de=I(Su,de,Ot),cn===null?wt=Su:cn.sibling=Su,cn=Su,jt=zr}if($n.done)return g(me,jt),On&&Fc(me,Ot),wt;if(jt===null){for(;!$n.done;Ot++,$n=ye.next())$n=Re(me,$n.value,je),$n!==null&&(de=I($n,de,Ot),cn===null?wt=$n:cn.sibling=$n,cn=$n);return On&&Fc(me,Ot),wt}for(jt=v(jt);!$n.done;Ot++,$n=ye.next())$n=Se(jt,me,Ot,$n.value,je),$n!==null&&(h&&$n.alternate!==null&&jt.delete($n.key===null?Ot:$n.key),de=I($n,de,Ot),cn===null?wt=$n:cn.sibling=$n,cn=$n);return h&&jt.forEach(function(bq){return p(me,bq)}),On&&Fc(me,Ot),wt}function aa(me,de,ye,je){if(typeof ye=="object"&&ye!==null&&ye.type===y&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case m:e:{for(var wt=ye.key;de!==null;){if(de.key===wt){if(wt=ye.type,wt===y){if(de.tag===7){g(me,de.sibling),je=N(de,ye.props.children),je.return=me,me=je;break e}}else if(de.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===$&&Dj(wt)===de.type){g(me,de.sibling),je=N(de,ye.props),lx(je,ye),je.return=me,me=je;break e}g(me,de);break}else p(me,de);de=de.sibling}ye.type===y?(je=$c(ye.props.children,me.mode,je,ye.key),je.return=me,me=je):(je=S0(ye.type,ye.key,ye.props,null,me.mode,je),lx(je,ye),je.return=me,me=je)}return L(me);case x:e:{for(wt=ye.key;de!==null;){if(de.key===wt)if(de.tag===4&&de.stateNode.containerInfo===ye.containerInfo&&de.stateNode.implementation===ye.implementation){g(me,de.sibling),je=N(de,ye.children||[]),je.return=me,me=je;break e}else{g(me,de);break}else p(me,de);de=de.sibling}je=oS(ye,me.mode,je),je.return=me,me=je}return L(me);case $:return wt=ye._init,ye=wt(ye._payload),aa(me,de,ye,je)}if(J(ye))return Ht(me,de,ye,je);if(j(ye)){if(wt=j(ye),typeof wt!="function")throw Error(a(150));return ye=wt.call(ye),Bt(me,de,ye,je)}if(typeof ye.then=="function")return aa(me,de,L0(ye),je);if(ye.$$typeof===C)return aa(me,de,E0(me,ye),je);P0(me,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,de!==null&&de.tag===6?(g(me,de.sibling),je=N(de,ye),je.return=me,me=je):(g(me,de),je=iS(ye,me.mode,je),je.return=me,me=je),L(me)):g(me,de)}return function(me,de,ye,je){try{ox=0;var wt=aa(me,de,ye,je);return Lp=null,wt}catch(jt){if(jt===Qg||jt===T0)throw jt;var cn=yi(29,jt,null,me.mode);return cn.lanes=je,cn.return=me,cn}}}var Pp=Rj(!0),Mj=Rj(!1),Vi=Y(null),Oo=null;function ou(h){var p=h.alternate;ee(Cr,Cr.current&1),ee(Vi,h),Oo===null&&(p===null||$p.current!==null||p.memoizedState!==null)&&(Oo=h)}function $j(h){if(h.tag===22){if(ee(Cr,Cr.current),ee(Vi,h),Oo===null){var p=h.alternate;p!==null&&p.memoizedState!==null&&(Oo=h)}}else lu()}function lu(){ee(Cr,Cr.current),ee(Vi,Vi.current)}function wl(h){ne(Vi),Oo===h&&(Oo=null),ne(Cr)}var Cr=Y(0);function z0(h){for(var p=h;p!==null;){if(p.tag===13){var g=p.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||Ak(g)))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===h)break;for(;p.sibling===null;){if(p.return===null||p.return===h)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}function PS(h,p,g,v){p=h.memoizedState,g=g(v,p),g=g==null?p:c({},p,g),h.memoizedState=g,h.lanes===0&&(h.updateQueue.baseState=g)}var zS={enqueueSetState:function(h,p,g){h=h._reactInternals;var v=Si(),N=ru(v);N.payload=p,g!=null&&(N.callback=g),p=su(h,N,v),p!==null&&(ki(p,h,v),ex(p,h,v))},enqueueReplaceState:function(h,p,g){h=h._reactInternals;var v=Si(),N=ru(v);N.tag=1,N.payload=p,g!=null&&(N.callback=g),p=su(h,N,v),p!==null&&(ki(p,h,v),ex(p,h,v))},enqueueForceUpdate:function(h,p){h=h._reactInternals;var g=Si(),v=ru(g);v.tag=2,p!=null&&(v.callback=p),p=su(h,v,g),p!==null&&(ki(p,h,g),ex(p,h,g))}};function Bj(h,p,g,v,N,I,L){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(v,I,L):p.prototype&&p.prototype.isPureReactComponent?!Vg(g,v)||!Vg(N,I):!0}function Fj(h,p,g,v){h=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(g,v),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(g,v),p.state!==h&&zS.enqueueReplaceState(p,p.state,null)}function Vc(h,p){var g=p;if("ref"in p){g={};for(var v in p)v!=="ref"&&(g[v]=p[v])}if(h=h.defaultProps){g===p&&(g=c({},g));for(var N in h)g[N]===void 0&&(g[N]=h[N])}return g}var U0=typeof reportError=="function"?reportError:function(h){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof h=="object"&&h!==null&&typeof h.message=="string"?String(h.message):String(h),error:h});if(!window.dispatchEvent(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",h);return}console.error(h)};function Oj(h){U0(h)}function Lj(h){console.error(h)}function Pj(h){U0(h)}function W0(h,p){try{var g=h.onUncaughtError;g(p.value,{componentStack:p.stack})}catch(v){setTimeout(function(){throw v})}}function zj(h,p,g){try{var v=h.onCaughtError;v(g.value,{componentStack:g.stack,errorBoundary:p.tag===1?p.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function US(h,p,g){return g=ru(g),g.tag=3,g.payload={element:null},g.callback=function(){W0(h,p)},g}function Uj(h){return h=ru(h),h.tag=3,h}function Wj(h,p,g,v){var N=g.type.getDerivedStateFromError;if(typeof N=="function"){var I=v.value;h.payload=function(){return N(I)},h.callback=function(){zj(p,g,v)}}var L=g.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(h.callback=function(){zj(p,g,v),typeof N!="function"&&(fu===null?fu=new Set([this]):fu.add(this));var K=v.stack;this.componentDidCatch(v.value,{componentStack:K!==null?K:""})})}function bG(h,p,g,v,N){if(g.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(p=g.alternate,p!==null&&Xg(p,g,N,!0),g=Vi.current,g!==null){switch(g.tag){case 13:return Oo===null?hk():g.alternate===null&&Pa===0&&(Pa=3),g.flags&=-257,g.flags|=65536,g.lanes=N,v===xS?g.flags|=16384:(p=g.updateQueue,p===null?g.updateQueue=new Set([v]):p.add(v),fk(h,v,N)),!1;case 22:return g.flags|=65536,v===xS?g.flags|=16384:(p=g.updateQueue,p===null?(p={transitions:null,markerInstances:null,retryQueue:new Set([v])},g.updateQueue=p):(g=p.retryQueue,g===null?p.retryQueue=new Set([v]):g.add(v)),fk(h,v,N)),!1}throw Error(a(435,g.tag))}return fk(h,v,N),hk(),!1}if(On)return p=Vi.current,p!==null?((p.flags&65536)===0&&(p.flags|=256),p.flags|=65536,p.lanes=N,v!==cS&&(h=Error(a(422),{cause:v}),Kg(Pi(h,g)))):(v!==cS&&(p=Error(a(423),{cause:v}),Kg(Pi(p,g))),h=h.current.alternate,h.flags|=65536,N&=-N,h.lanes|=N,v=Pi(v,g),N=US(h.stateNode,v,N),vS(h,N),Pa!==4&&(Pa=2)),!1;var I=Error(a(520),{cause:v});if(I=Pi(I,g),mx===null?mx=[I]:mx.push(I),Pa!==4&&(Pa=2),p===null)return!0;v=Pi(v,g),g=p;do{switch(g.tag){case 3:return g.flags|=65536,h=N&-N,g.lanes|=h,h=US(g.stateNode,v,h),vS(g,h),!1;case 1:if(p=g.type,I=g.stateNode,(g.flags&128)===0&&(typeof p.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(fu===null||!fu.has(I))))return g.flags|=65536,N&=-N,g.lanes|=N,N=Uj(N),Wj(N,h,g,v),vS(g,N),!1}g=g.return}while(g!==null);return!1}var Vj=Error(a(461)),Lr=!1;function Yr(h,p,g,v){p.child=h===null?Mj(p,null,g,v):Pp(p,h.child,g,v)}function Hj(h,p,g,v,N){g=g.render;var I=p.ref;if("ref"in v){var L={};for(var K in v)K!=="ref"&&(L[K]=v[K])}else L=v;return zc(p),v=CS(h,p,g,L,I,N),K=ES(),h!==null&&!Lr?(IS(h,p,N),Sl(h,p,N)):(On&&K&&lS(p),p.flags|=1,Yr(h,p,v,N),p.child)}function Gj(h,p,g,v,N){if(h===null){var I=g.type;return typeof I=="function"&&!sS(I)&&I.defaultProps===void 0&&g.compare===null?(p.tag=15,p.type=I,qj(h,p,I,v,N)):(h=S0(g.type,null,v,p,p.mode,N),h.ref=p.ref,h.return=p,p.child=h)}if(I=h.child,!YS(h,N)){var L=I.memoizedProps;if(g=g.compare,g=g!==null?g:Vg,g(L,v)&&h.ref===p.ref)return Sl(h,p,N)}return p.flags|=1,h=ml(I,v),h.ref=p.ref,h.return=p,p.child=h}function qj(h,p,g,v,N){if(h!==null){var I=h.memoizedProps;if(Vg(I,v)&&h.ref===p.ref)if(Lr=!1,p.pendingProps=v=I,YS(h,N))(h.flags&131072)!==0&&(Lr=!0);else return p.lanes=h.lanes,Sl(h,p,N)}return WS(h,p,g,v,N)}function Kj(h,p,g){var v=p.pendingProps,N=v.children,I=h!==null?h.memoizedState:null;if(v.mode==="hidden"){if((p.flags&128)!==0){if(v=I!==null?I.baseLanes|g:g,h!==null){for(N=p.child=h.child,I=0;N!==null;)I=I|N.lanes|N.childLanes,N=N.sibling;p.childLanes=I&~v}else p.childLanes=0,p.child=null;return Xj(h,p,v,g)}if((g&536870912)!==0)p.memoizedState={baseLanes:0,cachePool:null},h!==null&&I0(p,I!==null?I.cachePool:null),I!==null?q3(p,I):SS(),$j(p);else return p.lanes=p.childLanes=536870912,Xj(h,p,I!==null?I.baseLanes|g:g,g)}else I!==null?(I0(p,I.cachePool),q3(p,I),lu(),p.memoizedState=null):(h!==null&&I0(p,null),SS(),lu());return Yr(h,p,N,g),p.child}function Xj(h,p,g,v){var N=gS();return N=N===null?null:{parent:Nr._currentValue,pool:N},p.memoizedState={baseLanes:g,cachePool:N},h!==null&&I0(p,null),SS(),$j(p),h!==null&&Xg(h,p,v,!0),null}function V0(h,p){var g=p.ref;if(g===null)h!==null&&h.ref!==null&&(p.flags|=4194816);else{if(typeof g!="function"&&typeof g!="object")throw Error(a(284));(h===null||h.ref!==g)&&(p.flags|=4194816)}}function WS(h,p,g,v,N){return zc(p),g=CS(h,p,g,v,void 0,N),v=ES(),h!==null&&!Lr?(IS(h,p,N),Sl(h,p,N)):(On&&v&&lS(p),p.flags|=1,Yr(h,p,g,N),p.child)}function Yj(h,p,g,v,N,I){return zc(p),p.updateQueue=null,g=X3(p,v,g,N),K3(h),v=ES(),h!==null&&!Lr?(IS(h,p,I),Sl(h,p,I)):(On&&v&&lS(p),p.flags|=1,Yr(h,p,g,I),p.child)}function Jj(h,p,g,v,N){if(zc(p),p.stateNode===null){var I=_p,L=g.contextType;typeof L=="object"&&L!==null&&(I=hs(L)),I=new g(v,I),p.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,I.updater=zS,p.stateNode=I,I._reactInternals=p,I=p.stateNode,I.props=v,I.state=p.memoizedState,I.refs={},yS(p),L=g.contextType,I.context=typeof L=="object"&&L!==null?hs(L):_p,I.state=p.memoizedState,L=g.getDerivedStateFromProps,typeof L=="function"&&(PS(p,g,L,v),I.state=p.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(L=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),L!==I.state&&zS.enqueueReplaceState(I,I.state,null),nx(p,v,I,N),tx(),I.state=p.memoizedState),typeof I.componentDidMount=="function"&&(p.flags|=4194308),v=!0}else if(h===null){I=p.stateNode;var K=p.memoizedProps,se=Vc(g,K);I.props=se;var be=I.context,Te=g.contextType;L=_p,typeof Te=="object"&&Te!==null&&(L=hs(Te));var Re=g.getDerivedStateFromProps;Te=typeof Re=="function"||typeof I.getSnapshotBeforeUpdate=="function",K=p.pendingProps!==K,Te||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(K||be!==L)&&Fj(p,I,v,L),au=!1;var ve=p.memoizedState;I.state=ve,nx(p,v,I,N),tx(),be=p.memoizedState,K||ve!==be||au?(typeof Re=="function"&&(PS(p,g,Re,v),be=p.memoizedState),(se=au||Bj(p,g,se,v,ve,be,L))?(Te||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount()),typeof I.componentDidMount=="function"&&(p.flags|=4194308)):(typeof I.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=v,p.memoizedState=be),I.props=v,I.state=be,I.context=L,v=se):(typeof I.componentDidMount=="function"&&(p.flags|=4194308),v=!1)}else{I=p.stateNode,bS(h,p),L=p.memoizedProps,Te=Vc(g,L),I.props=Te,Re=p.pendingProps,ve=I.context,be=g.contextType,se=_p,typeof be=="object"&&be!==null&&(se=hs(be)),K=g.getDerivedStateFromProps,(be=typeof K=="function"||typeof I.getSnapshotBeforeUpdate=="function")||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(L!==Re||ve!==se)&&Fj(p,I,v,se),au=!1,ve=p.memoizedState,I.state=ve,nx(p,v,I,N),tx();var Se=p.memoizedState;L!==Re||ve!==Se||au||h!==null&&h.dependencies!==null&&C0(h.dependencies)?(typeof K=="function"&&(PS(p,g,K,v),Se=p.memoizedState),(Te=au||Bj(p,g,Te,v,ve,Se,se)||h!==null&&h.dependencies!==null&&C0(h.dependencies))?(be||typeof I.UNSAFE_componentWillUpdate!="function"&&typeof I.componentWillUpdate!="function"||(typeof I.componentWillUpdate=="function"&&I.componentWillUpdate(v,Se,se),typeof I.UNSAFE_componentWillUpdate=="function"&&I.UNSAFE_componentWillUpdate(v,Se,se)),typeof I.componentDidUpdate=="function"&&(p.flags|=4),typeof I.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof I.componentDidUpdate!="function"||L===h.memoizedProps&&ve===h.memoizedState||(p.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||L===h.memoizedProps&&ve===h.memoizedState||(p.flags|=1024),p.memoizedProps=v,p.memoizedState=Se),I.props=v,I.state=Se,I.context=se,v=Te):(typeof I.componentDidUpdate!="function"||L===h.memoizedProps&&ve===h.memoizedState||(p.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||L===h.memoizedProps&&ve===h.memoizedState||(p.flags|=1024),v=!1)}return I=v,V0(h,p),v=(p.flags&128)!==0,I||v?(I=p.stateNode,g=v&&typeof g.getDerivedStateFromError!="function"?null:I.render(),p.flags|=1,h!==null&&v?(p.child=Pp(p,h.child,null,N),p.child=Pp(p,null,g,N)):Yr(h,p,g,N),p.memoizedState=I.state,h=p.child):h=Sl(h,p,N),h}function Qj(h,p,g,v){return qg(),p.flags|=256,Yr(h,p,g,v),p.child}var VS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function HS(h){return{baseLanes:h,cachePool:L3()}}function GS(h,p,g){return h=h!==null?h.childLanes&~g:0,p&&(h|=Hi),h}function Zj(h,p,g){var v=p.pendingProps,N=!1,I=(p.flags&128)!==0,L;if((L=I)||(L=h!==null&&h.memoizedState===null?!1:(Cr.current&2)!==0),L&&(N=!0,p.flags&=-129),L=(p.flags&32)!==0,p.flags&=-33,h===null){if(On){if(N?ou(p):lu(),On){var K=La,se;if(se=K){e:{for(se=K,K=Fo;se.nodeType!==8;){if(!K){K=null;break e}if(se=mo(se.nextSibling),se===null){K=null;break e}}K=se}K!==null?(p.memoizedState={dehydrated:K,treeContext:Bc!==null?{id:gl,overflow:xl}:null,retryLane:536870912,hydrationErrors:null},se=yi(18,null,null,0),se.stateNode=K,se.return=p,p.child=se,js=p,La=null,se=!0):se=!1}se||Lc(p)}if(K=p.memoizedState,K!==null&&(K=K.dehydrated,K!==null))return Ak(K)?p.lanes=32:p.lanes=536870912,null;wl(p)}return K=v.children,v=v.fallback,N?(lu(),N=p.mode,K=H0({mode:"hidden",children:K},N),v=$c(v,N,g,null),K.return=p,v.return=p,K.sibling=v,p.child=K,N=p.child,N.memoizedState=HS(g),N.childLanes=GS(h,L,g),p.memoizedState=VS,v):(ou(p),qS(p,K))}if(se=h.memoizedState,se!==null&&(K=se.dehydrated,K!==null)){if(I)p.flags&256?(ou(p),p.flags&=-257,p=KS(h,p,g)):p.memoizedState!==null?(lu(),p.child=h.child,p.flags|=128,p=null):(lu(),N=v.fallback,K=p.mode,v=H0({mode:"visible",children:v.children},K),N=$c(N,K,g,null),N.flags|=2,v.return=p,N.return=p,v.sibling=N,p.child=v,Pp(p,h.child,null,g),v=p.child,v.memoizedState=HS(g),v.childLanes=GS(h,L,g),p.memoizedState=VS,p=N);else if(ou(p),Ak(K)){if(L=K.nextSibling&&K.nextSibling.dataset,L)var be=L.dgst;L=be,v=Error(a(419)),v.stack="",v.digest=L,Kg({value:v,source:null,stack:null}),p=KS(h,p,g)}else if(Lr||Xg(h,p,g,!1),L=(g&h.childLanes)!==0,Lr||L){if(L=da,L!==null&&(v=g&-g,v=(v&42)!==0?1:we(v),v=(v&(L.suspendedLanes|g))!==0?0:v,v!==0&&v!==se.retryLane))throw se.retryLane=v,Ap(h,v),ki(L,h,v),Vj;K.data==="$?"||hk(),p=KS(h,p,g)}else K.data==="$?"?(p.flags|=192,p.child=h.child,p=null):(h=se.treeContext,La=mo(K.nextSibling),js=p,On=!0,Oc=null,Fo=!1,h!==null&&(Ui[Wi++]=gl,Ui[Wi++]=xl,Ui[Wi++]=Bc,gl=h.id,xl=h.overflow,Bc=p),p=qS(p,v.children),p.flags|=4096);return p}return N?(lu(),N=v.fallback,K=p.mode,se=h.child,be=se.sibling,v=ml(se,{mode:"hidden",children:v.children}),v.subtreeFlags=se.subtreeFlags&65011712,be!==null?N=ml(be,N):(N=$c(N,K,g,null),N.flags|=2),N.return=p,v.return=p,v.sibling=N,p.child=v,v=N,N=p.child,K=h.child.memoizedState,K===null?K=HS(g):(se=K.cachePool,se!==null?(be=Nr._currentValue,se=se.parent!==be?{parent:be,pool:be}:se):se=L3(),K={baseLanes:K.baseLanes|g,cachePool:se}),N.memoizedState=K,N.childLanes=GS(h,L,g),p.memoizedState=VS,v):(ou(p),g=h.child,h=g.sibling,g=ml(g,{mode:"visible",children:v.children}),g.return=p,g.sibling=null,h!==null&&(L=p.deletions,L===null?(p.deletions=[h],p.flags|=16):L.push(h)),p.child=g,p.memoizedState=null,g)}function qS(h,p){return p=H0({mode:"visible",children:p},h.mode),p.return=h,h.child=p}function H0(h,p){return h=yi(22,h,null,p),h.lanes=0,h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},h}function KS(h,p,g){return Pp(p,h.child,null,g),h=qS(p,p.pendingProps.children),h.flags|=2,p.memoizedState=null,h}function eD(h,p,g){h.lanes|=p;var v=h.alternate;v!==null&&(v.lanes|=p),hS(h.return,p,g)}function XS(h,p,g,v,N){var I=h.memoizedState;I===null?h.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:v,tail:g,tailMode:N}:(I.isBackwards=p,I.rendering=null,I.renderingStartTime=0,I.last=v,I.tail=g,I.tailMode=N)}function tD(h,p,g){var v=p.pendingProps,N=v.revealOrder,I=v.tail;if(Yr(h,p,v.children,g),v=Cr.current,(v&2)!==0)v=v&1|2,p.flags|=128;else{if(h!==null&&(h.flags&128)!==0)e:for(h=p.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&eD(h,g,p);else if(h.tag===19)eD(h,g,p);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===p)break e;for(;h.sibling===null;){if(h.return===null||h.return===p)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}v&=1}switch(ee(Cr,v),N){case"forwards":for(g=p.child,N=null;g!==null;)h=g.alternate,h!==null&&z0(h)===null&&(N=g),g=g.sibling;g=N,g===null?(N=p.child,p.child=null):(N=g.sibling,g.sibling=null),XS(p,!1,N,g,I);break;case"backwards":for(g=null,N=p.child,p.child=null;N!==null;){if(h=N.alternate,h!==null&&z0(h)===null){p.child=N;break}h=N.sibling,N.sibling=g,g=N,N=h}XS(p,!0,g,null,I);break;case"together":XS(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function Sl(h,p,g){if(h!==null&&(p.dependencies=h.dependencies),pu|=p.lanes,(g&p.childLanes)===0)if(h!==null){if(Xg(h,p,g,!1),(g&p.childLanes)===0)return null}else return null;if(h!==null&&p.child!==h.child)throw Error(a(153));if(p.child!==null){for(h=p.child,g=ml(h,h.pendingProps),p.child=g,g.return=p;h.sibling!==null;)h=h.sibling,g=g.sibling=ml(h,h.pendingProps),g.return=p;g.sibling=null}return p.child}
vendor: 3,531 bytes, line 8
8function YS(h,p){return(h.lanes&p)!==0?!0:(h=h.dependencies,!!(h!==null&&C0(h)))}function vG(h,p,g){switch(p.tag){case 3:xe(p,p.stateNode.containerInfo),nu(p,Nr,h.memoizedState.cache),qg();break;case 27:case 5:_e(p);break;case 4:xe(p,p.stateNode.containerInfo);break;case 10:nu(p,p.type,p.memoizedProps.value);break;case 13:var v=p.memoizedState;if(v!==null)return v.dehydrated!==null?(ou(p),p.flags|=128,null):(g&p.child.childLanes)!==0?Zj(h,p,g):(ou(p),h=Sl(h,p,g),h!==null?h.sibling:null);ou(p);break;case 19:var N=(h.flags&128)!==0;if(v=(g&p.childLanes)!==0,v||(Xg(h,p,g,!1),v=(g&p.childLanes)!==0),N){if(v)return tD(h,p,g);p.flags|=128}if(N=p.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),ee(Cr,Cr.current),v)break;return null;case 22:case 23:return p.lanes=0,Kj(h,p,g);case 24:nu(p,Nr,h.memoizedState.cache)}return Sl(h,p,g)}function nD(h,p,g){if(h!==null)if(h.memoizedProps!==p.pendingProps)Lr=!0;else{if(!YS(h,g)&&(p.flags&128)===0)return Lr=!1,vG(h,p,g);Lr=(h.flags&131072)!==0}else Lr=!1,On&&(p.flags&1048576)!==0&&D3(p,N0,p.index);switch(p.lanes=0,p.tag){case 16:e:{h=p.pendingProps;var v=p.elementType,N=v._init;if(v=N(v._payload),p.type=v,typeof v=="function")sS(v)?(h=Vc(v,h),p.tag=1,p=Jj(null,p,v,h,g)):(p.tag=0,p=WS(null,p,v,h,g));else{if(v!=null){if(N=v.$$typeof,N===E){p.tag=11,p=Hj(null,p,v,h,g);break e}else if(N===A){p.tag=14,p=Gj(null,p,v,h,g);break e}}throw p=X(v)||v,Error(a(306,p,""))}}return p;case 0:return WS(h,p,p.type,p.pendingProps,g);case 1:return v=p.type,N=Vc(v,p.pendingProps),Jj(h,p,v,N,g);case 3:e:{if(xe(p,p.stateNode.containerInfo),h===null)throw Error(a(387));v=p.pendingProps;var I=p.memoizedState;N=I.element,bS(h,p),nx(p,v,null,g);var L=p.memoizedState;if(v=L.cache,nu(p,Nr,v),v!==I.cache&&pS(p,[Nr],g,!0),tx(),v=L.element,I.isDehydrated)if(I={element:v,isDehydrated:!1,cache:L.cache},p.updateQueue.baseState=I,p.memoizedState=I,p.flags&256){p=Qj(h,p,v,g);break e}else if(v!==N){N=Pi(Error(a(424)),p),Kg(N),p=Qj(h,p,v,g);break e}else for(h=p.stateNode.containerInfo,h.nodeType===9?h=h.body:h=h.nodeName==="HTML"?h.ownerDocument.body:h,La=mo(h.firstChild),js=p,On=!0,Oc=null,Fo=!0,g=Mj(p,null,v,g),p.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(qg(),v===N){p=Sl(h,p,g);break e}Yr(h,p,v,g)}p=p.child}return p;case 26:return V0(h,p),h===null?(g=iR(p.type,null,p.pendingProps,null))?p.memoizedState=g:On||(g=p.type,h=p.pendingProps,v=s1(pe.current).createElement(g),v[$t]=p,v[It]=h,Qr(v,g,h),Rn(v),p.stateNode=v):p.memoizedState=iR(p.type,h.memoizedProps,p.pendingProps,h.memoizedState),null;case 27:return _e(p),h===null&&On&&(v=p.stateNode=aR(p.type,p.pendingProps,pe.current),js=p,Fo=!0,N=La,xu(p.type)?(_k=N,La=mo(v.firstChild)):La=N),Yr(h,p,p.pendingProps.children,g),V0(h,p),h===null&&(p.flags|=4194304),p.child;case 5:return h===null&&On&&((N=v=La)&&(v=KG(v,p.type,p.pendingProps,Fo),v!==null?(p.stateNode=v,js=p,La=mo(v.firstChild),Fo=!1,N=!0):N=!1),N||Lc(p)),_e(p),N=p.type,I=p.pendingProps,L=h!==null?h.memoizedProps:null,v=I.children,Ek(N,I)?v=null:L!==null&&Ek(N,L)&&(p.flags|=32),p.memoizedState!==null&&(N=CS(h,p,hG,null,null,g),Nx._currentValue=N),V0(h,p),Yr(h,p,v,g),p.child;case 6:return h===null&&On&&((h=g=La)&&(g=XG(g,p.pendingProps,Fo),g!==null?(p.stateNode=g,js=p,La=null,h=!0):h=!1),h||Lc(p)),null;case 13:return Zj(h,p,g);case 4:return xe(p,p.stateNode.containerInfo),v=p.pendingProps,h===null?p.child=Pp(p,null,v,g):Yr(h,p,v,g),p.child;case 11:return Hj(h,p,p.type,p.pendingProps,g);case 7:return Yr(h,p,p.pendingProps,g),p.child;
vendor: 1,130 bytes, line 8
8case 8:return Yr(h,p,p.pendingProps.children,g),p.child;case 12:return Yr(h,p,p.pendingProps.children,g),p.child;case 10:return v=p.pendingProps,nu(p,p.type,v.value),Yr(h,p,v.children,g),p.child;case 9:return N=p.type._context,v=p.pendingProps.children,zc(p),N=hs(N),v=v(N),p.flags|=1,Yr(h,p,v,g),p.child;case 14:return Gj(h,p,p.type,p.pendingProps,g);case 15:return qj(h,p,p.type,p.pendingProps,g);case 19:return tD(h,p,g);case 31:return v=p.pendingProps,g=p.mode,v={mode:v.mode,children:v.children},h===null?(g=H0(v,g),g.ref=p.ref,p.child=g,g.return=p,p=g):(g=ml(h.child,v),g.ref=p.ref,p.child=g,g.return=p,p=g),p;case 22:return Kj(h,p,g);case 24:return zc(p),v=hs(Nr),h===null?(N=gS(),N===null&&(N=da,I=fS(),N.pooledCache=I,I.refCount++,I!==null&&(N.pooledCacheLanes|=g),N=I),p.memoizedState={parent:v,cache:N},yS(p),nu(p,Nr,N)):((h.lanes&g)!==0&&(bS(h,p),nx(p,null,null,g),tx()),N=h.memoizedState,I=p.memoizedState,N.parent!==v?(N={parent:v,cache:v},p.memoizedState=N,p.lanes===0&&(p.memoizedState=p.updateQueue.baseState=N),nu(p,Nr,v)):(v=I.cache,nu(p,Nr,v),v!==N.cache&&pS(p,[Nr],g,!0))),Yr(h,p,p.pendingProps.children,g),p.
vendor: 18,960 bytes, line 8
8child;case 29:throw p.pendingProps}throw Error(a(156,p.tag))}function kl(h){h.flags|=4}function aD(h,p){if(p.type!=="stylesheet"||(p.state.loading&4)!==0)h.flags&=-16777217;else if(h.flags|=16777216,!dR(p)){if(p=Vi.current,p!==null&&((Cn&4194048)===Cn?Oo!==null:(Cn&62914560)!==Cn&&(Cn&536870912)===0||p!==Oo))throw Zg=xS,P3;h.flags|=8192}}function G0(h,p){p!==null&&(h.flags|=4),h.flags&16384&&(p=h.tag!==22?qa():536870912,h.lanes|=p,Vp|=p)}function ux(h,p){if(!On)switch(h.tailMode){case"hidden":p=h.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?h.tail=null:g.sibling=null;break;case"collapsed":g=h.tail;for(var v=null;g!==null;)g.alternate!==null&&(v=g),g=g.sibling;v===null?p||h.tail===null?h.tail=null:h.tail.sibling=null:v.sibling=null}}function Da(h){var p=h.alternate!==null&&h.alternate.child===h.child,g=0,v=0;if(p)for(var N=h.child;N!==null;)g|=N.lanes|N.childLanes,v|=N.subtreeFlags&65011712,v|=N.flags&65011712,N.return=h,N=N.sibling;else for(N=h.child;N!==null;)g|=N.lanes|N.childLanes,v|=N.subtreeFlags,v|=N.flags,N.return=h,N=N.sibling;return h.subtreeFlags|=v,h.childLanes=g,p}function wG(h,p,g){var v=p.pendingProps;switch(uS(p),p.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Da(p),null;case 1:return Da(p),null;case 3:return g=p.stateNode,v=null,h!==null&&(v=h.memoizedState.cache),p.memoizedState.cache!==v&&(p.flags|=2048),bl(Nr),Ie(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(h===null||h.child===null)&&(Gg(p)?kl(p):h===null||h.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,$3())),Da(p),null;case 26:return g=p.memoizedState,h===null?(kl(p),g!==null?(Da(p),aD(p,g)):(Da(p),p.flags&=-16777217)):g?g!==h.memoizedState?(kl(p),Da(p),aD(p,g)):(Da(p),p.flags&=-16777217):(h.memoizedProps!==v&&kl(p),Da(p),p.flags&=-16777217),null;case 27:Oe(p),g=pe.current;var N=p.type;if(h!==null&&p.stateNode!=null)h.memoizedProps!==v&&kl(p);else{if(!v){if(p.stateNode===null)throw Error(a(166));return Da(p),null}h=U.current,Gg(p)?R3(p):(h=aR(N,v,g),p.stateNode=h,kl(p))}return Da(p),null;case 5:if(Oe(p),g=p.type,h!==null&&p.stateNode!=null)h.memoizedProps!==v&&kl(p);else{if(!v){if(p.stateNode===null)throw Error(a(166));return Da(p),null}if(h=U.current,Gg(p))R3(p);else{switch(N=s1(pe.current),h){case 1:h=N.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:h=N.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":h=N.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":h=N.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":h=N.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof v.is=="string"?N.createElement("select",{is:v.is}):N.createElement("select"),v.multiple?h.multiple=!0:v.size&&(h.size=v.size);break;default:h=typeof v.is=="string"?N.createElement(g,{is:v.is}):N.createElement(g)}}h[$t]=p,h[It]=v;e:for(N=p.child;N!==null;){if(N.tag===5||N.tag===6)h.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===p)break e;for(;N.sibling===null;){if(N.return===null||N.return===p)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}p.stateNode=h;e:switch(Qr(h,g,v),g){case"button":case"input":case"select":case"textarea":h=!!v.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&kl(p)}}return Da(p),p.flags&=-16777217,null;case 6:if(h&&p.stateNode!=null)h.memoizedProps!==v&&kl(p);else{if(typeof v!="string"&&p.stateNode===null)throw Error(a(166));if(h=pe.current,Gg(p)){if(h=p.stateNode,g=p.memoizedProps,v=null,N=js,N!==null)switch(N.tag){case 27:case 5:v=N.memoizedProps}h[$t]=p,h=!!(h.nodeValue===g||v!==null&&v.suppressHydrationWarning===!0||YD(h.nodeValue,g)),h||Lc(p)}else h=s1(h).createTextNode(v),h[$t]=p,p.stateNode=h}return Da(p),null;case 13:if(v=p.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(N=Gg(p),v!==null&&v.dehydrated!==null){if(h===null){if(!N)throw Error(a(318));if(N=p.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(a(317));N[$t]=p}else qg(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Da(p),N=!1}else N=$3(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=N),N=!0;if(!N)return p.flags&256?(wl(p),p):(wl(p),null)}if(wl(p),(p.flags&128)!==0)return p.lanes=g,p;if(g=v!==null,h=h!==null&&h.memoizedState!==null,g){v=p.child,N=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(N=v.alternate.memoizedState.cachePool.pool);var I=null;v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(I=v.memoizedState.cachePool.pool),I!==N&&(v.flags|=2048)}return g!==h&&g&&(p.child.flags|=8192),G0(p,p.updateQueue),Da(p),null;case 4:return Ie(),h===null&&wk(p.stateNode.containerInfo),Da(p),null;case 10:return bl(p.type),Da(p),null;case 19:if(ne(Cr),N=p.memoizedState,N===null)return Da(p),null;if(v=(p.flags&128)!==0,I=N.rendering,I===null)if(v)ux(N,!1);else{if(Pa!==0||h!==null&&(h.flags&128)!==0)for(h=p.child;h!==null;){if(I=z0(h),I!==null){for(p.flags|=128,ux(N,!1),h=I.updateQueue,p.updateQueue=h,G0(p,h),p.subtreeFlags=0,h=g,g=p.child;g!==null;)j3(g,h),g=g.sibling;return ee(Cr,Cr.current&1|2),p.child}h=h.sibling}N.tail!==null&&tt()>X0&&(p.flags|=128,v=!0,ux(N,!1),p.lanes=4194304)}else{if(!v)if(h=z0(I),h!==null){if(p.flags|=128,v=!0,h=h.updateQueue,p.updateQueue=h,G0(p,h),ux(N,!0),N.tail===null&&N.tailMode==="hidden"&&!I.alternate&&!On)return Da(p),null}else 2*tt()-N.renderingStartTime>X0&&g!==536870912&&(p.flags|=128,v=!0,ux(N,!1),p.lanes=4194304);N.isBackwards?(I.sibling=p.child,p.child=I):(h=N.last,h!==null?h.sibling=I:p.child=I,N.last=I)}return N.tail!==null?(p=N.tail,N.rendering=p,N.tail=p.sibling,N.renderingStartTime=tt(),p.sibling=null,h=Cr.current,ee(Cr,v?h&1|2:h&1),p):(Da(p),null);case 22:case 23:return wl(p),kS(),v=p.memoizedState!==null,h!==null?h.memoizedState!==null!==v&&(p.flags|=8192):v&&(p.flags|=8192),v?(g&536870912)!==0&&(p.flags&128)===0&&(Da(p),p.subtreeFlags&6&&(p.flags|=8192)):Da(p),g=p.updateQueue,g!==null&&G0(p,g.retryQueue),g=null,h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(g=h.memoizedState.cachePool.pool),v=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(v=p.memoizedState.cachePool.pool),v!==g&&(p.flags|=2048),h!==null&&ne(Uc),null;case 24:return g=null,h!==null&&(g=h.memoizedState.cache),p.memoizedState.cache!==g&&(p.flags|=2048),bl(Nr),Da(p),null;case 25:return null;case 30:return null}throw Error(a(156,p.tag))}function SG(h,p){switch(uS(p),p.tag){case 1:return h=p.flags,h&65536?(p.flags=h&-65537|128,p):null;case 3:return bl(Nr),Ie(),h=p.flags,(h&65536)!==0&&(h&128)===0?(p.flags=h&-65537|128,p):null;case 26:case 27:case 5:return Oe(p),null;case 13:if(wl(p),h=p.memoizedState,h!==null&&h.dehydrated!==null){if(p.alternate===null)throw Error(a(340));qg()}return h=p.flags,h&65536?(p.flags=h&-65537|128,p):null;case 19:return ne(Cr),null;case 4:return Ie(),null;case 10:return bl(p.type),null;case 22:case 23:return wl(p),kS(),h!==null&&ne(Uc),h=p.flags,h&65536?(p.flags=h&-65537|128,p):null;case 24:return bl(Nr),null;case 25:return null;default:return null}}function rD(h,p){switch(uS(p),p.tag){case 3:bl(Nr),Ie();break;case 26:case 27:case 5:Oe(p);break;case 4:Ie();break;case 13:wl(p);break;case 19:ne(Cr);break;case 10:bl(p.type);break;case 22:case 23:wl(p),kS(),h!==null&&ne(Uc);break;case 24:bl(Nr)}}function cx(h,p){try{var g=p.updateQueue,v=g!==null?g.lastEffect:null;if(v!==null){var N=v.next;g=N;do{if((g.tag&h)===h){v=void 0;var I=g.create,L=g.inst;v=I(),L.destroy=v}g=g.next}while(g!==N)}}catch(K){ia(p,p.return,K)}}function uu(h,p,g){try{var v=p.updateQueue,N=v!==null?v.lastEffect:null;if(N!==null){var I=N.next;v=I;do{if((v.tag&h)===h){var L=v.inst,K=L.destroy;if(K!==void 0){L.destroy=void 0,N=p;var se=g,be=K;try{be()}catch(Te){ia(N,se,Te)}}}v=v.next}while(v!==I)}}catch(Te){ia(p,p.return,Te)}}function sD(h){var p=h.updateQueue;if(p!==null){var g=h.stateNode;try{G3(p,g)}catch(v){ia(h,h.return,v)}}}function iD(h,p,g){g.props=Vc(h.type,h.memoizedProps),g.state=h.memoizedState;try{g.componentWillUnmount()}catch(v){ia(h,p,v)}}function dx(h,p){try{var g=h.ref;if(g!==null){switch(h.tag){case 26:case 27:case 5:var v=h.stateNode;break;case 30:v=h.stateNode;break;default:v=h.stateNode}typeof g=="function"?h.refCleanup=g(v):g.current=v}}catch(N){ia(h,p,N)}}function Lo(h,p){var g=h.ref,v=h.refCleanup;if(g!==null)if(typeof v=="function")try{v()}catch(N){ia(h,p,N)}finally{h.refCleanup=null,h=h.alternate,h!=null&&(h.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(N){ia(h,p,N)}else g.current=null}function oD(h){var p=h.type,g=h.memoizedProps,v=h.stateNode;try{e:switch(p){case"button":case"input":case"select":case"textarea":g.autoFocus&&v.focus();break e;case"img":g.src?v.src=g.src:g.srcSet&&(v.srcset=g.srcSet)}}catch(N){ia(h,h.return,N)}}function JS(h,p,g){try{var v=h.stateNode;WG(v,h.type,g,p),v[It]=p}catch(N){ia(h,h.return,N)}}function lD(h){return h.tag===5||h.tag===3||h.tag===26||h.tag===27&&xu(h.type)||h.tag===4}function QS(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||lD(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.tag===27&&xu(h.type)||h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function ZS(h,p,g){var v=h.tag;if(v===5||v===6)h=h.stateNode,p?(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g).insertBefore(h,p):(p=g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,p.appendChild(h),g=g._reactRootContainer,g!=null||p.onclick!==null||(p.onclick=r1));else if(v!==4&&(v===27&&xu(h.type)&&(g=h.stateNode,p=null),h=h.child,h!==null))for(ZS(h,p,g),h=h.sibling;h!==null;)ZS(h,p,g),h=h.sibling}function q0(h,p,g){var v=h.tag;if(v===5||v===6)h=h.stateNode,p?g.insertBefore(h,p):g.appendChild(h);else if(v!==4&&(v===27&&xu(h.type)&&(g=h.stateNode),h=h.child,h!==null))for(q0(h,p,g),h=h.sibling;h!==null;)q0(h,p,g),h=h.sibling}function uD(h){var p=h.stateNode,g=h.memoizedProps;try{for(var v=h.type,N=p.attributes;N.length;)p.removeAttributeNode(N[0]);Qr(p,v,g),p[$t]=h,p[It]=g}catch(I){ia(h,h.return,I)}}var Nl=!1,Za=!1,ek=!1,cD=typeof WeakSet=="function"?WeakSet:Set,Pr=null;function kG(h,p){if(h=h.containerInfo,Nk=d1,h=w3(h),Q2(h)){if("selectionStart"in h)var g={start:h.selectionStart,end:h.selectionEnd};else e:{g=(g=h.ownerDocument)&&g.defaultView||window;var v=g.getSelection&&g.getSelection();if(v&&v.rangeCount!==0){g=v.anchorNode;var N=v.anchorOffset,I=v.focusNode;v=v.focusOffset;try{g.nodeType,I.nodeType}catch{g=null;break e}var L=0,K=-1,se=-1,be=0,Te=0,Re=h,ve=null;t:for(;;){for(var Se;Re!==g||N!==0&&Re.nodeType!==3||(K=L+N),Re!==I||v!==0&&Re.nodeType!==3||(se=L+v),Re.nodeType===3&&(L+=Re.nodeValue.length),(Se=Re.firstChild)!==null;)ve=Re,Re=Se;for(;;){if(Re===h)break t;if(ve===g&&++be===N&&(K=L),ve===I&&++Te===v&&(se=L),(Se=Re.nextSibling)!==null)break;Re=ve,ve=Re.parentNode}Re=Se}g=K===-1||se===-1?null:{start:K,end:se}}else g=null}g=g||{start:0,end:0}}else g=null;for(Ck={focusedElem:h,selectionRange:g},d1=!1,Pr=p;Pr!==null;)if(p=Pr,h=p.child,(p.subtreeFlags&1024)!==0&&h!==null)h.return=p,Pr=h;else for(;Pr!==null;){switch(p=Pr,I=p.alternate,h=p.flags,p.tag){case 0:break;case 11:case 15:break;case 1:if((h&1024)!==0&&I!==null){h=void 0,g=p,N=I.memoizedProps,I=I.memoizedState,v=g.stateNode;try{var Ht=Vc(g.type,N,g.elementType===g.type);h=v.getSnapshotBeforeUpdate(Ht,I),v.__reactInternalSnapshotBeforeUpdate=h}catch(Bt){ia(g,g.return,Bt)}}break;case 3:if((h&1024)!==0){if(h=p.stateNode.containerInfo,g=h.nodeType,g===9)Tk(h);else if(g===1)switch(h.nodeName){case"HEAD":case"HTML":case"BODY":Tk(h);break;default:h.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(a(163))}if(h=p.sibling,h!==null){h.return=p.return,Pr=h;break}Pr=p.return}}function dD(h,p,g){var v=g.flags;switch(g.tag){case 0:case 11:case 15:cu(h,g),v&4&&cx(5,g);break;case 1:if(cu(h,g),v&4)if(h=g.stateNode,p===null)try{h.componentDidMount()}catch(L){ia(g,g.return,L)}else{var N=Vc(g.type,p.memoizedProps);p=p.memoizedState;try{h.componentDidUpdate(N,p,h.__reactInternalSnapshotBeforeUpdate)}catch(L){ia(g,g.return,L)}}v&64&&sD(g),v&512&&dx(g,g.return);break;case 3:if(cu(h,g),v&64&&(h=g.updateQueue,h!==null)){if(p=null,g.child!==null)switch(g.child.tag){case 27:case 5:p=g.child.stateNode;break;case 1:p=g.child.stateNode}try{G3(h,p)}catch(L){ia(g,g.return,L)}}break;case 27:p===null&&v&4&&uD(g);case 26:case 5:cu(h,g),p===null&&v&4&&oD(g),v&512&&dx(g,g.return);break;case 12:cu(h,g);break;case 13:cu(h,g),v&4&&fD(h,g),v&64&&(h=g.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(g=DG.bind(null,g),YG(h,g))));break;case 22:if(v=g.memoizedState!==null||Nl,!v){p=p!==null&&p.memoizedState!==null||Za,N=Nl;var I=Za;Nl=v,(Za=p)&&!I?du(h,g,(g.subtreeFlags&8772)!==0):cu(h,g),Nl=N,Za=I}break;case 30:break;default:cu(h,g)}}function hD(h){var p=h.alternate;p!==null&&(h.alternate=null,hD(p)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(p=h.stateNode,p!==null&&os(p)),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}var ya=null,Ks=!1;function Cl(h,p,g){for(g=g.child;g!==null;)pD(h,p,g),g=g.sibling}function pD(h,p,g){if(lt&&typeof lt.onCommitFiberUnmount=="function")try{lt.onCommitFiberUnmount(Be,g)}catch{}switch(g.tag){case 26:Za||Lo(g,p),Cl(h,p,g),g.memoizedState?g.memoizedState.count--:g.stateNode&&(g=g.stateNode,g.parentNode.removeChild(g));break;case 27:Za||Lo(g,p);var v=ya,N=Ks;xu(g.type)&&(ya=g.stateNode,Ks=!1),Cl(h,p,g),vx(g.stateNode),ya=v,Ks=N;break;case 5:Za||Lo(g,p);case 6:if(v=ya,N=Ks,ya=null,Cl(h,p,g),ya=v,Ks=N,ya!==null)if(Ks)try{(ya.nodeType===9?ya.body:ya.nodeName==="HTML"?ya.ownerDocument.body:ya).removeChild(g.stateNode)}catch(I){ia(g,p,I)}else try{ya.removeChild(g.stateNode)}catch(I){ia(g,p,I)}break;case 18:ya!==null&&(Ks?(h=ya,tR(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,g.stateNode),Tx(h)):tR(ya,g.stateNode));break;case 4:v=ya,N=Ks,ya=g.stateNode.containerInfo,Ks=!0,Cl(h,p,g),ya=v,Ks=N;break;case 0:case 11:case 14:case 15:Za||uu(2,g,p),Za||uu(4,g,p),Cl(h,p,g);break;case 1:Za||(Lo(g,p),v=g.stateNode,typeof v.componentWillUnmount=="function"&&iD(g,p,v)),Cl(h,p,g);break;case 21:Cl(h,p,g);break;case 22:Za=(v=Za)||g.memoizedState!==null,Cl(h,p,g),Za=v;break;default:Cl(h,p,g)}}function fD(h,p){if(p.memoizedState===null&&(h=p.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null))))try{Tx(h)}catch(g){ia(p,p.return,g)}}function NG(h){switch(h.tag){case 13:case 19:var p=h.stateNode;return p===null&&(p=h.stateNode=new cD),p;case 22:return h=h.stateNode,p=h._retryCache,p===null&&(p=h._retryCache=new cD),p;default:throw Error(a(435,h.tag))}}function tk(h,p){var g=NG(h);p.forEach(function(v){var N=RG.bind(null,h,v);g.has(v)||(g.add(v),v.then(N,N))})}function bi(h,p){var g=p.deletions;if(g!==null)for(var v=0;v<g.length;v++){var N=g[v],I=h,L=p,K=L;e:for(;K!==null;){switch(K.tag){case 27:if(xu(K.type)){ya=K.stateNode,Ks=!1;break e}break;case 5:ya=K.stateNode,Ks=!1;break e;case 3:case 4:ya=K.stateNode.containerInfo,Ks=!0;break e}K=K.return}if(ya===null)throw Error(a(160));pD(I,L,N),ya=null,Ks=!1,I=N.alternate,I!==null&&(I.return=null),N.return=null}if(p.subtreeFlags&13878)for(p=p.child;p!==null;)mD(p,h),p=p.sibling}var fo=null;function mD(h,p){var g=h.alternate,v=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:bi(p,h),vi(h),v&4&&(uu(3,h,h.return),cx(3,h),uu(5,h,h.return));break;case 1:bi(p,h),vi(h),v&512&&(Za||g===null||Lo(g,g.return)),v&64&&Nl&&(h=h.updateQueue,h!==null&&(v=h.callbacks,v!==null&&(g=h.shared.hiddenCallbacks,h.shared.hiddenCallbacks=g===null?v:g.concat(v))));break;case 26:var N=fo;if(bi(p,h),vi(h),v&512&&(Za||g===null||Lo(g,g.return)),v&4){var I=g!==null?g.memoizedState:null;if(v=h.memoizedState,g===null)if(v===null)if(h.stateNode===null){e:{v=h.type,g=h.memoizedProps,N=N.ownerDocument||N;t:switch(v){case"title":I=N.getElementsByTagName("title")[0],(!I||I[fa]||I[$t]||I.namespaceURI==="http://www.w3.org/2000/svg"||I.hasAttribute("itemprop"))&&(I=N.createElement(v),N.head.insertBefore(I,N.querySelector("head > title"))),Qr(I,v,g),I[$t]=h,Rn(I),v=I;break e;case"link":var L=uR("link","href",N).get(v+(g.href||""));if(L){for(var K=0;K<L.length;K++)if(I=L[K],I.getAttribute("href")===(g.href==null||g.href===""?null:g.href)&&I.getAttribute("rel")===(g.rel==null?null:g.rel)&&I.getAttribute("title")===(g.title==null?null:g.title)&&I.getAttribute("crossorigin")===(g.crossOrigin==null?null:g.crossOrigin)){L.splice(K,1);break t}}I=N.createElement(v),Qr(I,v,g),N.head.appendChild(I);break;case"meta":if(L=uR("meta","content",N).get(v+(g.content||""))){for(K=0;K<L.length;K++)if(I=L[K],I.getAttribute("content")===(g.content==null?null:""+g.content)&&I.getAttribute("name")===(g.name==null?null:g.name)&&I.getAttribute("property")===(g.property==null?null:g.property)&&I.getAttribute("http-equiv")===(g.httpEquiv==null?null:g.httpEquiv)&&I.getAttribute("charset")===(g.charSet==null?null:g.charSet)){L.splice(K,1);break t}}I=N.createElement(v),Qr(I,v,g),N.head.appendChild(I);break;default:throw Error(a(468,v))}I[$t]=h,Rn(I),v=I}h.stateNode=v}else cR(N,h.type,h.stateNode);else h.stateNode=lR(N,v,h.memoizedProps);else I!==v?(I===null?g.stateNode!==null&&(g=g.stateNode,g.parentNode.removeChild(g)):I.count--,v===null?cR(N,h.type,h.stateNode):lR(N,v,h.memoizedProps)):v===null&&h.stateNode!==null&&JS(h,h.memoizedProps,g.memoizedProps)}break;case 27:bi(p,h),vi(h),v&512&&(Za||g===null||Lo(g,g.return)),g!==null&&v&4&&JS(h,h.memoizedProps,g.memoizedProps);break;case 5:if(bi(p,h),vi(h),v&512&&(Za||g===null||Lo(g,g.return)),h.flags&32){N=h.stateNode;try{ds(N,"")}catch(Se){ia(h,h.return,Se)}}v&4&&h.stateNode!=null&&(N=h.memoizedProps,JS(h,N,g!==null?g.memoizedProps:N)),v&1024&&(ek=!0);break;case 6:if(bi(p,h),vi(h),v&4){if(h.stateNode===null)throw Error(a(162));v=h.memoizedProps,g=h.stateNode;try{g.nodeValue=v}catch(Se){ia(h,h.return,Se)}}break;case 3:if(l1=null,N=fo,fo=i1(p.containerInfo),bi(p,h),fo=N,vi(h),v&4&&g!==null&&g.memoizedState.isDehydrated)try{Tx(p.containerInfo)}catch(Se){ia(h,h.return,Se)}ek&&(ek=!1,gD(h));break;case 4:v=fo,fo=i1(h.stateNode.containerInfo),bi(p,h),vi(h),fo=v;break;case 12:bi(p,h),vi(h);break;case 13:bi(p,h),vi(h),h.child.flags&8192&&h.memoizedState!==null!=(g!==null&&g.memoizedState!==null)&&(ok=tt()),v&4&&(v=h.updateQueue,v!==null&&(h.updateQueue=null,tk(h,v)));break;case 22:N=h.memoizedState!==null;var se=g!==null&&g.memoizedState!==null,be=Nl,Te=Za;if(Nl=be||N,Za=Te||se,bi(p,h),Za=Te,Nl=be,vi(h),v&8192)e:for(p=h.stateNode,p._visibility=N?p._visibility&-2:p._visibility|1,N&&(g===null||se||Nl||Za||Hc(h)),g=null,p=h;;
vendor: 1,928 bytes, line 8
8){if(p.tag===5||p.tag===26){if(g===null){se=g=p;try{if(I=se.stateNode,N)L=I.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{K=se.stateNode;var Re=se.memoizedProps.style,ve=Re!=null&&Re.hasOwnProperty("display")?Re.display:null;K.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(Se){ia(se,se.return,Se)}}}else if(p.tag===6){if(g===null){se=p;try{se.stateNode.nodeValue=N?"":se.memoizedProps}catch(Se){ia(se,se.return,Se)}}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===h)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===h)break e;for(;p.sibling===null;){if(p.return===null||p.return===h)break e;g===p&&(g=null),p=p.return}g===p&&(g=null),p.sibling.return=p.return,p=p.sibling}v&4&&(v=h.updateQueue,v!==null&&(g=v.retryQueue,g!==null&&(v.retryQueue=null,tk(h,g))));break;case 19:bi(p,h),vi(h),v&4&&(v=h.updateQueue,v!==null&&(h.updateQueue=null,tk(h,v)));break;case 30:break;case 21:break;default:bi(p,h),vi(h)}}function vi(h){var p=h.flags;if(p&2){try{for(var g,v=h.return;v!==null;){if(lD(v)){g=v;break}v=v.return}if(g==null)throw Error(a(160));switch(g.tag){case 27:var N=g.stateNode,I=QS(h);q0(h,I,N);break;case 5:var L=g.stateNode;g.flags&32&&(ds(L,""),g.flags&=-33);var K=QS(h);q0(h,K,L);break;case 3:case 4:var se=g.stateNode.containerInfo,be=QS(h);ZS(h,be,se);break;default:throw Error(a(161))}}catch(Te){ia(h,h.return,Te)}h.flags&=-3}p&4096&&(h.flags&=-4097)}function gD(h){if(h.subtreeFlags&1024)for(h=h.child;h!==null;){var p=h;gD(p),p.tag===5&&p.flags&1024&&p.stateNode.reset(),h=h.sibling}}function cu(h,p){if(p.subtreeFlags&8772)for(p=p.child;p!==null;)dD(h,p.alternate,p),p=p.sibling}function Hc(h){for(h=h.child;h!==null;){var p=h;switch(p.tag){case 0:case 11:case 14:case 15:uu(4,p,p.return),Hc(p);break;case 1:Lo(p,p.return);var g=p.stateNode;typeof g.componentWillUnmount=="function"&&iD(p,p.return,g),Hc(p
vendor: 19,431 bytes, line 8
8);break;case 27:vx(p.stateNode);case 26:case 5:Lo(p,p.return),Hc(p);break;case 22:p.memoizedState===null&&Hc(p);break;case 30:Hc(p);break;default:Hc(p)}h=h.sibling}}function du(h,p,g){for(g=g&&(p.subtreeFlags&8772)!==0,p=p.child;p!==null;){var v=p.alternate,N=h,I=p,L=I.flags;switch(I.tag){case 0:case 11:case 15:du(N,I,g),cx(4,I);break;case 1:if(du(N,I,g),v=I,N=v.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(be){ia(v,v.return,be)}if(v=I,N=v.updateQueue,N!==null){var K=v.stateNode;try{var se=N.shared.hiddenCallbacks;if(se!==null)for(N.shared.hiddenCallbacks=null,N=0;N<se.length;N++)H3(se[N],K)}catch(be){ia(v,v.return,be)}}g&&L&64&&sD(I),dx(I,I.return);break;case 27:uD(I);case 26:case 5:du(N,I,g),g&&v===null&&L&4&&oD(I),dx(I,I.return);break;case 12:du(N,I,g);break;case 13:du(N,I,g),g&&L&4&&fD(N,I);break;case 22:I.memoizedState===null&&du(N,I,g),dx(I,I.return);break;case 30:break;default:du(N,I,g)}p=p.sibling}}function nk(h,p){var g=null;h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(g=h.memoizedState.cachePool.pool),h=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(h=p.memoizedState.cachePool.pool),h!==g&&(h!=null&&h.refCount++,g!=null&&Yg(g))}function ak(h,p){h=null,p.alternate!==null&&(h=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==h&&(p.refCount++,h!=null&&Yg(h))}function Po(h,p,g,v){if(p.subtreeFlags&10256)for(p=p.child;p!==null;)xD(h,p,g,v),p=p.sibling}function xD(h,p,g,v){var N=p.flags;switch(p.tag){case 0:case 11:case 15:Po(h,p,g,v),N&2048&&cx(9,p);break;case 1:Po(h,p,g,v);break;case 3:Po(h,p,g,v),N&2048&&(h=null,p.alternate!==null&&(h=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==h&&(p.refCount++,h!=null&&Yg(h)));break;case 12:if(N&2048){Po(h,p,g,v),h=p.stateNode;try{var I=p.memoizedProps,L=I.id,K=I.onPostCommit;typeof K=="function"&&K(L,p.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(se){ia(p,p.return,se)}}else Po(h,p,g,v);break;case 13:Po(h,p,g,v);break;case 23:break;case 22:I=p.stateNode,L=p.alternate,p.memoizedState!==null?I._visibility&2?Po(h,p,g,v):hx(h,p):I._visibility&2?Po(h,p,g,v):(I._visibility|=2,zp(h,p,g,v,(p.subtreeFlags&10256)!==0)),N&2048&&nk(L,p);break;case 24:Po(h,p,g,v),N&2048&&ak(p.alternate,p);break;default:Po(h,p,g,v)}}function zp(h,p,g,v,N){for(N=N&&(p.subtreeFlags&10256)!==0,p=p.child;p!==null;){var I=h,L=p,K=g,se=v,be=L.flags;switch(L.tag){case 0:case 11:case 15:zp(I,L,K,se,N),cx(8,L);break;case 23:break;case 22:var Te=L.stateNode;L.memoizedState!==null?Te._visibility&2?zp(I,L,K,se,N):hx(I,L):(Te._visibility|=2,zp(I,L,K,se,N)),N&&be&2048&&nk(L.alternate,L);break;case 24:zp(I,L,K,se,N),N&&be&2048&&ak(L.alternate,L);break;default:zp(I,L,K,se,N)}p=p.sibling}}function hx(h,p){if(p.subtreeFlags&10256)for(p=p.child;p!==null;){var g=h,v=p,N=v.flags;switch(v.tag){case 22:hx(g,v),N&2048&&nk(v.alternate,v);break;case 24:hx(g,v),N&2048&&ak(v.alternate,v);break;default:hx(g,v)}p=p.sibling}}var px=8192;function Up(h){if(h.subtreeFlags&px)for(h=h.child;h!==null;)yD(h),h=h.sibling}function yD(h){switch(h.tag){case 26:Up(h),h.flags&px&&h.memoizedState!==null&&uq(fo,h.memoizedState,h.memoizedProps);break;case 5:Up(h);break;case 3:case 4:var p=fo;fo=i1(h.stateNode.containerInfo),Up(h),fo=p;break;case 22:h.memoizedState===null&&(p=h.alternate,p!==null&&p.memoizedState!==null?(p=px,px=16777216,Up(h),px=p):Up(h));break;default:Up(h)}}function bD(h){var p=h.alternate;if(p!==null&&(h=p.child,h!==null)){p.child=null;do p=h.sibling,h.sibling=null,h=p;while(h!==null)}}function fx(h){var p=h.deletions;if((h.flags&16)!==0){if(p!==null)for(var g=0;g<p.length;g++){var v=p[g];Pr=v,wD(v,h)}bD(h)}if(h.subtreeFlags&10256)for(h=h.child;h!==null;)vD(h),h=h.sibling}function vD(h){switch(h.tag){case 0:case 11:case 15:fx(h),h.flags&2048&&uu(9,h,h.return);break;case 3:fx(h);break;case 12:fx(h);break;case 22:var p=h.stateNode;h.memoizedState!==null&&p._visibility&2&&(h.return===null||h.return.tag!==13)?(p._visibility&=-3,K0(h)):fx(h);break;default:fx(h)}}function K0(h){var p=h.deletions;if((h.flags&16)!==0){if(p!==null)for(var g=0;g<p.length;g++){var v=p[g];Pr=v,wD(v,h)}bD(h)}for(h=h.child;h!==null;){switch(p=h,p.tag){case 0:case 11:case 15:uu(8,p,p.return),K0(p);break;case 22:g=p.stateNode,g._visibility&2&&(g._visibility&=-3,K0(p));break;default:K0(p)}h=h.sibling}}function wD(h,p){for(;Pr!==null;){var g=Pr;switch(g.tag){case 0:case 11:case 15:uu(8,g,p);break;case 23:case 22:if(g.memoizedState!==null&&g.memoizedState.cachePool!==null){var v=g.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:Yg(g.memoizedState.cache)}if(v=g.child,v!==null)v.return=g,Pr=v;else e:for(g=h;Pr!==null;){v=Pr;var N=v.sibling,I=v.return;if(hD(v),v===g){Pr=null;break e}if(N!==null){N.return=I,Pr=N;break e}Pr=I}}}var CG={getCacheForType:function(h){var p=hs(Nr),g=p.data.get(h);return g===void 0&&(g=h(),p.data.set(h,g)),g}},EG=typeof WeakMap=="function"?WeakMap:Map,Kn=0,da=null,dn=null,Cn=0,Xn=0,wi=null,hu=!1,Wp=!1,rk=!1,El=0,Pa=0,pu=0,Gc=0,sk=0,Hi=0,Vp=0,mx=null,Xs=null,ik=!1,ok=0,X0=1/0,Y0=null,fu=null,Jr=0,mu=null,Hp=null,Gp=0,lk=0,uk=null,SD=null,gx=0,ck=null;function Si(){if((Kn&2)!==0&&Cn!==0)return Cn&-Cn;if(V.T!==null){var h=Rp;return h!==0?h:xk()}return xt()}function kD(){Hi===0&&(Hi=(Cn&536870912)===0||On?pi():536870912);var h=Vi.current;return h!==null&&(h.flags|=32),Hi}function ki(h,p,g){(h===da&&(Xn===2||Xn===9)||h.cancelPendingCommit!==null)&&(qp(h,0),gu(h,Cn,Hi,!1)),Kr(h,g),((Kn&2)===0||h!==da)&&(h===da&&((Kn&2)===0&&(Gc|=g),Pa===4&&gu(h,Cn,Hi,!1)),zo(h))}function ND(h,p,g){if((Kn&6)!==0)throw Error(a(327));var v=!g&&(p&124)===0&&(p&h.expiredLanes)===0||qr(h,p),N=v?AG(h,p):pk(h,p,!0),I=v;do{if(N===0){Wp&&!v&&gu(h,p,0,!1);break}else{if(g=h.current.alternate,I&&!IG(g)){N=pk(h,p,!1),I=!1;continue}if(N===2){if(I=p,h.errorRecoveryDisabledLanes&I)var L=0;else L=h.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){p=L;e:{var K=h;N=mx;var se=K.current.memoizedState.isDehydrated;if(se&&(qp(K,L).flags|=256),L=pk(K,L,!1),L!==2){if(rk&&!se){K.errorRecoveryDisabledLanes|=I,Gc|=I,N=4;break e}I=Xs,Xs=N,I!==null&&(Xs===null?Xs=I:Xs.push.apply(Xs,I))}N=L}if(I=!1,N!==2)continue}}if(N===1){qp(h,0),gu(h,p,0,!0);break}e:{switch(v=h,I=N,I){case 0:case 1:throw Error(a(345));case 4:if((p&4194048)!==p)break;case 6:gu(v,p,Hi,!hu);break e;case 2:Xs=null;break;case 3:case 5:break;default:throw Error(a(329))}if((p&62914560)===p&&(N=ok+300-tt(),10<N)){if(gu(v,p,Hi,!hu),di(v,0,!0)!==0)break e;v.timeoutHandle=ZD(CD.bind(null,v,g,Xs,Y0,ik,p,Hi,Gc,Vp,hu,I,2,-0,0),N);break e}CD(v,g,Xs,Y0,ik,p,Hi,Gc,Vp,hu,I,0,-0,0)}}break}while(!0);zo(h)}function CD(h,p,g,v,N,I,L,K,se,be,Te,Re,ve,Se){if(h.timeoutHandle=-1,Re=p.subtreeFlags,(Re&8192||(Re&16785408)===16785408)&&(kx={stylesheets:null,count:0,unsuspend:lq},yD(p),Re=cq(),Re!==null)){h.cancelPendingCommit=Re(DD.bind(null,h,p,I,g,v,N,L,K,se,Te,1,ve,Se)),gu(h,I,L,!be);return}DD(h,p,I,g,v,N,L,K,se)}function IG(h){for(var p=h;;){var g=p.tag;if((g===0||g===11||g===15)&&p.flags&16384&&(g=p.updateQueue,g!==null&&(g=g.stores,g!==null)))for(var v=0;v<g.length;v++){var N=g[v],I=N.getSnapshot;N=N.value;try{if(!xi(I(),N))return!1}catch{return!1}}if(g=p.child,p.subtreeFlags&16384&&g!==null)g.return=p,p=g;else{if(p===h)break;for(;p.sibling===null;){if(p.return===null||p.return===h)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function gu(h,p,g,v){p&=~sk,p&=~Gc,h.suspendedLanes|=p,h.pingedLanes&=~p,v&&(h.warmLanes|=p),v=h.expirationTimes;for(var N=p;0<N;){var I=31-Ue(N),L=1<<I;v[I]=-1,N&=~L}g!==0&&Ba(h,g,p)}function J0(){return(Kn&6)===0?(xx(0),!1):!0}function dk(){if(dn!==null){if(Xn===0)var h=dn.return;else h=dn,yl=Pc=null,TS(h),Lp=null,ox=0,h=dn;for(;h!==null;)rD(h.alternate,h),h=h.return;dn=null}}function qp(h,p){var g=h.timeoutHandle;g!==-1&&(h.timeoutHandle=-1,HG(g)),g=h.cancelPendingCommit,g!==null&&(h.cancelPendingCommit=null,g()),dk(),da=h,dn=g=ml(h.current,null),Cn=p,Xn=0,wi=null,hu=!1,Wp=qr(h,p),rk=!1,Vp=Hi=sk=Gc=pu=Pa=0,Xs=mx=null,ik=!1,(p&8)!==0&&(p|=p&32);var v=h.entangledLanes;if(v!==0)for(h=h.entanglements,v&=p;0<v;){var N=31-Ue(v),I=1<<N;p|=h[N],v&=~I}return El=p,b0(),g}function ED(h,p){on=null,V.H=O0,p===Qg||p===T0?(p=W3(),Xn=3):p===P3?(p=W3(),Xn=4):Xn=p===Vj?8:p!==null&&typeof p=="object"&&typeof p.then=="function"?6:1,wi=p,dn===null&&(Pa=1,W0(h,Pi(p,h.current)))}function ID(){var h=V.H;return V.H=O0,h===null?O0:h}function TD(){var h=V.A;return V.A=CG,h}function hk(){Pa=4,hu||(Cn&4194048)!==Cn&&Vi.current!==null||(Wp=!0),(pu&134217727)===0&&(Gc&134217727)===0||da===null||gu(da,Cn,Hi,!1)}function pk(h,p,g){var v=Kn;Kn|=2;var N=ID(),I=TD();(da!==h||Cn!==p)&&(Y0=null,qp(h,p)),p=!1;var L=Pa;e:do try{if(Xn!==0&&dn!==null){var K=dn,se=wi;switch(Xn){case 8:dk(),L=6;break e;case 3:case 2:case 9:case 6:Vi.current===null&&(p=!0);var be=Xn;if(Xn=0,wi=null,Kp(h,K,se,be),g&&Wp){L=0;break e}break;default:be=Xn,Xn=0,wi=null,Kp(h,K,se,be)}}TG(),L=Pa;break}catch(Te){ED(h,Te)}while(!0);return p&&h.shellSuspendCounter++,yl=Pc=null,Kn=v,V.H=N,V.A=I,dn===null&&(da=null,Cn=0,b0()),L}function TG(){for(;dn!==null;)AD(dn)}function AG(h,p){var g=Kn;Kn|=2;var v=ID(),N=TD();da!==h||Cn!==p?(Y0=null,X0=tt()+500,qp(h,p)):Wp=qr(h,p);e:do try{if(Xn!==0&&dn!==null){p=dn;var I=wi;t:switch(Xn){case 1:Xn=0,wi=null,Kp(h,p,I,1);break;case 2:case 9:if(z3(I)){Xn=0,wi=null,_D(p);break}p=function(){Xn!==2&&Xn!==9||da!==h||(Xn=7),zo(h)},I.then(p,p);break e;case 3:Xn=7;break e;case 4:Xn=5;break e;case 7:z3(I)?(Xn=0,wi=null,_D(p)):(Xn=0,wi=null,Kp(h,p,I,7));break;case 5:var L=null;switch(dn.tag){case 26:L=dn.memoizedState;case 5:case 27:var K=dn;if(!L||dR(L)){Xn=0,wi=null;var se=K.sibling;if(se!==null)dn=se;else{var be=K.return;be!==null?(dn=be,Q0(be)):dn=null}break t}}Xn=0,wi=null,Kp(h,p,I,5);break;case 6:Xn=0,wi=null,Kp(h,p,I,6);break;case 8:dk(),Pa=6;break e;default:throw Error(a(462))}}_G();break}catch(Te){ED(h,Te)}while(!0);return yl=Pc=null,V.H=v,V.A=N,Kn=g,dn!==null?0:(da=null,Cn=0,b0(),Pa)}function _G(){for(;dn!==null&&!ct();)AD(dn)}function AD(h){var p=nD(h.alternate,h,El);h.memoizedProps=h.pendingProps,p===null?Q0(h):dn=p}function _D(h){var p=h,g=p.alternate;switch(p.tag){case 15:case 0:p=Yj(g,p,p.pendingProps,p.type,void 0,Cn);break;case 11:p=Yj(g,p,p.pendingProps,p.type.render,p.ref,Cn);break;case 5:TS(p);default:rD(g,p),p=dn=j3(p,El),p=nD(g,p,El)}h.memoizedProps=h.pendingProps,p===null?Q0(h):dn=p}function Kp(h,p,g,v){yl=Pc=null,TS(p),Lp=null,ox=0;var N=p.return;try{if(bG(h,N,p,g,Cn)){Pa=1,W0(h,Pi(g,h.current)),dn=null;return}}catch(I){if(N!==null)throw dn=N,I;Pa=1,W0(h,Pi(g,h.current)),dn=null;return}p.flags&32768?(On||v===1?h=!0:Wp||(Cn&536870912)!==0?h=!1:(hu=h=!0,(v===2||v===9||v===3||v===6)&&(v=Vi.current,v!==null&&v.tag===13&&(v.flags|=16384))),jD(p,h)):Q0(p)}function Q0(h){var p=h;do{if((p.flags&32768)!==0){jD(p,hu);return}h=p.return;var g=wG(p.alternate,p,El);if(g!==null){dn=g;return}if(p=p.sibling,p!==null){dn=p;return}dn=p=h}while(p!==null);Pa===0&&(Pa=5)}function jD(h,p){do{var g=SG(h.alternate,h);if(g!==null){g.flags&=32767,dn=g;return}if(g=h.return,g!==null&&(g.flags|=32768,g.subtreeFlags=0,g.deletions=null),!p&&(h=h.sibling,h!==null)){dn=h;return}dn=h=g}while(h!==null);Pa=6,dn=null}function DD(h,p,g,v,N,I,L,K,se){h.cancelPendingCommit=null;do Z0();while(Jr!==0);if((Kn&6)!==0)throw Error(a(327));if(p!==null){if(p===h.current)throw Error(a(177));if(I=p.lanes|p.childLanes,I|=aS,lr(h,g,I,L,K,se),h===da&&(dn=da=null,Cn=0),Hp=p,mu=h,Gp=g,lk=I,uk=N,SD=v,(p.subtreeFlags&10256)!==0||(p.flags&10256)!==0?(h.callbackNode=null,h.callbackPriority=0,MG(Tn,function(){return FD(),null})):(h.callbackNode=null,h.callbackPriority=0),v=(p.flags&13878)!==0,(p.subtreeFlags&13878)!==0||v){v=V.T,V.T=null,N=Q.p,Q.p=2,L=Kn,Kn|=4;try{kG(h,p,g)}finally{Kn=L,Q.p=N,V.T=v}}Jr=1,RD(),MD(),$D()}}function RD(){if(Jr===1){Jr=0;var h=mu,p=Hp,g=(p.flags&13878)!==0;if((p.subtreeFlags&13878)!==0||g){g=V.T,V.T=null;var v=Q.p;Q.p=2;var N=Kn;Kn|=4;try{mD(p,h);var I=Ck,L=w3(h.containerInfo),K=I.focusedElem,se=I.selectionRange;if(L!==K&&K&&K.ownerDocument&&v3(K.ownerDocument.documentElement,K)){if(se!==null&&Q2(K)){var be=se.start,Te=se.end;if(Te===void 0&&(Te=be),"selectionStart"in K)K.selectionStart=be,K.selectionEnd=Math.min(Te,K.value.length);else{var Re=K.ownerDocument||document,ve=Re&&Re.defaultView||window;if(ve.getSelection){var Se=ve.getSelection(),Ht=K.textContent.length,Bt=Math.min(se.start,Ht),aa=se.end===void 0?Bt:Math.min(se.end,Ht);!Se.extend&&Bt>aa&&(L=aa,aa=Bt,Bt=L);var me=b3(K,Bt),de=b3(K,aa);if(me&&de&&(Se.rangeCount!==1||Se.anchorNode!==me.node||Se.anchorOffset!==me.offset||Se.focusNode!==de.node||Se.focusOffset!==de.offset)){var ye=Re.createRange();ye.setStart(me.node,me.offset),Se.removeAllRanges(),Bt>aa?(Se.addRange(ye),Se.extend(de.node,de.offset)):(ye.setEnd(de.node,de.offset),Se.addRange(ye))}}}}for(Re=[],Se=K;Se=Se.parentNode;)Se.nodeType===1&&Re.push({element:Se,left:Se.scrollLeft,top:Se.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Re.length;K++){var je=Re[K];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}d1=!!Nk,Ck=Nk=null}finally{Kn=N,Q.p=v,V.T=g}}h.current=p,Jr=2}}function MD(){if(Jr===2){Jr=0;var h=mu,p=Hp,g=(p.flags&8772)!==0;if((p.subtreeFlags&8772)!==0||g){g=V.T,V.T=null;var v=Q.p;Q.p=2;var N=Kn;Kn|=4;try{dD(h,p.alternate,p)}finally{Kn=N,Q.p=v,V.T=g}}Jr=3}}function $D(){if(Jr===4||Jr===3){Jr=0,ot();var h=mu,p=Hp,g=Gp,v=SD;(p.subtreeFlags&10256)!==0||(p.flags&10256)!==0?Jr=5:(Jr=0,Hp=mu=null,BD(h,h.pendingLanes));var N=h.pendingLanes;if(N===0&&(fu=null),Fe(g),p=p.stateNode,lt&&typeof lt.onCommitFiberRoot=="function")try{lt.onCommitFiberRoot(Be,p,void 0,(p.current.flags&128)===128)}catch{}if(v!==null){p=V.T,N=Q.p,Q.p=2,V.T=null;try{for(var I=h.onRecoverableError,L=0;L<v.length;L++){var K=v[L];I(K.value,{componentStack:K.stack})}}finally{V.T=p,Q.p=N}}(Gp&3)!==0&&Z0(),zo(h),N=h.pendingLanes,(g&4194090)!==0&&(N&42)!==0?h===ck?gx++:(gx=0,ck=h):gx=0,xx(0)}}function BD(h,p){(h.pooledCacheLanes&=p)===0&&(p=h.pooledCache,p!=null&&(h.pooledCache=null,Yg(p)))}function Z0(h){return RD(),MD(),$D(),FD()}function FD(){if(Jr!==5)return!1;var h=mu,p=lk;lk=0;var g=Fe(Gp),v=V.T,N=Q.p;try{Q.p=32>g?32:g,V.T=null,g=uk,uk=null;var I=mu,L=Gp;if(Jr=0,Hp=mu=null,Gp=0,(Kn&6)!==0)throw Error(a(331));var K=Kn;if(Kn|=4,vD(I.current),xD(I,I.current,L,g),Kn=K,xx(0,!1),lt&&typeof lt.onPostCommitFiberRoot=="function")try{lt.onPostCommitFiberRoot(Be,I)}catch{}return!0}finally{Q.p=N,V.T=v,BD(h,p)}}function OD(h,p,g){p=Pi(g,p),p=US(h.stateNode,p,2),h=su(h,p,2),h!==null&&(Kr(h,2),zo(h))}function ia(h,p,g){if(h.tag===3)OD(h,h,g);else for(;p!==null;){if(p.tag===3){OD(p,h,g);break}else if(p.tag===1){var v=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(fu===null||!fu.has(v))){h=Pi(g,h),g=Uj(2),v=su(p,g,2),v!==null&&(Wj(g,v,p,h),Kr(v,2),zo(v));break}}p=p.return}}function fk(h,p,g){var v=h.pingCache;if(v===null){v=h.pingCache=new EG;var N=new Set;v.set(p,N)}else N=v.get(p),N===void 0&&(N=new Set,v.set(p,N));N.has(g)||(rk=!0,N.add(g),h=jG.bind(null,h,p,g),p.then(h,h))}function jG(h,p,g){var v=h.pingCache;v!==null&&v.delete(p),h.pingedLanes|=h.suspendedLanes&g,h.warmLanes&=~g,da===h&&(Cn&g)===g&&(Pa===4||Pa===3&&(Cn&62914560)===Cn&&300>tt()-ok?(Kn&2)===0&&qp(h,0):sk|=g,Vp===Cn&&(Vp=0)),zo(h)}function LD(h,p){p===0&&(p=qa()),h=Ap(h,p),h!==null&&(Kr(h,p),zo(h))}function DG(h){var p=h.memoizedState,g=0;p!==null&&(g=p.retryLane),LD(h,g)}function RG(h,p){var g=0;switch(h.tag){case 13:var v=h.stateNode,N=h.memoizedState;N!==null&&(g=N.retryLane);break;case 19:v=h.stateNode;break;case 22:v=h.stateNode._retryCache;break;default:throw Error(a(314))}v!==null&&v.delete(p),LD(h,g)}function MG(h,p){return ft(h,p)}var e1=null,Xp=null,mk=!1,t1=!1,gk=!1,qc=0;function zo(h){h!==Xp&&h.next===null&&(Xp===null?e1=Xp=h:Xp=Xp.next=h),t1=!0,mk||(mk=!0,BG())}function xx(h,p){if(!gk&&t1){gk=!0;do for(var g=!1,v=e1;v!==null;){if(h!==0){var N=v.pendingLanes;if(N===0)var I=0;else{var L=v.suspendedLanes,K=v.pingedLanes;I=(1<<31-Ue(42|h)+1)-1,I&=N&~(L&~K),I=I&201326741?I&201326741|1:I?I|2:0}I!==0&&(g=!0,WD(v,I))}else I=Cn,I=di(v,v===da?I:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(I&3)===0||qr(v,I)||(g=!0,WD(v,I));v=v.next}while(g);gk=!1}}function $G(){PD()}function PD(){t1=mk=!1;var h=0;qc!==0&&(VG()&&(h=qc),qc=0);for(var p=tt(),g=null,v=e1;v!==null;){var N=v.next,I=zD(v,p);I===0?(v.next=null,g===null?e1=N:g.next=N,N===null&&(Xp=g)):(g=v,(h!==0||(I&3)!==0)&&(t1=!0)),v=N}xx(h)}function zD(h,p){for(var g=h.suspendedLanes,v=h.pingedLanes,N=h.expirationTimes,I=h.pendingLanes&-62914561;0<I;){var L=31-Ue(I),K=1<<L,se=N[L];se===-1?((K&g)===0||(K&v)!==0)&&(N[L]=hi(K,p)):se<=p&&(h.expiredLanes|=K),I&=~K}if(p=da,g=Cn,g=di(h,h===p?g:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),v=h.callbackNode,g===0||h===p&&(Xn===2||Xn===9)||h.cancelPendingCommit!==null)return v!==null&&v!==null&&ze(v),h.callbackNode=null,h.callbackPriority=0;if((g&3)===0||qr(h,g)){if(p=g&-g,p===h.callbackPriority)return p;switch(v!==null&&ze(v),Fe(g)){case 2:case 8:g=Ut;break;case 32:g=Tn;break;case 268435456:g=Pn;break;default:g=Tn}return v=UD.bind(null,h),g=ft(g,v),h.callbackPriority=p,h.callbackNode=g,p}return v!==null&&v!==null&&ze(v),h.callbackPriority=2,h.callbackNode=null,2}function UD(h,p){if(Jr!==0&&Jr!==5)return h.callbackNode=null,h.callbackPriority=0,null;var g=h.callbackNode;if(Z0()&&h.callbackNode!==g)return null;var v=Cn;return v=di(h,h===da?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),v===0?null:(ND(h,v,p),zD(h,tt()),h.callbackNode!=null&&h.callbackNode===g?UD.bind(null,h):null)}function WD(h,p){if(Z0())return null;ND(h,p,!0)}function BG(){GG(function(){(Kn&6)!==0?ft(bn,$G):PD()})}function xk(){return qc===0&&(qc=pi()),qc}function VD(h){return h==null||typeof h=="symbol"||typeof h=="boolean"?null:typeof h=="function"?h:As(""+h)}function HD(h,p){var g=p.ownerDocument.createElement("input");return g.name=p.name,g.value=p.value,h.id&&g.setAttribute("form",h.id),p.parentNode.insertBefore(g,p),h=new FormData(h),g.parentNode.removeChild(g),h}function FG(h,p,g,v,N){if(p==="submit"&&g&&g.stateNode===N){var I=VD((N[It]||null).action),L=v.submitter;L&&(p=(p=L[It]||null)?VD(p.formAction):L.getAttribute("formAction"),p!==null&&(I=p,L=null));var K=new pl("action","action",null,v,N);h.push({event:K,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(qc!==0){var se=L?HD(N,L):new FormData(N);FS(g,{pending:!0,data:se,method:N.method,action:I},null,se)}}else typeof I=="function"&&(K.preventDefault(),se=L?HD(N,L):new FormData(N),FS(g,{pending:!0,data:se,method:N.method,action:I},I,se))},currentTarget:N}]})}}for(var yk=0;yk<nS.length;yk++){var bk=nS[yk],OG=bk.toLowerCase(),LG=bk[0].toUpperCase()+bk.slice(1);po(OG,"on"+LG)}po(N3,"onAnimationEnd"),po(C3,"onAnimationIteration"),po(E3,"onAnimationStart"),po("dblclick","onDoubleClick"),po("focusin","onFocus"),po("focusout","onBlur"),po(nG,"onTransitionRun"),po(aG,"onTransitionStart"),po(rG,"onTransitionCancel"),po(I3,"onTransitionEnd"),ur("onMouseEnter",["mouseout","mouseover"]),ur("onMouseLeave",["mouseout","mouseover"]),ur("onPointerEnter",["pointerout","pointerover"]),ur("onPointerLeave",["pointerout","pointerover"]),Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hs("onSelect","focusout contextmenu dragend focu
8sin keydown keyup mousedown mouseup selectionchange".split(" ")),Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yx="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(" "),PG=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yx));function GD(h,p){p=(p&4)!==0;for(var g=0;g<h.length;g++){var v=h[g],N=v.event;v=v.listeners;e:{var I=void 0;if(p)for(var L=v.length-1;0<=L;L--){var K=v[L],se=K.instance,be=K.currentTarget;if(K=K.listener,se!==I&&N.isPropagationStopped())break e;I=K,N.currentTarget=be;try{I(N)}catch(Te){U0(Te)}N.currentTarget=null,I=se}else for(L=0;L<v.length;L++){if(K=v[L],se=K.instance,be=K.currentTarget,K=K.listener,se!==I&&N.isPropagationStopped())break e;I=K,N.currentTarget=be;try{I(N)}catch(Te){U0(Te)}N.currentTarget=null,I=se}}}}function hn(h,p){var g=p[vn];g===void 0&&(g=p[vn]=new Set);var v=h+"__bubble";g.has(v)||(qD(p,h,2,!1),g.add(v))}function vk(h,p,g){var v=0;p&&(v|=4),qD(g,h,v,p)}var n1="_reactListening"+Math.random().toString(36).slice(2);function wk(h){if(!h[n1]){h[n1]=!0,Or.forEach(function(g){g!=="selectionchange"&&(PG.has(g)||vk(g,!1,h),vk(g,!0,h))});var p=h.nodeType===9?h:h.ownerDocument;p===null||p[n1]||(p[n1]=!0,vk("selectionchange",!1,p))}}function qD(h,p,g,v){switch(xR(p)){case 2:var N=pq;break;case 8:N=fq;break;default:N=$k}g=N.bind(null,p,g,h),N=void 0,!Ft||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(N=!0),v?N!==void 0?h.addEventListener(p,g,{capture:!0,passive:N}):h.addEventListener(p,g,!0):N!==void 0?h.addEventListener(p,g,{passive:N}):h.addEventListener(p,g,!1)}function Sk(h,p,g,v,N){var I=v;if((p&1)===0&&(p&2)===0&&v!==null)e:for(;;){if(v===null)return;var L=v.tag;if(L===3||L===4){var K=v.stateNode.containerInfo;if(K===N)break;if(L===4)for(L=v.return;L!==null;){var se=L.tag;if((se===3||se===4)&&L.stateNode.containerInfo===N)return;L=L.return}for(;K!==null;){if(L=sn(K),L===null)return;if(se=L.tag,se===5||se===6||se===26||se===27){v=I=L;continue e}K=K.parentNode}}v=v.return}We(function(){var be=I,Te=co(g),Re=[];e:{var ve=T3.get(h);if(ve!==void 0){var Se=pl,Ht=h;switch(h){case"keypress":if(ho(g)===0)break e;case"keydown":case"keyup":Se=nt;break;case"focusin":Ht="focus",Se=Np;break;case"focusout":Ht="blur",Se=Np;break;case"beforeblur":case"afterblur":Se=Np;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=p0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=q2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=Vt;break;case N3:case C3:case E3:Se=K2;break;case I3:Se=_a;break;case"scroll":case"scrollend":Se=h0;break;case"wheel":Se=Fn;break;case"copy":case"cut":case"paste":Se=m0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=it;break;case"toggle":case"beforetoggle":Se=fl}var Bt=(p&4)!==0,aa=!Bt&&(h==="scroll"||h==="scrollend"),me=Bt?ve!==null?ve+"Capture":null:ve;Bt=[];for(var de=be,ye;de!==null;){var je=de;if(ye=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||ye===null||me===null||(je=At(de,me),je!=null&&Bt.push(bx(de,je,ye))),aa)break;de=de.return}0<Bt.length&&(ve=new Se(ve,Ht,null,g,Te),Re.push({event:ve,listeners:Bt}))}}if((p&7)===0){e:{if(ve=h==="mouseover"||h==="pointerover",Se=h==="mouseout"||h==="pointerout",ve&&g!==_s&&(Ht=g.relatedTarget||g.fromElement)&&(sn(Ht)||Ht[vt]))break e;if((Se||ve)&&(ve=Te.window===Te?Te:(ve=Te.ownerDocument)?ve.defaultView||ve.parentWindow:window,Se?(Ht=g.relatedTarget||g.toElement,Se=be,Ht=Ht?sn(Ht):null,Ht!==null&&(aa=s(Ht),Bt=Ht.tag,Ht!==aa||Bt!==5&&Bt!==27&&Bt!==6)&&(Ht=null)):(Se=null,Ht=be),Se!==Ht)){if(Bt=p0,je="onMouseLeave",me="onMouseEnter",de="mouse",(h==="pointerout"||h==="pointerover")&&(Bt=it,je="onPointerLeave",me="onPointerEnter",de="pointer"),aa=Se==null?ve:Ka(Se),ye=Ht==null?ve:Ka(Ht),ve=new Bt(je,de+"leave",Se,g,Te),ve.target=aa,ve.relatedTarget=ye,je=null,sn(Te)===be&&(Bt=new Bt(me,de+"enter",Ht,g,Te),Bt.target=ye,Bt.relatedTarget=aa,je=Bt),aa=je,Se&&Ht)t:{for(Bt=Se,me=Ht,de=0,ye=Bt;ye;ye=Yp(ye))de++;for(ye=0,je=me;je;je=Yp(je))ye++;for(;0<de-ye;)Bt=Yp(Bt),de--;for(;0<ye-de;)me=Yp(me),ye--;for(;de--;){if(Bt===me||me!==null&&Bt===me.alternate)break t;Bt=Yp(Bt),me=Yp(me)}Bt=null}else Bt=null;Se!==null&&KD(Re,ve,Se,Bt,!1),Ht!==null&&aa!==null&&KD(Re,aa,Ht,Bt,!0)}}
vendor: 5,265 bytes, lines 8-9
8e:{if(ve=be?Ka(be):window,Se=ve.nodeName&&ve.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ve.type==="file")var wt=p3;else if(d3(ve))if(f3)wt=ZH;else{wt=JH;var cn=YH}else Se=ve.nodeName,!Se||Se.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?be&&Oi(be.elementType)&&(wt=p3):wt=QH;if(wt&&(wt=wt(h,be))){h3(Re,wt,g,Te);break e}cn&&cn(h,ve,be),h==="focusout"&&be&&ve.type==="number"&&be.memoizedProps.value!=null&&Ts(ve,"number",ve.value)}switch(cn=be?Ka(be):window,h){case"focusin":(d3(cn)||cn.contentEditable==="true")&&(Ep=cn,Z2=be,Hg=null);break;case"focusout":Hg=Z2=Ep=null;break;case"mousedown":eS=!0;break;case"contextmenu":case"mouseup":case"dragend":eS=!1,S3(Re,g,Te);break;case"selectionchange":if(tG)break;case"keydown":case"keyup":S3(Re,g,Te)}var jt;if(gi)e:{switch(h){case"compositionstart":var Ot="onCompositionStart";break e;case"compositionend":Ot="onCompositionEnd";break e;case"compositionupdate":Ot="onCompositionUpdate";break e}Ot=void 0}else tu?g0(h,g)&&(Ot="onCompositionEnd"):h==="keydown"&&g.keyCode===229&&(Ot="onCompositionStart");Ot&&(Li&&g.locale!=="ko"&&(tu||Ot!=="onCompositionStart"?Ot==="onCompositionEnd"&&tu&&(jt=Gs()):(gt=Te,Dn="value"in gt?gt.value:gt.textContent,tu=!0)),cn=a1(be,Ot),0<cn.length&&(Ot=new Cp(Ot,h,null,g,Te),Re.push({event:Ot,listeners:cn}),jt?Ot.data=jt:(jt=x0(g),jt!==null&&(Ot.data=jt)))),(jt=Un?c3(h,g):qH(h,g))&&(Ot=a1(be,"onBeforeInput"),0<Ot.length&&(cn=new Cp("onBeforeInput","beforeinput",null,g,Te),Re.push({event:cn,listeners:Ot}),cn.data=jt)),FG(Re,h,be,g,Te)}GD(Re,p)})}function bx(h,p,g){return{instance:h,listener:p,currentTarget:g}}function a1(h,p){for(var g=p+"Capture",v=[];h!==null;){var N=h,I=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||I===null||(N=At(h,g),N!=null&&v.unshift(bx(h,N,I)),N=At(h,p),N!=null&&v.push(bx(h,N,I))),h.tag===3)return v;h=h.return}return[]}function Yp(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5&&h.tag!==27);return h||null}function KD(h,p,g,v,N){for(var I=p._reactName,L=[];g!==null&&g!==v;){var K=g,se=K.alternate,be=K.stateNode;if(K=K.tag,se!==null&&se===v)break;K!==5&&K!==26&&K!==27||be===null||(se=be,N?(be=At(g,I),be!=null&&L.unshift(bx(g,be,se))):N||(be=At(g,I),be!=null&&L.push(bx(g,be,se)))),g=g.return}L.length!==0&&h.push({event:p,listeners:L})}var zG=/\r\n?/g,UG=/\u0000|\uFFFD/g;function XD(h){return(typeof h=="string"?h:""+h).replace(zG,`
9`).replace(UG,"")}function YD(h,p){return p=XD(p),XD(h)===p}function r1(){}function na(h,p,g,v,N,I){switch(g){case"children":typeof v=="string"?p==="body"||p==="textarea"&&v===""||ds(h,v):(typeof v=="number"||typeof v=="bigint")&&p!=="body"&&ds(h,""+v);break;case"className":Le(h,"class",v);break;case"tabIndex":Le(h,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":Le(h,g,v);break;case"style":hl(h,v,I);break;case"data":if(p!=="object"){Le(h,"data",v);break}case"src":case"href":if(v===""&&(p!=="a"||g!=="href")){h.removeAttribute(g);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){h.removeAttribute(g);break}v=As(""+v),h.setAttribute(g,v);break;case"action":case"formAction":if(typeof v=="function"){h.setAttribute(g,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof I=="function"&&(g==="formAction"?(p!=="input"&&na(h,p,"name",N.name,N,null),na(h,p,"formEncType",N.formEncType,N,null),na(h,p,"formMethod",N.formMethod,N,null),na(h,p,"formTarget",N.formTarget,N,null)):(na(h,p,"encType",N.encType,N,null),na(h,p,"method",N.method,N,null),na(h,p,"target",N.target,N,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){h.removeAttribute(g);break}v=As(""+v),h.setAttribute(g,v);break;case"onClick":v!=null&&(h.onclick=r1);break;case"onScroll":v!=null&&hn("scroll",h);break;case"onScrollEnd":v!=null&&hn("scrollend",h);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(g=v.__html,g!=null){if(N.children!=null)throw Error(a(60));h.innerHTML=g}}break;case"multiple":h.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":h.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){h.removeAttribute("xlink:href");break}g=As(""+v),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?h.setAttribute(g,""+v):h.removeAttribute(g);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
9ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?h.setAttribute(g,""):h.removeAttribute(g);break;case"capture":case"download":v===!0?h.setAttribute(g,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?h.setAttribute(g,v):h.removeAttribute(g);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?h.setAttribute(g,v):h.removeAttribute(g);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?h.removeAttribute(g):h.setAttribute(g,v);break;case"popover":hn("beforetoggle",h),hn("toggle",h),Ee(h,"popover",v);break;case"xlinkActuate":Ke(h,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":Ke(h,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":Ke(h,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":Ke(h,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":Ke(h,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":Ke(h,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":Ke(h,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":Ke(h,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":Ke(h,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Ee(h,"is",v);break;case"innerText":case"textContent":break;default:(!(2<g.length)||g[0]!=="o"&&g[0]!=="O"||g[1]!=="n"&&g[1]!=="N")&&(g=lo.get(g)||g,Ee(h,g,v))}}function kk(h,p,g,v,N,I){switch(g){case"style":hl(h,v,I);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(g=v.__html,g!=null){if(N.children!=null)throw Error(a(60));h.innerHTML=g}}break;case"children":typeof v=="string"?ds(h,v):(typeof v=="number"||typeof v=="bigint")&&ds(h,""+v);break;case"onScroll":v!=null&&hn("scroll",h);break;case"onScrollEnd":v!=null&&hn("scrollend",h);break;case"onClick":v!=null&&(h.onclick=r1);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ls.hasOwnProperty(g))e:{if(g[0]==="o"&&g[1]==="n"&&(N=g.endsWith("Capture"),p=g.slice(2,N?g.length-7:void 0),I=h[It]||null,I=I!=null?I[g]:null,typeof I=="function"&&h.removeEventListener(p,I,N),typeof v=="function")){typeof I!="function"&&I!==null&&(g in h?h[g]=null:h.hasAttribute(g)&&h.removeAttribute(g)),h.addEventListener(p,v,N);break e}g in h?h[g]=v:v===!0?h.setAttribute(g,""):Ee(h,g,v)}}}function Qr(h,p,g){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":hn("error",h),hn("load",h);var v=!1,N=!1,I;for(I in g)if(g.hasOwnProperty(I)){var L=g[I];if(L!=null)switch(I){case"src":v=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,p));default:na(h,p,I,L,g,null)}}N&&na(h,p,"srcSet",g.srcSet,g,null),v&&na(h,p,"src",g.src,g,null);return;case"input":hn("invalid",h);var K=I=L=N=null,se=null,be=null;for(v in g)if(g.hasOwnProperty(v)){var Te=g[v];if(Te!=null)switch(v){case"name":N=Te;break;case"type":L=Te;break;case"checked":se=Te;break;case"defaultChecked":be=Te;break;case"value":I=Te;break;case"defaultValue":K=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(a(137,p));break;default:na(h,p,v,Te,g,null)}}cs(h,I,K,se,be,L,N,!1),Ea(h);return;case"select":hn("invalid",h),v=L=I=null;for(N in g)if(g.hasOwnProperty(N)&&(K=g[N],K!=null))switch(N){case"value":I=K;break;case"defaultValue":L=K;break;case"multiple":v=K;default:na(h,p,N,K,g,null)}p=I,g=L,h.multiple=!!v,p!=null?Oa(h,!!v,p,!1):g!=null&&Oa(h,!!v,g,!0);return;case"textarea":hn("invalid",h),I=N=v=null;for(L in g)if(g.hasOwnProperty(L)&&(K=g[L],K!=null))switch(L){case"value":v=K;break;case"defaultValue":N=K;break;case"children":I=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(a(91));break;default:na(h,p,L,K,g,null)}Fi(h,v,N,I),Ea(h);return;case"option":for(se in g)g.hasOwnProperty(se)&&(v=g[se],v!=null)&&(se==="selected"?h.selected=v&&typeof v!="function"&&typeof v!="symbol":na(h,p,se,v,g,null));return;case"dialog":hn("beforetoggle",h),hn("toggle",h),hn("cancel",h),hn("close",h);break;case"iframe":case"object":hn("load",h);break;case"video":case"audio":for(v=0;v<yx.length;v++)hn(yx[v],h);break;case"image":hn("error",h),hn("load",h);break;case"details":hn("toggle",h);break;case"embed":case"source":case"link":hn("error",h),hn("load",h);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(be in g)if(g.hasOwnProperty(be)&&(v=g[be],v!=null))switch(be){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,p));default:na(h,p,be,v,g,null)}return;default:if(Oi(p)){for(Te in g)g.hasOwnProperty(Te)&&(v=g[Te],v!==void 0&&kk(h,p,Te,v,g,void 0));return}}for(K in g)g.hasOwnProperty(K)&&(v=g[K],v!=null&&na(h,p,K,v,g,null))}function WG(h,p,g,v){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;
vendor: 4,164 bytes, line 9
9case"input":var N=null,I=null,L=null,K=null,se=null,be=null,Te=null;for(Se in g){var Re=g[Se];if(g.hasOwnProperty(Se)&&Re!=null)switch(Se){case"checked":break;case"value":break;case"defaultValue":se=Re;default:v.hasOwnProperty(Se)||na(h,p,Se,null,v,Re)}}for(var ve in v){var Se=v[ve];if(Re=g[ve],v.hasOwnProperty(ve)&&(Se!=null||Re!=null))switch(ve){case"type":I=Se;break;case"name":N=Se;break;case"checked":be=Se;break;case"defaultChecked":Te=Se;break;case"value":L=Se;break;case"defaultValue":K=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(a(137,p));break;default:Se!==Re&&na(h,p,ve,Se,v,Re)}}Ta(h,L,K,se,be,Te,I,N);return;case"select":Se=L=K=ve=null;for(I in g)if(se=g[I],g.hasOwnProperty(I)&&se!=null)switch(I){case"value":break;case"multiple":Se=se;default:v.hasOwnProperty(I)||na(h,p,I,null,v,se)}for(N in v)if(I=v[N],se=g[N],v.hasOwnProperty(N)&&(I!=null||se!=null))switch(N){case"value":ve=I;break;case"defaultValue":K=I;break;case"multiple":L=I;default:I!==se&&na(h,p,N,I,v,se)}p=K,g=L,v=Se,ve!=null?Oa(h,!!g,ve,!1):!!v!=!!g&&(p!=null?Oa(h,!!g,p,!0):Oa(h,!!g,g?[]:"",!1));return;case"textarea":Se=ve=null;for(K in g)if(N=g[K],g.hasOwnProperty(K)&&N!=null&&!v.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:na(h,p,K,null,v,N)}for(L in v)if(N=v[L],I=g[L],v.hasOwnProperty(L)&&(N!=null||I!=null))switch(L){case"value":ve=N;break;case"defaultValue":Se=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(a(91));break;default:N!==I&&na(h,p,L,N,v,I)}Ya(h,ve,Se);return;case"option":for(var Ht in g)ve=g[Ht],g.hasOwnProperty(Ht)&&ve!=null&&!v.hasOwnProperty(Ht)&&(Ht==="selected"?h.selected=!1:na(h,p,Ht,null,v,ve));for(se in v)ve=v[se],Se=g[se],v.hasOwnProperty(se)&&ve!==Se&&(ve!=null||Se!=null)&&(se==="selected"?h.selected=ve&&typeof ve!="function"&&typeof ve!="symbol":na(h,p,se,ve,v,Se));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Bt in g)ve=g[Bt],g.hasOwnProperty(Bt)&&ve!=null&&!v.hasOwnProperty(Bt)&&na(h,p,Bt,null,v,ve);for(be in v)if(ve=v[be],Se=g[be],v.hasOwnProperty(be)&&ve!==Se&&(ve!=null||Se!=null))switch(be){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(a(137,p));break;default:na(h,p,be,ve,v,Se)}return;default:if(Oi(p)){for(var aa in g)ve=g[aa],g.hasOwnProperty(aa)&&ve!==void 0&&!v.hasOwnProperty(aa)&&kk(h,p,aa,void 0,v,ve);for(Te in v)ve=v[Te],Se=g[Te],!v.hasOwnProperty(Te)||ve===Se||ve===void 0&&Se===void 0||kk(h,p,Te,ve,v,Se);return}}for(var me in g)ve=g[me],g.hasOwnProperty(me)&&ve!=null&&!v.hasOwnProperty(me)&&na(h,p,me,null,v,ve);for(Re in v)ve=v[Re],Se=g[Re],!v.hasOwnProperty(Re)||ve===Se||ve==null&&Se==null||na(h,p,Re,ve,v,Se)}var Nk=null,Ck=null;function s1(h){return h.nodeType===9?h:h.ownerDocument}function JD(h){switch(h){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function QD(h,p){if(h===0)switch(p){case"svg":return 1;case"math":return 2;default:return 0}return h===1&&p==="foreignObject"?0:h}function Ek(h,p){return h==="textarea"||h==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.children=="bigint"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var Ik=null;function VG(){var h=window.event;return h&&h.type==="popstate"?h===Ik?!1:(Ik=h,!0):(Ik=null,!1)}var ZD=typeof setTimeout=="function"?setTimeout:void 0,HG=typeof clearTimeout=="function"?clearTimeout:void 0,eR=typeof Promise=="function"?Promise:void 0,GG=typeof queueMicrotask=="function"?queueMicrotask:typeof eR<"u"?function(h){return eR.resolve(null).then(h).catch(qG)}:ZD;function qG(h){setTimeout(function(){throw h})}function xu(h){return h==="head"}function tR(h,p){var g=p,v=0,N=0;do{var I=g.nextSibling;if(h.removeChild(g),I&&I.nodeType===8)if(g=I.data,g==="/$"){if(0<v&&8>v){g=v;var L=h.ownerDocument;if(g&1&&vx(L.documentElement),g&2&&vx(L.body),g&4)for(g=L.head,vx(g),L=g.firstChild;L;){var K=L.nextSibling,se=L.nodeName;
vendor: 5,620 bytes, line 9
9L[fa]||se==="SCRIPT"||se==="STYLE"||se==="LINK"&&L.rel.toLowerCase()==="stylesheet"||g.removeChild(L),L=K}}if(N===0){h.removeChild(I),Tx(p);return}N--}else g==="$"||g==="$?"||g==="$!"?N++:v=g.charCodeAt(0)-48;else v=0;g=I}while(g);Tx(p)}function Tk(h){var p=h.firstChild;for(p&&p.nodeType===10&&(p=p.nextSibling);p;){var g=p;switch(p=p.nextSibling,g.nodeName){case"HTML":case"HEAD":case"BODY":Tk(g),os(g);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(g.rel.toLowerCase()==="stylesheet")continue}h.removeChild(g)}}function KG(h,p,g,v){for(;h.nodeType===1;){var N=g;if(h.nodeName.toLowerCase()!==p.toLowerCase()){if(!v&&(h.nodeName!=="INPUT"||h.type!=="hidden"))break}else if(v){if(!h[fa])switch(p){case"meta":if(!h.hasAttribute("itemprop"))break;return h;case"link":if(I=h.getAttribute("rel"),I==="stylesheet"&&h.hasAttribute("data-precedence"))break;if(I!==N.rel||h.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||h.getAttribute("title")!==(N.title==null?null:N.title))break;return h;case"style":if(h.hasAttribute("data-precedence"))break;return h;case"script":if(I=h.getAttribute("src"),(I!==(N.src==null?null:N.src)||h.getAttribute("type")!==(N.type==null?null:N.type)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&I&&h.hasAttribute("async")&&!h.hasAttribute("itemprop"))break;return h;default:return h}}else if(p==="input"&&h.type==="hidden"){var I=N.name==null?null:""+N.name;if(N.type==="hidden"&&h.getAttribute("name")===I)return h}else return h;if(h=mo(h.nextSibling),h===null)break}return null}function XG(h,p,g){if(p==="")return null;for(;h.nodeType!==3;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!g||(h=mo(h.nextSibling),h===null))return null;return h}function Ak(h){return h.data==="$!"||h.data==="$?"&&h.ownerDocument.readyState==="complete"}function YG(h,p){var g=h.ownerDocument;if(h.data!=="$?"||g.readyState==="complete")p();else{var v=function(){p(),g.removeEventListener("DOMContentLoaded",v)};g.addEventListener("DOMContentLoaded",v),h._reactRetry=v}}function mo(h){for(;h!=null;h=h.nextSibling){var p=h.nodeType;if(p===1||p===3)break;if(p===8){if(p=h.data,p==="$"||p==="$!"||p==="$?"||p==="F!"||p==="F")break;if(p==="/$")return null}}return h}var _k=null;function nR(h){h=h.previousSibling;for(var p=0;h;){if(h.nodeType===8){var g=h.data;if(g==="$"||g==="$!"||g==="$?"){if(p===0)return h;p--}else g==="/$"&&p++}h=h.previousSibling}return null}function aR(h,p,g){switch(p=s1(g),h){case"html":if(h=p.documentElement,!h)throw Error(a(452));return h;case"head":if(h=p.head,!h)throw Error(a(453));return h;case"body":if(h=p.body,!h)throw Error(a(454));return h;default:throw Error(a(451))}}function vx(h){for(var p=h.attributes;p.length;)h.removeAttributeNode(p[0]);os(h)}var Gi=new Map,rR=new Set;function i1(h){return typeof h.getRootNode=="function"?h.getRootNode():h.nodeType===9?h:h.ownerDocument}var Il=Q.d;Q.d={f:JG,r:QG,D:ZG,C:eq,L:tq,m:nq,X:rq,S:aq,M:sq};function JG(){var h=Il.f(),p=J0();return h||p}function QG(h){var p=wn(h);p!==null&&p.tag===5&&p.type==="form"?Nj(p):Il.r(h)}var Jp=typeof document>"u"?null:document;function sR(h,p,g){var v=Jp;if(v&&typeof p=="string"&&p){var N=jn(p);N='link[rel="'+h+'"][href="'+N+'"]',typeof g=="string"&&(N+='[crossorigin="'+g+'"]'),rR.has(N)||(rR.add(N),h={rel:h,crossOrigin:g,href:p},v.querySelector(N)===null&&(p=v.createElement("link"),Qr(p,"link",h),Rn(p),v.head.appendChild(p)))}}function ZG(h){Il.D(h),sR("dns-prefetch",h,null)}function eq(h,p){Il.C(h,p),sR("preconnect",h,p)}function tq(h,p,g){Il.L(h,p,g);var v=Jp;if(v&&h&&p){var N='link[rel="preload"][as="'+jn(p)+'"]';p==="image"&&g&&g.imageSrcSet?(N+='[imagesrcset="'+jn(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(N+='[imagesizes="'+jn(g.imageSizes)+'"]')):N+='[href="'+jn(h)+'"]';var I=N;switch(p){case"style":I=Qp(h);break;case"script":I=Zp(h)}Gi.has(I)||(h=c({rel:"preload",href:p==="image"&&g&&g.imageSrcSet?void 0:h,as:p},g),Gi.set(I,h),v.querySelector(N)!==null||p==="style"&&v.querySelector(wx(I))||p==="script"&&v.querySelector(Sx(I))||(p=v.createElement("link"),Qr(p,"link",h),Rn(p),v.head.appendChild(p)))}}function nq(h,p){Il.m(h,p);var g=Jp;if(g&&h){var v=p&&typeof p.as=="string"?p.as:"script",N='link[rel="modulepreload"][as="'+jn(v)+'"][href="'+jn(h)+'"]',I=N;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":I=Zp(h)}if(!Gi.has(I)&&(h=c({rel:"modulepreload",href:h},p),Gi.set(I,h),g.querySelector(N)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(Sx(I)))return}v=g.createElement("link"),Qr(v,"link",h),Rn(v),g.head.appendChild(v)}}}function aq(h,p,g){Il.S(h,p,g);var v=Jp;if(v&&h){var N=Ca(v).hoistableStyles,I=Qp(h);p=p||"default";var L=N.get(I);if(!L){var K={loading:0,preload:null};if(L=v.querySelector(wx(I)))K.loading=5;else{h=c({rel:"stylesheet",href:h,"data-precedence":p},g),(g=Gi.get(I))&&jk(h,g);var se=L=v.createElement("link");Rn(se),Qr(se,"link",h),se._p=new Promise(function(be,Te){se.onload=be,se.onerror=Te}),se.addEventListener("load",function(){K.loading|=1}),se.addEventListener("error",function(){K.loading|=2}),K.loading|=4,o1(L,p,v)}L={type:"stylesheet",instance:L,count:1,state:K},N.set(I,L)}}}function rq(h,p){Il.X(h,p);var g=Jp;if(g&&h){var v=Ca(g).hoistableScripts,N=Zp(h),I=v.get(N);I||(I=g.querySelector(Sx(N)),I||(h=c({src:h,async:!0},p),(p=Gi.get(N))&&Dk(h,p),I=g.createElement("script"),Rn(I),Qr(I,"link",h),g.head.appendChild(I)
vendor: 5,226 bytes, line 9
9),I={type:"script",instance:I,count:1,state:null},v.set(N,I))}}function sq(h,p){Il.M(h,p);var g=Jp;if(g&&h){var v=Ca(g).hoistableScripts,N=Zp(h),I=v.get(N);I||(I=g.querySelector(Sx(N)),I||(h=c({src:h,async:!0,type:"module"},p),(p=Gi.get(N))&&Dk(h,p),I=g.createElement("script"),Rn(I),Qr(I,"link",h),g.head.appendChild(I)),I={type:"script",instance:I,count:1,state:null},v.set(N,I))}}function iR(h,p,g,v){var N=(N=pe.current)?i1(N):null;if(!N)throw Error(a(446));switch(h){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(p=Qp(g.href),g=Ca(N).hoistableStyles,v=g.get(p),v||(v={type:"style",instance:null,count:0,state:null},g.set(p,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){h=Qp(g.href);var I=Ca(N).hoistableStyles,L=I.get(h);if(L||(N=N.ownerDocument||N,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},I.set(h,L),(I=N.querySelector(wx(h)))&&!I._p&&(L.instance=I,L.state.loading=5),Gi.has(h)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},Gi.set(h,g),I||iq(N,h,g,L.state))),p&&v===null)throw Error(a(528,""));return L}if(p&&v!==null)throw Error(a(529,""));return null;case"script":return p=g.async,g=g.src,typeof g=="string"&&p&&typeof p!="function"&&typeof p!="symbol"?(p=Zp(g),g=Ca(N).hoistableScripts,v=g.get(p),v||(v={type:"script",instance:null,count:0,state:null},g.set(p,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,h))}}function Qp(h){return'href="'+jn(h)+'"'}function wx(h){return'link[rel="stylesheet"]['+h+"]"}function oR(h){return c({},h,{"data-precedence":h.precedence,precedence:null})}function iq(h,p,g,v){h.querySelector('link[rel="preload"][as="style"]['+p+"]")?v.loading=1:(p=h.createElement("link"),v.preload=p,p.addEventListener("load",function(){return v.loading|=1}),p.addEventListener("error",function(){return v.loading|=2}),Qr(p,"link",g),Rn(p),h.head.appendChild(p))}function Zp(h){return'[src="'+jn(h)+'"]'}function Sx(h){return"script[async]"+h}function lR(h,p,g){if(p.count++,p.instance===null)switch(p.type){case"style":var v=h.querySelector('style[data-href~="'+jn(g.href)+'"]');if(v)return p.instance=v,Rn(v),v;var N=c({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return v=(h.ownerDocument||h).createElement("style"),Rn(v),Qr(v,"style",N),o1(v,g.precedence,h),p.instance=v;case"stylesheet":N=Qp(g.href);var I=h.querySelector(wx(N));if(I)return p.state.loading|=4,p.instance=I,Rn(I),I;v=oR(g),(N=Gi.get(N))&&jk(v,N),I=(h.ownerDocument||h).createElement("link"),Rn(I);var L=I;return L._p=new Promise(function(K,se){L.onload=K,L.onerror=se}),Qr(I,"link",v),p.state.loading|=4,o1(I,g.precedence,h),p.instance=I;case"script":return I=Zp(g.src),(N=h.querySelector(Sx(I)))?(p.instance=N,Rn(N),N):(v=g,(N=Gi.get(I))&&(v=c({},g),Dk(v,N)),h=h.ownerDocument||h,N=h.createElement("script"),Rn(N),Qr(N,"link",v),h.head.appendChild(N),p.instance=N);case"void":return null;default:throw Error(a(443,p.type))}else p.type==="stylesheet"&&(p.state.loading&4)===0&&(v=p.instance,p.state.loading|=4,o1(v,g.precedence,h));return p.instance}function o1(h,p,g){for(var v=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=v.length?v[v.length-1]:null,I=N,L=0;L<v.length;L++){var K=v[L];if(K.dataset.precedence===p)I=K;else if(I!==N)break}I?I.parentNode.insertBefore(h,I.nextSibling):(p=g.nodeType===9?g.head:g,p.insertBefore(h,p.firstChild))}function jk(h,p){h.crossOrigin==null&&(h.crossOrigin=p.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=p.referrerPolicy),h.title==null&&(h.title=p.title)}function Dk(h,p){h.crossOrigin==null&&(h.crossOrigin=p.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=p.referrerPolicy),h.integrity==null&&(h.integrity=p.integrity)}var l1=null;function uR(h,p,g){if(l1===null){var v=new Map,N=l1=new Map;N.set(g,v)}else N=l1,v=N.get(g),v||(v=new Map,N.set(g,v));if(v.has(h))return v;for(v.set(h,null),g=g.getElementsByTagName(h),N=0;N<g.length;N++){var I=g[N];if(!(I[fa]||I[$t]||h==="link"&&I.getAttribute("rel")==="stylesheet")&&I.namespaceURI!=="http://www.w3.org/2000/svg"){var L=I.getAttribute(p)||"";L=h+L;var K=v.get(L);K?K.push(I):v.set(L,[I])}}return v}function cR(h,p,g){h=h.ownerDocument||h,h.head.insertBefore(g,p==="title"?h.querySelector("head > title"):null)}function oq(h,p,g){if(g===1||p.itemProp!=null)return!1;switch(h){case"meta":case"title":return!0;case"style":if(typeof p.precedence!="string"||typeof p.href!="string"||p.href==="")break;return!0;case"link":if(typeof p.rel!="string"||typeof p.href!="string"||p.href===""||p.onLoad||p.onError)break;return p.rel==="stylesheet"?(h=p.disabled,typeof p.precedence=="string"&&h==null):!0;case"script":if(p.async&&typeof p.async!="function"&&typeof p.async!="symbol"&&!p.onLoad&&!p.onError&&p.src&&typeof p.src=="string")return!0}return!1}function dR(h){return!(h.type==="stylesheet"&&(h.state.loading&3)===0)}var kx=null;function lq(){}function uq(h,p,g){if(kx===null)throw Error(a(475));var v=kx;
vendor: 9,428 bytes, line 9
9if(p.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var N=Qp(g.href),I=h.querySelector(wx(N));if(I){h=I._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(v.count++,v=u1.bind(v),h.then(v,v)),p.state.loading|=4,p.instance=I,Rn(I);return}I=h.ownerDocument||h,g=oR(g),(N=Gi.get(N))&&jk(g,N),I=I.createElement("link"),Rn(I);var L=I;L._p=new Promise(function(K,se){L.onload=K,L.onerror=se}),Qr(I,"link",g),p.instance=I}v.stylesheets===null&&(v.stylesheets=new Map),v.stylesheets.set(p,h),(h=p.state.preload)&&(p.state.loading&3)===0&&(v.count++,p=u1.bind(v),h.addEventListener("load",p),h.addEventListener("error",p))}}function cq(){if(kx===null)throw Error(a(475));var h=kx;return h.stylesheets&&h.count===0&&Rk(h,h.stylesheets),0<h.count?function(p){var g=setTimeout(function(){if(h.stylesheets&&Rk(h,h.stylesheets),h.unsuspend){var v=h.unsuspend;h.unsuspend=null,v()}},6e4);return h.unsuspend=p,function(){h.unsuspend=null,clearTimeout(g)}}:null}function u1(){if(this.count--,this.count===0){if(this.stylesheets)Rk(this,this.stylesheets);else if(this.unsuspend){var h=this.unsuspend;this.unsuspend=null,h()}}}var c1=null;function Rk(h,p){h.stylesheets=null,h.unsuspend!==null&&(h.count++,c1=new Map,p.forEach(dq,h),c1=null,u1.call(h))}function dq(h,p){if(!(p.state.loading&4)){var g=c1.get(h);if(g)var v=g.get(null);else{g=new Map,c1.set(h,g);for(var N=h.querySelectorAll("link[data-precedence],style[data-precedence]"),I=0;I<N.length;I++){var L=N[I];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(g.set(L.dataset.precedence,L),v=L)}v&&g.set(null,v)}N=p.instance,L=N.getAttribute("data-precedence"),I=g.get(L)||v,I===v&&g.set(null,N),g.set(L,N),this.count++,v=u1.bind(this),N.addEventListener("load",v),N.addEventListener("error",v),I?I.parentNode.insertBefore(N,I.nextSibling):(h=h.nodeType===9?h.head:h,h.insertBefore(N,h.firstChild)),p.state.loading|=4}}var Nx={$$typeof:C,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function hq(h,p,g,v,N,I,L,K){this.tag=1,this.containerInfo=h,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=is(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=is(0),this.hiddenUpdates=is(null),this.identifierPrefix=v,this.onUncaughtError=N,this.onCaughtError=I,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function hR(h,p,g,v,N,I,L,K,se,be,Te,Re){return h=new hq(h,p,g,L,K,se,be,Re),p=1,I===!0&&(p|=24),I=yi(3,null,null,p),h.current=I,I.stateNode=h,p=fS(),p.refCount++,h.pooledCache=p,p.refCount++,I.memoizedState={element:v,isDehydrated:g,cache:p},yS(I),h}function pR(h){return h?(h=_p,h):_p}function fR(h,p,g,v,N,I){N=pR(N),v.context===null?v.context=N:v.pendingContext=N,v=ru(p),v.payload={element:g},I=I===void 0?null:I,I!==null&&(v.callback=I),g=su(h,v,p),g!==null&&(ki(g,h,p),ex(g,h,p))}function mR(h,p){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var g=h.retryLane;h.retryLane=g!==0&&g<p?g:p}}function Mk(h,p){mR(h,p),(h=h.alternate)&&mR(h,p)}function gR(h){if(h.tag===13){var p=Ap(h,67108864);p!==null&&ki(p,h,67108864),Mk(h,67108864)}}var d1=!0;function pq(h,p,g,v){var N=V.T;V.T=null;var I=Q.p;try{Q.p=2,$k(h,p,g,v)}finally{Q.p=I,V.T=N}}function fq(h,p,g,v){var N=V.T;V.T=null;var I=Q.p;try{Q.p=8,$k(h,p,g,v)}finally{Q.p=I,V.T=N}}function $k(h,p,g,v){if(d1){var N=Bk(v);if(N===null)Sk(h,p,v,h1,g),yR(h,v);else if(gq(N,h,p,g,v))v.stopPropagation();else if(yR(h,v),p&4&&-1<mq.indexOf(h)){for(;N!==null;){var I=wn(N);if(I!==null)switch(I.tag){case 3:if(I=I.stateNode,I.current.memoizedState.isDehydrated){var L=_n(I.pendingLanes);if(L!==0){var K=I;for(K.pendingLanes|=2,K.entangledLanes|=2;L;){var se=1<<31-Ue(L);K.entanglements[1]|=se,L&=~se}zo(I),(Kn&6)===0&&(X0=tt()+500,xx(0))}}break;case 13:K=Ap(I,2),K!==null&&ki(K,I,2),J0(),Mk(I,2)}if(I=Bk(v),I===null&&Sk(h,p,v,h1,g),I===N)break;N=I}N!==null&&v.stopPropagation()}else Sk(h,p,v,null,g)}}function Bk(h){return h=co(h),Fk(h)}var h1=null;function Fk(h){if(h1=null,h=sn(h),h!==null){var p=s(h);if(p===null)h=null;else{var g=p.tag;if(g===13){if(h=i(p),h!==null)return h;h=null}else if(g===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;h=null}else p!==h&&(h=null)}}return h1=h,null}function xR(h){switch(h){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Tt()){case bn:return 2;case Ut:return 8;case Tn:case Nn:return 32;case Pn:return 268435456;default:return 32}default:return 32}}var Ok=!1,yu=null,bu=null,vu=null,Cx=new Map,Ex=new Map,wu=[],mq="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".split(" ");function yR(h,p){switch(h){case"focusin":case"focusout":yu=null;break;case"dragenter":case"dragleave":bu=null;break;case"mouseover":case"mouseout":vu=null;break;case"pointerover":case"pointerout":Cx.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ex.delete(p.pointerId)}}function Ix(h,p,g,v,N,I){return h===null||h.nativeEvent!==I?(h={blockedOn:p,domEventName:g,eventSystemFlags:v,nativeEvent:I,targetContainers:[N]},p!==null&&(p=wn(p),p!==null&&gR(p)),h):(h.eventSystemFlags|=v,p=h.targetContainers,N!==null&&p.indexOf(N)===-1&&p.push(N),h)}function gq(h,p,g,v,N){switch(p){case"focusin":return yu=Ix(yu,h,p,g,v,N),!0;case"dragenter":return bu=Ix(bu,h,p,g,v,N),!0;case"mouseover":return vu=Ix(vu,h,p,g,v,N),!0;case"pointerover":var I=N.pointerId;return Cx.set(I,Ix(Cx.get(I)||null,h,p,g,v,N)),!0;case"gotpointercapture":return I=N.pointerId,Ex.set(I,Ix(Ex.get(I)||null,h,p,g,v,N)),!0}return!1}function bR(h){var p=sn(h.target);if(p!==null){var g=s(p);if(g!==null){if(p=g.tag,p===13){if(p=i(g),p!==null){h.blockedOn=p,Xe(h.priority,function(){if(g.tag===13){var v=Si();v=we(v);var N=Ap(g,v);N!==null&&ki(N,g,v),Mk(g,v)}});return}}else if(p===3&&g.stateNode.current.memoizedState.isDehydrated){h.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}h.blockedOn=null}function p1(h){if(h.blockedOn!==null)return!1;for(var p=h.targetContainers;0<p.length;){var g=Bk(h.nativeEvent);if(g===null){g=h.nativeEvent;var v=new g.constructor(g.type,g);_s=v,g.target.dispatchEvent(v),_s=null}else return p=wn(g),p!==null&&gR(p),h.blockedOn=g,!1;p.shift()}return!0}function vR(h,p,g){p1(h)&&g.delete(p)}function xq(){Ok=!1,yu!==null&&p1(yu)&&(yu=null),bu!==null&&p1(bu)&&(bu=null),vu!==null&&p1(vu)&&(vu=null),Cx.forEach(vR),Ex.forEach(vR)}function f1(h,p){h.blockedOn===p&&(h.blockedOn=null,Ok||(Ok=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,xq)))}var m1=null;function wR(h){m1!==h&&(m1=h,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){m1===h&&(m1=null);for(var p=0;p<h.length;p+=3){var g=h[p],v=h[p+1],N=h[p+2];if(typeof v!="function"){if(Fk(v||g)===null)continue;break}var I=wn(g);I!==null&&(h.splice(p,3),p-=3,FS(I,{pending:!0,data:N,method:g.method,action:v},v,N))}}))}function Tx(h){function p(se){return f1(se,h)}yu!==null&&f1(yu,h),bu!==null&&f1(bu,h),vu!==null&&f1(vu,h),Cx.forEach(p),Ex.forEach(p);for(var g=0;g<wu.length;g++){var v=wu[g];v.blockedOn===h&&(v.blockedOn=null)}for(;0<wu.length&&(g=wu[0],g.blockedOn===null);)bR(g),g.blockedOn===null&&wu.shift();if(g=(h.ownerDocument||h).$$reactFormReplay,g!=null)for(v=0;v<g.length;v+=3){var N=g[v],I=g[v+1],L=N[It]||null;if(typeof I=="function")L||wR(g);else if(L){var K=null;if(I&&I.hasAttribute("formAction")){if(N=I,L=I[It]||null)K=L.formAction;else if(Fk(N)!==null)continue}else K=L.action;typeof K=="function"?g[v+1]=K:(g.splice(v,3),v-=3),wR(g)}}}function Lk(h){this._internalRoot=h}g1.prototype.render=Lk.prototype.render=function(h){var p=this._internalRoot;if(p===null)throw Error(a(409));var g=p.current,v=Si();fR(g,v,h,p,null,null)},g1.prototype.unmount=Lk.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;
9var p=h.containerInfo;fR(h.current,2,null,h,null,null),J0(),p[vt]=null}};function g1(h){this._internalRoot=h}g1.prototype.unstable_scheduleHydration=function(h){if(h){var p=xt();h={blockedOn:null,target:h,priority:p};for(var g=0;g<wu.length&&p!==0&&p<wu[g].priority;g++);wu.splice(g,0,h),g===0&&bR(h)}};var SR=t.version;if(SR!=="19.1.1")throw Error(a(527,SR,"19.1.1"));Q.findDOMNode=function(h){var p=h._reactInternals;if(p===void 0)throw typeof h.render=="function"?Error(a(188)):(h=Object.keys(h).join(","),Error(a(268,h)));return h=l(p),h=h!==null?d(h):null,h=h===null?null:h.stateNode,h};var yq={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var x1=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!x1.isDisabled&&x1.supportsFiber)try{Be=x1.inject(yq),lt=x1}catch{}}return _x.createRoot=function(h,p){if(!r(h))throw Error(a(299));var g=!1,v="",N=Oj,I=Lj,L=Pj,K=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(v=p.identifierPrefix),p.onUncaughtError!==void 0&&(N=p.onUncaughtError),p.onCaughtError!==void 0&&(I=p.onCaughtError),p.onRecoverableError!==void 0&&(L=p.onRecoverableError),p.unstable_transitionCallbacks!==void 0&&(K=p.unstable_transitionCallbacks)),p=hR(h,1,!1,null,null,g,v,N,I,L,K,null),h[vt]=p.current,wk(h),new Lk(p)},_x.hydrateRoot=function(h,p,g){if(!r(h))throw Error(a(299));var v=!1,N="",I=Oj,L=Lj,K=Pj,se=null,be=null;return g!=null&&(g.unstable_strictMode===!0&&(v=!0),g.identifierPrefix!==void 0&&(N=g.identifierPrefix),g.onUncaughtError!==void 0&&(I=g.onUncaughtError),g.onCaughtError!==void 0&&(L=g.onCaughtError),g.onRecoverableError!==void 0&&(K=g.onRecoverableError),g.unstable_transitionCallbacks!==void 0&&(se=g.unstable_transitionCallbacks),g.formState!==void 0&&(be=g.formState)),p=hR(h,1,!0,p,g??null,v,N,I,L,K,se,be),p.context=pR(null),g=p.current,v=Si(),v=we(v),N=ru(v),N.callback=null,su(g,N,v),g=v,p.current.lanes=g,Kr(p,g),zo(p),h[vt]=p.current,wk(h),new g1(p)},_x.version="19.1.1",_x}var DR;function Aq(){if(DR)return Uk.exports;DR=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Uk.exports=Tq(),Uk.exports}var _q=Aq();const jq=lF(_q);var Dq=cF();function fy(){return fy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},fy.apply(this,arguments)}var Fu;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Fu||(Fu={}));const RR="popstate";function Rq(e){e===void 0&&(e={});function t(a,r){let{pathname:s,search:i,hash:o}=a.location;return JN("",{pathname:s,search:i,hash:o},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function n(a,r){return typeof r=="string"?r:pv(r)}return $q(t,n,null,e)}function br(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function JE(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Mq(){return Math.random().toString(36).substr(2,8)}function MR(e,t){return{usr:e.state,key:e.key,idx:t}}function JN(e,t,n,a){return n===void 0&&(n=null),fy({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?sm(t):t,{state:n,key:t&&t.key||a||Mq()})}function pv(e){let{pathname:t="/",search:n="",hash:a=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),a&&a!=="#"&&(t+=a.charAt(0)==="#"?a:"#"+a),t}function sm(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function $q(e,t,n,a){a===void 0&&(a={});let{window:r=document.defaultView,v5Compat:s=!1}=a,i=r.history,o=Fu.Pop,l=null,d=c();d==null&&(d=0,i.replaceState(fy({},i.state,{idx:d}),""));function c(){return(i.state||{idx:null}).idx}function f(){o=Fu.Pop;let w=c(),S=w==null?null:w-d;d=w,l&&l({action:o,location:b.location,delta:S})}function m(w,S){o=Fu.Push;let k=JN(b.location,w,S);d=c()+1;let C=MR(k,d),E=b.createHref(k);try{i.pushState(C,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;r.location.assign(E)}s&&l&&l({action:o,location:b.location,delta:1})}function x(w,S){o=Fu.Replace;let k=JN(b.location,w,S);d=c();let C=MR(k,d),E=b.createHref(k);i.replaceState(C,"",E),s&&l&&l({action:o,location:b.location,delta:0})}function y(w){let S=r.location.origin!=="null"?r.location.origin:r.location.href,k=typeof w=="string"?w:pv(w);return k=k.replace(/ $/,"%20"),br(S,"No window.location.(origin|href) available to create URL for href: "+k),new URL(k,S)}let b={get action(){return o},get location(){return e(r,i)},listen(w){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(RR,f),l=w,()=>{r.removeEventListener(RR,f),l=null}},createHref(w){return t(r,w)},createURL:y,encodeLocation(w){let S=y(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:m,replace:x,go(w){return i.go(w)}};return b}var $R;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})($R||($R={}));function Bq(e,t,n){return n===void 0&&(n="/"),Fq(e,t,n)}function Fq(e,t,n,a){let r=typeof t=="string"?sm(t):t,s=QE(r.pathname||"/",n);if(s==null)return null;let i=dF(e);Oq(i);let o=null;for(let l=0;o==null&&l<i.length;++l){let d=Yq(s);o=qq(i[l],d)}return o}function dF(e,t,n,a){t===void 0&&(t=[]),n===void 0&&(n=[]),a===void 0&&(a="");let r=(s,i,o)=>{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};l.relativePath.startsWith("/")&&(br(l.relativePath.startsWith(a),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+a+'" is not val
9id. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(a.length));let d=Uu([a,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(br(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),dF(s.children,t,c,d)),!(s.path==null&&!s.index)&&t.push({path:d,score:Hq(d,s.index),routesMeta:c})};return e.forEach((s,i)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))r(s,i);else for(let l of hF(s.path))r(s,i,l)}),t}function hF(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(a.length===0)return r?[s,""]:[s];let i=hF(a.join("/")),o=[];return o.push(...i.map(l=>l===""?s:[s,l].join("/"))),r&&o.push(...i),o.map(l=>e.startsWith("/")&&l===""?"/":l)}function Oq(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Gq(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}const Lq=/^:[\w-]+$/,Pq=3,zq=2,Uq=1,Wq=10,Vq=-2,BR=e=>e==="*";function Hq(e,t){let n=e.split("/"),a=n.length;return n.some(BR)&&(a+=Vq),t&&(a+=zq),n.filter(r=>!BR(r)).reduce((r,s)=>r+(Lq.test(s)?Pq:s===""?Uq:Wq),a)}function Gq(e,t){return e.length===t.length&&e.slice(0,-1).every((a,r)=>a===t[r])?e[e.length-1]-t[t.length-1]:0}function qq(e,t,n){let{routesMeta:a}=e,r={},s="/",i=[];for(let o=0;o<a.length;++o){let l=a[o],d=o===a.length-1,c=s==="/"?t:t.slice(s.length)||"/",f=Kq({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},c),m=l.route;if(!f)return null;
vendor: 6,948 bytes, line 9
9Object.assign(r,f.params),i.push({params:r,pathname:Uu([s,f.pathname]),pathnameBase:tK(Uu([s,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(s=Uu([s,f.pathnameBase]))}return i}function Kq(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=Xq(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let s=r[0],i=s.replace(/(.)\/+$/,"$1"),o=r.slice(1);return{params:a.reduce((d,c,f)=>{let{paramName:m,isOptional:x}=c;if(m==="*"){let b=o[f]||"";i=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const y=o[f];return x&&!y?d[m]=void 0:d[m]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:i,pattern:e}}function Xq(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),JE(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let a=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,l)=>(a.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(a.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),a]}function Yq(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return JE(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function QE(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}const Jq=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qq=e=>Jq.test(e);function Zq(e,t){t===void 0&&(t="/");let{pathname:n,search:a="",hash:r=""}=typeof e=="string"?sm(e):e,s;if(n)if(Qq(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),JE(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?s=FR(n.substring(1),"/"):s=FR(n,t)}else s=t;return{pathname:s,search:nK(a),hash:aK(r)}}function FR(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Gk(e,t,n,a){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(a)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function eK(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function pF(e,t){let n=eK(e);return t?n.map((a,r)=>r===n.length-1?a.pathname:a.pathnameBase):n.map(a=>a.pathnameBase)}function fF(e,t,n,a){a===void 0&&(a=!1);let r;typeof e=="string"?r=sm(e):(r=fy({},e),br(!r.pathname||!r.pathname.includes("?"),Gk("?","pathname","search",r)),br(!r.pathname||!r.pathname.includes("#"),Gk("#","pathname","hash",r)),br(!r.search||!r.search.includes("#"),Gk("#","search","hash",r)));let s=e===""||r.pathname==="",i=s?"/":r.pathname,o;if(i==null)o=n;else{let f=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),f-=1;r.pathname=m.join("/")}o=f>=0?t[f]:"/"}let l=Zq(r,o),d=i&&i!=="/"&&i.endsWith("/"),c=(s||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(d||c)&&(l.pathname+="/"),l}const Uu=e=>e.join("/").replace(/\/\/+/g,"/"),tK=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),nK=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aK=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function rK(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const mF=["post","put","patch","delete"];new Set(mF);const sK=["get",...mF];new Set(sK);function my(){return my=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},my.apply(this,arguments)}const ZE=D.createContext(null),iK=D.createContext(null),Vd=D.createContext(null),aw=D.createContext(null),uc=D.createContext({outlet:null,matches:[],isDataRoute:!1}),gF=D.createContext(null);function oK(e,t){let{relative:n}=t===void 0?{}:t;Ky()||br(!1);let{basename:a,navigator:r}=D.useContext(Vd),{hash:s,pathname:i,search:o}=yF(e,{relative:n}),l=i;return a!=="/"&&(l=i==="/"?a:Uu([a,i])),r.createHref({pathname:l,search:o,hash:s})}function Ky(){return D.useContext(aw)!=null}function Vl(){return Ky()||br(!1),D.useContext(aw).location}function xF(e){D.useContext(Vd).static||D.useLayoutEffect(e)}function Us(){let{isDataRoute:e}=D.useContext(uc);return e?wK():lK()}function lK(){Ky()||br(!1);let e=D.useContext(ZE),{basename:t,future:n,navigator:a}=D.useContext(Vd),{matches:r}=D.useContext(uc),{pathname:s}=Vl(),i=JSON.stringify(pF(r,n.v7_relativeSplatPath)),o=D.useRef(!1);return xF(()=>{o.current=!0}),D.useCallback(function(d,c){if(c===void 0&&(c={}),!o.current)return;if(typeof d=="number"){a.go(d);return}let f=fF(d,JSON.parse(i),s,c.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Uu([t,f.pathname])),(c.replace?a.replace:a.push)(f,c.state,c)},[t,a,i,s,e])}function uK(){let{matches:e}=D.useContext(uc),t=e[e.length-1];return t?t.params:{}}function yF(e,t){let{relative:n}=t===void 0?{}:t,{future:a}=D.useContext(Vd),{matches:r}=D.useContext(uc),{pathname:s}=Vl(),i=JSON.stringify(pF(r,a.v7_relativeSplatPath));return D.useMemo(()=>fF(e,JSON.parse(i),s,n==="path"),[e,i,s,n])}function cK(e,t){return dK(e,t)}function dK(e,t,n,a){Ky()||br(!1);let{navigator:r}=D.useContext(Vd),{matches:s}=D.useContext(uc),i=s[s.length-1],o=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let d=Vl(),c;if(t){var f;let w=typeof t=="string"?sm(t):t;l==="/"||(f=w.pathname)!=null&&f.startsWith(l)||br(!1),c=w}else c=d;let m=c.pathname||"/",x=m;if(l!=="/"){let w=l.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=Bq(e,{pathname:x}),b=gK(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},o,w.params),pathname:Uu([l,r.encodeLocation?r.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:Uu([l,r.encodeLocation?r.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,a);return t&&b?D.createElement(aw.Provider,{value:{location:my({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Fu.Pop}},b):b}function hK(){let e=vK(),t=rK(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application 
9Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},t),n?D.createElement("pre",{style:r},n):null,null)}const pK=D.createElement(hK,null);class fK extends D.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?D.createElement(uc.Provider,{value:this.props.routeContext},D.createElement(gF.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function mK(e){let{routeContext:t,match:n,children:a}=e,r=D.useContext(ZE);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),D.createElement(uc.Provider,{value:t},a)}function gK(e,t,n,a){var r;if(t===void 0&&(t=[]),n===void 0&&(n=null),a===void 0&&(a=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=a)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,o=(r=n)==null?void 0:r.errors;if(o!=null){let c=i.findIndex(f=>f.route.id&&o?.[f.route.id]!==void 0);c>=0||br(!1),i=i.slice(0,Math.min(i.length,c+1))}let l=!1,d=-1;if(n&&a&&a.v7_partialHydration)for(let c=0;c<i.length;c++){let f=i[c];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=c),f.route.id){let{loaderData:m,errors:x}=n,y=f.route.loader&&m[f.route.id]===void 0&&(!x||x[f.route.id]===void 0);if(f.route.lazy||y){l=!0,d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}return i.reduceRight((c,f,m)=>{let x,y=!1,b=null,w=null;n&&(x=o&&f.route.id?o[f.route.id]:void 0,b=f.route.errorElement||pK,l&&(d<0&&m===0?(SK("route-fallback"),y=!0,w=null):d===m&&(y=!0,w=f.route.hydrateFallbackElement||null)));let S=t.concat(i.slice(0,m+1)),k=()=>{let C;return x?C=b:y?C=w:f.route.Component?C=D.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=c,D.createElement(mK,{match:f,routeContext:{outlet:c,matches:S,isDataRoute:n!=null},children:C})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?D.createElement(fK,{location:n.location,revalidation:n.revalidation,component:b,error:x,children:k(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):k()},null)}var bF=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(bF||{}),vF=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(vF||{});function xK(e){let t=D.useContext(ZE);return t||br(!1),t}function yK(e){let t=D.useContext(iK);return t||br(!1),t}function bK(e){let t=D.useContext(uc);return t||br(!1),t}function wF(e){let t=bK(),n=t.matches[t.matches.length-1];return n.route.id||br(!1),n.route.id}function vK(){var e;let t=D.useContext(gF),n=yK(),a=wF();return t!==void 0?t:(e=n.errors)==null?void 0:e[a]}function wK(){let{router:e}=xK(bF.UseNavigateStable),t=wF(vF.UseNavigateStable),n=D.useRef(!1);return xF(()=>{n.current=!0}),D.useCallback(function(r,s){s===void 0&&(s={}),n.current&&(typeof r=="number"?e.navigate(r):e.navigate(r,my({fromRouteId:t},s)))},[e,t])}const OR={};function SK(e,t,n){OR[e]||(OR[e]=!0)}function kK(e,t){e?.v7_startTransition,e?.v7_relativeSplatPath}function ma(e){br(!1)}function NK(e){let{basename:t="/",children:n=null,location:a,navigationType:r=Fu.Pop,navigator:s,static:i=!1,future:o}=e;Ky()&&br(!1);let l=t.replace(/^\/*/,"/"),d=D.useMemo(()=>({basename:l,navigator:s,static:i,future:my({v7_relativeSplatPath:!1},o)}),[l,o,s,i]);
9typeof a=="string"&&(a=sm(a));let{pathname:c="/",search:f="",hash:m="",state:x=null,key:y="default"}=a,b=D.useMemo(()=>{let w=QE(c,l);return w==null?null:{location:{pathname:w,search:f,hash:m,state:x,key:y},navigationType:r}},[l,c,f,m,x,y,r]);return b==null?null:D.createElement(Vd.Provider,{value:d},D.createElement(aw.Provider,{children:n,value:b}))}function CK(e){let{children:t,location:n}=e;return cK(QN(t),n)}new Promise(()=>{});function QN(e,t){t===void 0&&(t=[]);let n=[];return D.Children.forEach(e,(a,r)=>{if(!D.isValidElement(a))return;let s=[...t,r];if(a.type===D.Fragment){n.push.apply(n,QN(a.props.children,s));return}a.type!==ma&&br(!1),!a.props.index||!a.props.children||br(!1);let i={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=QN(a.props.children,s)),n.push(i)}),n}function ZN(){return ZN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ZN.apply(this,arguments)}function EK(e,t){if(e==null)return{};var n={},a=Object.keys(e),r,s;for(s=0;s<a.length;s++)r=a[s],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}function IK(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function TK(e,t){return e.button===0&&(!t||t==="_self")&&!IK(e)}function eC(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(r=>[n,r]):[[n,a]])},[]))}function AK(e,t){let n=eC(e);return t&&t.forEach((a,r)=>{n.has(r)||t.getAll(r).forEach(s=>{n.append(r,s)})}),n}const _K=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],jK="6";try{window.__reactRouterVersion=jK}catch{}const DK="startTransition",LR=Nq[DK];function RK(e){let{basename:t,children:n,future:a,window:r}=e,s=D.useRef();s.current==null&&(s.current=Rq({window:r,v5Compat:!0}));let i=s.current,[o,l]=D.useState({action:i.action,location:i.location}),{v7_startTransition:d}=a||{},c=D.useCallback(f=>{d&&LR?LR(()=>l(f)):l(f)},[l,d]);return D.useLayoutEffect(()=>i.listen(c),[i,c]),D.useEffect(()=>kK(a),[a]),D.createElement(NK,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:i,future:a})}const MK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$K=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fv=D.forwardRef(function(t,n){let{onClick:a,relative:r,reloadDocument:s,replace:i,state:o,target:l,to:d,preventScrollReset:c,viewTransition:f}=t,m=EK(t,_K),{basename:x}=D.useContext(Vd),y,b=!1;if(typeof d=="string"&&$K.test(d)&&(y=d,MK))try{let C=new URL(window.location.href),E=d.startsWith("//")?new URL(C.protocol+d):new URL(d),T=QE(E.pathname,x);E.origin===C.origin&&T!=null?d=T+E.search+E.hash:b=!0}catch{}let w=oK(d,{relative:r}),S=BK(d,{replace:i,state:o,target:l,preventScrollReset:c,relative:r,viewTransition:f});function k(C){a&&a(C),C.defaultPrevented||S(C)}return D.createElement("a",ZN({},m,{href:y||w,onClick:b||s?a:k,ref:n,target:l}))});var PR;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(PR||(PR={}));var zR;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zR||(zR={}));function BK(e,t){let{target:n,replace:a,state:r,preventScrollReset:s,relative:i,viewTransition:o}=t===void 0?{}:t,l=Us(),d=Vl(),c=yF(e,{relative:i});return D.useCallback(f=>{if(TK(f,n)){f.preventDefault();let m=a!==void 0?a:pv(d)===pv(c);l(e,{replace:m,state:r,preventScrollReset:s,relative:i,viewTransition:o})}},[d,l,c,a,r,n,e,s,i,o])}function rw(e){let t=D.useRef(eC(e)),n=D.useRef(!1),a=Vl(),r=D.useMemo(()=>AK(a.search,n.current?null:t.current),[a.search]),s=Us(),i=D.useCallback((o,l)=>{const d=eC(typeof o=="function"?o(r):o);n.current=!0,s("?"+d,l)},[s,r]);return[r,i]}const eI=D.createContext({});function tI(e){const t=D.useRef(null);return t.current===null&&(t.current=e()),t.current}const nI=typeof window<"u",SF=nI?D.useLayoutEffect:D.useEffect,sw=D.createContext(null);function aI(e,t){e.indexOf(t)===-1&&e.push(t)}function rI(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}
vendor: 43,813 bytes, lines 9-17
9const Pl=(e,t,n)=>n>t?t:n<e?e:n;let sI=()=>{};const zl={},kF=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function NF(e){return typeof e=="object"&&e!==null}const CF=e=>/^0[^.\s]+$/u.test(e);function iI(e){let t;return()=>(t===void 0&&(t=e()),t)}const Zi=e=>e,FK=(e,t)=>n=>t(e(n)),Xy=(...e)=>e.reduce(FK),gy=(e,t,n)=>{const a=t-e;return a===0?1:(n-e)/a};class oI{constructor(){this.subscriptions=[]}add(t){return aI(this.subscriptions,t),()=>rI(this.subscriptions,t)}notify(t,n,a){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,a);else for(let s=0;s<r;s++){const i=this.subscriptions[s];i&&i(t,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Jo=e=>e*1e3,Qo=e=>e/1e3;function EF(e,t){return t?e*(1e3/t):0}const IF=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,OK=1e-7,LK=12;function PK(e,t,n,a,r){let s,i,o=0;do i=t+(n-t)/2,s=IF(i,a,r)-e,s>0?n=i:t=i;while(Math.abs(s)>OK&&++o<LK);return i}function Yy(e,t,n,a){if(e===t&&n===a)return Zi;const r=s=>PK(s,0,1,e,n);return s=>s===0||s===1?s:IF(r(s),t,a)}const TF=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,AF=e=>t=>1-e(1-t),_F=Yy(.33,1.53,.69,.99),lI=AF(_F),jF=TF(lI),DF=e=>(e*=2)<1?.5*lI(e):.5*(2-Math.pow(2,-10*(e-1))),uI=e=>1-Math.sin(Math.acos(e)),RF=AF(uI),MF=TF(uI),zK=Yy(.42,0,1,1),UK=Yy(0,0,.58,1),$F=Yy(.42,0,.58,1),WK=e=>Array.isArray(e)&&typeof e[0]!="number",BF=e=>Array.isArray(e)&&typeof e[0]=="number",VK={linear:Zi,easeIn:zK,easeInOut:$F,easeOut:UK,circIn:uI,circInOut:MF,circOut:RF,backIn:lI,backInOut:jF,backOut:_F,anticipate:DF},HK=e=>typeof e=="string",UR=e=>{if(BF(e)){sI(e.length===4);const[t,n,a,r]=e;return Yy(t,n,a,r)}else if(HK(e))return VK[e];return e},y1=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function GK(e,t){let n=new Set,a=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(c){i.has(c)&&(d.schedule(c),e()),c(o)}const d={schedule:(c,f=!1,m=!1)=>{const y=m&&r?n:a;return f&&i.add(c),y.has(c)||y.add(c),c},cancel:c=>{a.delete(c),i.delete(c)},process:c=>{if(o=c,r){s=!0;return}r=!0,[n,a]=[a,n],n.forEach(l),n.clear(),r=!1,s&&(s=!1,d.process(c))}};return d}const qK=40;function FF(e,t){let n=!1,a=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,i=y1.reduce((C,E)=>(C[E]=GK(s),C),{}),{setup:o,read:l,resolveKeyframes:d,preUpdate:c,update:f,preRender:m,render:x,postRender:y}=i,b=()=>{const C=zl.useManualTiming?r.timestamp:performance.now();n=!1,zl.useManualTiming||(r.delta=a?1e3/60:Math.max(Math.min(C-r.timestamp,qK),1)),r.timestamp=C,r.isProcessing=!0,o.process(r),l.process(r),d.process(r),c.process(r),f.process(r),m.process(r),x.process(r),y.process(r),r.isProcessing=!1,n&&t&&(a=!1,e(b))},w=()=>{n=!0,a=!0,r.isProcessing||e(b)};return{schedule:y1.reduce((C,E)=>{const T=i[E];return C[E]=(_,A=!1,$=!1)=>(n||w(),T.schedule(_,A,$)),C},{}),cancel:C=>{for(let E=0;E<y1.length;E++)i[y1[E]].cancel(C)},state:r,steps:i}}const{schedule:wa,cancel:Gu,state:ts,steps:qk}=FF(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zi,!0);let Z1;function KK(){Z1=void 0}const ni={now:()=>(Z1===void 0&&ni.set(ts.isProcessing||zl.useManualTiming?ts.timestamp:performance.now()),Z1),set:e=>{Z1=e,queueMicrotask(KK)}},OF=e=>t=>typeof t=="string"&&t.startsWith(e),cI=OF("--"),XK=OF("var(--"),dI=e=>XK(e)?YK.test(e.split("/*")[0].trim()):!1,YK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,im={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},xy={...im,transform:e=>Pl(0,1,e)},b1={...im,default:1},ey=e=>Math.round(e*1e5)/1e5,hI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JK(e){return e==null}const QK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,pI=(e,t)=>n=>!!(typeof n=="string"&&QK.test(n)&&n.startsWith(e)||t&&!JK(n)&&Object.prototype.hasOwnProperty.call(n,t)),LF=(e,t,n)=>a=>{if(typeof a!="string")return a;const[r,s,i,o]=a.match(hI);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(i),alpha:o!==void 0?parseFloat(o):1}},ZK=e=>Pl(0,255,e),Kk={...im,transform:e=>Math.round(ZK(e))},pd={test:pI("rgb","red"),parse:LF("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Kk.transform(e)+", "+Kk.transform(t)+", "+Kk.transform(n)+", "+ey(xy.transform(a))+")"};function eX(e){let t="",n="",a="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,a+=a,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:r?parseInt(r,16)/255:1}}const tC={test:pI("#"),parse:eX,transform:pd.transform},Jy=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Iu=Jy("deg"),Zo=Jy("%"),Gt=Jy("px"),tX=Jy("vh"),nX=Jy("vw"),WR={...Zo,parse:e=>Zo.parse(e)/100,transform:e=>Zo.transform(e*100)},Nf={test:pI("hsl","hue"),parse:LF("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Zo.transform(ey(t))+", "+Zo.transform(ey(n))+", "+ey(xy.transform(a))+")"},gr={test:e=>pd.test(e)||tC.test(e)||Nf.test(e),parse:e=>pd.test(e)?pd.parse(e):Nf.test(e)?Nf.parse(e):tC.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?pd.transform(e):Nf.transform(e),getAnimatableNone:e=>{const t=gr.parse(e);return t.alpha=0,gr.transform(t)}},aX=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function rX(e){return isNaN(e)&&typeof e=="string"&&(e.match(hI)?.length||0)+(e.match(aX)?.length||0)>0}const PF="number",zF="color",sX="var",iX="var(",VR="${}",oX=/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 yy(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},r=[];let s=0;const o=t.replace(oX,l=>(gr.test(l)?(a.color.push(s),r.push(zF),n.push(gr.parse(l))):l.startsWith(iX)?(a.var.push(s),r.push(sX),n.push(l)):(a.number.push(s),r.push(PF),n.push(parseFloat(l))),++s,VR)).split(VR);return{values:n,split:o,indexes:a,types:r}}function UF(e){return yy(e).values}function WF(e){const{split:t,types:n}=yy(e),a=t.length;return r=>{let s="";for(let i=0;i<a;i++)if(s+=t[i],r[i]!==void 0){const o=n[i];o===PF?s+=ey(r[i]):o===zF?s+=gr.transform(r[i]):s+=r[i]}return s}}const lX=e=>typeof e=="number"?0:gr.test(e)?gr.getAnimatableNone(e):e;function uX(e){const t=UF(e);return WF(e)(t.map(lX))}const qu={test:rX,parse:UF,createTransformer:WF,getAnimatableNone:uX};function Xk(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function cX({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,t/=100,n/=100;let r=0,s=0,i=0;if(!t)r=s=i=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;r=Xk(l,o,e+1/3),s=Xk(l,o,e),i=Xk(l,o,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(i*255),alpha:a}}function mv(e,t){return n=>n>0?t:e}const Ma=(e,t,n)=>e+(t-e)*n,Yk=(e,t,n)=>{const a=e*e,r=n*(t*t-a)+a;return r<0?0:Math.sqrt(r)},dX=[tC,pd,Nf],hX=e=>dX.find(t=>t.test(e));function HR(e){const t=hX(e);if(!t)return!1;let n=t.parse(e);return t===Nf&&(n=cX(n)),n}const GR=(e,t)=>{const n=HR(e),a=HR(t);if(!n||!a)return mv(e,t);const r={...n};return s=>(r.red=Yk(n.red,a.red,s),r.green=Yk(n.green,a.green,s),r.blue=Yk(n.blue,a.blue,s),r.alpha=Ma(n.alpha,a.alpha,s),pd.transform(r))},nC=new Set(["none","hidden"]);function pX(e,t){return nC.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function fX(e,t){return n=>Ma(e,t,n)}function fI(e){return typeof e=="number"?fX:typeof e=="string"?dI(e)?mv:gr.test(e)?GR:xX:Array.isArray(e)?VF:typeof e=="object"?gr.test(e)?GR:mX:mv}function VF(e,t){const n=[...e],a=n.length,r=e.map((s,i)=>fI(s)(s,t[i]));return s=>{for(let i=0;i<a;i++)n[i]=r[i](s);return n}}function mX(e,t){const n={...e,...t},a={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(a[r]=fI(e[r])(e[r],t[r]));return r=>{for(const s in a)n[s]=a[s](r);return n}}function gX(e,t){const n=[],a={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const s=t.types[r],i=e.indexes[s][a[s]],o=e.values[i]??0;n[r]=o,a[s]++}return n}const xX=(e,t)=>{const n=qu.createTransformer(t),a=yy(e),r=yy(t);return a.indexes.var.length===r.indexes.var.length&&a.indexes.color.length===r.indexes.color.length&&a.indexes.number.length>=r.indexes.number.length?nC.has(e)&&!r.values.length||nC.has(t)&&!a.values.length?pX(e,t):Xy(VF(gX(a,r),r.values),n):mv(e,t)};function HF(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ma(e,t,n):fI(e)(e,t)}const yX=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>wa.update(t,n),stop:()=>Gu(t),now:()=>ts.isProcessing?ts.timestamp:ni.now()}},GF=(e,t,n=10)=>{let a="";const r=Math.max(Math.round(t/n),2);for(let s=0;s<r;s++)a+=Math.round(e(s/(r-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},gv=2e4;function mI(e){let t=0;const n=50;let a=e.next(t);for(;!a.done&&t<gv;)t+=n,a=e.next(t);return t>=gv?1/0:t}function bX(e,t=100,n){const a=n({...e,keyframes:[0,t]}),r=Math.min(mI(a),gv);return{type:"keyframes",ease:s=>a.next(r*s).value/t,duration:Qo(r)}}const vX=5;function qF(e,t,n){const a=Math.max(t-vX,0);return EF(n-e(a),t-a)}const Ua={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Jk=.001;function wX({duration:e=Ua.duration,bounce:t=Ua.bounce,velocity:n=Ua.velocity,mass:a=Ua.mass}){let r,s,i=1-t;i=Pl(Ua.minDamping,Ua.maxDamping,i),e=Pl(Ua.minDuration,Ua.maxDuration,Qo(e)),i<1?(r=d=>{const c=d*i,f=c*e,m=c-n,x=aC(d,i),y=Math.exp(-f);return Jk-m/x*y},s=d=>{const f=d*i*e,m=f*n+n,x=Math.pow(i,2)*Math.pow(d,2)*e,y=Math.exp(-f),b=aC(Math.pow(d,2),i);return(-r(d)+Jk>0?-1:1)*((m-x)*y)/b}):(r=d=>{const c=Math.exp(-d*e),f=(d-n)*e+1;return-Jk+c*f},s=d=>{const c=Math.exp(-d*e),f=(n-d)*(e*e);return c*f});const o=5/e,l=kX(r,s,o);if(e=Jo(e),isNaN(l))return{stiffness:Ua.stiffness,damping:Ua.damping,duration:e};{const d=Math.pow(l,2)*a;return{stiffness:d,damping:i*2*Math.sqrt(a*d),duration:e}}}const SX=12;function kX(e,t,n){let a=n;for(let r=1;r<SX;r++)a=a-e(a)/t(a);return a}function aC(e,t){return e*Math.sqrt(1-t*t)}const NX=["duration","bounce"],CX=["stiffness","damping","mass"];function qR(e,t){return t.some(n=>e[n]!==void 0)}function EX(e){let t={velocity:Ua.velocity,stiffness:Ua.stiffness,damping:Ua.damping,mass:Ua.mass,isResolvedFromDuration:!1,...e};if(!qR(e,CX)&&qR(e,NX))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(n*1.2),r=a*a,s=2*Pl(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Ua.mass,stiffness:r,damping:s}}else{const n=wX(e);t={...t,...n,mass:Ua.mass},t.isResolvedFromDuration=!0}return t}function xv(e=Ua.visualDuration,t=Ua.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:r}=n;const s=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:l,damping:d,mass:c,duration:f,velocity:m,isResolvedFromDuration:x}=EX({...n,velocity:-Qo(n.velocity||0)}),y=m||0,b=d/(2*Math.sqrt(l*c)),w=i-s,S=Qo(Math.sqrt(l/c)),k=Math.abs(w)<5;a||(a=k?Ua.restSpeed.granular:Ua.restSpeed.default),r||(r=k?Ua.restDelta.granular:Ua.restDelta.default);let C;if(b<1){const T=aC(S,b);C=_=>{const A=Math.exp(-b*S*_);return i-A*((y+b*S*w)/T*Math.sin(T*_)+w*Math.cos(T*_))}}else if(b===1)C=T=>i-Math.exp(-S*T)*(w+(y+S*w)*T);else{const T=S*Math.sqrt(b*b-1);C=_=>{const A=Math.exp(-b*S*_),$=Math.min(T*_,300);return i-A*((y+b*S*w)*Math.sinh($)+T*w*Math.cosh($))/T}}const E={calculatedDuration:x&&f||null,next:T=>{const _=C(T);if(x)o.done=T>=f;else{let A=T===0?y:0;b<1&&(A=T===0?Jo(y):qF(C,T,_));const $=Math.abs(A)<=a,O=Math.abs(i-_)<=r;o.done=$&&O}return o.value=o.done?i:_,o},toString:()=>{const T=Math.min(mI(E),gv),_=GF(A=>E.next(T*A).value,T,30);return T+"ms "+_},toTransition:()=>{}};return E}xv.applyToOptions=e=>{const t=bX(e,100,xv);return e.ease=t.ease,e.duration=Jo(t.duration),e.type="keyframes",e};function rC({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:i,min:o,max:l,restDelta:d=.5,restSpeed:c}){const f=e[0],m={done:!1,value:f},x=$=>o!==void 0&&$<o||l!==void 0&&$>l,y=$=>o===void 0?l:l===void 0||Math.abs(o-$)<Math.abs(l-$)?o:l;let b=n*t;const w=f+b,S=i===void 0?w:i(w);S!==w&&(b=S-f);const k=$=>-b*Math.exp(-$/a),C=$=>S+k($),E=$=>{const O=k($),z=C($);m.done=Math.abs(O)<=d,m.value=m.done?S:z};let T,_;const A=$=>{x(m.value)&&(T=$,_=xv({keyframes:[m.value,y(m.value)],velocity:qF(C,$,m.value),damping:r,stiffness:s,restDelta:d,restSpeed:c}))};return A(0),{calculatedDuration:null,next:$=>{let O=!1;return!_&&T===void 0&&(O=!0,E($),A($)),T!==void 0&&$>=T?_.next($-T):(!O&&E($),m)}}}function IX(e,t,n){const a=[],r=n||zl.mix||HF,s=e.length-1;for(let i=0;i<s;i++){let o=r(e[i],e[i+1]);if(t){const l=Array.isArray(t)?t[i]||Zi:t;o=Xy(l,o)}a.push(o)}return a}function TX(e,t,{clamp:n=!0,ease:a,mixer:r}={}){const s=e.length;if(sI(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=IX(t,a,r),l=o.length,d=c=>{if(i&&c<e[0])return t[0];let f=0;if(l>1)for(;f<e.length-2&&!(c<e[f+1]);f++);const m=gy(e[f],e[f+1],c);return o[f](m)};return n?c=>d(Pl(e[0],e[s-1],c)):d}function AX(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const r=gy(0,t,a);e.push(Ma(n,1,r))}}function _X(e){const t=[0];return AX(t,e.length-1),t}function jX(e,t){return e.map(n=>n*t)}function DX(e,t){return e.map(()=>t||$F).splice(0,e.length-1)}function ty({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const r=WK(a)?a.map(UR):UR(a),s={done:!1,value:t[0]},i=jX(n&&n.length===t.length?n:_X(t),e),o=TX(i,t,{ease:Array.isArray(r)?r:DX(t,r)});return{calculatedDuration:e,next:l=>(s.value=o(l),s.done=l>=e,s)}}const RX=e=>e!==null;function gI(e,{repeat:t,repeatType:n="loop"},a,r=1){const s=e.filter(RX),o=r<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||a===void 0?s[o]:a}const MX={decay:rC,inertia:rC,tween:ty,keyframes:ty,spring:xv};function KF(e){typeof e.type=="string"&&(e.type=MX[e.type])}class xI{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const $X=e=>e/100;class yI extends xI{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==ni.now()&&this.tick(ni.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;KF(t);const{type:n=ty,repeat:a=0,repeatDelay:r=0,repeatType:s,velocity:i=0}=t;let{keyframes:o}=t;const l=n||ty;l!==ty&&typeof o[0]!="number"&&(this.mixKeyframes=Xy($X,HF(o[0],o[1])),o=[0,100]);const d=l({...t,keyframes:o});s==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...o].reverse(),velocity:-i})),d.calculatedDuration===null&&(d.calculatedDuration=mI(d));const{calculatedDuration:c}=d;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(a+1)-r,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:a,totalDuration:r,mixKeyframes:s,mirroredGenerator:i,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return a.next(0);const{delay:d=0,keyframes:c,repeat:f,repeatType:m,repeatDelay:x,type:y,onUpdate:b,finalKeyframe:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const S=this.currentTime-d*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?S<0:S>r;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let C=this.currentTime,E=a;if(f){const $=Math.min(this.currentTime,r)/o;let O=Math.floor($),z=$%1;!z&&$>=1&&(z=1),z===1&&O--,O=Math.min(O,f+1),O%2&&(m==="reverse"?(z=1-z,x&&(z-=x/o)):m==="mirror"&&(E=i)),C=Pl(0,1,z)*o}const T=k?{done:!1,value:c[0]}:E.next(C);s&&(T.value=s(T.value));let{done:_}=T;!k&&l!==null&&(_=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_);return A&&y!==rC&&(T.value=gI(c,this.options,w,this.speed)),b&&b(T.value),A&&this.finish(),T}then(t,n){return this.finished.then(t,n)}get duration(){return Qo(this.calculatedDuration)}get time(){return Qo(this.currentTime)}set time(t){t=Jo(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(ni.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Qo(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=yX,startTime:n}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ni.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function BX(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const fd=e=>e*180/Math.PI,sC=e=>{const t=fd(Math.atan2(e[1],e[0]));return iC(t)},FX={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:sC,rotateZ:sC,skewX:e=>fd(Math.atan(e[1])),skewY:e=>fd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},iC=e=>(e=e%360,e<0&&(e+=360),e),KR=sC,XR=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),YR=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),OX={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:XR,scaleY:YR,scale:e=>(XR(e)+YR(e))/2,rotateX:e=>iC(fd(Math.atan2(e[6],e[5]))),rotateY:e=>iC(fd(Math.atan2(-e[2],e[0]))),rotateZ:KR,rotate:KR,skewX:e=>fd(Math.atan(e[4])),skewY:e=>fd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function oC(e){return e.includes("scale")?1:0}function lC(e,t){if(!e||e==="none")return oC(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,r;if(n)a=OX,r=n;else{const o=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=FX,r=o}if(!r)return oC(t);const s=a[t],i=r[1].split(",").map(PX);return typeof s=="function"?s(i):i[s]}const LX=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return lC(n,t)};function PX(e){return parseFloat(e.trim())}const om=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],lm=new Set(om),JR=e=>e===im||e===Gt,zX=new Set(["x","y","z"]),UX=om.filter(e=>!zX.has(e));function WX(e){const t=[];return UX.forEach(n=>{const a=e.getValue(n);a!==void 0&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}const yd={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>lC(t,"x"),y:(e,{transform:t})=>lC(t,"y")};yd.translateX=yd.x;yd.translateY=yd.y;const bd=new Set;let uC=!1,cC=!1,dC=!1;function XF(){if(cC){const e=Array.from(bd).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),n=new Map;t.forEach(a=>{const r=WX(a);r.length&&(n.set(a,r),a.render())}),e.forEach(a=>a.measureInitialState()),t.forEach(a=>{a.render();const r=n.get(a);r&&r.forEach(([s,i])=>{a.getValue(s)?.set(i)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}cC=!1,uC=!1,bd.forEach(e=>e.complete(dC)),bd.clear()}function YF(){bd.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(cC=!0)})}function VX(){dC=!0,YF(),XF(),dC=!1}class bI{constructor(t,n,a,r,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=a,this.motionValue=r,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(bd.add(this),uC||(uC=!0,wa.read(YF),wa.resolveKeyframes(XF))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:a,motionValue:r}=this;if(t[0]===null){const s=r?.get(),i=t[t.length-1];if(s!==void 0)t[0]=s;else if(a&&n){const o=a.readValue(n,i);o!=null&&(t[0]=o)}t[0]===void 0&&(t[0]=i),r&&s===void 0&&r.set(t[0])}BX(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),bd.delete(this)}cancel(){this.state==="scheduled"&&(bd.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const HX=e=>e.startsWith("--");function GX(e,t,n){HX(t)?e.style.setProperty(t,n):e.style[t]=n}const qX=iI(()=>window.ScrollTimeline!==void 0),KX={};function XX(e,t){const n=iI(e);return()=>KX[t]??n()}const JF=XX(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Px=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,QR={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Px([0,.65,.55,1]),circOut:Px([.55,0,1,.45]),backIn:Px([.31,.01,.66,-.59]),backOut:Px([.33,1.53,.69,.99])};function QF(e,t){if(e)return typeof e=="function"?JF()?GF(e,t):"ease-out":BF(e)?Px(e):Array.isArray(e)?e.map(n=>QF(n,t)||QR.easeOut):QR[e]}function YX(e,t,n,{delay:a=0,duration:r=300,repeat:s=0,repeatType:i="loop",ease:o="easeOut",times:l}={},d=void 0){const c={[t]:n};l&&(c.offset=l);const f=QF(o,r);Array.isArray(f)&&(c.easing=f);const m={delay:a,duration:r,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:i==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),e.animate(c,m)}function ZF(e){return typeof e=="function"&&"applyToOptions"in e}function JX({type:e,...t}){return ZF(e)&&JF()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class QX extends xI{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:a,keyframes:r,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=t,sI(typeof t.type!="string");const d=JX(t);this.animation=YX(n,a,r,d,s),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const c=gI(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(c):GX(n,a,c),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Qo(Number(t))}get time(){return Qo(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Jo(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&qX()?(this.animation.timeline=t,Zi):n(this)}}const eO={anticipate:DF,backInOut:jF,circInOut:MF};function ZX(e){return e in eO}function eY(e){typeof e.ease=="string"&&ZX(e.ease)&&(e.ease=eO[e.ease])}const ZR=10;class tY extends QX{constructor(t){eY(t),KF(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:a,onComplete:r,element:s,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const o=new yI({...i,autoplay:!1}),l=Jo(this.finishedTime??this.time);n.setWithVelocity(o.sample(l-ZR).value,o.sample(l).value,ZR),o.stop()}}const eM=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(qu.test(e)||e==="0")&&!e.startsWith("url("));function nY(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function aY(e,t,n,a){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],i=eM(r,t),o=eM(s,t);return!i||!o?!1:nY(e)||(n==="spring"||ZF(n))&&a}function hC(e){e.duration=0,e.type}const rY=new Set(["opacity","clipPath","filter","transform"]),sY=iI(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function iY(e){const{motionValue:t,name:n,repeatDelay:a,repeatType:r,damping:s,type:i}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:d}=t.owner.getProps();return sY()&&n&&rY.has(n)&&(n!=="transform"||!d)&&!l&&!a&&r!=="mirror"&&s!==0&&i!=="inertia"}const oY=40;class lY extends xI{constructor({autoplay:t=!0,delay:n=0,type:a="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i="loop",keyframes:o,name:l,motionValue:d,element:c,...f}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ni.now();const m={autoplay:t,delay:n,type:a,repeat:r,repeatDelay:s,repeatType:i,name:l,motionValue:d,element:c,...f},x=c?.KeyframeResolver||bI;this.keyframeResolver=new x(o,(y,b,w)=>this.onKeyframesResolved(y,b,m,!w),l,d,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,a,r){this.keyframeResolver=void 0;const{name:s,type:i,velocity:o,delay:l,isHandoff:d,onUpdate:c}=a;this.resolvedAt=ni.now(),aY(t,s,i,o)||((zl.instantAnimations||!l)&&c?.(gI(t,a,n)),t[0]=t[t.length-1],hC(a),a.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>oY?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:t},x=!d&&iY(m)?new tY({...m,element:m.motionValue.owner.current}):new yI(m);x.finished.then(()=>this.notifyFinished()).catch(Zi),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),VX()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const uY=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cY(e){const t=uY.exec(e);if(!t)return[,];const[,n,a,r]=t;return[`--${n??a}`,r]}function tO(e,t,n=1){const[a,r]=cY(e);if(!a)return;const s=window.getComputedStyle(t).getPropertyValue(a);if(s){const i=s.trim();return kF(i)?parseFloat(i):i}return dI(r)?tO(r,t,n+1):r}function vI(e,t){return e?.[t]??e?.default??e}const nO=new Set(["width","height","top","left","right","bottom",...om]),dY={test:e=>e==="auto",parse:e=>e},aO=e=>t=>t.test(e),rO=[im,Gt,Zo,Iu,nX,tX,dY],tM=e=>rO.find(aO(e));function hY(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||CF(e):!0}const pY=new Set(["brightness","contrast","saturate","opacity"]);function fY(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=n.match(hI)||[];if(!a)return e;const r=n.replace(a,"");let s=pY.has(t)?1:0;return a!==n&&(s*=100),t+"("+s+r+")"}const mY=/\b([a-z-]*)\(.*?\)/gu,pC={...qu,getAnimatableNone:e=>{const t=e.match(mY);return t?t.map(fY).join(" "):e}},nM={...im,transform:Math.round},gY={rotate:Iu,rotateX:Iu,rotateY:Iu,rotateZ:Iu,scale:b1,scaleX:b1,scaleY:b1,scaleZ:b1,skew:Iu,skewX:Iu,skewY:Iu,distance:Gt,translateX:Gt,translateY:Gt,translateZ:Gt,x:Gt,y:Gt,z:Gt,perspective:Gt,transformPerspective:Gt,opacity:xy,originX:WR,originY:WR,originZ:Gt},wI={borderWidth:Gt,borderTopWidth:Gt,borderRightWidth:Gt,borderBottomWidth:Gt,borderLeftWidth:Gt,borderRadius:Gt,radius:Gt,borderTopLeftRadius:Gt,borderTopRightRadius:Gt,borderBottomRightRadius:Gt,borderBottomLeftRadius:Gt,width:Gt,maxWidth:Gt,height:Gt,maxHeight:Gt,top:Gt,right:Gt,bottom:Gt,left:Gt,padding:Gt,paddingTop:Gt,paddingRight:Gt,paddingBottom:Gt,paddingLeft:Gt,margin:Gt,marginTop:Gt,marginRight:Gt,marginBottom:Gt,marginLeft:Gt,backgroundPositionX:Gt,backgroundPositionY:Gt,...gY,zIndex:nM,fillOpacity:xy,strokeOpacity:xy,numOctaves:nM},xY={...wI,color:gr,backgroundColor:gr,outlineColor:gr,fill:gr,stroke:gr,borderColor:gr,borderTopColor:gr,borderRightColor:gr,borderBottomColor:gr,borderLeftColor:gr,filter:pC,WebkitFilter:pC},sO=e=>xY[e];function iO(e,t){let n=sO(e);return n!==pC&&(n=qu),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const yY=new Set(["auto","none","0"]);function bY(e,t,n){let a=0,r;for(;a<e.length&&!r;){const s=e[a];typeof s=="string"&&!yY.has(s)&&yy(s).values.length&&(r=e[a]),a++}if(r&&n)for(const s of t)e[s]=iO(n,r)}class vY extends bI{constructor(t,n,a,r,s){super(t,n,a,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let d=t[l];if(typeof d=="string"&&(d=d.trim(),dI(d))){const c=tO(d,n.current);c!==void 0&&(t[l]=c),l===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!nO.has(a)||t.length!==2)return;const[r,s]=t,i=tM(r),o=tM(s);if(i!==o)if(JR(i)&&JR(o))for(let l=0;l<t.length;l++){const d=t[l];typeof d=="string"&&(t[l]=parseFloat(d))}else yd[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,a=[];for(let r=0;r<t.length;r++)(t[r]===null||hY(t[r]))&&a.push(r);a.length&&bY(t,a,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=yd[a](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(a,r).jump(r,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:a}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const s=a.length-1,i=a[s];a[s]=yd[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([o,l])=>{t.getValue(o).set(l)}),this.resolveNoneKeyframes()}}function wY(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const r=n?.[e]??a.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}const oO=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function lO(e){return NF(e)&&"offsetHeight"in e}const aM=30,SY=e=>!isNaN(parseFloat(e));class kY{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const r=ni.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ni.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=SY(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new oI);const a=this.events[t].add(n);return t==="change"?()=>{a(),wa.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=ni.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>aM)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,aM);return EF(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(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.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Of(e,t){return new kY(e,t)}const{schedule:SI}=FF(queueMicrotask,!1),vo={x:!1,y:!1};function uO(){return vo.x||vo.y}function NY(e){return e==="x"||e==="y"?vo[e]?null:(vo[e]=!0,()=>{vo[e]=!1}):vo.x||vo.y?null:(vo.x=vo.y=!0,()=>{vo.x=vo.y=!1})}function cO(e,t){const n=wY(e),a=new AbortController,r={passive:!0,...t,signal:a.signal};return[n,r,()=>a.abort()]}function rM(e){return!(e.pointerType==="touch"||uO())}function CY(e,t,n={}){const[a,r,s]=cO(e,n),i=o=>{if(!rM(o))return;const{target:l}=o,d=t(l,o);if(typeof d!="function"||!l)return;const c=f=>{rM(f)&&(d(f),l.removeEventListener("pointerleave",c))};l.addEventListener("pointerleave",c,r)};return a.forEach(o=>{o.addEventListener("pointerenter",i,r)}),s}const dO=(e,t)=>t?e===t?!0:dO(e,t.parentElement):!1,kI=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,EY=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function IY(e){return EY.has(e.tagName)||e.tabIndex!==-1}const ev=new WeakSet;function sM(e){return t=>{t.key==="Enter"&&e(t)}}function Qk(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const TY=(e,t)=>{const n=e.currentTarget;if(!n)return;const a=sM(()=>{if(ev.has(n))return;Qk(n,"down");const r=sM(()=>{Qk(n,"up")}),s=()=>Qk(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)};function iM(e){return kI(e)&&!uO()}function AY(e,t,n={}){const[a,r,s]=cO(e,n),i=o=>{const l=o.currentTarget;if(!iM(o))return;ev.add(l);const d=t(l,o),c=(x,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",m),ev.has(l)&&ev.delete(l),iM(x)&&typeof d=="function"&&d(x,{success:y})},f=x=>{c(x,l===window||l===document||n.useGlobalTarget||dO(l,x.target))},m=x=>{c(x,!1)};window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",m,r)};return a.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",i,r),lO(o)&&(o.addEventListener("focus",d=>TY(d,r)),!IY(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),s}function hO(e){return NF(e)&&"ownerSVGElement"in e}function _Y(e){return hO(e)&&e.tagName==="svg"}const ys=e=>!!(e&&e.getVelocity),jY=[...rO,gr,qu],DY=e=>jY.find(aO(e)),NI=D.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class RY extends D.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const a=n.offsetParent,r=lO(a)&&a.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=r-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function MY({children:e,isPresent:t,anchorX:n,root:a}){const r=D.useId(),s=D.useRef(null),i=D.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:o}=D.useContext(NI);return D.useInsertionEffect(()=>{const{width:l,height:d,top:c,left:f,right:m}=i.current;if(t||!s.current||!l||!d)return;const x=n==="left"?`left: ${f}`:`right: ${m}`;s.current.dataset.motionPopId=r;const y=document.createElement("style");o&&(y.nonce=o);const b=a??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
10          [data-motion-pop-id="${r}"] {
11            position: absolute !important;
12            width: ${l}px !important;
13            height: ${d}px !important;
14            ${x}px !important;
15            top: ${c}px !important;
16          }
17        `),()=>{b.contains(y)&&b.removeChild(y)}},[t]),u.jsx(RY,{isPresent:t,childRef:s,sizeRef:i,children:D.cloneElement(e,{ref:s})})}const $Y=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:r,presenceAffectsLayout:s,mode:i,anchorX:o,root:l})=>{const d=tI(BY),c=D.useId();let f=!0,m=D.useMemo(()=>(f=!1,{id:c,initial:t,isPresent:n,custom:r,onExitComplete:x=>{d.set(x,!0);for(const y of d.values())if(!y)return;a&&a()},register:x=>(d.set(x,!1),()=>d.delete(x))}),[n,d,a]);return s&&f&&(m={...m}),D.useMemo(()=>{d.forEach((x,y)=>d.set(y,!1))},[n]),D.useEffect(()=>{!n&&!d.size&&a&&a()},[n]),i==="popLayout"&&(e=u.jsx(MY,{isPresent:n,anchorX:o,root:l,children:e})),u.jsx(sw.Provider,{value:m,children:e})};function BY(){return new Map}function pO(e=!0){const t=D.useContext(sw);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=t,s=D.useId();D.useEffect(()=>{if(e)return r(s)},[e]);const i=D.useCallback(()=>e&&a&&a(s),[s,a,e]);return!n&&a?[!1,i]:[!0]}const v1=e=>e.key||"";function oM(e){const t=[];return D.Children.forEach(e,n=>{D.isValidElement(n)&&t.push(n)}),t}const CI=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:r=!0,mode:s="sync",propagate:i=!1,anchorX:o="left",root:l})=>{const[d,c]=pO(i),f=D.useMemo(()=>oM(e),[e]),m=i&&!d?[]:f.map(v1),x=D.useRef(!0),y=D.useRef(f),b=tI(()=>new Map),[w,S]=D.useState(f),[k,C]=D.useState(f);SF(()=>{x.current=!1,y.current=f;for(let _=0;_<k.length;_++){const A=v1(k[_]);m.includes(A)?b.delete(A):b.get(A)!==!0&&b.set(A,!1)}},[k,m.length,m.join("-")]);const E=[];if(f!==w){let _=[...f];for(let A=0;A<k.length;A++){const $=k[A],O=v1($);m.includes(O)||(_.splice(A,0,$),E.push($))}return s==="wait"&&E.length&&(_=E),C(oM(_)),S(f),null}const{forceRender:T}=D.useContext(eI);return u.jsx(u.Fragment,{children:k.map(_=>{const A=v1(_),$=i&&!d?!1:f===k||m.includes(A),O=()=>{if(b.has(A))b.set(A,!0);else return;let z=!0;b.forEach(P=>{P||(z=!1)}),z&&(T?.(),C(y.current),i&&c?.(),a&&a())};return u.jsx($Y,{isPresent:$,initial:!x.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:s,root:l,onExitComplete:$?void 0:O,anchorX:o,children:_},A)})})},fO=D.createContext({strict:!1}),lM={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"]},Lf={};for(const e in lM)Lf[e]={isEnabled:t=>lM[e].some(n=>!!t[n])};function FY(e){for(const t in e)Lf[t]={...Lf[t],...e[t]}}const OY=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 yv(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||OY.has(e)}let mO=e=>!yv(e);function LY(e){typeof e=="function"&&(mO=t=>t.startsWith("on")?!yv(t):e(t))}try{LY(require("@emotion/is-prop-valid").default)}catch{}function PY(e,t,n){const a={};for(const r in e)r==="values"&&typeof e.values=="object"||(mO(r)||n===!0&&yv(r)||!t&&!yv(r)||e.draggable&&r.startsWith("onDrag"))&&(a[r]=e[r]);return a}const iw=D.createContext({});function ow(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function by(e){return typeof e=="string"||Array.isArray(e)}const EI=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],II=["initial",...EI];function lw(e){return ow(e.animate)||II.some(t=>by(e[t]))}function gO(e){return!!(lw(e)||e.variants)}function zY(e,t){if(lw(e)){const{initial:n,animate:a}=e;return{initial:n===!1||by(n)?n:void 0,animate:by(a)?a:void 0}}return e.inherit!==!1?t:{}}function UY(e){const{initial:t,animate:n}=zY(e,D.useContext(iw));return D.useMemo(()=>({initial:t,animate:n}),[uM(t),uM(n)])}function uM(e){return Array.isArray(e)?e.join(" "):e}const vy={};function WY(e){for(const t in e)vy[t]=e[t],cI(t)&&(vy[t].isCSSVariable=!0)}function xO(e,{layout:t,layoutId:n}){return lm.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!vy[e]||e==="opacity")}const VY={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},HY=om.length;function GY(e,t,n){let a="",r=!0;for(let s=0;s<HY;
vendor: 4,169 bytes, line 17
17s++){const i=om[s],o=e[i];if(o===void 0)continue;let l=!0;if(typeof o=="number"?l=o===(i.startsWith("scale")?1:0):l=parseFloat(o)===0,!l||n){const d=oO(o,wI[i]);if(!l){r=!1;const c=VY[i]||i;a+=`${c}(${d}) `}n&&(t[i]=d)}}return a=a.trim(),n?a=n(t,r?"":a):r&&(a="none"),a}function TI(e,t,n){const{style:a,vars:r,transformOrigin:s}=e;let i=!1,o=!1;for(const l in t){const d=t[l];if(lm.has(l)){i=!0;continue}else if(cI(l)){r[l]=d;continue}else{const c=oO(d,wI[l]);l.startsWith("origin")?(o=!0,s[l]=c):a[l]=c}}if(t.transform||(i||n?a.transform=GY(t,e.transform,n):a.transform&&(a.transform="none")),o){const{originX:l="50%",originY:d="50%",originZ:c=0}=s;a.transformOrigin=`${l} ${d} ${c}`}}const AI=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yO(e,t,n){for(const a in t)!ys(t[a])&&!xO(a,n)&&(e[a]=t[a])}function qY({transformTemplate:e},t){return D.useMemo(()=>{const n=AI();return TI(n,t,e),Object.assign({},n.vars,n.style)},[t])}function KY(e,t){const n=e.style||{},a={};return yO(a,n,e),Object.assign(a,qY(e,t)),a}function XY(e,t){const n={},a=KY(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}const YY={offset:"stroke-dashoffset",array:"stroke-dasharray"},JY={offset:"strokeDashoffset",array:"strokeDasharray"};function QY(e,t,n=1,a=0,r=!0){e.pathLength=1;const s=r?YY:JY;e[s.offset]=Gt.transform(-a);const i=Gt.transform(t),o=Gt.transform(n);e[s.array]=`${i} ${o}`}function bO(e,{attrX:t,attrY:n,attrScale:a,pathLength:r,pathSpacing:s=1,pathOffset:i=0,...o},l,d,c){if(TI(e,o,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=c?.transformBox??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),a!==void 0&&(f.scale=a),r!==void 0&&QY(f,r,s,i,!1)}const vO=()=>({...AI(),attrs:{}}),wO=e=>typeof e=="string"&&e.toLowerCase()==="svg";function ZY(e,t,n,a){const r=D.useMemo(()=>{const s=vO();return bO(s,t,wO(a),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};yO(s,e.style,e),r.style={...s,...r.style}}return r}const eJ=["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 _I(e){return typeof e!="string"||e.includes("-")?!1:!!(eJ.indexOf(e)>-1||/[A-Z]/u.test(e))}function tJ(e,t,n,{latestValues:a},r,s=!1){const o=(_I(e)?ZY:XY)(t,a,r,e),l=PY(t,typeof e=="string",s),d=e!==D.Fragment?{...l,...o,ref:n}:{},{children:c}=t,f=D.useMemo(()=>ys(c)?c.get():c,[c]);return D.createElement(e,{...d,children:f})}function cM(e){const t=[{},{}];return e?.values.forEach((n,a)=>{t[0][a]=n.get(),t[1][a]=n.getVelocity()}),t}function jI(e,t,n,a){if(typeof t=="function"){const[r,s]=cM(a);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=cM(a);t=t(n!==void 0?n:e.custom,r,s)}return t}function tv(e){return ys(e)?e.get():e}function nJ({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,r){return{latestValues:aJ(n,a,r,e),renderState:t()}}function aJ(e,t,n,a){const r={},s=a(e,{});for(const m in s)r[m]=tv(s[m]);let{initial:i,animate:o}=e;const l=lw(e),d=gO(e);t&&d&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),o===void 0&&(o=t.animate));let c=n?n.initial===!1:!1;c=c||i===!1;const f=c?o:i;if(f&&typeof f!="boolean"&&!ow(f)){const m=Array.isArray(f)?f:[f];for(let x=0;x<m.length;x++){const y=jI(e,m[x]);if(y){const{transitionEnd:b,transition:w,...S}=y;for(const k in S){let C=S[k];if(Array.isArray(C)){const E=c?C.length-1:0;C=C[E]}C!==null&&(r[k]=C)}for(const k in b)r[k]=b[k]}}}return r}const SO=e=>(t,n)=>{const a=D.useContext(iw),r=D.useContext(sw),s=()=>nJ(e,t,a,r);return n?s():tI(s)};
vendor: 7,677 bytes, line 17
17function DI(e,t,n){const{style:a}=e,r={};for(const s in a)(ys(a[s])||t.style&&ys(t.style[s])||xO(s,e)||n?.getValue(s)?.liveStyle!==void 0)&&(r[s]=a[s]);return r}const rJ=SO({scrapeMotionValuesFromProps:DI,createRenderState:AI});function kO(e,t,n){const a=DI(e,t,n);for(const r in e)if(ys(e[r])||ys(t[r])){const s=om.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;a[s]=e[r]}return a}const sJ=SO({scrapeMotionValuesFromProps:kO,createRenderState:vO}),iJ=Symbol.for("motionComponentSymbol");function Cf(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function oJ(e,t,n){return D.useCallback(a=>{a&&e.onMount&&e.onMount(a),t&&(a?t.mount(a):t.unmount()),n&&(typeof n=="function"?n(a):Cf(n)&&(n.current=a))},[t])}const RI=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lJ="framerAppearId",NO="data-"+RI(lJ),CO=D.createContext({});function uJ(e,t,n,a,r){const{visualElement:s}=D.useContext(iw),i=D.useContext(fO),o=D.useContext(sw),l=D.useContext(NI).reducedMotion,d=D.useRef(null);a=a||i.renderer,!d.current&&a&&(d.current=a(e,{visualState:t,parent:s,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:l}));const c=d.current,f=D.useContext(CO);c&&!c.projection&&r&&(c.type==="html"||c.type==="svg")&&cJ(d.current,n,r,f);const m=D.useRef(!1);D.useInsertionEffect(()=>{c&&m.current&&c.update(n,o)});const x=n[NO],y=D.useRef(!!x&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return SF(()=>{c&&(m.current=!0,window.MotionIsMounted=!0,c.updateFeatures(),c.scheduleRenderMicrotask(),y.current&&c.animationState&&c.animationState.animateChanges())}),D.useEffect(()=>{c&&(!y.current&&c.animationState&&c.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),y.current=!1),c.enteringChildren=void 0)}),c}function cJ(e,t,n,a){const{layoutId:r,layout:s,drag:i,dragConstraints:o,layoutScroll:l,layoutRoot:d,layoutCrossfade:c}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:EO(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!i||o&&Cf(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:a,crossfade:c,layoutScroll:l,layoutRoot:d})}function EO(e){if(e)return e.options.allowProjection!==!1?e.projection:EO(e.parent)}function Zk(e,{forwardMotionProps:t=!1}={},n,a){n&&FY(n);const r=_I(e)?sJ:rJ;function s(o,l){let d;const c={...D.useContext(NI),...o,layoutId:dJ(o)},{isStatic:f}=c,m=UY(o),x=r(o,f);if(!f&&nI){hJ();const y=pJ(c);d=y.MeasureLayout,m.visualElement=uJ(e,x,c,a,y.ProjectionNode)}return u.jsxs(iw.Provider,{value:m,children:[d&&m.visualElement?u.jsx(d,{visualElement:m.visualElement,...c}):null,tJ(e,o,oJ(x,m.visualElement,l),x,f,t)]})}s.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=D.forwardRef(s);return i[iJ]=e,i}function dJ({layoutId:e}){const t=D.useContext(eI).id;return t&&e!==void 0?t+"-"+e:e}function hJ(e,t){D.useContext(fO).strict}function pJ(e){const{drag:t,layout:n}=Lf;if(!t&&!n)return{};const a={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function fJ(e,t){if(typeof Proxy>"u")return Zk;const n=new Map,a=(s,i)=>Zk(s,i,e,t),r=(s,i)=>a(s,i);return new Proxy(r,{get:(s,i)=>i==="create"?a:(n.has(i)||n.set(i,Zk(i,void 0,e,t)),n.get(i))})}function IO({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function mJ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function gJ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function eN(e){return e===void 0||e===1}function fC({scale:e,scaleX:t,scaleY:n}){return!eN(e)||!eN(t)||!eN(n)}function td(e){return fC(e)||TO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function TO(e){return dM(e.x)||dM(e.y)}function dM(e){return e&&e!=="0%"}function bv(e,t,n){const a=e-n,r=t*a;return n+r}function hM(e,t,n,a,r){return r!==void 0&&(e=bv(e,r,a)),bv(e,n,a)+t}function mC(e,t=0,n=1,a,r){e.min=hM(e.min,t,n,a,r),e.max=hM(e.max,t,n,a,r)}function AO(e,{x:t,y:n}){mC(e.x,t.translate,t.scale,t.originPoint),mC(e.y,n.translate,n.scale,n.originPoint)}const pM=.999999999999,fM=1.0000000000001;function xJ(e,t,n,a=!1){const r=n.length;if(!r)return;t.x=t.y=1;let s,i;for(let o=0;o<r;o++){s=n[o],i=s.projectionDelta;const{visualElement:l}=s.options;l&&l.props.style&&l.props.style.display==="contents"||(a&&s.options.layoutScroll&&s.scroll&&s!==s.root&&If(e,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,AO(e,i)),a&&td(s.latestValues)&&If(e,s.latestValues))}t.x<fM&&t.x>pM&&(t.x=1),t.y<fM&&t.y>pM&&(t.y=1)}function Ef(e,t){e.min=e.min+t,e.max=e.max+t}function mM(e,t,n,a,r=.5){const s=Ma(e.min,e.max,r);mC(e,t,n,s,a)}function If(e,t){mM(e.x,t.x,t.scaleX,t.scale,t.originX),mM(e.y,t.y,t.scaleY,t.scale,t.originY)}function _O(e,t){return IO(gJ(e.getBoundingClientRect(),t))}function yJ(e,t,n){const a=_O(e,n),{scroll:r}=t;return r&&(Ef(a.x,r.offset.x),Ef(a.y,r.offset.y)),a}const gM=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tf=()=>({x:gM(),y:gM()}),xM=()=>({min:0,max:0}),er=()=>({x:xM(),y:xM()}),gC={current:null},jO={current:!1};function bJ(){if(jO.current=!0,!!nI)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>gC.current=e.matches;e.addEventListener("change",t),t()}else gC.current=!1}const vJ=new WeakMap;function wJ(e,t,n){for(const a in t){const r=t[a],s=n[a];if(ys(r))e.addValue(a,r);else if(ys(s))e.addValue(a,Of(r,{owner:e}));else if(s!==r)if(e.hasValue(a)){const i=e.getValue(a);i.liveStyle===!0?i.jump(r):i.hasAnimated||i.set(r)}else{const i=e.getStaticValue(a);e.addValue(a,Of(i!==void 0?i:r,{owner:e}))}}for(const a in n)t[a]===void 0&&e.removeValue(a);return t}const yM=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class SJ{scrapeMotionValuesFromProps(t,n,a){return{}}constructor({parent:t,props:n,presenceContext:a,reducedMotionConfig:r,blockInitialAnimation:s,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=bI,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 m=ni.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,wa.render(this.render,!1,!0))};const{latestValues:l,renderState:d}=i;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!s,this.isControllingVariants=lw(n),this.isVariantNode=gO(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const x=f[m];l[m]!==void 0&&ys(x)&&x.set(l[m])}}mount(t){this.current=t,vJ.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEac
vendor: 7,360 bytes, line 17
17h((n,a)=>this.bindToMotionValue(a,n)),jO.current||bJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:gC.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Gu(this.notifyUpdate),Gu(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const a=lm.has(t);a&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&wa.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s&&s(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Lf){const n=Lf[t];if(!n)continue;const{isEnabled:a,Feature:r}=n;if(!this.features[t]&&r&&a(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):er()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<yM.length;a++){const r=yM[a];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,i=t[s];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=wJ(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const a=this.values.get(t);n!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&n!==void 0&&(a=Of(n===null?void 0:n,{owner:this}),this.addValue(t,a)),a}readValue(t,n){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(kF(a)||CF(a))?a=parseFloat(a):!DY(a)&&qu.test(n)&&(a=iO(t,n)),this.setBaseTarget(t,ys(a)?a.get():a)),ys(a)?a.get():a}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const s=jI(this.props,n,this.presenceContext?.custom);s&&(a=s[t])}if(n&&a!==void 0)return a;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!ys(r)?r:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new oI),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){SI.render(this.render)}}class DO extends SJ{constructor(){super(...arguments),this.KeyframeResolver=vY}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:a}){delete n[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ys(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function RO(e,{style:t,vars:n},a,r){const s=e.style;let i;for(i in t)s[i]=t[i];r?.applyProjectionStyles(s,a);for(i in n)s.setProperty(i,n[i])}function kJ(e){return window.getComputedStyle(e)}class NJ extends DO{constructor(){super(...arguments),this.type="html",this.renderInstance=RO}readValueFromInstance(t,n){if(lm.has(n))return this.projection?.isProjecting?oC(n):LX(t,n);{const a=kJ(t),r=(cI(n)?a.getPropertyValue(n):a[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return _O(t,n)}build(t,n,a){TI(t,n,a.transformTemplate)}scrapeMotionValuesFromProps(t,n,a){return DI(t,n,a)}}const MO=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 CJ(e,t,n,a){RO(e,t,void 0,a);for(const r in t.attrs)e.setAttribute(MO.has(r)?r:RI(r),t.attrs[r])}class EJ extends DO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=er}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(lm.has(n)){const a=sO(n);return a&&a.default||0}return n=MO.has(n)?n:RI(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,a){return kO(t,n,a)}build(t,n,a){bO(t,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,n,a,r){CJ(t,n,a,r)}mount(t){this.isSVGTag=wO(t.tagName),super.mount(t)}}const IJ=(e,t)=>_I(e)?new EJ(t):new NJ(t,{allowProjection:e!==D.Fragment});function jf(e,t,n){const a=e.getProps();return jI(a,t,n!==void 0?n:a.custom,e)}const xC=e=>Array.isArray(e);function TJ(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Of(n))}function AJ(e){return xC(e)?e[e.length-1]||0:e}function _J(e,t){const n=jf(e,t);let{transitionEnd:a={},transition:r={},...s}=n||{};s={...s,...a};for(const i in s){const o=AJ(s[i]);TJ(e,i,o)}}function jJ(e){return!!(ys(e)&&e.add)}function yC(e,t){const n=e.getValue("willChange");if(jJ(n))return n.add(t);if(!n&&zl.WillChange){const a=new zl.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function $O(e){return e.props[NO]}
vendor: 20,361 bytes, line 17
17const DJ=e=>e!==null;function RJ(e,{repeat:t,repeatType:n="loop"},a){const r=e.filter(DJ),s=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[s]}const MJ={type:"spring",stiffness:500,damping:25,restSpeed:10},$J=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),BJ={type:"keyframes",duration:.8},FJ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},OJ=(e,{keyframes:t})=>t.length>2?BJ:lm.has(e)?e.startsWith("scale")?$J(t[1]):MJ:FJ;function LJ({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:r,repeat:s,repeatType:i,repeatDelay:o,from:l,elapsed:d,...c}){return!!Object.keys(c).length}const MI=(e,t,n,a={},r,s)=>i=>{const o=vI(a,e)||{},l=o.delay||a.delay||0;let{elapsed:d=0}=a;d=d-Jo(l);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-d,onUpdate:m=>{t.set(m),o.onUpdate&&o.onUpdate(m)},onComplete:()=>{i(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:r};LJ(o)||Object.assign(c,OJ(e,c)),c.duration&&(c.duration=Jo(c.duration)),c.repeatDelay&&(c.repeatDelay=Jo(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(hC(c),c.delay===0&&(f=!0)),(zl.instantAnimations||zl.skipAnimations)&&(f=!0,hC(c),c.delay=0),c.allowFlatten=!o.type&&!o.ease,f&&!s&&t.get()!==void 0){const m=RJ(c.keyframes,o);if(m!==void 0){wa.update(()=>{c.onUpdate(m),c.onComplete()});return}}return o.isSync?new yI(c):new lY(c)};function PJ({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,a}function BO(e,t,{delay:n=0,transitionOverride:a,type:r}={}){let{transition:s=e.getDefaultTransition(),transitionEnd:i,...o}=t;a&&(s=a);const l=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const c in o){const f=e.getValue(c,e.latestValues[c]??null),m=o[c];if(m===void 0||d&&PJ(d,c))continue;const x={delay:n,...vI(s||{},c)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(m)&&m===y&&!x.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const S=$O(e);if(S){const k=window.MotionHandoffAnimation(S,c,wa);k!==null&&(x.startTime=k,b=!0)}}yC(e,c),f.start(MI(c,f,m,e.shouldReduceMotion&&nO.has(c)?{type:!1}:x,e,b));const w=f.animation;w&&l.push(w)}return i&&Promise.all(l).then(()=>{wa.update(()=>{i&&_J(e,i)})}),l}function FO(e,t,n,a=0,r=1){const s=Array.from(e).sort((d,c)=>d.sortNodePosition(c)).indexOf(t),i=e.size,o=(i-1)*a;return typeof n=="function"?n(s,i):r===1?s*a:o-s*a}function bC(e,t,n={}){const a=jf(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(r=n.transitionOverride);const s=a?()=>Promise.all(BO(e,a,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:c,staggerDirection:f}=r;return zJ(e,t,l,d,c,f,n)}:()=>Promise.resolve(),{when:o}=r;if(o){const[l,d]=o==="beforeChildren"?[s,i]:[i,s];return l().then(()=>d())}else return Promise.all([s(),i(n.delay)])}function zJ(e,t,n=0,a=0,r=0,s=1,i){const o=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),o.push(bC(l,t,{...i,delay:n+(typeof a=="function"?0:a)+FO(e.variantChildren,l,a,r,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}function UJ(e,t,n={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const r=t.map(s=>bC(e,s,n));a=Promise.all(r)}else if(typeof t=="string")a=bC(e,t,n);else{const r=typeof t=="function"?jf(e,t,n.custom):t;a=Promise.all(BO(e,r,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}function OO(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let a=0;a<n;a++)if(t[a]!==e[a])return!1;return!0}const WJ=II.length;function LO(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?LO(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<WJ;n++){const a=II[n],r=e.props[a];(by(r)||r===!1)&&(t[a]=r)}return t}const VJ=[...EI].reverse(),HJ=EI.length;function GJ(e){return t=>Promise.all(t.map(({animation:n,options:a})=>UJ(e,n,a)))}function qJ(e){let t=GJ(e),n=bM(),a=!0;const r=l=>(d,c)=>{const f=jf(e,c,l==="exit"?e.presenceContext?.custom:void 0);if(f){const{transition:m,transitionEnd:x,...y}=f;d={...d,...y,...x}}return d};function s(l){t=l(e)}function i(l){const{props:d}=e,c=LO(e.parent)||{},f=[],m=new Set;let x={},y=1/0;for(let w=0;w<HJ;w++){const S=VJ[w],k=n[S],C=d[S]!==void 0?d[S]:c[S],E=by(C),T=S===l?k.isActive:null;T===!1&&(y=w);let _=C===c[S]&&C!==d[S]&&E;if(_&&a&&e.manuallyAnimateOnMount&&(_=!1),k.protectedKeys={...x},!k.isActive&&T===null||!C&&!k.prevProp||ow(C)||typeof C=="boolean")continue;const A=KJ(k.prevProp,C);let $=A||S===l&&k.isActive&&!_&&E||w>y&&E,O=!1;const z=Array.isArray(C)?C:[C];let P=z.reduce(r(S),{});T===!1&&(P={});const{prevResolvedValues:j={}}=k,G={...j,...P},X=Q=>{$=!0,m.has(Q)&&(O=!0,m.delete(Q)),k.needsAnimating[Q]=!0;const F=e.getValue(Q);F&&(F.liveStyle=!1)};for(const Q in G){const F=P[Q],H=j[Q];if(x.hasOwnProperty(Q))continue;let B=!1;xC(F)&&xC(H)?B=!OO(F,H):B=F!==H,B?F!=null?X(Q):m.add(Q):F!==void 0&&m.has(Q)?X(Q):k.protectedKeys[Q]=!0}k.prevProp=C,k.prevResolvedValues=P,k.isActive&&(x={...x,...P}),a&&e.blockInitialAnimation&&($=!1);const J=_&&A;$&&(!J||O)&&f.push(...z.map(Q=>{const F={type:S};if(typeof Q=="string"&&a&&!J&&e.manuallyAnimateOnMount&&e.parent){const{parent:H}=e,B=jf(H,Q);if(H.enteringChildren&&B){const{delayChildren:Y}=B.transition||{};F.delay=FO(H.enteringChildren,e,Y)}}return{animation:Q,options:F}}))}if(m.size){const w={};if(typeof d.initial!="boolean"){const S=jf(e,Array.isArray(d.initial)?d.initial[0]:d.initial);S&&S.transition&&(w.transition=S.transition)}m.forEach(S=>{const k=e.getBaseTarget(S),C=e.getValue(S);C&&(C.liveStyle=!0),w[S]=k??null}),f.push({animation:w})}let b=!!f.length;return a&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(b=!1),a=!1,b?t(f):Promise.resolve()}function o(l,d){if(n[l].isActive===d)return Promise.resolve();e.variantChildren?.forEach(f=>f.animationState?.setActive(l,d)),n[l].isActive=d;const c=i(l);for(const f in n)n[f].protectedKeys={};return c}return{animateChanges:i,setActive:o,setAnimateFunction:s,getState:()=>n,reset:()=>{n=bM(),a=!0}}}function KJ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!OO(t,e):!1}function Kc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function bM(){return{animate:Kc(!0),whileInView:Kc(),whileHover:Kc(),whileTap:Kc(),whileDrag:Kc(),whileFocus:Kc(),exit:Kc()}}class cc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class XJ extends cc{constructor(t){super(t),t.animationState||(t.animationState=qJ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ow(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let YJ=0;class JJ extends cc{constructor(){super(...arguments),this.id=YJ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const QJ={animation:{Feature:XJ},exit:{Feature:JJ}};function wy(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}function Qy(e){return{point:{x:e.pageX,y:e.pageY}}}const ZJ=e=>t=>kI(t)&&e(t,Qy(t));function ny(e,t,n,a){return wy(e,t,ZJ(n),a)}const PO=1e-4,eQ=1-PO,tQ=1+PO,zO=.01,nQ=0-zO,aQ=0+zO;function Ms(e){return e.max-e.min}function rQ(e,t,n){return Math.abs(e-t)<=n}function vM(e,t,n,a=.5){e.origin=a,e.originPoint=Ma(t.min,t.max,e.origin),e.scale=Ms(n)/Ms(t),e.translate=Ma(n.min,n.max,e.origin)-e.originPoint,(e.scale>=eQ&&e.scale<=tQ||isNaN(e.scale))&&(e.scale=1),(e.translate>=nQ&&e.translate<=aQ||isNaN(e.translate))&&(e.translate=0)}function ay(e,t,n,a){vM(e.x,t.x,n.x,a?a.originX:void 0),vM(e.y,t.y,n.y,a?a.originY:void 0)}function wM(e,t,n){e.min=n.min+t.min,e.max=e.min+Ms(t)}function sQ(e,t,n){wM(e.x,t.x,n.x),wM(e.y,t.y,n.y)}function SM(e,t,n){e.min=t.min-n.min,e.max=e.min+Ms(t)}function ry(e,t,n){SM(e.x,t.x,n.x),SM(e.y,t.y,n.y)}function Yi(e){return[e("x"),e("y")]}const UO=({current:e})=>e?e.ownerDocument.defaultView:null,kM=(e,t)=>Math.abs(e-t);function iQ(e,t){const n=kM(e.x,t.x),a=kM(e.y,t.y);return Math.sqrt(n**2+a**2)}class WO{constructor(t,n,{transformPagePoint:a,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=nN(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,y=iQ(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!y)return;const{point:b}=m,{timestamp:w}=ts;this.history.push({...b,timestamp:w});const{onStart:S,onMove:k}=this.handlers;x||(S&&S(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,m)},this.handlePointerMove=(m,x)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=tN(x,this.transformPagePoint),wa.update(this.updatePoint,!0)},this.handlePointerUp=(m,x)=>{this.end();const{onEnd:y,onSessionEnd:b,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=nN(m.type==="pointercancel"?this.lastMoveEventInfo:tN(x,this.transformPagePoint),this.history);this.startEvent&&y&&y(m,S),b&&b(m,S)},!kI(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=i,this.contextWindow=r||window;const o=Qy(t),l=tN(o,this.transformPagePoint),{point:d}=l,{timestamp:c}=ts;this.history=[{...d,timestamp:c}];const{onSessionStart:f}=n;f&&f(t,nN(l,this.history)),this.removeListeners=Xy(ny(this.contextWindow,"pointermove",this.handlePointerMove),ny(this.contextWindow,"pointerup",this.handlePointerUp),ny(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Gu(this.updatePoint)}}function tN(e,t){return t?{point:t(e.point)}:e}function NM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nN({point:e},t){return{point:e,delta:NM(e,VO(t)),offset:NM(e,oQ(t)),velocity:lQ(t,.1)}}function oQ(e){return e[0]}function VO(e){return e[e.length-1]}function lQ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const r=VO(e);for(;n>=0&&(a=e[n],!(r.timestamp-a.timestamp>Jo(t)));)n--;if(!a)return{x:0,y:0};const s=Qo(r.timestamp-a.timestamp);if(s===0)return{x:0,y:0};const i={x:(r.x-a.x)/s,y:(r.y-a.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function uQ(e,{min:t,max:n},a){return t!==void 0&&e<t?e=a?Ma(t,e,a.min):Math.max(e,t):n!==void 0&&e>n&&(e=a?Ma(n,e,a.max):Math.min(e,n)),e}function CM(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cQ(e,{top:t,left:n,bottom:a,right:r}){return{x:CM(e.x,n,r),y:CM(e.y,t,a)}}function EM(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,a]=[a,n]),{min:n,max:a}}function dQ(e,t){return{x:EM(e.x,t.x),y:EM(e.y,t.y)}}function hQ(e,t){let n=.5;const a=Ms(e),r=Ms(t);return r>a?n=gy(t.min,t.max-a,e.min):a>r&&(n=gy(e.min,e.max-r,t.min)),Pl(0,1,n)}function pQ(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const vC=.35;function fQ(e=vC){return e===!1?e=0:e===!0&&(e=vC),{x:IM(e,"left","right"),y:IM(e,"top","bottom")}}function IM(e,t,n){return{min:TM(e,t),max:TM(e,n)}}function TM(e,t){return typeof e=="number"?e:e[t]||0}const mQ=new WeakMap;class gQ{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=er(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=f=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Qy(f).point)},i=(f,m)=>{const{drag:x,dragPropagation:y,onDragStart:b}=this.getProps();if(x&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=NY(x),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Yi(S=>{let k=this.getAxisMotionValue(S).get()||0;if(Zo.test(k)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[S];E&&(k=Ms(E)*(parseFloat(k)/100))}}this.originPoint[S]=k}),b&&wa.postRender(()=>b(f,m)),yC(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},o=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m;const{dragPropagation:x,dragDirectionLock:y,onDirectionLock:b,onDrag:w}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:S}=m;if(y&&this.currentDirection===null){this.currentDirection=xQ(S),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",m.point,S),this.updateAxis("y",m.point,S),this.visualElement.render(),w&&w(f,m)},l=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m,this.stop(f,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>Yi(f=>this.getAnimationState(f)==="paused"&&this.getAxisMotionValue(f).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new WO(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:a,contextWindow:UO(this.visualElement)})}stop(t,n){const a=t||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!a)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&wa.postRender(()=>o(a,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,a){const{drag:r}=this.getProps();if(!a||!w1(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(i=uQ(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;t&&Cf(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=cQ(a.layoutBox,t):this.constraints=!1,this.elastic=fQ(n),r!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&Yi(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=pQ(a.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Cf(t))return!1;const a=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=yJ(a,r.root,this.visualElement.getTransformPagePoint());let i=dQ(r.layout.layoutBox,s);if(n){const o=n(mJ(i));this.hasMutatedConstraints=!!o,o&&(i=IO(o))}return i}startAnimation(t){const{drag:n,dragMomentum:a,dragElastic:r,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},d=Yi(c=>{if(!w1(c,n,this.currentDirection))return;let f=l&&l[c]||{};i&&(f={min:0,max:0});const m=r?200:1e6,x=r?40:1e7,y={type:"inertia",velocity:a?t[c]:0,bounceStiffness:m,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(c,y)});return Promise.all(d).then(o)}startAxisValueAnimation(t,n){const a=this.getAxisMotionValue(t);return yC(this.visualElement,t),a.start(MI(t,a,0,n,this.visualElement,!1))}stopAnimation(){Yi(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Yi(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,a=this.visualElement.getProps(),r=a[n];return r||this.visualElement.getValue(t,(a.initial?a.initial[t]:void 0)||0)}snapToCursor(t){Yi(n=>{const{drag:a}=this.getProps();if(!w1(n,a,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:i,max:o}=r.layout.layoutBox[n];s.set(t[n]-Ma(i,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!Cf(n)||!a||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Yi(i=>{const o=this.getAxisMotionValue(i);if(o&&this.constraints!==!1){const l=o.get();r[i]=hQ({min:l,max:l},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),Yi(i=>{if(!w1(i,t,null))return;const o=this.getAxisMotionValue(i),{min:l,max:d}=this.constraints[i];o.set(Ma(l,d,r[i]))})}addListeners(){if(!this.visualElement.current)return;mQ.set(this.visualElement,this);const t=this.visualElement.current,n=ny(t,"pointerdown",l=>{const{drag:d,dragListener:c=!0}=this.getProps();d&&c&&this.start(l)}),a=()=>{const{dragConstraints:l}=this.getProps();Cf(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",a);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),wa.read(a);const i=wy(window,"resize",()=>this.scalePositionWithinConstraints()),o=r.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:d})=>{this.isDragging&&d&&(Yi(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())}));return()=>{i(),n(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:i=vC,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:a,dragPropagation:r,dragConstraints:s,dragElastic:i,dragMomentum:o}}}function w1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function xQ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class yQ extends cc{constructor(t){super(t),this.removeGroupControls=Zi,this.removeListeners=Zi,this.controls=new gQ(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Zi}unmount(){this.removeGroupControls(),this.removeListeners()}}const AM=e=>(t,n)=>{e&&wa.postRender(()=>e(t,n))};class bQ extends cc{constructor(){super(...arguments),this.removePointerDownListener=Zi}onPointerDown(t){this.session=new WO(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:UO(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:a,onPanEnd:r}=this.node.getProps();return{onSessionStart:AM(t),onStart:AM(n),onMove:a,onEnd:(s,i)=>{delete this.session,r&&wa.postRender(()=>r(s,i))}}}mount(){this.removePointerDownListener=ny(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const nv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function _M(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const jx={correct:(e,t)=>
vendor: 5,304 bytes, line 17
17{if(!t.target)return e;if(typeof e=="string")if(Gt.test(e))e=parseFloat(e);else return e;const n=_M(e,t.target.x),a=_M(e,t.target.y);return`${n}% ${a}%`}},vQ={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,r=qu.parse(e);if(r.length>5)return a;const s=qu.createTransformer(e),i=typeof r[0]!="number"?1:0,o=n.x.scale*t.x,l=n.y.scale*t.y;r[0+i]/=o,r[1+i]/=l;const d=Ma(o,l,.5);return typeof r[2+i]=="number"&&(r[2+i]/=d),typeof r[3+i]=="number"&&(r[3+i]/=d),s(r)}};let aN=!1;class wQ extends D.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a,layoutId:r}=this.props,{projection:s}=t;WY(SQ),s&&(n.group&&n.group.add(s),a&&a.register&&r&&a.register(s),aN&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),nv.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:a,drag:r,isPresent:s}=this.props,{projection:i}=a;return i&&(i.isPresent=s,aN=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||wa.postRender(()=>{const o=i.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),SI.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:r}=t;aN=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),a&&a.deregister&&a.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function HO(e){const[t,n]=pO(),a=D.useContext(eI);return u.jsx(wQ,{...e,layoutGroup:a,switchLayoutGroup:D.useContext(CO),isPresent:t,safeToRemove:n})}const SQ={borderRadius:{...jx,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:jx,borderTopRightRadius:jx,borderBottomLeftRadius:jx,borderBottomRightRadius:jx,boxShadow:vQ};function kQ(e,t,n){const a=ys(e)?e:Of(e);return a.start(MI("",a,t,n)),a.animation}const NQ=(e,t)=>e.depth-t.depth;class CQ{constructor(){this.children=[],this.isDirty=!1}add(t){aI(this.children,t),this.isDirty=!0}remove(t){rI(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(NQ),this.isDirty=!1,this.children.forEach(t)}}function EQ(e,t){const n=ni.now(),a=({timestamp:r})=>{const s=r-n;s>=t&&(Gu(a),e(s-t))};return wa.setup(a,!0),()=>Gu(a)}const GO=["TopLeft","TopRight","BottomLeft","BottomRight"],IQ=GO.length,jM=e=>typeof e=="string"?parseFloat(e):e,DM=e=>typeof e=="number"||Gt.test(e);function TQ(e,t,n,a,r,s){r?(e.opacity=Ma(0,n.opacity??1,AQ(a)),e.opacityExit=Ma(t.opacity??1,0,_Q(a))):s&&(e.opacity=Ma(t.opacity??1,n.opacity??1,a));for(let i=0;i<IQ;i++){const o=`border${GO[i]}Radius`;let l=RM(t,o),d=RM(n,o);if(l===void 0&&d===void 0)continue;l||(l=0),d||(d=0),l===0||d===0||DM(l)===DM(d)?(e[o]=Math.max(Ma(jM(l),jM(d),a),0),(Zo.test(d)||Zo.test(l))&&(e[o]+="%")):e[o]=d}(t.rotate||n.rotate)&&(e.rotate=Ma(t.rotate||0,n.rotate||0,a))}function RM(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const AQ=qO(0,.5,RF),_Q=qO(.5,.95,Zi);function qO(e,t,n){return a=>a<e?0:a>t?1:n(gy(e,t,a))}function MM(e,t){e.min=t.min,e.max=t.max}function qi(e,t){MM(e.x,t.x),MM(e.y,t.y)}function $M(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function BM(e,t,n,a,r){return e-=t,e=bv(e,1/n,a),r!==void 0&&(e=bv(e,1/r,a)),e}function jQ(e,t=0,n=1,a=.5,r,s=e,i=e){if(Zo.test(t)&&(t=parseFloat(t),t=Ma(i.min,i.max,t/100)-i.min),typeof t!="number")return;let o=Ma(s.min,s.max,a);e===s&&(o-=t),e.min=BM(e.min,t,n,o,r),e.max=BM(e.max,t,n,o,r)}function FM(e,t,[n,a,r],s,i){jQ(e,t[n],t[a],t[r],t.scale,s,i)}const DQ=["x","scaleX","originX"],RQ=["y","scaleY","originY"];function OM(e,t,n,a){FM(e.x,t,DQ,n?n.x:void 0,a?a.x:void 0),FM(e.y,t,RQ,n?n.y:void 0,a?a.y:void 0)}function LM(e){return e.translate===0&&e.scale===1}function KO(e){return LM(e.x)&&LM(e.y)}function PM(e,t){return e.min===t.min&&e.max===t.max}function MQ(e,t){return PM(e.x,t.x)&&PM(e.y,t.y)}function zM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function XO(e,t){return zM(e.x,t.x)&&zM(e.y,t.y)}function UM(e){return Ms(e.x)/Ms(e.y)}function WM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class $Q{constructor(){this.members=[]}add(t){aI(this.members,t),t.scheduleRender()}remove(t){if(rI(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let a;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){a=s;break}}return a?(this.promote(a),!0):!1}promote(t,n){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.instance&&a.scheduleRender(),t.scheduleRender(),t.resumeFrom=a,n&&(t.resumeFrom.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&a.hide()}}
vendor: 5,025 bytes, line 17
17exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:a}=t;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function BQ(e,t,n){let a="";const r=e.x.translate/t.x,s=e.y.translate/t.y,i=n?.z||0;if((r||s||i)&&(a=`translate3d(${r}px, ${s}px, ${i}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:c,rotateX:f,rotateY:m,skewX:x,skewY:y}=n;d&&(a=`perspective(${d}px) ${a}`),c&&(a+=`rotate(${c}deg) `),f&&(a+=`rotateX(${f}deg) `),m&&(a+=`rotateY(${m}deg) `),x&&(a+=`skewX(${x}deg) `),y&&(a+=`skewY(${y}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return(o!==1||l!==1)&&(a+=`scale(${o}, ${l})`),a||"none"}const rN=["","X","Y","Z"],FQ=1e3;let OQ=0;function sN(e,t,n,a){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),a&&(a[e]=0))}function YO(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=$O(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",wa,!(r||s))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&YO(a)}function JO({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:r}){return class{constructor(i={},o=t?.()){this.id=OQ++,this.animationId=0,this.animationCommitId=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,this.nodes.forEach(zQ),this.nodes.forEach(HQ),this.nodes.forEach(GQ),this.nodes.forEach(UQ)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new CQ)}addEventListener(i,o){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new oI),this.eventHandlers.get(i).add(o)}notifyListeners(i,...o){const l=this.eventHandlers.get(i);l&&l.notify(...o)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=hO(i)&&!_Y(i),this.instance=i;const{layoutId:o,layout:l,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),e){let c,f=0;const m=()=>this.root.updateBlockedByResize=!1;wa.read(()=>{f=window.innerWidth}),e(i,()=>{const x=window.innerWidth;x!==f&&(f=x,this.root.updateBlockedByResize=!0,c&&c(),c=EQ(m,250),nv.hasAnimatedSinceResize&&(nv.hasAnimatedSinceResize=!1,this.nodes.forEach(GM)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&d&&(o||l)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||JQ,{onLayoutAnimationStart:b,onLayoutAnimationComplete:w}=d.getProps(),S=!this.targetLayout||!XO(this.targetLayout,x),k=!f&&m;if(this.options.layoutRoot||this.resumeFrom||k||f&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...vI(y,"layout"),onPlay:b,onComplete:w};(d.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(c,k)}else f||GM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Gu(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.forEac
vendor: 7,558 bytes, line 17
17h(qQ),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const f=this.path[c];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(VM);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(HM);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(VQ),this.nodes.forEach(LQ),this.nodes.forEach(PQ)):this.nodes.forEach(HM),this.clearAllSnapshots();const o=ni.now();ts.delta=Pl(0,1e3/60,o-ts.timestamp),ts.timestamp=o,ts.isProcessing=!0,qk.update.process(ts),qk.preRender.process(ts),qk.render.process(ts),ts.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,SI.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(WQ),this.sharedNodes.forEach(KQ)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wa.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wa.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ms(this.snapshot.measuredBox.x)&&!Ms(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=er(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(o=!1),o&&this.instance){const l=a(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!KO(this.projectionDelta),l=this.getTransformTemplate(),d=l?l(this.latestValues,""):void 0,c=d!==this.prevTransformTemplateValue;i&&this.instance&&(o||td(this.latestValues)||c)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return i&&(l=this.removeTransform(l)),QQ(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return er();const o=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(ZQ))){const{scroll:d}=this.root;d&&(Ef(o.x,d.offset.x),Ef(o.y,d.offset.y))}return o}removeElementScroll(i){const o=er();if(qi(o,i),this.scroll?.wasRoot)return o;for(let l=0;l<this.path.length;l++){const d=this.path[l],{scroll:c,options:f}=d;d!==this.root&&c&&f.layoutScroll&&(c.wasRoot&&qi(o,i),Ef(o.x,c.offset.x),Ef(o.y,c.offset.y))}return o}applyTransform(i,o=!1){const l=er();qi(l,i);for(let d=0;d<this.path.length;d++){const c=this.path[d];!o&&c.options.layoutScroll&&c.scroll&&c!==c.root&&If(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),td(c.latestValues)&&If(l,c.latestValues)}return td(this.latestValues)&&If(l,this.latestValues),l}removeTransform(i){const o=er();qi(o,i);for(let l=0;l<this.path.length;l++){const d=this.path[l];if(!d.instance||!td(d.latestValues))continue;fC(d.latestValues)&&d.updateSnapshot();const c=er(),f=d.measurePageBox();qi(c,f),OM(o,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,c)}return td(this.latestValues)&&OM(o,this.latestValues),o}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.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!==ts.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(i||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:f}=this.options;if(!(!this.layout||!(c||f))){if(this.resolvedRelativeTargetAt=ts.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=er(),this.relativeTargetOrigin=er(),ry(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),qi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=er(),this.targetWithTransforms=er()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),sQ(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):qi(this.target,this.layout.layoutBox),AO(this.target,this.targetDelta)):qi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=er(),this.relativeTargetOrigin=er(),ry(this.relativeTargetOrigin,this.target,m.target),qi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||fC(this.parent.latestValues)||TO(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const i=this.getLead(),o=!!this.resumingFrom||this!==i;let l=!0;
vendor: 8,937 bytes, line 17
17if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===ts.timestamp&&(l=!1),l)return;const{layout:d,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||c))return;qi(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;xJ(this.layoutCorrected,this.treeScale,this.path,o),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=er());const{target:x}=i;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():($M(this.prevProjectionDelta.x,this.projectionDelta.x),$M(this.prevProjectionDelta.y,this.projectionDelta.y)),ay(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!WM(this.projectionDelta.x,this.prevProjectionDelta.x)||!WM(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Tf(),this.projectionDelta=Tf(),this.projectionDeltaWithTransform=Tf()}setAnimationOrigin(i,o=!1){const l=this.snapshot,d=l?l.latestValues:{},c={...this.latestValues},f=Tf();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const m=er(),x=l?l.source:void 0,y=this.layout?this.layout.source:void 0,b=x!==y,w=this.getStack(),S=!w||w.members.length<=1,k=!!(b&&!S&&this.options.crossfade===!0&&!this.path.some(YQ));this.animationProgress=0;let C;this.mixTargetDelta=E=>{const T=E/1e3;qM(f.x,i.x,T),qM(f.y,i.y,T),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ry(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),XQ(this.relativeTarget,this.relativeTargetOrigin,m,T),C&&MQ(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=er()),qi(C,this.relativeTarget)),b&&(this.animationValues=c,TQ(c,d,this.latestValues,T,k,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Gu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wa.update(()=>{nv.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Of(0)),this.currentAnimation=kQ(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:o=>{this.mixTargetDelta(o),i.onUpdate&&i.onUpdate(o)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.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 i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(FQ),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:o,target:l,layout:d,latestValues:c}=i;if(!(!o||!l||!d)){if(this!==i&&this.layout&&d&&QO(this.options.animationType,this.layout.layoutBox,d.layoutBox)){l=this.target||er();const f=Ms(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+f;const m=Ms(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+m}qi(o,l),If(o,c),ay(this.projectionDeltaWithTransform,this.layoutCorrected,o,c)}}registerSharedNode(i,o){this.sharedNodes.has(i)||this.sharedNodes.set(i,new $Q),this.sharedNodes.get(i).add(o);const d=o.options.initialPromotionConfig;o.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(o):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:o,preserveFollowOpacity:l}={}){const d=this.getStack();d&&d.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let o=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const d={};l.z&&sN("z",i,d,this.animationValues);for(let c=0;c<rN.length;c++)sN(`rotate${rN[c]}`,i,d,this.animationValues),sN(`skew${rN[c]}`,i,d,this.animationValues);i.render();for(const c in d)i.setStaticValue(c,d[c]),this.animationValues&&(this.animationValues[c]=d[c]);i.scheduleRender()}applyProjectionStyles(i,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=tv(o?.pointerEvents)||"",i.transform=l?l(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=tv(o?.pointerEvents)||""),this.hasProjected&&!td(this.latestValues)&&(i.transform=l?l({},""):"none",this.hasProjected=!1);return}i.visibility="";const c=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=BQ(this.projectionDeltaWithTransform,this.treeScale,c);l&&(f=l(c,f)),i.transform=f;const{x:m,y:x}=this.projectionDelta;i.transformOrigin=`${m.origin*100}% ${x.origin*100}% 0`,d.animationValues?i.opacity=d===this?c.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:c.opacityExit:i.opacity=d===this?c.opacity!==void 0?c.opacity:"":c.opacityExit!==void 0?c.opacityExit:0;for(const y in vy){if(c[y]===void 0)continue;const{correct:b,applyTo:w,isCSSVariable:S}=vy[y],k=f==="none"?c[y]:b(c[y],d);if(w){const C=w.length;for(let E=0;E<C;E++)i[w[E]]=k}else S?this.options.visualElement.renderState.vars[y]=k:i[y]=k}this.options.layoutId&&(i.pointerEvents=d===this?tv(o?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(VM),this.root.sharedNodes.clear()}}}function LQ(e){e.updateLayout()}function PQ(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:r}=e.options,s=t.source!==e.layout.source;r==="size"?Yi(c=>{const f=s?t.measuredBox[c]:t.layoutBox[c],m=Ms(f);f.min=n[c].min,f.max=f.min+m}):QO(r,t.layoutBox,n)&&Yi(c=>{const f=s?t.measuredBox[c]:t.layoutBox[c],m=Ms(n[c]);f.max=f.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+m)});const i=Tf();ay(i,n,t.layoutBox);const o=Tf();s?ay(o,e.applyTransform(a,!0),t.measuredBox):ay(o,n,t.layoutBox);const l=!KO(i);let d=!1;if(!e.resumeFrom){const c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){const{snapshot:f,layout:m}=c;if(f&&m){const x=er();ry(x,t.layoutBox,f.layoutBox);const y=er();ry(y,n,m.layoutBox),XO(x,y)||(d=!0),c.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=x,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:o,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function zQ(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function UQ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function WQ(e){e.clearSnapshot()}
vendor: 5,426 bytes, line 17
17function VM(e){e.clearMeasurements()}function HM(e){e.isLayoutDirty=!1}function VQ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function GM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function HQ(e){e.resolveTargetDelta()}function GQ(e){e.calcProjection()}function qQ(e){e.resetSkewAndRotation()}function KQ(e){e.removeLeadSnapshot()}function qM(e,t,n){e.translate=Ma(t.translate,0,n),e.scale=Ma(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function KM(e,t,n,a){e.min=Ma(t.min,n.min,a),e.max=Ma(t.max,n.max,a)}function XQ(e,t,n,a){KM(e.x,t.x,n.x,a),KM(e.y,t.y,n.y,a)}function YQ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const JQ={duration:.45,ease:[.4,0,.1,1]},XM=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),YM=XM("applewebkit/")&&!XM("chrome/")?Math.round:Zi;function JM(e){e.min=YM(e.min),e.max=YM(e.max)}function QQ(e){JM(e.x),JM(e.y)}function QO(e,t,n){return e==="position"||e==="preserve-aspect"&&!rQ(UM(t),UM(n),.2)}function ZQ(e){return e!==e.root&&e.scroll?.wasRoot}const eZ=JO({attachResizeListener:(e,t)=>wy(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),iN={current:void 0},ZO=JO({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!iN.current){const e=new eZ({});e.mount(window),e.setOptions({layoutScroll:!0}),iN.current=e}return iN.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),tZ={pan:{Feature:bQ},drag:{Feature:yQ,ProjectionNode:ZO,MeasureLayout:HO}};function QM(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=a[r];s&&wa.postRender(()=>s(t,Qy(t)))}class nZ extends cc{mount(){const{current:t}=this.node;t&&(this.unmount=CY(t,(n,a)=>(QM(this.node,a,"Start"),r=>QM(this.node,r,"End"))))}unmount(){}}class aZ extends cc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Xy(wy(this.node.current,"focus",()=>this.onFocus()),wy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ZM(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=a[r];s&&wa.postRender(()=>s(t,Qy(t)))}class rZ extends cc{mount(){const{current:t}=this.node;t&&(this.unmount=AY(t,(n,a)=>(ZM(this.node,a,"Start"),(r,{success:s})=>ZM(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const wC=new WeakMap,oN=new WeakMap,sZ=e=>{const t=wC.get(e.target);t&&t(e)},iZ=e=>{e.forEach(sZ)};function oZ({root:e,...t}){const n=e||document;oN.has(n)||oN.set(n,{});const a=oN.get(n),r=JSON.stringify(t);return a[r]||(a[r]=new IntersectionObserver(iZ,{root:e,...t})),a[r]}function lZ(e,t,n){const a=oZ(t);return wC.set(e,n),a.observe(e),()=>{wC.delete(e),a.unobserve(e)}}const uZ={some:0,all:1};class cZ extends cc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:a,amount:r="some",once:s}=t,i={root:n?n.current:void 0,rootMargin:a,threshold:typeof r=="number"?r:uZ[r]},o=l=>{const{isIntersecting:d}=l;if(this.isInView===d||(this.isInView=d,s&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),m=d?c:f;m&&m(l)};return lZ(this.node.current,i,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(dZ(t,n))&&this.startObserver()}unmount(){}}function dZ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const hZ={inView:{Feature:cZ},tap:{Feature:rZ},focus:{Feature:aZ},hover:{Feature:nZ}},pZ={layout:{ProjectionNode:ZO,MeasureLayout:HO}},fZ={...QJ,...hZ,...tZ,...pZ},qe=fJ(fZ,IJ),lN={en:{"nav.about":"About","nav.bls":"Adaptive BLS","nav.faqs":"FAQs","nav.contact":"Contact","nav.account":"My Account","nav.accountShort":"Account","nav.login":"Log In","nav.signup":"Sign Up","nav.language":"Language","nav.languageEnglish":"English","nav.languageSpanish":"Español","a11y.skipToMain":"Skip to main content","a11y.mainNav":"Main navigation","a11y.mobileNav":"Mobile navigation","a11y.openMenu":"Open menu","a11y.closeMenu":"Close menu","a11y.heroView":"Hero view","a11y.showIntro":"Show Solta AI intro","a11y.showHowItWorks":"Show How It Works","a11y.hero":"Hero","a11y.switchToEnglish":"Switch to English","a11y.switchToSpanish":"Cambiar a Español","home.seo.title":"Solta AI – Nervous System Regulation","home.seo.description":"Solta AI offers adaptive bilateral stimulation that adju
17sts in real-time to your emotions. Designed to support nervous system regulation between therapy sessions.","home.seo.jsonLdDescription":"Adaptive bilateral stimulation that adjusts in real-time based on AI emotion detection. Designed to support nervous system regulation between therapy sessions.","home.seo.jsonLdOfferDescription":"Monthly subscription with 7-day free trial","home.tagline":"Nervous system regulation that adapts to your emotions","home.emdrInspired":"EMDR-inspired","home.cta":"Try it now - Free","home.howHeading":"Bring to mind what's weighing on you","home.step1.title":"Follow the dot","home.step1.body":"Follow the dot on screen — bilateral stimulation, the core mechanism behind EMDR, helps calm your nervous system","home.step2.title":"We read your emotions in real time","home.step2.body":"Our AI uses computer vision and voice analysis to detect your emotional state","home.step3.title":"The experience adapts to you","home.step3.body":"The stimulation speed and intensity adjust in real time based on how you're actually feeling","home.loop.emotion":"Emotion","home.loop.ai":"AI","home.loop.bls":"BLS","home.loop.repeat":"repeat","home.emotion.happy":"Happy","home.emotion.sad":"Sad","home.emotion.surprised":"Surprised","footer.acknowledgment":"Acknowledgment","footer.crisisPrefix":"Solta AI is not designed to be used in crisis. If you are in crisis, please seek out professional help, or a crisis line. You can find resources at ","footer.crisisSuffix":".","footer.getInTouch":"Get In Touch","footer.emailAria":"Email us at [email protected]","footer.linkedinAria":"Visit Solta AI on LinkedIn (opens in new tab)","footer.privacy":"Privacy Policy","about.seo.title":"About Us – Solta AI","about.seo.description":"Meet the team behind Solta AI. We're on a mission to make EMDR therapy more affordable and accessible by combining human-centered AI with evidence-based practice.","about.mission.heading":"Our Mission","about.mission.body":"Our mission is to make science-backed emotional wellness accessible to everyone. By combining AI with the neuroscience behind EMDR, Solta AI helps people regulate their nervous system in the moments that matter most — whether it's after a stressful day, before sleep, or in the middle of an overwhelming moment. We believe everyone deserves a tool that adapts to how they feel, not just what they choose.","about.team.heading":"Meet the Team","about.sofia.role":"Founder & CEO","about.sofia.linkedinAria":"Sofia Muller's LinkedIn profile (opens in new tab)","about.sofia.bioP1":"Sofia grew her career over nearly four years at **Apple**, where she led data architecture for AI-driven brain health research and co-authored a publication in **Nature Medicine**. She holds a Master's in Machine Learning from **Georgia Tech** and a **BBA in Finance** and Management from Texas Tech.","about.sofia.bioP2":"She started Solta AI after experiencing firsthand how hard it is to access EMDR therapy — long waitlists, high costs, and limited options between sessions. She's building the tool she wishes she'd had.","about.carlos.role":"Clinical Advisor (Co-Founder Track)","about.carlos.linkedinAria":"Dr. Carlos Castañeda's LinkedIn profile (opens in new tab)","about.carlos.bioP1":"Dr. Castañeda is a Licensed Professional Counselor with a **PhD** in Counselor Education & Supervision, an **MA in Mental Health** from Palo Alto University, and a BS in Psychology from **UT Austin**. He is NCC-credentialed and **EMDR-trained**.","about.carlos.bioP2":"He is an **associate professor of psychology** at St. Edward's University and an **experienced founder**, building Think AITA and the Missing Peace Clinic from the ground up. Dr. Castañeda has also contributed to textbooks on AI use for mental health published by the **American Psychological Association** and Cognella Publishing.","about.cab.heading":"Clinical Advisory Board","about.cab.subtitle":"Guiding Clinical Excellence","about.cab.body":"We work closely with EMDR clinicians to ensure that what we build is grounded in clinical best practices and genuinely serves both therapists and the people they treat. Solta AI is formalizing a clinical advisory board of EMDR-trained therapists and researchers to guide product development, safety, and clinical validation. If you're an EMDR clinician interested in shaping the future of accessible trauma reprocessing tools, we'd love to hear from you at [email protected]_.","faq.seo.title":"FAQs – Solta AI","faq.seo.description":"Frequently asked questions about Solta AI — science-backed bilateral stimulation for stress, sleep, and emotional regulation.","faq.heading":"Frequently Asked Questions","faq.section.general":"General","faq.section.clinicians":"Clinicians","faq.section.investors":"Investors","faq.general.items":[{q:"What is Solta AI?",a:"Solta AI is a wellness tool for everyday emotional regulation — the moments when you need to quickly return to baseline after a stressful meeting, before sleep, or when your mind won't stop racing. Choose a mode that fits the moment, and let the AI adapt the experience to how you're feeling."},{q:"How does Solta AI work?",a:"Solta AI uses bilateral stimulation — a gentle, rhythmic pattern your eyes follow on screen — combined with AI that detects your emotional state in real time and adjusts the experience to help you regulate. Think of it as a quick reset for your nervous system when life gets overwhelming."},{q:"What does the AI actually do?",a:"Our computer vision and voice analysis models detect your emotional state in real time — no wearables needed, just your device's camera and microphone. Based on what we detect, we adjust the speed and pattern of the bilateral stimulation to meet you where you are. It's personalized nervous system regulation."},{q:"How is this different from meditation apps?",a:"Meditation asks you to clear your mind. Solta AI gives your brain something active to do — following bilateral stimulation while our AI reads your emotional signals and adapts in real time. It's a different mechanism: active regulation instead of passive stillness. Most people feel a shift in 3-5 minutes."},{q:"When should I use Solta AI?",a:"Whenever you need to return to baseline. After a stressful meeting. When you can't fall asleep. Before a big presentation. During a crav
17ing. When you feel emotionally activated and need to reset quickly. Choose a mode — Calm Down, Sleep, Recharge, Focus, or Emotional Balance — and let the AI do the rest."},{q:"Is this therapy?",a:"No. Solta AI is a wellness tool, not therapy. It's designed for everyday emotional regulation — the moment between getting an upsetting email and walking into a meeting, or when your mind won't stop racing at night. If you're looking for therapy, we recommend working with a licensed professional."},{q:"Will you record my microphone and video during the session?",a:"No. Our emotion detection uses pre-trained models that run entirely on your device. We do not record, store, or transmit any audio or video data. Your privacy is fundamental to how we build."},{q:"What's the story behind the idea?",a:"After a health incident, my doctor recommended The Body Keeps the Score by Dr. Bessel van der Kolk. Reading about how the nervous system processes stress — combined with my background in AI and emotion detection models — gave me the idea for Solta AI. Inspired by techniques used in clinical settings, I wanted to make science-backed emotional regulation accessible to everyone, not just those who can afford weekly therapy."}],"faq.clinicians.items":[{q:"How will you make this product safe?",a:"Safety is central to everything I build. I work closely with EMDR-trained clinicians to ensure our product is grounded in clinical best practices. I'm building a clinical advisory board of EMDR-trained therapists and researchers who will define the clinical guardrails required for safe and responsible deployment. If you're an EMDR clinician interested in helping shape this, please reach out at [email protected]."}],"faq.investors.q1":"I'm interested in investing. What's next?","faq.investors.contactBefore":"Please reach out to ","faq.investors.contactBetween":" or ","faq.investors.linkedinLabel":"our LinkedIn","faq.investors.contactAfter":" to learn more.","account.seo.title":"My Account – Solta AI","account.seo.description":"Manage your Solta AI profile and subscription.","account.heading":"My Account","account.subheading":"Manage your profile and subscription","account.profile.heading":"Profile Information","account.profile.fullName":"Full Name","account.profile.fullNamePlaceholder":"Enter your name","account.profile.notSet":"Not set","account.profile.editName":"Edit full name","account.profile.save":"Save","account.profile.saving":"Saving...","account.profile.cancel":"Cancel","account.profile.email":"Email","account.profile.accountType":"Account Type","account.profile.type.loading":"Loading...","account.profile.type.individual":"Individual","account.profile.type.organization":"Organization","account.profile.type.member":"Organization member","account.profile.type.affiliate":"Affiliate","account.profile.memberSince":"Member Since","account.signOut":"Sign Out","account.org.heading":"My Organization","account.org.namePlaceholder":"Organization name","account.org.editName":"Edit organization name","account.org.inviteBlurb":"Invite members by sharing the code or link below. They'll get full access at no cost.","account.org.memberCode":"Member Code","account.org.copyCode":"Copy organization code","account.org.copy":"Copy","account.org.copied":"Copied","account.org.inviteLink":"Invite Link","account.org.copyLink":"Copy invite link","account.affiliate.heading":"Affiliate Program","account.affiliate.statsEmpty":"Start spreading the word. Share your referral code or link below — you'll be credited for anyone choosing a paid subscription.","account.affiliate.statsActive":"Thanks for spreading the word! You've referred **{referred}** {people}, and **{paid}** of them chose a paid subscription. Keep earning by sharing your referral code or link below.","account.affiliate.statReferred":"People referred","account.affiliate.statPaid":"Paid subscriptions","account.affiliate.person":"person","account.affiliate.people":"people","account.affiliate.referralCode":"Referral Code","account.affiliate.copyCode":"Copy referral code","account.affiliate.referralLink":"Referral Link","account.affiliate.copyLink":"Copy referral link","account.seat.heading":"Seat usage","account.seat.usedSuffix":"used","account.seat.full":"All seats are in use. Contact [email protected] to add more.","account.email.heading":"Email Preferences","account.email.title":"Product updates and tips","account.email.body":"Receive occasional emails about new features and helpful tips.","account.email.toggleAria":"Toggle email marketing consent","account.sub.heading":"Subscription","account.sub.loading":"Loading subscription details...","account.sub.status.active":"Active subscription","account.sub.status.canceled":"Canceled","account.sub.status.pastDue":"Payment past due","account.sub.trialUntil":"Free trial until {date}","account.sub.cancelsOn":"Cancels on {date}","account.sub.nextBillingLabel":"Next billing date:","account.sub.includedFeatures":"Included Features:","account.sub.upToMembers":"Up to {count} member","account.sub.upToMembersPlural":"Up to {count} members","account.sub.orgPlan":"Organization plan","account.sub.allIncluded":"All features included for each member","account.sub.subEnds":"Subscription ends","account.sub.manage":"Manage Subscription","account.sub.processing":"Processing...","account.sub.needHelp":"Need help? Contact us at ","account.sub.cta":"Subscribe to unlock unlimited BLS sessions and continue your healing journey.","account.sub.monthly":"Monthly","account.sub.yearly":"Yearly","account.sub.sevenDaysFree":"7 days free","account.sub.bestValue":"Best Value","account.sub.yearlyValue":"Best value — save 25%","account.sub.yearlyValueSub":"Like getting 3 months free vs. paying monthly.","account.sub.cancelAnytime":"Cancel anytime. No commitment required.","account.sub.startTrial":"Start Free Trial","account.sub.subscribeYearly":"Subscribe Yearly","account.sub.codeApplied":"Organization code applied! Refreshing...","account.feature.unlimited":"Unlimited BLS sessions","account.feature.adaptive":"AI-adaptive speed control","account.feature.emotion":"Emotion tracking & insights","account.feature.affiliateEarn":"Earn money for your referrals","account.feature.entSeats":"{count} members — full access for each","account.alert.loginToManage":"Please log in to manage your subscription.","account.alert.portalFail":"Unable to open subscription management. Please try again or c
17ontact [email protected]","account.alert.portalError":"An error occurred. Please contact [email protected] to manage your subscription.","account.alert.codeApplied":'Localhost: Organization code "{code}" applied! You now have access.',"account.subscribe.error.login":"Please log in to subscribe","account.subscribe.error.generic":"Something went wrong. Please try again.","account.subscribe.error.tryAgain":"An error occurred. Please try again.","auth.loading":"Loading...","auth.or":"OR","auth.continueGoogle":"Continue with Google","auth.connecting":"Connecting...","auth.googleError":"Failed to connect to Google. Please try again.","auth.signup.title":"Create your Solta account","auth.signup.subtitle":"No credit card required","auth.signup.fullNameLabel":"Full name","auth.signup.fullNamePlaceholder":"Full name","auth.signup.emailLabel":"Email address","auth.signup.emailPlaceholder":"Email address","auth.signup.passwordLabel":"Create password","auth.signup.passwordPlaceholder":"Create password (8+ characters)","auth.signup.marketingConsent":"Send me product updates and tips via email","auth.signup.joiningVia":"Joining via ","auth.signup.referredByFriend":"You've been referred","auth.signup.affiliateApplied":"Affiliate access applied","auth.signup.submit":"Create Account","auth.signup.submitLoading":"Creating account...","auth.signup.terms":"By signing up, you agree to our Terms of Service and Privacy Policy. Not a replacement for professional therapy.","auth.signup.haveAccount":"Already have an account?","auth.signup.loginLink":"Log in","auth.signup.alreadyExistsPrefix":"An account with this email already exists. ","auth.signup.forgotPasswordLink":"Forgot your password?","auth.signup.alreadyExistsBetween":" Or ","auth.signup.alreadyExistsLogin":"log in","auth.signup.alreadyExistsSuffix":".","auth.signup.error.fillFields":"Please fill in all fields","auth.signup.error.invalidEmail":"Please enter a valid email address","auth.signup.error.passwordLength":"Password must be at least 8 characters","auth.signup.error.generic":"Something went wrong. Please try again.","auth.signup.error.accountCreated":"Account created. Please log in.","auth.signup.error.tryAgain":"An error occurred. Please try again.","auth.login.title":"Log In","auth.login.subtitle":"Welcome back to Solta AI","auth.login.emailLabel":"Email address","auth.login.emailPlaceholder":"Enter your email","auth.login.passwordLabel":"Password","auth.login.passwordPlaceholder":"Enter your password","auth.login.forgotPassword":"Forgot your password?","auth.login.submit":"Log In","auth.login.submitLoading":"Logging in...","auth.login.noAccount":"Don't have an account?","auth.login.signupLink":"Sign up","auth.login.error.invalid":"Invalid email or password","auth.login.error.tryAgain":"An error occurred. Please try again.","auth.reset.title":"Reset Password","auth.reset.subtitle":"Enter your new password below","auth.reset.newPasswordLabel":"New password","auth.reset.newPasswordPlaceholder":"Enter new password","auth.reset.confirmPasswordLabel":"Confirm new password","auth.reset.confirmPasswordPlaceholder":"Confirm new password","auth.reset.submit":"Reset Password","auth.reset.submitLoading":"Resetting Password...","auth.reset.useEmailLink":"Please use the password reset link from your email to continue.","auth.reset.error.noToken":"No reset token found. Please use the link from your email.","auth.reset.error.invalidToken":"Invalid or missing reset token. Please request a new password reset link.","auth.reset.error.mismatch":"Passwords do not match","auth.reset.error.tooShort":"Password must be at least 6 characters long","auth.reset.error.useLink":"Please use the password reset link from your email.","auth.reset.error.updateFail":"Failed to update password. Please try again.","auth.reset.error.tryAgain":"An error occurred. Please try again.","enterprise.haveCode":"Have an access code?","enterprise.placeholder":"Enter access code","enterprise.apply":"Apply","enterprise.referredByFriend":"You've been referred","enterprise.affiliateApplied":"Affiliate access applied","enterprise.error.invali
17d":"Invalid or expired access code","enterprise.error.tryAgain":"Unable to validate code. Please try again.","notFound.seo.title":"Page Not Found – Solta AI","notFound.seo.description":"The page you're looking for doesn't exist. Head back home or get in touch with us.","notFound.eyebrow":"Error 404","notFound.heading":"Page not found","notFound.body":"The page you're looking for doesn't exist or may have moved. Let's get you back on track.","notFound.ctaHome":"Back to home","notFound.ctaContact":"Contact us"},es:{"nav.about":"Nosotros","nav.bls":"EBL Adaptativa","nav.faqs":"Preguntas frecuentes","nav.contact":"Contacto","nav.account":"Mi cuenta","nav.accountShort":"Cuenta","nav.login":"Iniciar sesión","nav.signup":"Registrarse","nav.language":"Idioma","nav.languageEnglish":"English","nav.languageSpanish":"Español","a11y.skipToMain":"Saltar al contenido principal","a11y.mainNav":"Navegación principal","a11y.mobileNav":"Navegación móvil","a11y.openMenu":"Abrir menú","a11y.closeMenu":"Cerrar menú","a11y.heroView":"Vista principal","a11y.showIntro":"Mostrar introducción de SoltaAI","a11y.showHowItWorks":"Mostrar cómo funciona","a11y.hero":"Portada","a11y.switchToEnglish":"Switch to English","a11y.switchToSpanish":"Cambiar a Español","home.seo.title":"Solta AI – Regulación del sistema nervioso","home.seo.description":"Solta AI ofrece estimulación bilateral adaptativa que se ajusta en tiempo real a tus emociones. Diseñada para apoyar la regulación del sistema nervioso entre sesiones de terapia.","home.seo.jsonLdDescription":"Estimulación bilateral adaptativa que se ajusta en tiempo real con detección de emociones por IA. Diseñada para apoyar la regulación del sistema nervioso entre sesiones de terapia.","home.seo.jsonLdOfferDescription":"Suscripción mensual con 7 días de prueba gratuita","home.tagline":"Regulación del sistema nervioso que se adapta a tus emociones","home.emdrInspired":"Inspirado en EMDR","home.cta":"Pruébalo gratis","home.howHeading":"Piensa en lo que te está pesando","home.step1.title":"Sigue el punto","home.step1.body":"Sigue el punto en la pantalla — la estimulación bilateral, mecanismo central del EMDR, ayuda a calmar tu sistema nervioso","home.step2.title":"Leemos tus emociones en tiempo real","home.step2.body":"Nuestra IA usa visión por computadora y análisis de voz para detectar tu estado emocional","home.step3.title":"La experiencia se adapta a ti","home.step3.body":"La velocidad y la intensidad de la estimulación se ajustan en tiempo real según cómo te sientes","home.loop.emotion":"Emoción","home.loop.ai":"IA","home.loop.bls":"EBL","home.loop.repeat":"repetir","home.emotion.happy":"Feliz","home.emotion.sad":"Triste","home.emotion.surprised":"Sorprendido","footer.acknowledgment":"Aviso","footer.crisisPrefix":"Solta AI no está diseña
17da para usarse en situaciones de crisis. Si estás en crisis, busca ayuda profesional o una línea de crisis. Puedes encontrar recursos en ","footer.crisisSuffix":".","footer.getInTouch":"Contáctanos","footer.emailAria":"Envíanos un correo a [email protected]","footer.linkedinAria":"Visita Solta AI en LinkedIn (abre en una nueva pestaña)","footer.privacy":"Política de privacidad","about.seo.title":"Nosotros – Solta AI","about.seo.description":"Conoce al equipo detrás de Solta AI. Nuestra misión es hacer la terapia EMDR más accesible y asequible combinando IA centrada en las personas con práctica basada en evidencia.","about.mission.heading":"Nuestra misión","about.mission.body":"Nuestra misión es hacer que el bienestar emocional respaldado por la ciencia sea accesible para todos. Combinando IA con la neurociencia detrás de EMDR, Solta AI ayuda a las personas a regular su sistema nervioso en los momentos que más importan — ya sea después de un día estresante, antes de dormir o en medio de un momento abrumador. Creemos que todos merecen una herramienta que se adapte a cómo se sienten, no solo a lo que eligen.","about.team.heading":"Conoce al equipo","about.sofia.role":"Fundadora y CEO","about.sofia.linkedinAria":"Perfil de LinkedIn de Sofia Muller (abre en una nueva pestaña)","about.sofia.bioP1":"Sofia construyó su carrera durante casi cuatro años en **Apple**, donde lideró la arquitectura de datos para investigación en salud cerebral impulsada por IA y coescribió una publicación en **Nature Medicine**. Tiene una Maestría en Machine Learning de **Georgia Tech** y un **BBA en finanzas** y administración de Texas Tech.","about.sofia.bioP2":"Empezó Solta AI tras vivir en carne propia lo difícil que es acceder a terapia EMDR — listas de espera largas, costos altos y pocas opciones entre sesiones. Está construyendo la herramienta que le habría gustado tener.","about.carlos.role":"Asesor clínico (camino de cofundador)","about.carlos.linkedinAria":"Perfil de LinkedIn del Dr. Carlos Castañeda (abre en una nueva pestaña)","about.carlos.bioP1":"El Dr. Castañeda es Consejero Profesional Licenciado con un **Doctorado** en Educación y Supervisión de Consejería, una **Maestría en Salud Mental** de Palo Alto University y una Licenciatura en Psicología de **UT Austin**. Cuenta con la credencial NCC y formación en **EMDR**.","about.carlos.bioP2":"Es **profesor asociado de psicología** en St. Edward's University y un **fundador experimentado**, habiendo creado Think AITA y la Missing Peace Clinic desde cero. El Dr. Castañeda también ha contribuido a libros de texto sobre el uso de IA en salud mental publicados por la **American Psychological Association** y Cognella Publishing.","about.cab.heading":"Consejo asesor clínico","about.cab.subtitle":"Guiando la excelencia clínica","about.cab.body":"Trabajamos de cerca con clínicos de EMDR para asegurar que lo que construimos esté basado en mejores prácticas clínicas y verdaderamente sirva tanto a los terapeutas como a las personas que atienden. Solta AI está formalizando un consejo asesor clínico de terapeutas e investigadores formados en EMDR para guiar el desarrollo del producto, la seguridad y la validación clínica. Si eres clínico de EMDR y te interesa dar forma al futuro de herramientas accesibles para el reprocesamiento del trauma, nos encantaría saber de ti en [email protected]_.","faq.seo.title":"Preguntas frecuentes – Solta AI","faq.seo.description":"Preguntas frecuentes sobre Solta AI — estimulación bilateral respaldada por la ciencia para el estrés, el sueño y la regulación emocional.","faq.heading":"Preguntas frecuentes","faq.section.general":"General","faq.section.clinicians":"Clínicos","faq.section.investors":"Inversionistas","faq.general.items":[{q:"¿Qué es Solta AI?",a:"Solta AI es una herramienta de bienestar para la regulación emocional cotidiana — esos momentos en los que necesitas volver rápidamente a tu equilibrio después de una reunión estresante, antes de dormir o cuando tu mente no para. Elige un modo que se ajuste al momento y deja que la IA adapte la experiencia a cómo te sientes."},{q:"¿Cómo funciona Solta AI?",a:"Solta AI usa estimulación bilateral — un patrón suave y rítmico que tus ojos siguen en la pantalla — combinada con IA que detecta tu estado emocional en tiempo real y ajusta la experiencia para ayudarte a regularte. Piénsalo como un reinicio rápido para tu sistema nervioso cuando la vida se vuelve abrumadora."},{q:"¿Qué hace la IA exactamente?",a:"Nuestros modelos de visión por computadora y análisis de voz detectan tu estado emocional en tiempo real — sin dispositivos especiales, solo la cámara y el micrófono de tu dispositivo. En función de lo que detectamos, ajustamos la velocidad y el patrón de la estimulación bilateral para acompañarte donde estés. Es regulación personalizada del sistema nervioso."},{q:"¿En qué se diferencia de las apps de meditación?",a:"La meditación te pide que aclares la mente. Solta AI le da a tu cerebro algo activo que hacer — seguir la estimulación bilateral mientras nuestra IA lee tus señales emocionales y se adapta en tiempo real. Es un mecanismo distinto: regulación activa en lugar de quietud pasiva. La mayoría de las personas siente un cambio en 3 a 5 minutos."},{q:"¿Cuándo debería usar Solta AI?",a:"Cuando necesites volver a tu equilibrio. Después de una reunión estresante. Cuando no puedas dormir. Antes de una presentación importante. Durante un antojo. Cuando te sientas emocionalmente activado y necesites reiniciarte rápido. Elige un modo — C
17almarse, Dormir, Recargar, Enfocar o Balance Emocional — y deja que la IA haga el resto."},{q:"¿Esto es terapia?",a:"No. Solta AI es una herramienta de bienestar, no terapia. Está diseñada para la regulación emocional cotidiana — el momento entre recibir un correo molesto y entrar a una reunión, o cuando tu mente no para por la noche. Si buscas terapia, te recomendamos trabajar con un profesional licenciado."},{q:"¿Grabarán mi micrófono y mi video durante la sesión?",a:"No. Nuestra detección de emociones usa modelos pre-entrenados que se ejecutan completamente en tu dispositivo. No grabamos, almacenamos ni transmitimos audio o video. Tu privacidad es fundamental en la forma en que construimos."},{q:"¿Cuál es la historia detrás de la idea?",a:"Después de un incidente de salud, mi doctor me recomendó El cuerpo lleva la cuenta del Dr. Bessel van der Kolk. Leer sobre cómo el sistema nervioso procesa el estrés — combinado con mi experiencia en IA y modelos de detección de emociones — me dio la idea de Solta AI. Inspirada en técnicas usadas en entornos clínicos, quería hacer que la regulación emocional respaldada por la ciencia fuera accesible para todos, no solo para quienes pueden pagar tera
17pia semanal."}],"faq.clinicians.items":[{q:"¿Cómo van a hacer que este producto sea seguro?",a:"La seguridad es central en todo lo que construyo. Trabajo de cerca con clínicos formados en EMDR para asegurar que nuestro producto esté basado en mejores prácticas clínicas. Estoy formando un consejo asesor clínico de terapeutas e investigadores formados en EMDR que definirán las salvaguardas clínicas necesarias para un despliegue seguro y responsable. Si eres clínico de EMDR y te interesa ayudar a darle forma a esto, escríbenos a [email protected]."}],"faq.investors.q1":"Me interesa invertir. ¿Qué sigue?","faq.investors.contactBefore":"Escríbenos a ","faq.investors.contactBetween":" o a través de ","faq.investors.linkedinLabel":"nuestro LinkedIn","faq.investors.contactAfter":" para saber más.","account.seo.title":"Mi cuenta – Solta AI","account.seo.description":"Administra tu perfil y suscripción de Solta AI.","account.heading":"Mi cuenta","account.subheading":"Administra tu perfil y suscripción","account.profile.heading":"Información del perfil","account.profile.fullName":"Nombre completo","account.profile.fullNamePlaceholder":"Escribe tu nombre","account.profile.notSet":"Sin definir","account.profile.editName":"Editar nombre completo","account.profile.save":"Guardar","account.profile.saving":"Guardando...","account.profile.cancel":"Cancelar","account.profile.email":"Correo","account.profile.accountType":"Tipo de cuenta","account.profile.type.loading":"Cargando...","account.profile.type.individual":"Individual","account.profile.type.organization":"Organización","account.profile.type.member":"Miembro de organización","account.profile.type.affiliate":"Afiliado","account.profile.memberSince":"Miembro desde","account.signOut":"Cerrar sesión","account.org.heading":"Mi organización","account.org.namePlaceholder":"Nombre de la organización","account.org.editName":"Editar nombre de la organización","account.org.inviteBlurb":"Invita a tus miembros compartiendo el código o el enlace de abajo. Tendrán acceso completo sin costo.","account.org.memberCode":"Código de miembro","account.org.copyCode":"Copiar código de la organización","account.org.copy":"Copiar","account.org.copied":"Copiado","account.org.inviteLink":"Enlace de invitación","account.org.copyLink":"Copiar enlace de invitación","account.affiliate.heading":"Programa de afiliados","account.affiliate.statsEmpty":"Empieza a correr la voz. Comparte tu código o enlace de abajo: se te acreditará por cualquier persona que elija una suscripción de pago.","account.affiliate.statsActive":"¡Gracias por correr la voz! Has referido a **{referred}** {people}, y **{paid}** de ellas eligieron una suscripción de pago. Sigue ganando al compartir tu código o enlace de abajo.","account.affiliate.statReferred":"Personas referidas","account.affiliate.statPaid":"Suscripciones de pago","account.affiliate.person":"persona","account.affiliate.people":"personas","account.affiliate.referralCode":"Código de referido","account.affiliate.copyCode":"Copiar código de referido","account.affiliate.referralLink":"Enlace de referido","account.affiliate.copyLink":"Copiar enlace de referido","account.seat.heading":"Uso de asientos","account.seat.usedSuffix":"en uso","account.seat.full":"Todos los asientos están ocupados. Escribe a [email protected] para agregar más.","account.email.heading":"Preferencias de correo","account.email.title":"Actualizaciones del producto y consejos","account.email.body":"Recibe correos ocasionales sobre nuevas funciones y consejos útiles.","account.email.toggleAria":"Alternar consentimiento de correos de marketing","account.sub.heading":"Suscripción","account.sub.loading":"Cargando detalles de la suscripción...","account.sub.status.active":"Suscripción activa","account.sub.status.canceled":"Cancelada","account.sub.status.pastDue":"Pago atrasado","account.sub.trialUntil":"Prueba gratuita hasta el {date}","account.sub.cancelsOn":"Se cancela el {date}","account.sub.nextBillingLabel":"Próxima fecha de cobro:","account.sub.includedFeatures":"Funciones incluidas:","account.sub.upToMembers":"Hasta {count} miembro","account.sub.upToMembersPlural":"Hasta {count} miembros","account.sub.orgPlan":"Plan de organización","account.sub.allIncluded":"Todas las funciones incluidas para cada miembro","account.sub.subEnds":"La suscripción termina","account.sub.manage":"Administrar suscripción","account.sub.processing":"Procesando...","account.sub.needHelp":"¿Necesitas ayuda? Escríbenos a ","account.sub.cta":"Suscríbete para desbloquear sesiones ilimitadas de EBL y continuar tu recorrido de bienestar.","account.sub.monthly":"Mensual","account.sub.yearly":"Anual","account.sub.sevenDaysFree":"7 días gratis","account.sub.bestValue":"Más valor","account.sub.yearlyValue":"Mejor valor: ahorra un 25 %","account.sub.yearlyValueSub":"Es como obtener 3 meses gratis frente al pago mensual.","account.sub.cancelAnytime":"Cancela en cualquier momento. Sin compromiso.","account.sub.startTrial":"Empezar prueba gratuita","account.sub.subscribeYearly":"Suscribirse al plan anual","account.sub.codeApplied":"¡Código de organización aplicad
17o! Actualizando...","account.feature.unlimited":"Sesiones ilimitadas de EBL","account.feature.adaptive":"Control de velocidad adaptable por IA","account.feature.emotion":"Seguimiento de emociones e insights","account.feature.affiliateEarn":"Gana dinero por tus referidos","account.feature.entSeats":"{count} miembros — acceso completo para cada uno","account.alert.loginToManage":"Inicia sesión para administrar tu suscripción.","account.alert.portalFail":"No se pudo abrir la administración de la suscripción. Intenta de nuevo o escríbenos a [email protected]","account.alert.portalError":"Ocurrió un error. Escribe a [email protected] para administrar tu suscripción.","account.alert.codeApplied":'Localhost: ¡Código de organización "{code}" aplicado! Ya tienes acceso.',"account.subscribe.error.login":"Inicia sesión para suscribirte","account.subscribe.error.generic":"Algo salió mal. Intenta de nuevo.","account.subscribe.error.tryAgain":"Ocurrió un error. Intenta de nuevo.","auth.loading":"Cargando...","auth.or":"O","auth.continueGoogle":"Continuar con Google","auth.connecting":"Conectando...","auth.googleError":"No se pudo conectar con Google. Intenta de nuevo.","auth.signup.title":"Crea tu cuenta de Solta","auth.signup.subtitle":"No se requiere tarjeta de crédito","auth.signup.fullNameLabel":"Nombre completo","auth.signup.fullNamePlaceholder":"Nombre completo","auth.signup.emailLabel":"Correo electrónico","auth.signup.emailPlaceholder":"Correo electrónico","auth.signup.passwordLabel":"Crear contraseña","auth.signup.passwordPlaceholder":"Crea una contraseña (8+ caracteres)","auth.signup.marketingConsent":"Quiero recibir actualizaciones y consejos del producto por correo","auth.signup.joiningVia":"Te unes a través de ","auth.signup.referredByFriend":"Fuiste referido","auth.signup.affiliateApplied":"Acceso de afiliado aplicado","auth.signup.submit":"Crear cuenta","auth.signup.submitLoading":"Creando cuenta...","auth.signup.terms":"Al registrarte, aceptas nuestros Términos de servicio y Política de privacidad. No es un sustituto de la terapia profesional.","auth.signup.haveAccount":"¿Ya tienes una cuenta?","auth.signup.loginLink":"Iniciar sesión","auth.signup.alreadyExistsPrefix":"Ya existe una cuenta con este correo. ","auth.signup.forgotPasswordLink":"¿Olvidaste tu contraseña?","auth.signup.alreadyExistsBetween":" O ","auth.signup.alreadyExistsLogin":"inicia sesión","auth.signup.alreadyExistsSuffix":".","auth.signup.error.fillFields":"Completa todos los campos","auth.signup.error.invalidEmail":"Escribe un correo electrónico válido","auth.signup.error.passwordLength":"La contraseña debe tener al menos 8 caracteres","auth.signup.error.generic":"Algo salió mal. Intenta de nuevo.","auth.signup.error.accountCreated":"Cuenta creada. Inicia sesión.","auth.signup.error.tryAgain":"Ocurrió un error. Intenta de nuevo.","auth.login.title":"Iniciar sesión","auth.login.subtitle":"Bienvenido de vuelta a Solta AI","auth.login.emailLabel":"Correo electrónico","auth.login.emailPlaceholder":"Escribe tu correo","auth.login.passwordLabel":"Contraseña","auth.login.passwordPlaceholder":"Escribe tu contraseña","auth.login.forgotPassword":"¿Olvidaste tu contraseña?","auth.login.submit":"Iniciar sesión","auth.login.submitLoading":"Iniciando sesión...","auth.login.noAccount":"¿No tienes una cuenta?","auth.login.signupLink":"Regístrate","auth.login.error.invalid":"Correo o contraseña incorrectos","auth.login.error.tryAgain":"Ocurrió un error. Intenta de nuevo.","auth.reset.title":"Restablecer contraseña","auth.reset.subtitle":"Escribe tu nueva contraseña abajo","auth.reset.newPasswordLabel":"Nueva contraseña","auth.reset.newPasswordPlaceholder":"Escribe la nueva contraseña","auth.reset.confirmPasswordLabel":"Confirma la nueva contraseña","auth.reset.confirmPasswordPlaceholder":"Confirma la nueva contraseña","auth.reset.submit":"Restablecer contraseña","auth.reset.submitLoading":"Restableciendo contraseña...","auth.reset.useEmailLink":"Usa el enlace de restablecimiento del correo para continuar.","auth.reset.error.noToken":"No se encontró el código de restablecimiento. Usa el enlace de tu correo.","auth.reset.error.invali
17dToken":"Código de restablecimiento inválido o ausente. Solicita un nuevo enlace.","auth.reset.error.mismatch":"Las contraseñas no coinciden","auth.reset.error.tooShort":"La contraseña debe tener al menos 6 caracteres","auth.reset.error.useLink":"Usa el enlace de restablecimiento del correo.","auth.reset.error.updateFail":"No se pudo actualizar la contraseña. Intenta de nuevo.","auth.reset.error.tryAgain":"Ocurrió un error. Intenta de nuevo.","enterprise.haveCode":"¿Tienes un código de acceso?","enterprise.placeholder":"Escribe el código de acceso","enterprise.apply":"Aplicar","enterprise.referredByFriend":"Fuiste referido","enterprise.affiliateApplied":"Acceso de afiliado aplicado","enterprise.error.invalid":"Código de acceso inválido o expirado","enterprise.error.tryAgain":"No se pudo validar el código. Intenta de nuevo.","notFound.seo.title":"Página no encontrada – Solta AI","notFound.seo.description":"La página que buscas no existe. Vuelve al inicio o contáctanos.","notFound.eyebrow":"Error 404","notFound.heading":"Página no encontrada","notFound.body":"La página que buscas no existe o puede haber sido movida. Te ayudamos a volver al camino correcto.","notFound.ctaHome":"Volver al inicio","notFound.ctaContact":"Contáctanos"}},Sy=["en","es"],ky="en",e8=D.createContext({lang:ky,setLang:()=>{},t:e=>e});function Ws(){return D.useContext(e8)}function e5(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mZ(...e){return t=>{let n=!1;const a=e.map(r=>{const s=e5(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<a.length;r++){const s=a[r];typeof s=="function"?s():e5(e[r],null)}}}}function gZ(e){const t=yZ(e),n=D.forwardRef((a,r)=>{const{children:s,...i}=a,o=D.Children.toArray(s),l=o.find(vZ);if(l){const d=l.props.children,c=o.map(f=>f===l?D.Children.count(d)>1?D.Children.only(null):D.isValidElement(d)?d.props.children:null:f);return u.jsx(t,{...i,ref:r,children:D.isValidElement(d)?D.cloneElement(d,void 0,c):null})}return u.jsx(t,{...i,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var xZ=gZ("Slot");function yZ(e){const t=D.forwardRef((n,a)=>{const{children:r,...s}=n;if(D.isValidElement(r)){const i=SZ(r),o=wZ(s,r.props);return r.type!==D.Fragment&&(o.ref=a?mZ(a,i):i),D.cloneElement(r,o)}return D.Children.count(r)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bZ=Symbol("radix.slottable");function vZ(e){return D.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bZ}function wZ(e,t){const n={...t};for(const a in t){const r=e[a],s=t[a];/^on[A-Z]/.test(a)?r&&s?n[a]=(...o)=>{const l=s(...o);return r(...o),l}:r&&(n[a]=r):a==="style"?n[a]={...r,...s}:a==="className"&&(n[a]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function SZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function t8(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=t8(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function n8(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=t8(e))&&(a&&(a+=" "),a+=t);return a}const t5=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,n5=n8,kZ=(e,t)=>n=>{var a;if(t?.variants==null)return n5(e,n?.class,n?.className);const{variants:r,defaultVariants:s}=t,i=Object.keys(r).map(d=>{const c=n?.[d],f=s?.[d];if(c===null)return null;const m=t5(c)||t5(f);return r[d][m]}),o=n&&Object.entries(n).reduce((d,c)=>{let[f,m]=c;return m===void 0||(d[f]=m),d},{}),l=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,c)=>{let{class:f,className:m,...x}=c;return Object.entries(x).every(y=>{let[b,w]=y;return Array.isArray(w)?w.includes({...s,...o}[b]):{...s,...o}[b]===w})?[...d,f,m]:d},[]);return n5(e,i,l,n?.class,n?.className)},$I="-",NZ=e=>{const t=EZ(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split($I);return o[0]===""&&o.length!==1&&o.shift(),a8(o,t)||CZ(i)},getConflictingClassGroupIds:(i,o)=>{const l=n[i]||[];return o&&a[i]?[...l,...a[i]]:l}}},a8=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?a8(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const s=e.join($I);return t.validators.find(({validator:i})=>i(s))?.classGroupId},a5=/^\[(.+)\]$/,CZ=e=>{if(a5.test(e)){const t=a5.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},EZ=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)SC(n[r],a,r,t);return a},SC=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const s=r===""?t:r5(t,r);s.classGroupId=n;return}if(typeof r=="function"){if(IZ(r)){SC(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,i])=>{SC(i,r5(t,s),n,a)})})},r5=(e,t)=>{let n=e;
vendor: 4,127 bytes, line 17
17return t.split($I).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},IZ=e=>e.isThemeGetter,TZ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const r=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=a.get(s))!==void 0)return r(s,i),i},set(s,i){n.has(s)?n.set(s,i):r(s,i)}}},kC="!",NC=":",AZ=NC.length,_Z=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const s=[];let i=0,o=0,l=0,d;for(let y=0;y<r.length;y++){let b=r[y];if(i===0&&o===0){if(b===NC){s.push(r.slice(l,y)),l=y+AZ;continue}if(b==="/"){d=y;continue}}b==="["?i++:b==="]"?i--:b==="("?o++:b===")"&&o--}const c=s.length===0?r:r.substring(l),f=jZ(c),m=f!==c,x=d&&d>l?d-l:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:x}};if(t){const r=t+NC,s=a;a=i=>i.startsWith(r)?s(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=a;a=s=>n({className:s,parseClassName:r})}return a},jZ=e=>e.endsWith(kC)?e.substring(0,e.length-1):e.startsWith(kC)?e.substring(1):e,DZ=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const r=[];let s=[];return a.forEach(i=>{i[0]==="["||t[i]?(r.push(...s.sort(),i),s=[]):s.push(i)}),r.push(...s.sort()),r}},RZ=e=>({cache:TZ(e.cacheSize),parseClassName:_Z(e),sortModifiers:DZ(e),...NZ(e)}),MZ=/\s+/,$Z=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:s}=t,i=[],o=e.trim().split(MZ);let l="";for(let d=o.length-1;d>=0;d-=1){const c=o[d],{isExternal:f,modifiers:m,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:b}=n(c);if(f){l=c+(l.length>0?" "+l:l);continue}let w=!!b,S=a(w?y.substring(0,b):y);if(!S){if(!w){l=c+(l.length>0?" "+l:l);continue}if(S=a(y),!S){l=c+(l.length>0?" "+l:l);continue}w=!1}const k=s(m).join(":"),C=x?k+kC:k,E=C+S;if(i.includes(E))continue;i.push(E);const T=r(S,w);for(let _=0;_<T.length;++_){const A=T[_];i.push(C+A)}l=c+(l.length>0?" "+l:l)}return l};function BZ(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=r8(t))&&(a&&(a+=" "),a+=n);return a}const r8=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=r8(e[a]))&&(n&&(n+=" "),n+=t);return n};function FZ(e,...t){let n,a,r,s=i;function i(l){const d=t.reduce((c,f)=>f(c),e());return n=RZ(d),a=n.cache.get,r=n.cache.set,s=o,o(l)}function o(l){const d=a(l);if(d)return d;const c=$Z(l,n);return r(l,c),c}return function(){return s(BZ.apply(null,arguments))}}const Er=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},s8=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i8=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OZ=/^\d+\/\d+$/,LZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ef=e=>OZ.test(e),ln=e=>!!e&&!Number.isNaN(Number(e)),ku=e=>!!e&&Number.isInteger(Number(e)),uN=e=>e.endsWith("%")&&ln(e.slice(0,-1)),Tl=e=>LZ.test(e),VZ=()=>!0,HZ=e=>PZ.test(e)&&!zZ.test(e),o8=()=>!1,GZ=e=>UZ.test(e),qZ=e=>WZ.test(e),KZ=e=>!St(e)&&!kt(e),XZ=e=>um(e,c8,o8),St=e=>s8.test(e),Xc=e=>um(e,d8,HZ),cN=e=>um(e,eee,ln),s5=e=>um(e,l8,o8),YZ=e=>um(e,u8,qZ),S1=e=>um(e,h8,GZ),kt=e=>i8.test(e),Dx=e=>cm(e,d8),JZ=e=>cm(e,tee),i5=e=>cm(e,l8),QZ=e=>cm(e,c8),ZZ=e=>cm(e,u8),k1=e=>cm(e,h8,!0),um=(e,t,n)=>{const a=s8.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},cm=(e,t,n=!1)=>{const a=i8.exec(e);return a?a[1]?t(a[1]):n:!1},l8=e=>e==="position"||e==="percentage",u8=e=>e==="image"||e==="url",c8=e=>e==="length"||e==="size"||e==="bg-size",d8=e=>e==="length",eee=e=>e==="number",tee=e=>e==="family-name",h8=e=>e==="shadow",nee=()=>{const e=Er("color"),t=Er("font"),n=Er("text"),a=Er("font-weight"),r=Er("tracking"),s=Er("leading"),i=Er
vendor: 4,218 bytes, line 17
17("breakpoint"),o=Er("container"),l=Er("spacing"),d=Er("radius"),c=Er("shadow"),f=Er("inset-shadow"),m=Er("text-shadow"),x=Er("drop-shadow"),y=Er("blur"),b=Er("perspective"),w=Er("aspect"),S=Er("ease"),k=Er("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),kt,St],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],$=()=>[kt,St,l],O=()=>[ef,"full","auto",...$()],z=()=>[ku,"none","subgrid",kt,St],P=()=>["auto",{span:["full",ku,kt,St]},ku,kt,St],j=()=>[ku,"auto",kt,St],G=()=>["auto","min","max","fr",kt,St],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...$()],Q=()=>[ef,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],F=()=>[e,kt,St],H=()=>[...E(),i5,s5,{position:[kt,St]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Y=()=>["auto","cover","contain",QZ,XZ,{size:[kt,St]}],ne=()=>[uN,Dx,Xc],ee=()=>["","none","full",d,kt,St],U=()=>["",ln,Dx,Xc],oe=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[ln,uN,i5,s5],xe=()=>["","none",y,kt,St],Ie=()=>["none",ln,kt,St],_e=()=>["none",ln,kt,St],Oe=()=>[ln,kt,St],Ye=()=>[ef,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tl],breakpoint:[Tl],color:[VZ],container:[Tl],"drop-shadow":[Tl],ease:["in","out","in-out"],font:[KZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tl],shadow:[Tl],spacing:["px",ln],text:[Tl],"text-shadow":[Tl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ef,St,kt,w]}],container:["container"],columns:[{columns:[ln,St,kt,o]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[ku,"auto",kt,St]}],basis:[{basis:[ef,"full","auto",o,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ln,ef,"auto","initial","none",St]}],grow:[{grow:["",ln,kt,St]}],shrink:[{shrink:["",ln,kt,St]}],order:[{order:[ku,"first","last","none",kt,St]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}
vendor: 10,905 bytes, line 17
17],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[o,"screen",...Q()]}],"min-w":[{"min-w":[o,"screen","none",...Q()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Dx,Xc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,kt,cN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uN,St]}],"font-family":[{font:[JZ,St,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,kt,St]}],"line-clamp":[{"line-clamp":[ln,"none",kt,cN]}],leading:[{leading:[s,...$()]}],"list-image":[{"list-image":["none",kt,St]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",kt,St]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ln,"from-font","auto",kt,Xc]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[ln,"auto",kt,St]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kt,St]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kt,St]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:Y()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ku,kt,St],radial:["",kt,St],conic:[ku,kt,St]},ZZ,YZ]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ln,kt,St]}],"outline-w":[{outline:["",ln,Dx,Xc]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",c,k1,S1]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",f,k1,S1]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[ln,Xc]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",m,k1,S1]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[ln,kt,St]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ln]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[kt,St]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[ln]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:Y()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",kt,St]}],filter:[{filter:["","none",kt,St]}],blur:[{blur:xe()}],brightness:[{brightness:[ln,kt,St]}],contrast:[{contrast:[ln,kt,St]}],"drop-shadow":[{"drop-shadow":["","none",x,k1,S1]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",ln,kt,St]}],"hue-rotate":[{"hue-rotate":[ln,kt,St]}],invert:[{invert:["",ln,kt,St]}],saturate:[{saturate:[ln,kt,St]}],sepia:[{sepia:["",ln,kt,St]}],"backdrop-filter":[{"backdrop-filter":["","none",kt,St]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[ln,kt,St]}],"backdrop-contrast":[{"backdrop-contrast":[ln,kt,St]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ln,kt,St]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ln,kt,St]}],"backdrop-invert":[{"backdrop-invert":["",ln,kt,St]}],"backdrop-opacity":[{"backdrop-opacity":[ln,kt,St]}],"backdrop-saturate":[{"backdrop-saturate":[ln,kt,St]}],"backdrop-sepia":[{"backdrop-sepia":["",ln,kt,St]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",kt,St]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ln,"initial",kt,St]}],ease:[{ease:["linear","initial",S,kt,St]}],delay:[{delay:[ln,kt,St]}],animate:[{animate:["none",k,kt,St]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,kt,St]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Oe()}],"skew-x":[{"skew-x":Oe()}],"skew-y":[{"skew-y":Oe()}],transform:[{transform:[kt,St,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ye()}],"translate-x":[{"translate-x":Ye()}],"translate-y":[{"translate-y":Ye()}],"translate-z":[{"translate-z":Ye()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}
vendor: 6,686 bytes, line 17
17],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kt,St]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",kt,St]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[ln,Dx,Xc,cN]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},aee=FZ(nee);function p8(...e){return aee(n8(e))}const ree=kZ("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Rs({className:e,variant:t,size:n,asChild:a=!1,...r}){const s=a?xZ:"button";return u.jsx(s,{"data-slot":"button",className:p8(ree({variant:t,size:n,className:e})),...r})}function uw(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n}function w7e(e,t,n,a){var r=arguments.length,s=r<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,a);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}function see(e,t,n,a){function r(s){return s instanceof n?s:new n(function(i){i(s)})}
17return new(n||(n=Promise))(function(s,i){function o(c){try{d(a.next(c))}catch(f){i(f)}}function l(c){try{d(a.throw(c))}catch(f){i(f)}}function d(c){c.done?s(c.value):r(c.value).then(o,l)}d((a=a.apply(e,t||[])).next())})}const iee=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class BI extends Error{constructor(t,n="FunctionsError",a){super(t),this.name=n,this.context=a}}class oee extends BI{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class o5 extends BI{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class l5 extends BI{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var CC;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(CC||(CC={}));class lee{constructor(t,{headers:n={},customFetch:a,region:r=CC.Any}={}){this.url=t,this.headers=n,this.region=r,this.fetch=iee(a)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return see(this,arguments,void 0,function*(n,a={}){var r;let s,i;try{const{headers:o,method:l,body:d,signal:c,timeout:f}=a;let m={},{region:x}=a;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(m["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let b;d&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",b=d):typeof d=="string"?(m["Content-Type"]="text/plain",b=d):typeof FormData<"u"&&d instanceof FormData?b=d:(m["Content-Type"]="application/json",b=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?b=JSON.stringify(d):b=d;let w=c;f&&(i=new AbortController,s=setTimeout(()=>i.abort(),f),c?(w=i.signal,c.addEventListener("abort",()=>i.abort())):w=i.signal);const S=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),o),body:b,signal:w}).catch(T=>{throw new oee(T)}),k=S.headers.get("x-relay-error");if(k&&k==="true")throw new o5(S);if(!S.ok)throw new l5(S);let C=((r=S.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),E;return C==="application/json"?E=yield S.json():C==="application/octet-stream"||C==="application/pdf"?E=yield S.blob():C==="text/event-stream"?E=S:C==="multipart/form-data"?E=yield S.formData():E=yield S.text(),{data:E,error:null,response:S}}catch(o){return{data:null,error:o,response:o instanceof l5||o instanceof o5?o.context:void 0}}finally{s&&clearTimeout(s)}})}}var uee=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
17de=e.code}},cee=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const a=this.fetch;let r=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let i=null,o=null,l=null,d=s.status,c=s.statusText;if(s.ok){var f,m;if(n.method!=="HEAD"){var x;const S=await s.text();S===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((x=n.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?o=S:o=JSON.parse(S))}const b=(f=n.headers.get("Prefer"))===null||f===void 0?void 0:f.match(/count=(exact|planned|estimated)/),w=(m=s.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");b&&w&&w.length>1&&(l=parseInt(w[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(o)&&(o.length>1?(i={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,d=406,c="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var y;const b=await s.text();try{i=JSON.parse(b),Array.isArray(i)&&s.status===404&&(o=[],i=null,d=200,c="OK")}catch{s.status===404&&b===""?(d=204,c="No Content"):i={message:b}}if(i&&n.isMaybeSingle&&(!(i==null||(y=i.details)===null||y===void 0)&&y.includes("0 rows"))&&(i=null,d=200,c="OK"),i&&n.shouldThrowOnError)throw new uee(i)}return{error:i,data:o,count:l,status:d,statusText:c}});return this.shouldThrowOnError||(r=r.catch(s=>{var i;let o="";const l=s?.cause;if(l){var d,c,f,m;const y=(d=l?.message)!==null&&d!==void 0?d:"",b=(c=l?.code)!==null&&c!==void 0?c:"";o=`${(f=s?.name)!==null&&f!==void 0?f:"FetchError"}: ${s?.message}`,o+=`
18
19Caused by: ${(m=l?.name)!==null&&m!==void 0?m:"Error"}: ${y}`,b&&(o+=` (${b})`),l?.stack&&(o+=`
20${l.stack}`)}else{var x;o=(x=s?.stack)!==null&&x!==void 0?x:""}return{error:{message:`${(i=s?.name)!==null&&i!==void 0?i:"FetchError"}: ${s?.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}returns(){return this}overrideTypes(){return this}},dee=class extends cee{select(e){let t=!1;const n=(e??"*").split("").map(a=>/\s/.test(a)&&!t?"":(a==='"'&&(t=!t),a)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:a,referencedTable:r=a}={}){const s=r?`${r}.order`:"order",i=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${i?`${i},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(a,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:a=n}={}){const r=typeof a>"u"?"offset":`${a}.offset`,s=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(r,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
20explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:a=!1,wal:r=!1,format:s="text"}={}){var i;const o=[e?"analyze":null,t?"verbose":null,n?"settings":null,a?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(i=this.headers.get("Accept"))!==null&&i!==void 0?i:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const u5=new RegExp("[,()]");var gf=class extends dee{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(a=>typeof a=="string"&&u5.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(a=>typeof a=="string"&&u5.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:a}={}){let r="";a==="plain"?r="pl":a==="phrase"?r="ph":a==="websearch"&&(r="w");const s=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${r}fts${s}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const a=n?`${n}.or`:"or";return this.url.searchParams.append(a,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},hee=class{constructor(e,{headers:t={},schema:n,fetch:a}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:a}=t??{},r=n?"HEAD":"GET";let s=!1;const i=(e??"*").split("").map(d=>/\s/.test(d)&&!s?"":(d==='"'&&(s=!s),d)).join(""),{url:o,headers:l}=this.cloneRequestState();
20return o.searchParams.set("select",i),a&&l.append("Prefer",`count=${a}`),new gf({method:r,url:o,headers:l,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var a;const r="POST",{url:s,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),n||i.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,d)=>l.concat(Object.keys(d)),[]);if(o.length>0){const l=[...new Set(o)].map(d=>`"${d}"`);s.searchParams.set("columns",l.join(","))}}return new gf({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:a,defaultToNull:r=!0}={}){var s;const i="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),a&&l.append("Prefer",`count=${a}`),r||l.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((c,f)=>c.concat(Object.keys(f)),[]);if(d.length>0){const c=[...new Set(d)].map(f=>`"${f}"`);o.searchParams.set("columns",c.join(","))}}return new gf({method:i,url:o,headers:l,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(e,{count:t}={}){var n;const a="PATCH",{url:r,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new gf({method:a,url:r,headers:s,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE",{url:a,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new gf({method:n,url:a,headers:r,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}},pee=class f8{constructor(t,{headers:n={},schema:a,fetch:r}={}){this.url=t,this.headers=new Headers(n),this.schemaName=a,this.fetch=r}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new hee(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new f8(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:a=!1,get:r=!1,count:s}={}){var i;let o;const l=new URL(`${this.url}/rpc/${t}`);let d;const c=x=>x!==null&&typeof x=="object"&&(!Array.isArray(x)||x.some(c)),f=a&&Object.values(n).some(c);f?(o="POST",d=n):a||r?(o=a?"HEAD":"GET",Object.entries(n).filter(([x,y])=>y!==void 0).map(([x,y])=>[x,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([x,y])=>{l.searchParams.append(x,y)})):(o="POST",d=n);const m=new Headers(this.headers);return f?m.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&m.set("Prefer",`count=${s}`),new gf({method:o,url:l,headers:m,schema:this.schemaName,body:d,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};class fee{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const a=n.versions;if(a&&a.node){const r=a.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
21import ws from "ws"
22new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
23
24Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const a=this.getWebSocketConstructor();return new a(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const mee="2.91.0",gee=`realtime-js/${mee}`,xee="1.0.0",m8="2.0.0",c5=m8,EC=1e4,yee=1e3,bee=100;var Du;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Du||(Du={}));var Ir;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Ir||(Ir={}));var So;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(So||(So={}));var IC;(function(e){e.websocket="websocket"})(IC||(IC={}));var id;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(id||(id={}));class vee{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let a=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(a))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,a;const r=(a=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&a!==void 0?a:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(t){var n,a;const r=(a=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&a!==void 0?a:{},i=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(t,n,a){var r,s;const i=t.topic,o=(r=t.ref)!==null&&r!==void 0?r:"",l=(s=t.join_ref)!==null&&s!==void 0?s:"",d=t.payload.event,c=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},f=Object.keys(c).length===0?"":JSON.stringify(c);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(i.length>255)throw new Error(`topic length ${i.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+i.length+d.length+f.length,x=new ArrayBuffer(this.HEADER_LENGTH+m);let y=new DataView(x),b=0;y.setUint8(b++,this.KINDS.userBroadcastPush),y.setUint8(b++,l.length),y.setUint8(b++,o.length),y.setUint8(b++,i.length),y.setUint8(b++,d.length),y.setUint8(b++,f.length),y.setUint8(b++,n),Array.from(l,S=>
24y.setUint8(b++,S.charCodeAt(0))),Array.from(o,S=>y.setUint8(b++,S.charCodeAt(0))),Array.from(i,S=>y.setUint8(b++,S.charCodeAt(0))),Array.from(d,S=>y.setUint8(b++,S.charCodeAt(0))),Array.from(f,S=>y.setUint8(b++,S.charCodeAt(0)));var w=new Uint8Array(x.byteLength+a.byteLength);return w.set(new Uint8Array(x),0),w.set(new Uint8Array(a),x.byteLength),w.buffer}decode(t,n){if(this._isArrayBuffer(t)){let a=this._binaryDecode(t);return n(a)}if(typeof t=="string"){const a=JSON.parse(t),[r,s,i,o,l]=a;return n({join_ref:r,ref:s,topic:i,event:o,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),a=n.getUint8(0),r=new TextDecoder;if(a===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,r)}_decodeUserBroadcast(t,n,a){const r=n.getUint8(1),s=n.getUint8(2),i=n.getUint8(3),o=n.getUint8(4);let l=this.HEADER_LENGTH+4;const d=a.decode(t.slice(l,l+r));l=l+r;const c=a.decode(t.slice(l,l+s));l=l+s;const f=a.decode(t.slice(l,l+i));l=l+i;const m=t.slice(l,t.byteLength),x=o===this.JSON_ENCODING?JSON.parse(a.decode(m)):m,y={type:this.BROADCAST_EVENT,event:c,payload:x};return i>0&&(y.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:y}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([a])=>n.includes(a)))}}class g8{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var ha;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(ha||(ha={}));const d5=(e,t,n={})=>{var a;const r=(a=n.skipTypes)!==null&&a!==void 0?a:[];return t?Object.keys(t).reduce((s,i)=>(s[i]=wee(i,e,t,r),s),{}):{}},wee=(e,t,n,a)=>{const r=t.find(o=>o.name===e),s=r?.type,i=n[e];return s&&!a.includes(s)?x8(s,i):TC(i)},x8=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Cee(t,n)}switch(e){case ha.bool:return See(t);case ha.float4:case ha.float8:case ha.int2:case ha.int4:case ha.int8:case ha.numeric:case ha.oid:return kee(t);case ha.json:case ha.jsonb:return Nee(t);case ha.timestamp:return Eee(t);case ha.abstime:case ha.date:case ha.daterange:case ha.int4range:case ha.int8range:case ha.money:case ha.reltime:case ha.text:case ha.time:case ha.timestamptz:case ha.timetz:case ha.tsrange:case ha.tstzrange:return TC(t);default:return TC(t)}},TC=e=>e,See=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},kee=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Nee=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Cee=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,a=e[n];if(e[0]==="{"&&a==="}"){let s;const i=e.slice(1,n);try{s=JSON.parse("["+i+"]")}catch{s=i?i.split(","):[]}return s.map(o=>x8(t,o))}return e},Eee=e=>typeof e=="string"?e.replace(" ","T"):e,y8=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class dN{constructor(t,n,a={},r=EC){this.channel=t,this.event=n,this.payload=a,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,j
vendor: 4,582 bytes, line 24
24oin_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var a;return this._hasReceived(t)&&n((a=this.receivedResp)===null||a===void 0?void 0:a.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(a=>a.status===t).forEach(a=>a.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var h5;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(h5||(h5={}));class sy{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const a=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(a.state,{},r=>{const{onJoin:s,onLeave:i,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=sy.syncState(this.state,r,s,i),this.pendingDiffs.forEach(l=>{this.state=sy.syncDiff(this.state,l,s,i)}),this.pendingDiffs=[],o()}),this.channel._on(a.diff,{},r=>{const{onJoin:s,onLeave:i,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=sy.syncDiff(this.state,r,s,i),o())}),this.onJoin((r,s,i)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:s,newPresences:i})}),this.onLeave((r,s,i)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:s,leftPresences:i})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,a,r){const s=this.cloneDeep(t),i=this.transformState(n),o={},l={};return this.map(s,(d,c)=>{i[d]||(l[d]=c)}),this.map(i,(d,c)=>{const f=s[d];if(f){const m=c.map(w=>w.presence_ref),x=f.map(w=>w.presence_ref),y=c.filter(w=>x.indexOf(w.presence_ref)<0),b=f.filter(w=>m.indexOf(w.presence_ref)<0);y.length>0&&(o[d]=y),b.length>0&&(l[d]=b)}else o[d]=c}),this.syncDiff(s,{joins:o,leaves:l},a,r)}static syncDiff(t,n,a,r){const{joins:s,leaves:i}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return a||(a=()=>{}),r||(r=()=>{}),this.map(s,(o,l)=>{var d;const c=(d=t[o])!==null&&d!==void 0?d:[];if(t[o]=this.cloneDeep(l),c.length>0){const f=t[o].map(x=>x.presence_ref),m=c.filter(x=>f.indexOf(x.presence_ref)<0);t[o].unshift(...m)}a(o,c,l)}),this.map(i,(o,l)=>{let d=t[o];if(!d)return;const c=l.map(f=>f.presence_ref);d=d.filter(f=>c.indexOf(f.presence_ref)<0),t[o]=d,r(o,d,l),d.length===0&&delete t[o]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(a=>n(a,t[a]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,a)=>{const r=t[a];return"metas"in r?n[a]=r.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[a]=r,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var p5;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(p5||(p5={}));var iy;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(iy||(iy={}));var jl;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(jl||(jl={}));class Af{constructor(t,n={config:{}},a){var r,s;if(this.topic=t,this.params=n,this.socket=a,this.bindings={},this.state=Ir.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new dN(this,So.join,this.params,this.timeout),this.rejoinTimer=new g8(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ir.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>
24i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ir.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this._on(So.reply,{},(i,o)=>{this._trigger(this._replyEventName(o),i)}),this.presence=new sy(this),this.broadcastEndpointURL=y8(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(r=this.params.config)===null||r===void 0?void 0:r.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var a,r,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ir.closed){const{config:{broadcast:i,presence:o,private:l}}=this.params,d=(r=(a=this.bindings.postgres_changes)===null||a===void 0?void 0:a.map(x=>x.filter))!==null&&r!==void 0?r:[],c=!!this.bindings[iy.PRESENCE]&&this.bindings[iy.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,f={},m={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:c}),postgres_changes:d,private:l};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(x=>t?.(jl.CHANNEL_ERROR,x)),this._onClose(()=>t?.(jl.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:x})=>{var y;if(this.socket._isManualToken()||this.socket.setAuth(),x===void 0){t?.(jl.SUBSCRIBED);return}else{const b=this.bindings.postgres_changes,w=(y=b?.length)!==null&&y!==void 0?y:0,S=[];for(let k=0;k<w;k++){const C=b[k],{filter:{event:E,schema:T,table:_,filter:A}}=C,$=x&&x[k];if($&&$.event===E&&Af.isFilterValueEqual($.schema,T)&&Af.isFilterValueEqual($.table,_)&&Af.isFilterValueEqual($.filter,A))S.push(Object.assign(Object.assign({},C),{id:$.id}));else{this.unsubscribe(),this.state=Ir.errored,t?.(jl.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,t&&t(jl.SUBSCRIBED);return}}).receive("error",x=>{this.state=Ir.errored,t?.(jl.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(x).join(", ")||"error")))}).receive("timeout",()=>{t?.(jl.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,a){return this.state===Ir.joined&&t===iy.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,a)}async httpSend(t,n,a={}){var r;if(n==null)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const i={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,i,(r=a.timeout)!==null&&r!==void 0?r:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const d=await o.json();l=d.error||d.message||l}catch{}return Promise.reject(new Error(l))}async send(t,n={}){var a,r;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
24in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:i}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:i,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=n.timeout)!==null&&a!==void 0?a:this.timeout);return await((r=d.body)===null||r===void 0?void 0:r.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var i,o,l;const d=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(o=(i=this.params)===null||i===void 0?void 0:i.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),d.receive("ok",()=>s("ok")),d.receive("error",()=>s("error")),d.receive("timeout",()=>s("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Ir.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(So.close,"leave",this._joinRef())};this.joinPush.destroy();let a=null;return new Promise(r=>{a=new dN(this,So.leave,{},t),a.receive("ok",()=>{n(),r("ok")}).receive("timeout",()=>{n(),r("timed out")}).receive("error",()=>{r("error")}),a.send(),this._canPush()||a.trigger("ok",{})}).finally(()=>{a?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ir.closed,this.bindings={}}async _fetchWithTimeout(t,n,a){const r=new AbortController,s=setTimeout(()=>r.abort(),a),i=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:r.signal}));return clearTimeout(s),i}_push(t,n,a=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new dN(this,t,n,a);return this._canPush()?r.send():this._addToPushBuffer(r),r}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>bee){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,a){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,a){var r,s;const i=t.toLocaleLowerCase(),{close:o,error:l,leave:d,join:c}=So;if(a&&[o,l,d,c].indexOf(i)>=0&&a!==this._joinRef())return;let m=this._onMessage(i,n,a);if(n&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(i)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(x=>{var y,b,w;return((y=x.filter)===null||y===void 0?void 0:y.event)==="*"||((w=(b=x.filter)===null||b===void 0?void 0:b.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===i}).map(x=>x.callback(m,a)):(s=this.bindings[i])===null||s===void 0||s.filter(x=>{var y,b,w,S,k,C,E,T;if(["broadcast","presence","postgres_changes"].includes(i))if("id"in x){const _=x.id,A=(y=x.filter)===null||y===void 0?void 0:y.event;return _&&((b=n.ids)===null||b===void 0?void 0:b.includes(_))&&(A==="*"||A?.toLocaleLowerCase()===((w=n.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))&&(!(!((S=x.filter)===null||S===void 0)&&S.table)||x.filter.table===((k=n.data)===null||k===void 0?void 0:k.table))}else{const _=(E=(C=x?.filter)===null||C===void 0?void 0:C.event)===null||E===void 0?void 0:E.toLocaleLowerCase();return _==="*"||_===((T=n?.event)===null||T===void 0?void 0:T.toLocaleLowerCase())}else return x.type.toLocaleLowerCase()===i}).map(x=>{if(typeof m=="object"&&"ids"in m){const y=m.data,{schema:b,table:w,commit_timestamp:S,type:k,errors:C}=y;m=Object.assign(Object.assign({},{schema:b,table:w,commit_timestamp:S,eventType:k,new:{},old:{},errors:C}),this._getPayloadRecords(y))}x.callback(m,a)})}_isClosed(){return this.state===Ir.closed}_isJoined(){return this.state===Ir.joined}_isJoining(){return this.state===Ir.joining}_isLeaving(){return this.state===Ir.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,a){const r=t.toLocaleLowerCase(),s={type:r,filter:n,callback:a};return this.bindings[r]?this.bindings[r].push(s):this.bindings[r]=[s],this}_off(t,n){const a=t.toLocaleLowerCase();return this.bindings[a]&&(this.bindings[a]=this.bindings[a].filter(r=>{var s;return!(((s=r.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===a&&Af.isEqual(r.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(t[a]!==n[a])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(So.close,{},t)}_onError(t){this._on(So.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ir.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=d5(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=d5(t.columns,t.old_record)),n}}const hN=()=>{},N1={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Iee=[1e3,2e3,5e3,1e4],Tee=1e4,Aee=`
25  addEventListener("message", (e) => {
26    if (e.data.event === "start") {
27      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
28    }
29  });`;class _ee{constructor(t,n){var a;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=EC,this.transport=null,this.heartbeatIntervalMs=N1.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=hN,this.ref=0,this.reconnectTimer=null,this.vsn=c5,this.logger=hN,this.conn=null,this.sendBuffer=[],this.serializer
29=new vee,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=r=>r?(...s)=>r(...s):(...s)=>fetch(...s),!(!((a=n?.params)===null||a===void 0)&&a.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${IC.websocket}`,this.httpEndpoint=y8(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=fee.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}
30
31To use Realtime in Node.js, you need to provide a WebSocket implementation:
32
33Option 1: Use Node.js 22+ which has native WebSocket support
34Option 2: Install and provide the "ws" package:
35
36  npm install ws
37
38  import ws from "ws"
39  const client = new RealtimeClient(url, {
40    ...options,
41    transport: ws
42  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const a=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(a),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,a){this.logger(t,n,a)}connectionState(){switch(this.conn&&this.conn.readyState){case Du.connecting:return id.Connecting;case Du.open:return id.Open;case Du.closing:return id.Closing;default:return id.Closed}}isConnected(){return this.connectionState()===id.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const a=`realtime:${t}`,r=this.getChannels().find(s=>s.topic===a);if(r)return r;{const s=new Af(`realtime:${t}`,n,this);return this.channels.push(s),s}}push(t){const{topic:n,event:a,payload:r,ref:s}=t,i=()=>{this.encode(t,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${n} ${a} (${s})`,r),this.isConnected()?i():this.sendBuffer.push(i)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(yee,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},N1.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(a=>a.topic===t&&(a._isJoined()||a._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>
42{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const d=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",d)}catch(c){this.log("error","error in heartbeat callback",c)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:a,event:r,payload:s,ref:i}=n,o=i?`(${i})`:"",l=s.status||"";this.log("receive",`${l} ${a} ${r} ${o}`.trim(),s),this.channels.filter(d=>d._isMember(a)).forEach(d=>d._trigger(r,s,i)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===Du.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Du.open||this.conn.readyState===Du.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(So.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const a=t.match(/\?/)?"&":"?",r=new URLSearchParams(n);return`${t}${a}${r}`}_workerObjectUrl(t){let n;if(t)n=t;else{const a=new Blob([Aee],{type:"application/javascript"});n=URL.createObjectURL(a)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,a=!1;if(t)n=t,a=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),n=this.accessTokenValue}else n=this.accessTokenValue;a?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const s={access_token:n,version:gee};n&&r.updateJoinPayload(s),r.joinedOnce&&r._isJoined()&&r._push(So.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(a=>{try{a(n)}catch(r){this.log("error",`error in ${t} callback`,r)}})}catch(a){this.log("error",`error triggering ${t} callbacks`,a)}}_setupReconnectionTimer(){this.reconnectTimer=new g8(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},N1.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,a,r,s,i,o,l,d,c,f,m,x;switch(this.transport=(n=t?.transport)!==null&&n!==void 0?n:null,this.timeout=(a=t?.timeout)!==null&&a!==void 0?a:EC,this.heartbeatIntervalMs=(r=t?.heartbeatIntervalMs)!==null&&r!==void 0?r:N1.HEARTBEAT_INTERVAL,this.worker=(s=t?.worker)!==null&&s!==void 0?s:!1,this.accessToken=(i=t?.accessToken)!==null&&i!==void 0?i:null,this.heartbeatCallback=(o=t?.heartbeatCallback)!==null&&o!==void 0?o:hN,this.vsn=(l=t?.vsn)!==null&&l!==void 0?l:c5,t?.params&&(this.params=t.params),t?.logger&&(this.logger=t.logger),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(d=t?.reconnectAfterMs)!==null&&d!==void 0?d:(y=>Iee[y-1]||Tee),this.vsn){case xee:this.encode=(c=t?.encode)!==null&&c!==void 0?c:((y,b)=>b(JSON.stringify(y))),this.decode=(f=t?.decode)!==null&&f!==void 0?f:((y,b)=>b(JSON.parse(y)));break;case m8:this.encode=(m=t?.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(x=t?.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t?.workerUrl}}}
42var Ny=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function jee(e,t,n){const a=new URL(t,e);if(n)for(const[r,s]of Object.entries(n))s!==void 0&&a.searchParams.set(r,s);return a.toString()}async function Dee(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Ree(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:a,query:r,body:s,headers:i}){const o=jee(e.baseUrl,a,r),l=await Dee(e.auth),d=await t(o,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...l,...i},body:s?JSON.stringify(s):void 0}),c=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),m=f&&c?JSON.parse(c):c;if(!d.ok){const x=f?m:void 0,y=x?.error;throw new Ny(y?.message??`Request failed with status ${d.status}`,{status:d.status,icebergType:y?.type,icebergCode:y?.code,details:x})}return{status:d.status,headers:d.headers,data:m}}}}function C1(e){return e.join("�")}var Mee=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:C1(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(a=>({namespace:a}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${C1(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${C1(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${C1(e.namespace)}`}),!0}catch(t){if(t instanceof Ny&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Ny&&n.status===409)return;throw n}}};function tf(e){return e.join("�")}var $ee=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${tf(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Ny&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Ny&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Bee=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Ree({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new Mee(this.client,t),this.tableOps=new $ee(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
42async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},cw=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function Ra(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Fee=class extends cw{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},AC=class extends cw{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const FI=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Oee=()=>Response,_C=e=>{if(Array.isArray(e))return e.map(n=>_C(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,a])=>{const r=n.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));t[r]=_C(a)}),t},Lee=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Pee=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function Cy(e){"@babel/helpers - typeof";return Cy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cy(e)}function zee(e,t){if(Cy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Cy(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Uee(e){var t=zee(e,"string");return Cy(t)=="symbol"?t:t+""}function Wee(e,t,n){return(t=Uee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,a)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?f5(Object(n),!0).forEach(function(a){Wee(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f5(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}const pN=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},Vee=async(e,t,n)=>{e instanceof await Oee()&&!n?.noResolveJson?e.json().then(a=>{const r=e.status||500,s=a?.statusCode||r+"";t(new Fee(pN(a),r,s))}).catch(a=>{t(new AC(pN(a),a))}):t(new AC(pN(e),e))},Hee=(e,t,n,a)=>{const r={method:e,headers:t?.headers||{}};return e==="GET"||!a?r:(Lee(a)?(r.headers=Pt({"Content-Type":"application/json"},t?.headers),r.body=JSON.stringify(a)):r.body=a,t?.duplex&&(r.duplex=t.duplex),Pt(Pt({},r),n))};async function Zy(e,t,n,a,r,s){return new Promise((i,o)=>{e(n,Hee(t,a,r,s)).then(l=>{if(!l.ok)throw l;return a?.noResolveJson?l:l.json()}).then(l=>i(l)).catch(l=>Vee(l,o,a))})}async function Ey(e,t,n,a){return Zy(e,"GET",t,n,a)}async function wo(e,t,n,a,r){return Zy(e,"POST",t,a,r,n)}async function jC(e,t,n,a,r){return Zy(e,"PUT",t,a,r,n)}async function Gee(e,t,n,a){return Zy(e,"HEAD",t,Pt(Pt({},n),{},{noResolveJson:!0}),a)}async function OI(e,t,n,a,r){return Zy(e,"DELETE",t,a,r,n)}var qee=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;
42if(Ra(t))return{data:null,error:t};throw t}}};let b8;b8=Symbol.toStringTag;var Kee=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[b8]="BlobDownloadBuilder",this.promise=null}asStream(){return new qee(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ra(t))return{data:null,error:t};throw t}}};const Xee={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},m5={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Yee=class{constructor(e,t={},n,a){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=FI(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,a){var r=this;try{let s;const i=Pt(Pt({},m5),a);let o=Pt(Pt({},r.headers),e==="POST"&&{"x-upsert":String(i.upsert)});const l=i.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",r.encodeMetadata(l)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",r.encodeMetadata(l))):(s=n,o["cache-control"]=`max-age=${i.cacheControl}`,o["content-type"]=i.contentType,l&&(o["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!i.duplex&&(i.duplex="half")),a?.headers&&(o=Pt(Pt({},o),a.headers));const d=r._removeEmptyFolders(t),c=r._getFinalPath(d),f=await(e=="PUT"?jC:wo)(r.fetch,`${r.url}/object/${c}`,s,Pt({headers:o},i?.duplex?{duplex:i.duplex}:{}));return{data:{path:d,id:f.Id,fullPath:f.Key},error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(Ra(s))return{data:null,error:s};throw s}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,a){var r=this;const s=r._removeEmptyFolders(e),i=r._getFinalPath(s),o=new URL(r.url+`/object/upload/sign/${i}`);o.searchParams.set("token",t);try{let l;const d=Pt({upsert:m5.upsert},a),c=Pt(Pt({},r.headers),{"x-upsert":String(d.upsert)});return typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",d.cacheControl),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.append("cacheControl",d.cacheControl)):(l=n,c["cache-control"]=`max-age=${d.cacheControl}`,c["content-type"]=d.contentType),{data:{path:s,fullPath:(await jC(r.fetch,o.toString(),l,{headers:c})).Key},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Ra(l))return{data:null,error:l};throw l}}async createSignedUploadUrl(e,t){var n=this;try{let a=n._getFinalPath(e);const r=Pt({},n.headers);t?.upsert&&(r["x-upsert"]="true");const s=await wo(n.fetch,`${n.url}/object/upload/sign/${a}`,{},{headers:r}),i=new URL(n.url+s.url),o=i.searchParams.get("token");if(!o)throw new cw("No token returned by API");return{data:{signedUrl:i.toString(),path:e,token:o},error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ra(a))return{data:null,error:a};throw a}}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var a=this;try{return{data:await wo(a.fetch,`${a.url}/object/move`,{bucketId:a.bucketId,sourceKey:e,destinationKey:t,de
42stinationBucket:n?.destinationBucket},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Ra(r))return{data:null,error:r};throw r}}async copy(e,t,n){var a=this;try{return{data:{path:(await wo(a.fetch,`${a.url}/object/copy`,{bucketId:a.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:a.headers})).Key},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Ra(r))return{data:null,error:r};throw r}}async createSignedUrl(e,t,n){var a=this;try{let r=a._getFinalPath(e),s=await wo(a.fetch,`${a.url}/object/sign/${r}`,Pt({expiresIn:t},n?.transform?{transform:n.transform}:{}),{headers:a.headers});const i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${a.url}${s.signedURL}${i}`)},{data:s,error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Ra(r))return{data:null,error:r};throw r}}async createSignedUrls(e,t,n){var a=this;try{const r=await wo(a.fetch,`${a.url}/object/sign/${a.bucketId}`,{expiresIn:t,paths:e},{headers:a.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:r.map(i=>Pt(Pt({},i),{},{signedUrl:i.signedURL?encodeURI(`${a.url}${i.signedURL}${s}`):null})),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Ra(r))return{data:null,error:r};throw r}}download(e,t){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString(t?.transform||{}),r=a?`?${a}`:"",s=this._getFinalPath(e),i=()=>Ey(this.fetch,`${this.url}/${n}/${s}${r}`,{headers:this.headers,noResolveJson:!0});return new Kee(i,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:_C(await Ey(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(Ra(a))return{data:null,error:a};throw a}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Gee(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(Ra(a)&&a instanceof AC){const r=a.originalError;if([400,404].includes(r?.status))return{data:!1,error:a}}throw a}}getPublicUrl(e,t){const n=this._getFinalPath(e),a=[],r=t?.download?`download=${t.download===!0?"":t.download}`:"";r!==""&&a.push(r);const s=typeof t?.transform<"u"?"render/image":"object",i=this.transformOptsToQueryString(t?.transform||{});i!==""&&a.push(i);let o=a.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${o}`)}}}async remove(e){var t=this;try{return{data:await OI(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async list(e,t,n){var a=this;try{const r=Pt(Pt(Pt({},Xee),t),{},{prefix:e||""});return{data:await wo(a.fetch,`${a.url}/object/list/${a.bucketId}`,r,{headers:a.headers},n),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Ra(r))return{data:null,error:r};throw r}}async listV2(e,t){var n=this;try{const a=Pt({},e);return{data:await wo(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,a,{headers:n.headers},t),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ra(a))return{data:null,error:a};throw a}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const v8="2.91.0",w8={"X-Client-Info":`storage-js/${v8}`};var Jee=class{constructor(e,t={},n,a){this.shouldThrowOnError=!1;const r=new URL(e);a?.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase.")),this.url=r.href.replace(/\/$/,""),this.headers=Pt(Pt({},w8),t),this.fetch=FI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await Ey(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await Ey(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await wo(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ra(a))return{data:null,error:a};throw a}}async updateBucket(e,t){var n=this;try{return{data:await jC(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ra(a))return{data:null,error:a};throw a}}async emptyBucket(e){var t=this;try{return{data:await wo(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await OI(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Qee=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pt(Pt({},w8),t),this.fetch=FI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await wo(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async listBuckets(e){var t=this;try{const n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",e.limit.toString()),e?.offset!==void 0&&n.set("offset",e.offset.toString()),e?.sortColumn&&n.set("sortColumn",e.sortColumn),e?.sortOrder&&n.set("sortOrder",e.sortOrder),e?.search&&n.set("search",e.search);const a=n.toString(),r=a?`${t.url}/bucket?${a}`:`${t.url}/bucket`;return{data:await Ey(t.fetch,r,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await OI(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ra(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!Pee(e))throw new cw("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Bee({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),a=this.shouldThrowOnError;return new Proxy(n,{get(r,s){const i=r[s];return typeof i!="function"?i:async(...o)=>{try{return{data:await i.apply(r,o),error:null}}catch(l){if(a)throw l;return{data:null,error:l}}}}})}};const LI={"X-Client-Info":`storage-js/${v8}`,"Content-Type":"application/json"};
42var S8=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Ci(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var fN=class extends S8{constructor(e,t,n){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Zee=class extends S8{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const PI=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),ete=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},g5=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),tte=async(e,t,n)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!n?.noResolveJson){const a=e.status||500,r=e;if(typeof r.json=="function")r.json().then(s=>{const i=s?.statusCode||s?.code||a+"";t(new fN(g5(s),a,i))}).catch(()=>{const s=a+"";t(new fN(r.statusText||`HTTP ${a} error`,a,s))});else{const s=a+"";t(new fN(r.statusText||`HTTP ${a} error`,a,s))}}else t(new Zee(g5(e),e))},nte=(e,t,n,a)=>{const r={method:e,headers:t?.headers||{}};return a?(ete(a)?(r.headers=Pt({"Content-Type":"application/json"},t?.headers),r.body=JSON.stringify(a)):r.body=a,Pt(Pt({},r),n)):r};async function ate(e,t,n,a,r,s){return new Promise((i,o)=>{e(n,nte(t,a,r,s)).then(l=>{if(!l.ok)throw l;if(a?.noResolveJson)return l;const d=l.headers.get("content-type");return!d||!d.includes("application/json")?{}:l.json()}).then(l=>i(l)).catch(l=>tte(l,o,a))})}async function Ei(e,t,n,a,r){return ate(e,"POST",t,a,r,n)}var rte=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pt(Pt({},LI),t),this.fetch=PI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await Ei(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ci(a))return{data:null,error:a};throw a}}async listIndexes(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await Ei(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Ci(a))return{data:null,error:a};throw a}}},ste=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pt(Pt({},LI),t),this.fetch=PI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){var t=this;try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Ei(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async listVectors(e){var t=this;try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:await Ei(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async deleteVectors(e){var t=this;try{if(e.keys.length<1||e.keys.length>
42500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Ei(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}},ite=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pt(Pt({},LI),t),this.fetch=PI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Ei(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Ci(n))return{data:null,error:n};throw n}}},ote=class extends ite{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new lte(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},lte=class extends rte{constructor(e,t,n,a){super(e,t,a),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new ute(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},ute=class extends ste{constructor(e,t,n,a,r){super(e,t,r),this.vectorBucketName=n,this.indexName=a}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Pt(Pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},cte=class extends Jee{constructor(e,t={},n,a){super(e,t,n,a)}from(e){return new Yee(this.url,this.headers,e,this.fetch)}get vectors(){return new ote(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Qee(this.url+"/iceberg",this.headers,this.fetch)}};const k8="2.91.0",xf=30*1e3,DC=3,mN=DC*xf,dte="http://localhost:9999",hte="supabase.auth.token",pte={"X-Client-Info":`gotrue-js/${k8}`},RC="X-Supabase-Api-Version",N8={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},fte=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,mte=600*1e3;class Iy extends Error{constructor(t,n,a){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=a}}function _t(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class gte extends Iy{constructor(t,n,a){super(t,n,a),this.name="AuthApiError",this.status=n,this.code=a}}function xte(e){return _t(e)&&e.name==="AuthApiError"}class od extends Iy{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Hl extends Iy{constructor(t,n,a,r){super(t,a,r),this.name=n,this.status=a}}class Ni extends Hl{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function yte(e){return _t(e)&&e.name==="AuthSessionMissingError"}class nf extends Hl{constructor(){super("Auth session or user missing","AuthInvalidToken
42ResponseError",500,void 0)}}class E1 extends Hl{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class I1 extends Hl{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function bte(e){return _t(e)&&e.name==="AuthImplicitGrantRedirectError"}class x5 extends Hl{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class vte extends Hl{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class MC extends Hl{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function gN(e){return _t(e)&&e.name==="AuthRetryableFetchError"}class y5 extends Hl{constructor(t,n,a){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=a}}class $C extends Hl{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const vv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),b5=` 	
43\r=`.split(""),wte=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<b5.length;t+=1)e[b5[t].charCodeAt(0)]=-2;for(let t=0;t<vv.length;t+=1)e[vv[t].charCodeAt(0)]=t;return e})();function v5(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const a=t.queue>>t.queuedBits-6&63;n(vv[a]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const a=t.queue>>t.queuedBits-6&63;n(vv[a]),t.queuedBits-=6}}function C8(e,t,n){const a=wte[e];if(a>-1)for(t.queue=t.queue<<6|a,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(a===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function w5(e){const t=[],n=i=>{t.push(String.fromCodePoint(i))},a={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},s=i=>{Nte(i,a,n)};for(let i=0;i<e.length;i+=1)C8(e.charCodeAt(i),r,s);return t.join("")}function Ste(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function kte(e,t){for(let n=0;n<e.length;n+=1){let a=e.charCodeAt(n);if(a>55295&&a<=56319){const r=(a-55296)*1024&65535;a=(e.charCodeAt(n+1)-56320&65535|r)+65536,n+=1}Ste(a,t)}}function Nte(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let a=1;a<6;a+=1)if((e>>7-a&1)===0){t.utf8seq=a;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Df(e){const t=[],n={queue:0,queuedBits:0},a=r=>{t.push(r)};for(let r=0;r<e.length;r+=1)C8(e.charCodeAt(r),n,a);return new Uint8Array(t)}function Cte(e){const t=[];return kte(e,n=>t.push(n)),new Uint8Array(t)}function md(e){const t=[],n={queue:0,queuedBits:0},a=r=>{t.push(r)};return e.forEach(r=>v5(r,n,a)),v5(null,n,a),t.join("")}function Ete(e){return Math.round(Date.now()/1e3)+e}function Ite(){return Symbol("auth-callback")}const es=()=>typeof window<"u"&&typeof document<"u",Yc={tested:!1,writable:!1},E8=()=>{if(!es())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Yc.tested)return Yc.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Yc.tested=!0,Yc.writable=!0}catch{Yc.tested=!0,Yc.writable=!1}return Yc.writable};function Tte(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEac
43h((r,s)=>{t[s]=r})}catch{}return n.searchParams.forEach((a,r)=>{t[r]=a}),t}const I8=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Ate=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",yf=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Jc=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Zr=async(e,t)=>{await e.removeItem(t)};class dw{constructor(){this.promise=new dw.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}dw.promiseConstructor=Promise;function xN(e){const t=e.split(".");if(t.length!==3)throw new $C("Invalid JWT structure");for(let a=0;a<t.length;a++)if(!fte.test(t[a]))throw new $C("JWT not in base64url format");return{header:JSON.parse(w5(t[0])),payload:JSON.parse(w5(t[1])),signature:Df(t[2]),raw:{header:t[0],payload:t[1]}}}async function _te(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function jte(e,t){return new Promise((a,r)=>{(async()=>{for(let s=0;s<1/0;s++)try{const i=await e(s);if(!t(s,null,i)){a(i);return}}catch(i){if(!t(s,i)){r(i);return}}})()})}function Dte(e){return("0"+e.toString(16)).substr(-2)}function Rte(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",a=n.length;let r="";for(let s=0;s<56;s++)r+=n.charAt(Math.floor(Math.random()*a));return r}return crypto.getRandomValues(t),Array.from(t,Dte).join("")}async function Mte(e){const n=new TextEncoder().encode(e),a=await crypto.subtle.digest("SHA-256",n),r=new Uint8Array(a);return Array.from(r).map(s=>String.fromCharCode(s)).join("")}async function $te(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Mte(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function af(e,t,n=!1){const a=Rte();let r=a;n&&(r+="/PASSWORD_RECOVERY"),await yf(e,`${t}-code-verifier`,r);const s=await $te(a);return[s,a===s?"plain":"s256"]}const Bte=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Fte(e){const t=e.headers.get(RC);if(!t||!t.match(Bte))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Ote(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Lte(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Pte=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function rf(e){if(!Pte.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function yN(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function zte(e,t){return new Proxy(e,{get:(n,a,r)=>{if(a==="__isInsecureUserWarningProxy")return!0;if(typeof a=="symbol"){const s=a.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,a,r)}
43return!t.value&&typeof a=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,a,r)}})}function S5(e){return JSON.parse(JSON.stringify(e))}const nd=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ute=[502,503,504];async function k5(e){var t;if(!Ate(e))throw new MC(nd(e),0);if(Ute.includes(e.status))throw new MC(nd(e),e.status);let n;try{n=await e.json()}catch(s){throw new od(nd(s),s)}let a;const r=Fte(e);if(r&&r.getTime()>=N8["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?a=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(a=n.error_code),a){if(a==="weak_password")throw new y5(nd(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(a==="session_not_found")throw new Ni}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,i)=>s&&typeof i=="string",!0))throw new y5(nd(n),e.status,n.weak_password.reasons);throw new gte(nd(n),e.status||500,a)}const Wte=(e,t,n,a)=>{const r={method:e,headers:t?.headers||{}};return e==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),r.body=JSON.stringify(a),Object.assign(Object.assign({},r),n))};async function Lt(e,t,n,a){var r;const s=Object.assign({},a?.headers);s[RC]||(s[RC]=N8["2024-01-01"].name),a?.jwt&&(s.Authorization=`Bearer ${a.jwt}`);const i=(r=a?.query)!==null&&r!==void 0?r:{};a?.redirectTo&&(i.redirect_to=a.redirectTo);const o=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",l=await Vte(e,t,n+o,{headers:s,noResolveJson:a?.noResolveJson},{},a?.body);return a?.xform?a?.xform(l):{data:Object.assign({},l),error:null}}async function Vte(e,t,n,a,r,s){const i=Wte(t,a,r,s);let o;try{o=await e(n,Object.assign({},i))}catch(l){throw console.error(l),new MC(nd(l),0)}if(o.ok||await k5(o),a?.noResolveJson)return o;try{return await o.json()}catch(l){await k5(l)}}function xo(e){var t;let n=null;qte(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Ete(e.expires_in)));const a=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:a},error:null}}function N5(e){const t=xo(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,a)=>n&&typeof a=="string",!0)&&(t.data.weak_password=e.weak_password),t}function $u(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Hte(e){return{data:e,error:null}}function Gte(e){const{action_link:t,email_otp:n,hashed_token:a,redirect_to:r,verification_type:s}=e,i=uw(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:n,hashed_token:a,redirect_to:r,verification_type:s},l=Object.assign({},i);return{data:{properties:o,user:l},error:null}}function C5(e){return e}function qte(e){return e.access_token&&e.refresh_token&&e.expires_in}const bN=["global","local","others"];class Kte{constructor({url:t="",headers:n={},fetch:a}){this.url=t,this.headers=n,this.fetch=I8(a),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,n=bN[0]){if(bN.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${bN.join(", ")}`);try{return await Lt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(a){if(_t(a))return{data:null,error:a};throw a}}async inviteUserByEmail(t,n={}){try{return await Lt(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:$u})}catch(a){if(_t(a))return{data:{user:null},error:a};throw a}}async generateLink(t){try{const{options:n}=t,a=uw(t,["options"]),r=Object.assign(Object.assign({},a),n);return"newEmail"in a&&(r.new_email=a?.newEmail,delete r.newEmail),await Lt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:Gte,redirectTo:n?.redirectTo})}catch(n){if(_t(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Lt(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:$u})}catch(n){if(_t(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,a,r,s,i,o,l;try{const d={nextPage:null,lastPage:0,total:0},c=await Lt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:"",per_page:(s=(r=t?.perPage)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:""},xform:C5});if(c.error)throw c.error;const f=await c.json(),m=(i=c.headers.get("x-total-count"))!==null&&i!==void 0?i:0,x=(l=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return x.length>
430&&(x.forEach(y=>{const b=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(y.split(";")[1].split("=")[1]);d[`${w}Page`]=b}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(_t(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){rf(t);try{return await Lt(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:$u})}catch(n){if(_t(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){rf(t);try{return await Lt(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:$u})}catch(a){if(_t(a))return{data:{user:null},error:a};throw a}}async deleteUser(t,n=!1){rf(t);try{return await Lt(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:$u})}catch(a){if(_t(a))return{data:{user:null},error:a};throw a}}async _listFactors(t){rf(t.userId);try{const{data:n,error:a}=await Lt(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:n,error:a}}catch(n){if(_t(n))return{data:null,error:n};throw n}}async _deleteFactor(t){rf(t.userId),rf(t.id);try{return{data:await Lt(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(_t(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,a,r,s,i,o,l;try{const d={nextPage:null,lastPage:0,total:0},c=await Lt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:"",per_page:(s=(r=t?.perPage)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:""},xform:C5});if(c.error)throw c.error;const f=await c.json(),m=(i=c.headers.get("x-total-count"))!==null&&i!==void 0?i:0,x=(l=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return x.length>0&&(x.forEach(y=>{const b=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(y.split(";")[1].split("=")[1]);d[`${w}Page`]=b}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(_t(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(t){try{return await Lt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_t(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Lt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_t(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Lt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(_t(a))return{data:null,error:a};throw a}}async _deleteOAuthClient(t){try{return await Lt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(_t(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Lt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_t(n))return{data:null,error:n};throw n}}}function E5(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const sf={debug:!!(globalThis&&E8()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class T8 extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Xte extends T8{}async function Yte(e,t,n){sf.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const a=new globalThis.AbortController;return t>0&&setTimeout(()=>{a.abort(),sf.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:a.signal},async r=>{if(r){sf.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await n()}finally{sf.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}
43}else{if(t===0)throw sf.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Xte(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(sf.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null,"  "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function Jte(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function A8(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Qte(e){return parseInt(e,16)}function Zte(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,a=>a.toString(16).padStart(2,"0")).join("")}function ene(e){var t;const{chainId:n,domain:a,expirationTime:r,issuedAt:s=new Date,nonce:i,notBefore:o,requestId:l,resources:d,scheme:c,uri:f,version:m}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!a)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
44`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const x=A8(e.address),y=c?`${c}://${a}`:a,b=e.statement?`${e.statement}
45`:"",w=`${y} wants you to sign in with your Ethereum account:
46${x}
47
48${b}`;let S=`URI: ${f}
49Version: ${m}
50Chain ID: ${n}${i?`
51Nonce: ${i}`:""}
52Issued At: ${s.toISOString()}`;if(r&&(S+=`
53Expiration Time: ${r.toISOString()}`),o&&(S+=`
54Not Before: ${o.toISOString()}`),l&&(S+=`
55Request ID: ${l}`),d){let k=`
56Resources:`;for(const C of d){if(!C||typeof C!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${C}`);k+=`
57- ${C}`}S+=k}return`${w}
58${S}`}class mr extends Error{constructor({message:t,code:n,cause:a,name:r}){var s;super(t,{cause:a}),this.__isWebAuthnError=!0,this.name=(s=r??(a instanceof Error?a.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class wv extends mr{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function tne({error:e,options:t}){var n,a,r;const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new mr({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new mr({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((a=s.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new mr({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new mr({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new mr({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new mr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return s.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new mr({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new mr({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const i=window.location.hostname;
58if(_8(i)){if(s.rp.id!==i)return new mr({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new mr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new mr({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new mr({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new mr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function nne({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new mr({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new mr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(_8(a)){if(n.rpId!==a)return new mr({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new mr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new mr({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new mr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class ane{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const rne=new ane;function sne(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:a}=e,r=uw(e,["challenge","user","excludeCredentials"]),s=Df(t).buffer,i=Object.assign(Object.assign({},n),{id:Df(n.id).buffer}),o=Object.assign(Object.assign({},r),{challenge:s,user:i});if(a&&a.length>0){o.excludeCredentials=new Array(a.length);for(let l=0;l<a.length;l++){const d=a[l];o.excludeCredentials[l]=Object.assign(Object.assign({},d),{id:Df(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return o}function ine(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,a=uw(e,["challenge","allowCredentials"]),r=Df(t).buffer,s=Object.assign(Object.assign({},a),{challenge:r});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let i=0;i<n.length;i++){const o=n[i];s.allowCredentials[i]=Object.assign(Object.assign({},o),{id:Df(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return s}function one(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:md(new Uint8Array(e.response.attestationObject)),clientDataJSON:md(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function lne(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,a=e.getClientExtensionResults(),r=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:md(new Uint8Array(r.authenticatorData)),clientDataJSON:md(new Uint8Array(r.clientDataJSON)),signature:md(new Uint8Array(r.signature)),userHandle:r.userHandle?md(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:a,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function _8(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function I5(){var e,t;return!!(es()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.get)=="function")}async function une(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new wv("Browser returned unexpected credential type",t)}:{data:null,error:new wv("Empty credential response",t)}}
58catch(t){return{data:null,error:tne({error:t,options:e})}}}async function cne(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new wv("Browser returned unexpected credential type",t)}:{data:null,error:new wv("Empty credential response",t)}}catch(t){return{data:null,error:nne({error:t,options:e})}}}const dne={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},hne={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Sv(...e){const t=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),n=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),a={};for(const r of e)if(r)for(const s in r){const i=r[s];if(i!==void 0)if(Array.isArray(i))a[s]=i;else if(n(i))a[s]=i;else if(t(i)){const o=a[s];t(o)?a[s]=Sv(o,i):a[s]=Sv(i)}else a[s]=i}return a}function pne(e,t){return Sv(dne,e,t||{})}function fne(e,t){return Sv(hne,e,t||{})}class mne{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:a,signal:r},s){try{const{data:i,error:o}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:o};const l=r??rne.createNewAbortSignal();if(i.webauthn.type==="create"){const{user:d}=i.webauthn.credential_options.publicKey;d.name||(d.name=`${d.id}:${a}`),d.displayName||(d.displayName=d.name)}switch(i.webauthn.type){case"create":{const d=pne(i.webauthn.credential_options.publicKey,s?.create),{data:c,error:f}=await une({publicKey:d,signal:l});return c?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:c}},error:null}:{data:null,error:f}}case"request":{const d=fne(i.webauthn.credential_options.publicKey,s?.request),{data:c,error:f}=await cne(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:d,signal:l}));return c?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:c}},error:null}:{data:null,error:f}}}}catch(i){return _t(i)?{data:null,error:i}:{data:null,error:new od("Unexpected error in challenge",i)}}}async _verify({challengeId:t,factorId:n,webauthn:a}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:a})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},s){if(!n)return{data:null,error:new Iy("rpId is required for WebAuthn authentication")};try{if(!I5())return{data:null,error:new od("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:a},signal:r},{request:s});if(!i)return{data:null,error:o};const{webauthn:l}=i;return this._verify({factorId:t,challengeId:i.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:a,credential_response:l.credential_response}})}catch(i){return _t(i)?{data:null,error:i}:{data:null,error:new od("Unexpected error in authenticate",i)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},s){if(!n)return{data:null,error:new Iy("rpId is required for WebAuthn registration")};try{if(!I5())return{data:null,error:new od("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this._enroll({friendlyName:t});if(!i)return await this.client.mfa.listFactors().then(c=>{var f;return(f=c.data)===null||f===void 0?void 0:f.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(c=>c?this.client.mfa.unenroll({factorId:c?.id}):void 0),{data:null,error:o};const{data:l,error:d}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:n,rpOrigins:a},signal:r},{create:s});return l?this._verify({factorId:i.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:a,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:d}}catch(i){return _t(i)?{data:null,error:i}:{data:null,error:new od("Unexpected error in register",i)}}}}Jte();const gne={url:dte,storageKey:hte,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:pte,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function T5(e,t,n){return await n()}const of={};class Ty{get jwks(){var t,n;return(n=(t=of[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){of[this.storageKey]=Object.assign(Object.assign({},of[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=of[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){of[this.storageKey]=Object.assign(Object.assign({},of[this.storageKey]),{cachedAt:t})}constructor(t){var n,a,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},gne),t);if(this.storageKey=s.storageKey,this.instanceID=(n=Ty.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ty.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&es()){const i=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(i),this.logDebugMessages&&console.trace(i)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new Kte({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=I8(s.fetch),this.lock=s.lock||T5,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&es()&&(!((a=globalThis?.navigator)===null||a===void 0)&&a.locks)?this.lock=Yte:this.lock=T5,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new mne(this)}
58,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:E8()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=E5(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=E5(this.memoryStorage)),es()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${k8}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},a="none";if(es()&&(n=Tte(window.location.href),this._isImplicitGrantCallback(n)?a="implicit":await this._isPKCECallback(n)&&(a="pkce")),es()&&this.detectSessionInUrl&&a!=="none"){const{data:r,error:s}=await this._getSessionFromURL(n,a);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),bte(s)){const l=(t=s.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:i,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return _t(n)?this._returnResult({error:n}):this._returnResult({error:new od("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,a,r;try{const s=await Lt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(a=(n=t?.options)===null||n===void 0?void 0:n.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:(r=t?.options)===null||r===void 0?void 0:r.captchaToken}},xform:xo}),{data:i,error:o}=s;if(o||!i)return this._returnResult({data:{user:null,session:null},error:o});const l=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:d,session:l},error:null})}catch(s){if(_t(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(t){var n,a,r;try{let s;if("email"in t){const{email:c,password:f,options:m}=t;let x=null,y=null;this.flowType==="pkce"&&([x,y]=await af(this.storage,this.storageKey)),s=await Lt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m?.emailRedirectTo,body:{email:c,password:f,data:(n=m?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:m?.captchaToken},code_challenge:x,code_challenge_method:y},xform:xo})}else if("phone"in t){const{phone:c,password:f,options:m}=t;s=await Lt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:f,data:(a=m?.data)!==null&&a!==void 0?a:{},channel:(r=m?.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:xo})}else throw new E1("You must provide either an email or phone number and a password");const{data:i,error:o}=s;
58if(o||!i)return await Zr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:d,session:l},error:null})}catch(s){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(t){try{let n;if("email"in t){const{email:s,password:i,options:o}=t;n=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:i,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:N5})}else if("phone"in t){const{phone:s,password:i,options:o}=t;n=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:i,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:N5})}else throw new E1("You must provide either an email or phone number and a password");const{data:a,error:r}=n;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!a||!a.session||!a.user){const s=new nf;return this._returnResult({data:{user:null,session:null},error:s})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign({user:a.user,session:a.session},a.weak_password?{weakPassword:a.weak_password}:null),error:r})}catch(n){if(_t(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,a,r,s;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(r=t.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(s=t.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,a,r,s,i,o,l,d,c,f,m;let x,y;if("message"in t)x=t.message,y=t.signature;else{const{chain:b,wallet:w,statement:S,options:k}=t;let C;if(es())if(typeof w=="object")C=w;else{const O=window;if("ethereum"in O&&typeof O.ethereum=="object"&&"request"in O.ethereum&&typeof O.ethereum.request=="function")C=O.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=w}const E=new URL((n=k?.url)!==null&&n!==void 0?n:window.location.href),T=await C.request({method:"eth_requestAccounts"}).then(O=>O).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const _=A8(T[0]);let A=(a=k?.signInWithEthereum)===null||a===void 0?void 0:a.chainId;if(!A){const O=await C.request({method:"eth_chainId"});A=Qte(O)}const $={domain:E.host,address:_,statement:S,uri:E.href,version:"1",chainId:A,nonce:(r=k?.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(i=(s=k?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(o=k?.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=k?.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(d=k?.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(c=k?.signInWithEthereum)===null||c===void 0?void 0:c.resources};x=ene($),y=await C.request({method:"personal_sign",params:[Zte(x),_]})}try{const{data:b,error:w}=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:x,signature:y},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:xo});if(w)throw w;if(!b||!b.session||!b.user){const S=new nf;return this._returnResult({data:{user:null,session:null},error:S})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:w})}catch(b){if(_t(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(t){var n,a,r,s,i,o,l,d,c,f,m,x;let y,b;if("message"in t)y=t.message,b=t.signature;else{const{chain:w,wallet:S,statement:k,options:C}=t;let E;if(es())if(typeof S=="object")E=S;else{const _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))E=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!C?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=S}const T=new URL((n=C?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in E&&E.signIn){const _=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},C?.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),k?{statement:k}:null));let A;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")A=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)A=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in A&&"signature"in A&&(typeof A.signedMessage=="string"||A.signedMessage instanceof Uint8Array)&&A.signature instanceof Uint8Array)y=typeof A.signedMessage=="string"?A.signedMessage:new TextDecoder().decode(A.signedMessage),b=A.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${T.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(r=(a=C?.signInWithSolana)===null||a===void 0?void 0:a.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((s=C?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${C.signInWithSolana.notBefore}`]:[],...!((i=C?.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${C.signInWithSolana.expirationTime}`]:[],...!((o=C?.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${C.signInWithSolana.chainId}`]:[],...!((l=C?.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${C.signInWithSolana.nonce}`]:[],...!((d=C?.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${C.signInWithSolana.requestId}`]:[],...!((f=(c=C?.signInWithSolana)===null||c===void 0?void 0:c.resources)===null||f===void 0)&&f.length?["Resources",...C.signInWithSolana.resources.map(A=>`- ${A}`)]:[]].join(`
59`);const _=await E.signMessage(new TextEncoder().encode(y),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=_}}try{const{data:w,error:S}=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:md(b)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(x=t.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:xo});if(S)throw S;if(!w||!w.session||!w.user){const k=new nf;return this._returnResult({data:{user:null,session:null},error:k})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:S})}catch(w){if(_t(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(t){const n=await Jc(this.storage,`${this.storageKey}-code-verifier`),[a,r]=(n??"").split("/");try{if(!a&&this.flowType==="pkce")throw new vte;const{data:s,error:i}=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:a},xform:xo});if(await Zr(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!s||!s.session||!s.user){const o=new nf;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return s.session&&(await this._saveSession(s.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",s.session)},0)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:r??null}),error:i})}catch(s){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(t){try{const{options:n,provider:a,token:r,access_token:s,nonce:i}=t,o=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:a,id_token:r,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:xo}),{data:l,error:d}=o;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!l||!l.session||!l.user){const c=new nf;return this._returnResult({data:{user:null,session:null},error:c})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:d})}catch(n){if(_t(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,a,r,s,i;try{if("email"in t){const{email:o,options:l}=t;let d=null,c=null;this.flowType==="pkce"&&([d,c]=await af(this.storage,this.storageKey));const{error:f}=await Lt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(n=l?.data)!==null&&n!==void 0?n:{},create_user:(a=l?.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},code_challenge:d,code_challenge_method:c},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in t){const{phone:o,options:l}=t,{data:d,error:c}=await Lt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(r=l?.data)!==null&&r!==void 0?r:{},create_user:(s=l?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},channel:(i=l?.channel)!==null&&i!==void 0?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d?.message_id},error:c})}throw new E1("You must provide either an email or phone number.")}catch(o){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(t){var n,a;try{let r,s;"options"in t&&(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo,s=(a=t.options)===null||a===void 0?void 0:a.captchaToken);const{data:i,error:o}=await Lt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:s}}),redirectTo:r,xform:xo});if(o)throw o;if(!i)throw new Error("An error occurred on token verification.");const l=i.session,d=i.user;return l?.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:d,session:l},error:null})}catch(r){if(_t(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(t){var n,a,r,s,i;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await af(this.storage,this.storageKey));const d=await Lt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&a!==void 0?a:void 0}),!((r=t?.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}
59:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Hte});return!((s=d.data)===null||s===void 0)&&s.url&&es()&&!(!((i=t.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(o){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;if(a)throw a;if(!n)throw new Ni;const{error:r}=await Lt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(t){if(_t(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:a,type:r,options:s}=t,{error:i}=await Lt(this.fetch,"POST",n,{headers:this.headers,body:{email:a,type:r,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}else if("phone"in t){const{phone:a,type:r,options:s}=t,{data:i,error:o}=await Lt(this.fetch,"POST",n,{headers:this.headers,body:{phone:a,type:r,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:i?.message_id},error:o})}throw new E1("You must provide either an email or phone number and a type")}catch(n){if(_t(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await a,await n()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const a=n();for(this.pendingInLock.push((async()=>{try{await a}catch{}})()),await a;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await a}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await Jc(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const a=t.expires_at?t.expires_at*1e3-Date.now()<mN:!1;if(this._debug("#__loadSession()",`session has${a?"":" not"} expired`,"expires_at",t.expires_at),!a){if(this.userStorage){const i=await Jc(this.userStorage,this.storageKey+"-user");i?.user?t.user=i.user:t.user=yN()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const i={value:this.suppressGetSessionWarning};t.user=zte(t.user,i),i.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:r,error:s}=await this._callRefreshToken(t.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Lt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:$u}):await this._useSession(async n=>{var a,r,s;const{data:i,error:o}=n;
59if(o)throw o;return!(!((a=i.session)===null||a===void 0)&&a.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ni}:await Lt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0,xform:$u})})}catch(n){if(_t(n))return yte(n)&&(await this._removeSession(),await Zr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async a=>{const{data:r,error:s}=a;if(s)throw s;if(!r.session)throw new Ni;const i=r.session;let o=null,l=null;this.flowType==="pkce"&&t.email!=null&&([o,l]=await af(this.storage,this.storageKey));const{data:d,error:c}=await Lt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:l}),jwt:i.access_token,xform:$u});if(c)throw c;return i.user=d.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(a){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Ni;const n=Date.now()/1e3;let a=n,r=!0,s=null;const{payload:i}=xN(t.access_token);if(i.exp&&(a=i.exp,r=a<=n),r){const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};s=o}else{const{data:o,error:l}=await this._getUser(t.access_token);if(l)throw l;s={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:a-n,expires_at:a},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(_t(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var a;if(!t){const{data:i,error:o}=n;if(o)throw o;t=(a=i.session)!==null&&a!==void 0?a:void 0}if(!t?.refresh_token)throw new Ni;const{data:r,error:s}=await this._callRefreshToken(t.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(_t(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!es())throw new I1("No browser detected.");if(t.error||t.error_description||t.error_code)throw new I1(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new x5("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new I1("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new x5("No code detected.");const{data:k,error:C}=await this._exchangeCodeForSession(t.code);if(C)throw C;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:k.session,redirectType:null},error:null}}const{provider_token:a,provider_refresh_token:r,access_token:s,refresh_token:i,expires_in:o,expires_at:l,token_type:d}=t;if(!s||!o||!i||!d)throw new I1("No session defined in URL");const c=Math.round(Date.now()/1e3),f=parseInt(o);let m=c+f;l&&(m=parseInt(l));const x=m-c;
59x*1e3<=xf&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${x}s, should have been closer to ${f}s`);const y=m-f;c-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,m,c):c-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,m,c);const{data:b,error:w}=await this._getUser(s);if(w)throw w;const S={provider_token:a,provider_refresh_token:r,access_token:s,expires_in:f,expires_at:m,refresh_token:i,token_type:d,user:b.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:t.type},error:null})}catch(a){if(_t(a))return this._returnResult({data:{session:null,redirectType:null},error:a});throw a}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await Jc(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var a;const{data:r,error:s}=n;if(s)return this._returnResult({error:s});const i=(a=r.session)===null||a===void 0?void 0:a.access_token;if(i){const{error:o}=await this.admin.signOut(i,t);if(o&&!(xte(o)&&(o.status===404||o.status===401||o.status===403)))return this._returnResult({error:o})}return t!=="others"&&(await this._removeSession(),await Zr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=Ite(),a={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,a),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:a}}}async _emitInitialSession(t){return await this._useSession(async n=>{var a,r;try{const{data:{session:s},error:i}=n;if(i)throw i;await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",t,"session",s)}catch(s){await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",s),console.error(s)}})}async resetPasswordForEmail(t,n={}){let a=null,r=null;this.flowType==="pkce"&&([a,r]=await af(this.storage,this.storageKey,!0));try{return await Lt(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:a,code_challenge_method:r,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var t;try{const{data:n,error:a}=await this.getUser();if(a)throw a;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:a,error:r}=await this._useSession(async s=>{var i,o,l,d,c;const{data:f,error:m}=s;if(m)throw m;const x=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(i=t.options)===null||i===void 0?void 0:i.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Lt(this.fetch,"GET",x,{headers:this.headers,jwt:(c=(d=f.session)===null||d===void 0?void 0:d.access_token)!==null&&c!==void 0?c:void 0})});if(r)throw r;return es()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(a?.url),this._returnResult({data:{provider:t.provider,url:a?.url},error:null})}catch(a){if(_t(a))return this._returnResult({data:{provider:t.provider,url:null},error:a});throw a}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var a;try{const{error:r,data:{session:s}}=n;
59if(r)throw r;const{options:i,provider:o,token:l,access_token:d,nonce:c}=t,f=await Lt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(a=s?.access_token)!==null&&a!==void 0?a:void 0,body:{provider:o,id_token:l,access_token:d,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:xo}),{data:m,error:x}=f;return x?this._returnResult({data:{user:null,session:null},error:x}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new nf}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:x}))}catch(r){if(await Zr(this.storage,`${this.storageKey}-code-verifier`),_t(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var a,r;const{data:s,error:i}=n;if(i)throw i;return await Lt(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(r=(a=s.session)===null||a===void 0?void 0:a.access_token)!==null&&r!==void 0?r:void 0})})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const a=Date.now();return await jte(async r=>(r>0&&await _te(200*Math.pow(2,r-1)),this._debug(n,"refreshing attempt",r),await Lt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:xo})),(r,s)=>{const i=200*Math.pow(2,r);return s&&gN(s)&&Date.now()+i-a<xf})}catch(a){if(this._debug(n,"error",a),_t(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const a=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",a),es()&&!n.skipBrowserRedirect&&window.location.assign(a),{data:{provider:t,url:a},error:null}}async _recoverAndRefresh(){var t,n;const a="#_recoverAndRefresh()";this._debug(a,"begin");try{const r=await Jc(this.storage,this.storageKey);if(r&&this.userStorage){let i=await Jc(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:r.user},await yf(this.userStorage,this.storageKey+"-user",i)),r.user=(t=i?.user)!==null&&t!==void 0?t:yN()}else if(r&&!r.user&&!r.user){const i=await Jc(this.storage,this.storageKey+"-user");i&&i?.user?(r.user=i.user,await Zr(this.storage,this.storageKey+"-user"),await yf(this.storage,this.storageKey,r)):r.user=yN()}if(this._debug(a,"session from storage",r),!this._isValidSession(r)){this._debug(a,"session is not valid"),r!==null&&await this._removeSession();return}const s=((n=r.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<mN;if(this._debug(a,`session has${s?"":" not"} expired with margin of ${mN}s`),s){if(this.autoRefreshToken&&r.refresh_token){const{error:i}=await this._callRefreshToken(r.refresh_token);i&&(console.error(i),gN(i)||(this._debug(a,"refresh failed with a non-retryable error, removing the session",i),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:o}=await this._getUser(r.access_token);!o&&i?.user?(r.user=i.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(a,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(a,"error getting user data, skipping SIGNED_IN notification",i)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(a,"error",r),console.error(r);return}finally{this._debug(a,"end")}}async _callRefreshToken(t){var n,a;if(!t)throw new Ni;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new dw;const{data:s,error:i}=await this._refreshAccessToken(t);if(i)throw i;if(!s.session)throw new Ni;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const o={data:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(r,"error",s),_t(s)){const i={data:null,error:s};return gN(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(i),i}throw(a=this.refreshingDeferred)===null||a===void 0||a.reject(s),s}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(t,n,a=!0){const r=`#_notifyAllSubscribers(${t})`;this._debug(r,"begin",n,`broadcast = ${a}`);try{this.broadcastChannel&&a&&this.broadcastChannel.postMessage({event:t,session:n});const s=[],i=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,n)}catch(l){s.push(l)}});if(await Promise.all(i),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(r,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Zr(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),a=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!a&&n.user&&await yf(this.userStorage,this.storageKey+"-user",{user:n.user});const r=Object.assign({},n);delete r.user;const s=S5(r);await yf(this.storage,this.storageKey,s)}else{const r=S5(n);await yf(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Zr(this.storage,this.storageKey),await Zr(this.storage,this.storageKey+"-code-verifier"),await Zr(this.storage,this.storageKey+"-user"),this.userStorage&&await Zr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&es()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}
59catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),xf);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:a}}=n;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((a.expires_at*1e3-t)/xf);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${xf}ms, refresh threshold is ${DC} ticks`),r<=DC&&await this._callRefreshToken(a.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof T8)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!es()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,a){const r=[`provider=${encodeURIComponent(n)}`];if(a?.redirectTo&&r.push(`redirect_to=${encodeURIComponent(a.redirectTo)}`),a?.scopes&&r.push(`scopes=${encodeURIComponent(a.scopes)}`),this.flowType==="pkce"){const[s,i]=await af(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(i)}`});r.push(o.toString())}if(a?.queryParams){const s=new URLSearchParams(a.queryParams);r.push(s.toString())}return a?.skipBrowserRedirect&&r.push(`skip_http_redirect=${a.skipBrowserRedirect}`),`${t}?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var a;const{data:r,error:s}=n;return s?this._returnResult({data:null,error:s}):await Lt(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(a=r?.session)===null||a===void 0?void 0:a.access_token})})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var a,r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:d}=await Lt(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(a=s?.session)===null||a===void 0?void 0:a.access_token});return d?this._returnResult({data:null,error:d}):(t.factorType==="totp"&&l.type==="totp"&&(!((r=l?.totp)===null||r===void 0)&&r.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var a;const{data:r,error:s}=n;if(s)return this._returnResult({data:null,error:s});const i=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?one(t.webauthn.credential_response):lne(t.webauthn.credential_response)})}:{code:t.code}),{data:o,error:l}=await Lt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:i,headers:this.headers,jwt:(a=r?.session)===null||a===void 0?void 0:a.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var a;const{data:r,error:s}=n;if(s)return this._returnResult({data:null,error:s});const i=await Lt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(a=r?.session)===null||a===void 0?void 0:a.access_token});if(i.error)return i;const{data:o}=i;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:sne(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:ine(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:a}=await this._challenge({factorId:t.factorId});return a?this._returnResult({data:null,error:a}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:a}=await this.getUser();if(a)return{data:null,error:a};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of(t=n?.factors)!==null&&t!==void 0?t:[])r.all.push(s),s.status==="verified"&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:a},error:r}
59=await this.getSession();if(r)return this._returnResult({data:null,error:r});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:s}=xN(a.access_token);let i=null;s.aal&&(i=s.aal);let o=i;((n=(t=a.user.factors)===null||t===void 0?void 0:t.filter(c=>c.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(o="aal2");const d=s.amr||[];return{data:{currentLevel:i,nextLevel:o,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:a},error:r}=n;return r?this._returnResult({data:null,error:r}):a?await Lt(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:a.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Ni})})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async a=>{const{data:{session:r},error:s}=a;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ni});const i=await Lt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});
59return i.data&&i.data.redirect_url&&es()&&!n?.skipBrowserRedirect&&window.location.assign(i.data.redirect_url),i})}catch(a){if(_t(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(t,n){try{return await this._useSession(async a=>{const{data:{session:r},error:s}=a;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ni});const i=await Lt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return i.data&&i.data.redirect_url&&es()&&!n?.skipBrowserRedirect&&window.location.assign(i.data.redirect_url),i})}catch(a){if(_t(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;return a?this._returnResult({data:null,error:a}):n?await Lt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Ni})})}catch(t){if(_t(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:a},error:r}=n;return r?this._returnResult({data:null,error:r}):a?(await Lt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ni})})}catch(n){if(_t(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let a=n.keys.find(o=>o.kid===t);if(a)return a;const r=Date.now();if(a=this.jwks.keys.find(o=>o.kid===t),a&&this.jwks_cached_at+mte>r)return a;const{data:s,error:i}=await Lt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=r,a=s.keys.find(o=>o.kid===t),!a)?null:a}async getClaims(t,n={}){try{let a=t;if(!a){const{data:x,error:y}
59=await this.getSession();if(y||!x.session)return this._returnResult({data:null,error:y});a=x.session.access_token}const{header:r,payload:s,signature:i,raw:{header:o,payload:l}}=xN(a);n?.allowExpired||Ote(s.exp);const d=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!d){const{error:x}=await this.getUser(a);if(x)throw x;return{data:{claims:s,header:r,signature:i},error:null}}const c=Lte(r.alg),f=await crypto.subtle.importKey("jwk",d,c,!0,["verify"]);if(!await crypto.subtle.verify(c,f,i,Cte(`${o}.${l}`)))throw new $C("Invalid JWT signature");return{data:{claims:s,header:r,signature:i},error:null}}catch(a){if(_t(a))return this._returnResult({data:null,error:a});throw a}}}Ty.nextInstanceID={};const xne=Ty,yne="2.91.0";let zx="";typeof Deno<"u"?zx="deno":typeof document<"u"?zx="web":typeof navigator<"u"&&navigator.product==="ReactNative"?zx="react-native":zx="node";const bne={"X-Client-Info":`supabase-js-${zx}/${yne}`},vne={headers:bne},wne={schema:"public"},Sne={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},kne={};function Ay(e){"@babel/helpers - typeof";return Ay=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ay(e)}function Nne(e,t){if(Ay(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Ay(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cne(e){var t=Nne(e,"string");return Ay(t)=="symbol"?t:t+""}function Ene(e,t,n){return(t=Cne(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,a)}return n}function za(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A5(Object(n),!0).forEach(function(a){Ene(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A5(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}const Ine=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Tne=()=>Headers,Ane=(e,t,n)=>{const a=Ine(n),r=Tne();return async(s,i)=>{var o;const l=(o=await t())!==null&&o!==void 0?o:e;let d=new r(i?.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${l}`),a(s,za(za({},i),{},{headers:d}))}};function _ne(e){return e.endsWith("/")?e:e+"/"}function jne(e,t){var n,a;const{db:r,auth:s,realtime:i,global:o}=e,{db:l,auth:d,realtime:c,global:f}=t,m={db:za(za({},l),r),auth:za(za({},d),s),realtime:za(za({},c),i),storage:{},global:za(za(za({},f),o),{},{headers:za(za({},(n=f?.headers)!==null&&n!==void 0?n:{}),(a=o?.headers)!==null&&a!==void 0?a:{})}),accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function Dne(e){const t=e?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(_ne(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Rne=class extends xne{constructor(e){super(e)}},Mne=class{constructor(e,t,n){var a,r;this.supabaseUrl=e,this.supabaseKey=t;const s=Dne(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const i=`sb-${s.hostname.split(".")[0]}-auth-token`,o={db:wne,realtime:kne,auth:za(za({},Sne),{},{storageKey:i}),global:vne},l=jne(n??{},o);if(this.storageKey=(a=l.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(r=l.global.headers)!==null&&r!==void 0?r:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(c,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var d;this.auth=this._initSupabaseAuthClient((d=l.auth)!==null&&d!==void 0?d:{},this.headers,l.global.fetch)}
59this.fetch=Ane(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(za({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(c=>this.realtime.setAuth(c)).catch(c=>console.warn("Failed to set initial Realtime auth token:",c)),this.rest=new pee(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new cte(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new lee(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:a}=await e.auth.getSession();return(t=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:a,userStorage:r,storageKey:s,flowType:i,lock:o,debug:l,throwOnError:d},c,f){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Rne({url:this.authUrl.href,headers:za(za({},m),c),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:a,userStorage:r,flowType:i,lock:o,debug:l,throwOnError:d,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new _ee(this.realtimeUrl.href,za(za({},e),{},{params:za(za({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t?.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const $ne=(e,t,n)=>new Mne(e,t,n);function Bne(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Bne()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Fne="https://xfnbiuvvntgqthfzpxlz.supabase.co/",One="sb_publishable_4NWKmBddtclp9a4M4eKb6w_Mf8f_RXl",No=$ne(Fne,One),Lne=Object.freeze(Object.defineProperty({__proto__:null,supabase:No},Symbol.toStringTag,{value:"Module"})),T1={email:"[email protected]",userId:"localhost-test-user-id",displayName:"Local Dev User"};function eb(){const[e,t]=D.useState(null),[n,a]=D.useState(!0),r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");return D.useEffect(()=>{if(r){if(sessionStorage.getItem("solta_localhost_signed_out")){t(null),a(!1);return}localStorage.getItem("soltaai_mvp_access")||(localStorage.setItem("soltaai_mvp_access",JSON.stringify(T1)),console.log("[AUTH] 🏠 Localhost: Created mock user credentials")),t({id:T1.userId,email:T1.email,user_metadata:{full_name:T1.displayName}}),a(!1);return}No.auth.getSession().then(({data:{session:o}})=>{const l=o?.user??null;t(l),a(!1),l&&localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:l.email,userId:l.id}))});const{data:{subscription:i}}=No.auth.onAuthStateChange((o,l)=>{const d=l?.user??null;t(d),d?localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:d.email,userId:d.id})):localStorage.removeItem("soltaai_mvp_access")});return()=>i.unsubscribe()},[r]),{user:e,loading:n,signOut:async()=>
59{if(r){localStorage.removeItem("soltaai_mvp_access"),localStorage.removeItem("solta_localhost_bls_set_count"),localStorage.removeItem("solta_subscription_choice"),sessionStorage.setItem("solta_localhost_signed_out","true"),window.location.href="/";return}await No.auth.signOut(),localStorage.removeItem("soltaai_mvp_access"),localStorage.removeItem("solta_subscription_choice")}}}function Pne({className:e=""}){return u.jsxs("svg",{viewBox:"0 0 60 40",className:e,role:"img","aria-hidden":"true",focusable:"false",children:[u.jsx("rect",{width:"60",height:"40",fill:"#B22234"}),[3,9,15,21,27,33].map(t=>u.jsx("rect",{y:t,width:"60",height:"3.08",fill:"#FFFFFF"},t)),u.jsx("rect",{width:"24",height:"21.5",fill:"#3C3B6E"})]})}function zne({className:e=""}){return u.jsxs("svg",{viewBox:"0 0 60 40",className:e,role:"img","aria-hidden":"true",focusable:"false",children:[u.jsx("rect",{width:"20",height:"40",fill:"#006847"}),u.jsx("rect",{x:"20",width:"20",height:"40",fill:"#FFFFFF"}),u.jsx("rect",{x:"40",width:"20",height:"40",fill:"#CE1126"}),u.jsx("circle",{cx:"30",cy:"20",r:"3.2",fill:"#7C3F00",opacity:"0.55"})]})}const vN=[{code:"en",labelKey:"a11y.switchToEnglish",short:"EN"},{code:"es",labelKey:"a11y.switchToSpanish",short:"ES"}];function Une(e,t){return e==="es"?u.jsx(zne,{className:t}):u.jsx(Pne,{className:t})}function _5({className:e=""}){const{lang:t,setLang:n,t:a}=Ws(),[r,s]=D.useState(!1),i=D.useRef(null);D.useEffect(()=>{if(!r)return;const l=c=>{i.current&&!i.current.contains(c.target)&&s(!1)},d=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d)}},[r]);const o=vN.find(l=>l.code===t)||vN[0];return u.jsxs("div",{ref:i,className:`relative ${e}`,children:[u.jsxs("button",{type:"button",onClick:()=>s(l=>!l),"aria-label":a("nav.language"),"aria-haspopup":"listbox","aria-expanded":r,className:"flex items-center gap-1 rounded px-1.5 py-1 text-[#1B4D1B]/70 hover:text-[#1B4D1B] hover:bg-[#7C9885]/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[#7C9885]",children:[u.jsx("span",{className:"text-xs font-semibold tracking-wide",children:o.short}),u.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5 L6 7.5 L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),r&&u.jsx("ul",{role:"listbox","aria-label":a("nav.language"),className:"absolute right-0 mt-1 min-w-[7rem] rounded-lg border border-[#7C9885]/25 bg-white shadow-lg py-1 z-50",children:vN.map(l=>{const d=l.code===t;return u.jsx("li",{role:"option","aria-selected":d,children:u.jsxs("button",{type:"button",onClick:()=>{n(l.code),s(!1)},"aria-label":a(l.labelKey),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left transition-colors ${d?"bg-[#7C9885]/10 text-[#1B4D1B] font-semibold":"text-[#1B4D1B]/80 hover:bg-[#7C9885]/10 hover:text-[#1B4D1B]"}`,children:[Une(l.code,"w-4 h-3 rounded-[1px] ring-1 ring-black/10"),u.jsx("span",{children:l.short})]})},l.code)})})]})}const Wne={hidden:{opacity:0,y:40},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}},Vne=new Set(["/signup","/login","/reset-password","/auth/callback"]);function j5(e){if(typeof window>"u")return e;const t=window.location.pathname;if(Vne.has(t))return e;const n=t+window.location.search;return n==="/"||n===""?e:`${e}?returnUrl=${encodeURIComponent(n)}`}function Vs({showJoinButton:e=!0,autoHide:t=!1}){const[n,a]=D.useState(!1),[r,s]=D.useState(!1),{user:i}=eb(),{t:o}=Ws(),l=!!i,d=j5("/signup"),c=j5("/login"),f=D.useCallback(x=>{x.key==="Escape"&&n&&a(!1)},[n]);D.useEffect(()=>(document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)),[f]),D.useEffect(()=>{if(!t)return;const x=()=>s(window.scrollY>8);return x(),window.addEventListener("scroll",x,{passive:!0}),()=>window.removeEventListener("scroll",x)},[t]);const m=t&&!r;return u.jsxs(u.Fragment,{children:[u.jsx("a",{href:"#main-content",className:"skip-link",children:o("a11y.skipToMain")}),u.jsx(qe.nav,{initial:"hidden",animate:"visible",variants:Wne,className:`fixed top-0 left-0 right-0 z-50 bg-white/60 backdrop-blur-md border-b border-[#7C9885]/20 transition-transform duration-300 ${m?"-translate-y-full":"translate-y-0"}`,"aria-label":o("a11y.mainNav"),children:u.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("a",{href:"/",className:"text-2xl md:text-3xl font-serif tracking-wider text-[#1B4D1B] hover:text-[#7C9885] transition-colors",children:["Solta",u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[u.jsx("a",{href:"/about",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium",children:o("nav.about")}),u.jsx("a",{href:"/bls",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium",children:o("nav.bls")}),u.jsx("a",{href:"/faqs",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium",children:o("nav.faqs")}),l?u.jsx("a",{href:"/account",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium",children:o("nav.account")}
59):u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("a",{href:c,className:"border-2 border-[#1B4D1B] text-[#1B4D1B] bg-transparent hover:bg-[#1B4D1B]/5 rounded-lg px-5 py-2 font-semibold transition-colors",children:o("nav.login")}),u.jsx("a",{href:d,className:"bg-[#F4A28C] hover:bg-[#e8927a] text-white rounded-lg px-5 py-2 font-semibold transition-colors shadow-sm",children:o("nav.signup")})]}),u.jsx(_5,{})]}),u.jsxs("div",{className:"flex md:hidden items-center gap-2",children:[u.jsx(_5,{}),u.jsx("button",{onClick:()=>a(!n),className:"p-2 rounded-lg text-[#1B4D1B] hover:bg-[#7C9885]/10 transition-colors focus:outline-none focus:ring-2 focus:ring-[#7C9885]","aria-label":o(n?"a11y.closeMenu":"a11y.openMenu"),"aria-expanded":n,"aria-controls":"mobile-menu",children:u.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n?u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]})]}),n&&u.jsx(qe.div,{id:"mobile-menu",initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"md:hidden mt-4 pb-4 border-t border-[#7C9885]/20 pt-4",role:"menu","aria-label":o("a11y.mobileNav"),children:u.jsxs("div",{className:"flex flex-col space-y-4",children:[u.jsx("a",{href:"/about",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium py-2",onClick:()=>a(!1),children:o("nav.about")}),u.jsx("a",{href:"/bls",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium py-2",onClick:()=>a(!1),children:o("nav.bls")}),u.jsx("a",{href:"/faqs",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium py-2",onClick:()=>a(!1),children:o("nav.faqs")}),u.jsx("a",{href:"/contact",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium py-2",onClick:()=>a(!1),children:o("nav.contact")}),l?u.jsx("a",{href:"/account",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors font-medium py-2 block",onClick:()=>a(!1),children:o("nav.accountShort")}):u.jsxs("div",{className:"flex gap-3 pt-2",children:[u.jsx("a",{href:c,className:"flex-1 text-center border-2 border-[#1B4D1B] text-[#1B4D1B] bg-transparent hover:bg-[#1B4D1B]/5 rounded-lg px-5 py-2.5 font-semibold transition-colors",onClick:()=>a(!1),children:o("nav.login")}),u.jsx("a",{href:d,className:"flex-1 text-center bg-[#F4A28C] hover:bg-[#e8927a] text-white rounded-lg px-5 py-2.5 font-semibold transition-colors shadow-sm",onClick:()=>a(!1),children:o("nav.signup")})]})]})})]})})]})}function ui(){const{t:e}=Ws();return u.jsx("footer",{className:"bg-[#5C7565] text-[#FEF9F6] py-12",children:u.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[u.jsxs("div",{className:"flex flex-col md:flex-row md:justify-between md:space-x-16 space-y-8 md:space-y-0 mb-8",children:[u.jsxs("div",{className:"space-y-3 max-w-prose",children:[u.jsx("h3",{className:"font-semibold text-sm uppercase tracking-wide",children:e("footer.acknowledgment")}),u.jsxs("p",{className:"text-[#FEF9F6] text-sm leading-relaxed",children:[e("footer.crisisPrefix"),u.jsx("a",{href:"https://www.findahelpline.com",className:"underline hover:text-[#F4A28C] transition-colors",target:"_blank",rel:"noopener noreferrer",children:"www.findahelpline.com"}),e("footer.crisisSuffix")]})]}),u.jsxs("div",{className:"space-y-3 md:justify-self-end",children:[u.jsx("h3",{className:"font-semibold text-sm text-[#FEF9F6] uppercase tracking-wide",children:e("footer.getInTouch")}),u.jsxs("div",{className:"space-y-3",children:[u.jsxs("a",{href:"mailto:[email protected]?subject=Solta%20AI%20Inquiry&body=Hi%20team,",className:"flex items-center space-x-3 hover:text-[#F4A28C] transition-colors focus:outline-none focus:ring-2 focus:ring-[#FEF9F6] rounded","aria-label":e("footer.emailAria"),children:[u.jsxs("svg",{className:"w-4 h-4 text-[#FEF9F6]",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("path",{d:"M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z"}),u.jsx("path",{d:"M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z"})]}),u.jsx("span",{children:"[email protected]"})]}),u.jsxs("a",{href:"https://www.linkedin.com/company/soltaai/",className:"flex items-center space-x-3 text-[#FEF9F6] text-sm hover:text-[#F4A28C] transition-colors focus:outline-none focus:ring-2 focus:ring-[#FEF9F6] rounded",target:"_blank",rel:"noopener noreferrer","aria-label":e("footer.linkedinAria"),children:[u.jsx("svg",{className:"w-4 h-4 text-[#FEF9F6]",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})}),u.jsx("span",{children:"Solta AI"})]})]})]})]}),u.jsxs("div",{className:"border-t border-[#FEF9F6]/30 pt-6 flex justify-between items-center",children:[u.jsxs("p",{className:"text-[#FEF9F6] text-sm",children:["© ",new Date().getFullYear()," Solta AI"]}),u.jsx("a",{href:"/privacy",className:"text-[#FEF9F6] text-sm hover:text-[#F4A28C] transition-colors",children:e("footer.privacy")})]})]})})}const j8="https://soltaai.com",D5=`${j8}/og-image.png`,wN={en:"en_US",es:"es_MX"};function vs({title:e,description:t,path:n="/",noindex:a=!1,jsonLd:r}){const{lang:s}=Ws(),i=`${j8}${n}`,o=wN[s]||wN.en,l=Object.entries(wN).filter(([d])=>d!==s).map(([,d])=>d);return u.jsxs(u.Fragment,{children:[u.jsx("title",{children:e}),u.jsx("meta",{name:"description",content:t}),u.jsx("meta",{name:"robots",content:a?"noindex, nofollow":"index, follow"}),u.jsx("link",{rel:"canonical",href:i}),u.jsx("meta",{property:"og:type",content:"website"}),u.jsx("meta",{property:"og:site_name",content:"Solta AI"}),u.jsx("meta",{property:"og:title",content:e}),u.jsx("meta",{property:"og:description",content:t}),u.jsx("meta",{property:"og:url",content:i}),u.jsx("meta",{property:"og:image",content:D5}
59),u.jsx("meta",{property:"og:image:width",content:"1200"}),u.jsx("meta",{property:"og:image:height",content:"630"}),u.jsx("meta",{property:"og:locale",content:o}),l.map(d=>u.jsx("meta",{property:"og:locale:alternate",content:d},d)),u.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),u.jsx("meta",{name:"twitter:title",content:e}),u.jsx("meta",{name:"twitter:description",content:t}),u.jsx("meta",{name:"twitter:image",content:D5}),r&&u.jsx("script",{type:"application/ld+json",children:JSON.stringify(r)})]})}const Hne=/(\*\*[^*]+\*\*|_[^_]+_)/g;function bf(e){return e==null?e:String(e).split(Hne).map((n,a)=>n.startsWith("**")&&n.endsWith("**")?u.jsx("b",{children:n.slice(2,-2)},a):n.startsWith("_")&&n.endsWith("_")?u.jsx("i",{children:n.slice(1,-1)},a):n)}const hw="/assets/carlos_headshot-zqiaRGj9.jpeg",pw="/assets/sofia_headshot-Bz4FK_lt.png",lf={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function Gne(){const{t:e}=Ws();return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:e("about.seo.title"),description:e("about.seo.description"),path:"/about"}),u.jsx(Vs,{showJoinButton:!1}),u.jsxs("main",{className:"pt-24",children:[u.jsx("section",{className:"pt-12 md:pt-16 pb-16 md:pb-24",children:u.jsx("div",{className:"max-w-6xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:lf,className:"bg-white/50 rounded-lg p-8 text-center",children:[u.jsx("h3",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:e("about.mission.heading")}),u.jsx("p",{className:"text-lg leading-relaxed text-[#1B4D1B] max-w-4xl mx-auto",children:e("about.mission.body")})]})})}),u.jsx("section",{className:"py-16 md:py-24 bg-white/50",children:u.jsx("div",{className:"max-w-6xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:lf,className:"space-y-8 text-[#1B4D1B]",children:[u.jsx("div",{className:"text-center",children:u.jsx("h2",{className:"font-serif text-3xl md:text-4xl mb-4",children:e("about.team.heading")})}),u.jsxs("div",{className:"grid md:grid-cols-2 gap-8 mt-12",children:[u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:lf,transition:{delay:.2},className:"text-center space-y-4",children:[u.jsx("div",{className:"w-32 h-32 bg-[#7C9885]/20 rounded-full mx-auto mb-4 flex items-center justify-center",children:u.jsx("div",{className:"w-24 h-24 rounded-full overflow-hidden",children:u.jsx("img",{src:pw,alt:"Sofia Muller",className:"w-full h-full object-cover"})})}),u.jsxs("h3",{className:"font-semibold text-xl text-[#1B4D1B] flex items-center justify-center gap-2",children:["Sofia Muller",u.jsx("a",{href:"https://www.linkedin.com/in/sofiamuller/",target:"_blank",rel:"noopener noreferrer",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors inline-flex items-center","aria-label":e("about.sofia.linkedinAria"),children:u.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})]}),u.jsx("p",{className:"text-[#5A7A63] font-medium",children:e("about.sofia.role")}),u.jsxs("p",{className:"text-sm leading-relaxed text-[#1B4D1B]",children:[bf(e("about.sofia.bioP1")),u.jsx("br",{}),u.jsx("br",{}),bf(e("about.sofia.bioP2"))]})]}),u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:lf,transition:{delay:.4},className:"text-center space-y-4",children:[u.jsx("div",{className:"w-32 h-32 bg-[#7C9885]/20 rounded-full mx-auto mb-4 flex items-center justify-center",children:u.jsx("div",{className:"w-24 h-24 rounded-full overflow-hidden",children:u.jsx("img",{src:hw,alt:"Dr. Carlos Castañeda",className:"w-full h-full object-cover"})})}),u.jsxs("h3",{className:"font-semibold text-xl text-[#1B4D1B] flex items-center justify-center gap-2",children:["Dr. Carlos Castañeda",u.jsx("a",{href:"https://www.linkedin.com/in/carlos-casta%C3%B1eda-704/",target:"_blank",rel:"noopener noreferrer",className:"text-[#1B4D1B] hover:text-[#7C9885] transition-colors inline-flex items-center","aria-label":e("about.carlos.linkedinAria"),children:u.jsx("svg",{className:"w-4 h-4",fill:"
59currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})]}),u.jsx("p",{className:"text-[#5A7A63] font-medium",children:e("about.carlos.role")}),u.jsxs("p",{className:"text-sm leading-relaxed text-[#1B4D1B]",children:[bf(e("about.carlos.bioP1")),u.jsx("br",{}),u.jsx("br",{}),bf(e("about.carlos.bioP2"))]})]})]})]})})}),u.jsx("section",{className:"py-16 md:py-24",children:u.jsx("div",{className:"max-w-6xl mx-auto px-6",children:u.jsx(qe.div,{initial:"hidden",animate:"visible",variants:lf,className:"space-y-8 text-[#1B4D1B]",children:u.jsx("div",{className:"max-w-4xl mx-auto",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:lf,transition:{delay:.2},className:"bg-white/50 rounded-lg p-8 md:p-10 flex flex-col md:flex-row items-center gap-8 md:gap-10",children:[u.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 space-y-3 md:w-48",children:[u.jsx("div",{className:"w-32 h-32 bg-[#F4A28C]/20 rounded-full flex items-center justify-center",children:u.jsx("div",{className:"w-24 h-24 bg-[#F4A28C] rounded-full flex items-center justify-center",children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-11 h-11","aria-hidden":"true",children:[u.jsx("path",{d:"M11 2v2"}),u.jsx("path",{d:"M5 2v2"}),u.jsx("path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1"}),u.jsx("path",{d:"M8 15a6 6 0 0 0 12 0v-3"}),u.jsx("circle",{cx:"20",cy:"10",r:"2"})]})})}),u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B] text-center",children:e("about.cab.heading")}),u.jsx("p",{className:"text-[#5A7A63] font-medium text-center text-sm",children:e("about.cab.subtitle")})]}),u.jsx("div",{className:"flex-1",children:u.jsx("p",{className:"text-sm md:text-base leading-relaxed text-[#1B4D1B] text-center md:text-left",children:bf(e("about.cab.body"))})})]})})})})})]}),u.jsx(ui,{})]})}const R5={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function qne(){return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(Vs,{showJoinButton:!1}),u.jsxs("main",{className:"pt-24",children:[u.jsx("section",{className:"py-12 md:py-16",children:u.jsx("div",{className:"max-w-6xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:R5,className:"text-center",children:[u.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B] mb-4",children:"Contact Us"}),u.jsx("p",{className:"text-lg md:text-xl text-[#1B4D1B] max-w-2xl mx-auto",children:"Get in touch with our team"})]})})}),u.jsx("section",{className:"py-16 md:py-24 bg-white/50",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:R5,className:"text-center space-y-8",children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"Get in Touch"}),u.jsx("p",{className:"text-lg text-[#1B4D1B] max-w-2xl mx-auto",children:"Have questions about our AI-powered trauma reprocessing platform? We'd love to hear from you."}),u.jsx("div",{className:"bg-white rounded-lg shadow-lg p-8 max-w-md mx-auto",children:u.jsx("div",{className:"space-y-6",children:u.jsxs("div",{className:"text-center",children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B] text-xl mb-2",children:"Email Us"}),u.jsx("p",{className:"text-[#1B4D1B] mb-4",children:u.jsx("strong",{children:"[email protected]"})}),u.jsx(Rs,{className:"bg-[#7C9885] hover:bg-[#6B8572] text-[#FDF7F3] px-6 py-2",onClick:()=>window.open("mailto:[email protected]"),children:"Send Email"})]})})})]})})})]}),u.jsx(ui,{})]})}function el({className:e,type:t,...n}){return u.jsx("input",{type:t,"data-slot":"input",className:p8("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}const Kne={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function Xne({email:e,onComplete:t,onSkip:n}
59){const[a,r]=D.useState(""),[s,i]=D.useState(""),[o,l]=D.useState(""),[d,c]=D.useState(""),[f,m]=D.useState(""),[x,y]=D.useState(!1),[b,w]=D.useState(""),S=async C=>{C.preventDefault(),y(!0),w("");try{const E=await fetch("/.netlify/functions/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,country:a,role:s,whatBringsYou:o,howManageStress:d,usageFrequency:f})}),T=await E.json();E.ok&&T.success?t():w(T.error||"An error occurred. Please try again.")}catch(E){console.error("Error submitting onboarding:",E),w("An error occurred. Please try again.")}finally{y(!1)}},k=()=>{n()};return u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:Kne,className:"text-center space-y-8 text-[#1B4D1B]",children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl",children:"Tell Us About Yourself"}),u.jsx("p",{className:"text-lg leading-relaxed max-w-2xl mx-auto",children:"Help us personalize your experience (all fields are optional)"}),u.jsx("div",{className:"bg-white rounded-lg shadow-lg p-8 max-w-md mx-auto",children:u.jsxs("form",{onSubmit:S,className:"space-y-6",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{htmlFor:"country",className:"block text-sm text-[#1B4D1B] text-left",children:"Country"}),u.jsx(el,{id:"country",type:"text",placeholder:"Enter your country",value:a,onChange:C=>r(C.target.value),className:"w-full"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{htmlFor:"role",className:"block text-sm text-[#1B4D1B] text-left",children:"Role"}),u.jsxs("select",{id:"role",value:s,onChange:C=>i(C.target.value),className:"w-full h-9 px-3 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#7C9885] focus-visible:border-[#7C9885] text-[#1B4D1B]",children:[u.jsx("option",{value:"",children:"Select a role"}),u.jsx("option",{value:"Clinician",children:"Clinician"}),u.jsx("option",{value:"Client",children:"Client"}),u.jsx("option",{value:"Investor",children:"Investor"}),u.jsx("option",{value:"Other",children:"Other"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{htmlFor:"whatBringsYou",className:"block text-sm text-[#1B4D1B] text-left",children:"What brings you here?"}),u.jsxs("select",{id:"whatBringsYou",value:o,onChange:C=>l(C.target.value),className:"w-full h-9 px-3 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#7C9885] focus-visible:border-[#7C9885] text-[#1B4D1B]",children:[u.jsx("option",{value:"",children:"Select an option"}),u.jsx("option",{value:"Daily stress/anxiety",children:"Daily stress/anxiety"}),u.jsx("option",{value:"Better sleep",children:"Better sleep"}),u.jsx("option",{value:"Emotional balance",children:"Emotional balance"}),u.jsx("option",{value:"Curiosity",children:"Curiosity"}),u.jsx("option",{value:"Other",children:"Other"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{htmlFor:"howManageStress",className:"block text-sm text-[#1B4D1B] text-left",children:"How do you usually manage stress?"}),u.jsxs("select",{id:"howManageStress",value:d,onChange:C=>c(C.target.value),className:"w-full h-9 px-3 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#7C9885] focus-visible:border-[#7C9885] text-[#1B4D1B]",children:[u.jsx("option",{value:"",children:"Select an option"}),u.jsx("option",{value:"Meditation/mindfulness",children:"Meditation/mindfulness"}),u.jsx("option",{value:"Exercise",children:"Exercise"}),u.jsx("option",{value:"Therapy",children:"Therapy"}),u.jsx("option",{value:"Nothing yet",children:"Nothing yet"}),u.jsx("option",{value:"Other",children:"Other"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{htmlFor:"usageFrequency",className:"block text-sm text-[#1B4D1B] text-left",children:"How often do you want to use this?"}),u.jsxs("select",{id:"usageFrequency",value:f,onChange:C=>m(C.target.value),className:"w-full h-9 px-3 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#7C9885] focus-visible:border-[#7C9885] text-[#1B4D1B]",children:[u.jsx("option",{value:"",children:"Select an option"}),u.jsx("option",{value:"Daily",children:"Daily"}),u.jsx("option",{value:"Few times a week",children:"Few times a week"}),u.jsx("option",{value:"As needed",children:"As needed"})]})]}),b&&u.jsx("p",{className:"text-sm text-red-500",children:b})]}),u.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[u.jsx(Rs,{type:"button",onClick:k,className:"flex-1 bg-gray-200 hover:bg-gray-300 text-[#1B4D1B]",disabled:x,children:"Skip"}),u.jsx(Rs,{type:"submit",className:"flex-1 bg-[#7C9885] hover:bg-[#6
59B8572] text-white",disabled:x,children:x?"Submitting...":"Submit"})]})]})})]})}var Yne=Object.defineProperty,Jne=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),zI=(e,t)=>{for(var n in t)Yne(e,n,{get:t[n],enumerable:!0})},Qne={};zI(Qne,{Abs:()=>hm,Acos:()=>Gd,Acosh:()=>qd,AdadeltaOptimizer:()=>oA,AdagradOptimizer:()=>lA,AdamOptimizer:()=>uA,AdamaxOptimizer:()=>cA,Add:()=>hc,AddN:()=>Kd,All:()=>pm,Any:()=>fm,ArgMax:()=>mm,ArgMin:()=>gm,Asin:()=>Xd,Asinh:()=>Yd,Atan:()=>Jd,Atan2:()=>Zd,Atanh:()=>Qd,AvgPool:()=>eh,AvgPool3D:()=>xm,AvgPool3DGrad:()=>rb,AvgPoolGrad:()=>ab,BackendWasm:()=>PV,BatchMatMul:()=>th,BatchToSpaceND:()=>ym,Bincount:()=>bm,BitwiseAnd:()=>vm,BroadcastArgs:()=>sb,BroadcastTo:()=>G8,Callback:()=>Lz,CallbackList:()=>D6,Cast:()=>nh,Ceil:()=>ah,ClipByValue:()=>pc,Complex:()=>yw,ComplexAbs:()=>ib,Concat:()=>wm,Conv2D:()=>rh,Conv2DBackpropFilter:()=>bw,Conv2DBackpropInput:()=>sh,Conv3D:()=>ih,Conv3DBackpropFilterV2:()=>Sm,Conv3DBackpropInputV2:()=>km,Cos:()=>oh,Cosh:()=>lh,CropAndResize:()=>Cm,Cumprod:()=>Nm,Cumsum:()=>uh,CustomCallback:()=>M6,DataStorage:()=>mw,DenseBincount:()=>ob,DepthToSpace:()=>Em,DepthwiseConv2dNative:()=>ch,DepthwiseConv2dNativeBackpropFilter:()=>vw,DepthwiseConv2dNativeBackpropInput:()=>ww,Diag:()=>lb,Dilation2D:()=>dh,Dilation2DBackpropFilter:()=>Uf,Dilation2DBackpropInput:()=>zf,Draw:()=>Sw,ENV:()=>GI,EarlyStopping:()=>Pz,Einsum:()=>kw,Elu:()=>ph,EluGrad:()=>Im,Environment:()=>V8,Equal:()=>Tm,Erf:()=>fh,Exp:()=>mh,ExpandDims:()=>Am,Expm1:()=>gh,FFT:()=>Nw,Fill:()=>ub,FlipLeftRight:()=>_m,Floor:()=>xh,FloorDiv:()=>yh,FromPixels:()=>Ev,FusedBatchNorm:()=>bh,FusedConv2D:()=>Cd,FusedDepthwiseConv2D:()=>Ed,GPGPUContext:()=>cv,GatherNd:()=>Dm,GatherV2:()=>jm,GraphModel:()=>Y_,Greater:()=>Rm,GreaterEqual:()=>vh,History:()=>R6,IFFT:()=>Cw,Identity:()=>wh,Imag:()=>Ew,InputSpec:()=>nr,IsFinite:()=>Sh,IsInf:()=>kh,IsNan:()=>Nh,KernelBackend:()=>tb,LRN:()=>Th,LRNGrad:()=>Pm,LayerVariable:()=>N6,LayersModel:()=>Ol,LeakyRelu:()=>Ch,Less:()=>Mm,LessEqual:()=>$m,LinSpace:()=>Bm,Log:()=>Eh,Log1p:()=>Ih,LogSoftmax:()=>K8,LogicalAnd:()=>Fm,LogicalNot:()=>Om,LogicalOr:()=>Lm,LogicalXor:()=>q8,LowerBound:()=>Wae,MathBackendCPU:()=>Z_,MathBackendWebGL:()=>I4,MatrixBandPart:()=>Vae,Max:()=>Ah,MaxPool:()=>jh,MaxPool3D:()=>zm,MaxPool3DGrad:()=>db,MaxPoolGrad:()=>cb,MaxPoolWithArgmax:()=>hb,Maximum:()=>_h,Mean:()=>Dh,Min:()=>Rh,Minimum:()=>Mh,MirrorPad:()=>$h,Mod:()=>Bh,MomentumOptimizer:()=>dA,Multinomial:()=>Um,Multiply:()=>Fh,Neg:()=>Wm,NonMaxSuppressionV3:()=>Hm,NonMaxSuppressionV4:()=>Gm,NonMaxSuppressionV5:()=>qm,NotEqual:()=>Vm,OP_SCOPE_SUFFIX:()=>JI,OneHot:()=>Oh,OnesLike:()=>Km,Optimizer:()=>Jl,OptimizerConstructors:()=>a6,Pack:()=>Xm,PadV2:()=>Lh,Pool:()=>Hae,Pow:()=>Ph,Prelu:()=>zh,Prod:()=>Uh,RMSPropOptimizer:()=>hA,RNN:()=>Ql,RaggedGather:()=>Iw,RaggedRange:()=>Tw,RaggedTensorToTensor:()=>Aw,Range:()=>pb,Rank:()=>OC,Real:()=>_w,RealDiv:()=>hh,Reciprocal:()=>Wh,Reduction:()=>gs,Relu:()=>Vh,Relu6:()=>qh,Reshape:()=>Ym,ResizeBilinear:()=>Gh,ResizeBilinearGrad:()=>Qm,ResizeNearestNeighbor:()=>Hh,ResizeNearestNeighborGrad:()=>Jm,Reverse:()=>Kh,RotateWithOffset:()=>pg,Round:()=>Xh,Rsqrt:()=>Yh,SGDOptimizer:()=>h2,ScatterNd:()=>Zm,SearchSorted:()=>tg,Select:()=>ng,Selu:()=>Jh,Sequential:()=>C2,Sigmoid:()=>tp,Sign:()=>ep,Sin:()=>Qh,Sinh:()=>Zh,Slice:()=>ag,Softmax:()=>sp,Softplus:()=>np,SpaceToBatchND:()=>rg,SparseFillEmptyRows:()=>fb,SparseReshape:()=>ig,SparseSegmentMean:()=>mb,SparseSegmentSum:()=>gb,SparseToDense:()=>og,SplitV:()=>sg,Sqrt:()=>ap,Square:()=>xb,SquaredDifference:()=>ip,StaticRegexReplace:()=>yb,Step:()=>mc,StridedSlice:()=>lg,StringNGrams:()=>bb,StringSplit:()=>vb,StringToHashBucketFast:()=>wb,Sub:()=>op,Sum:()=>rp,SymbolicTensor:()=>_o,Tan:()=>lp,Tanh:()=>up,Tensor:()=>en,TensorBuffer:()=>ar,TensorScatterUpdate:()=>eg,Tile:()=>fc,TopK:()=>ug,Transform:()=>cg,Transpose:()=>Fl,Unique:()=>Sb,Unpack:()=>dg,UnsortedSegmentSum:()=>kb,UpperBound:()=>Gae,Variable:()=>Id,ZerosLike:()=>hg,_FusedMatMul:()=>Nd,abs:()=>tr,acos:()=>nT,acosh:()=>aT,add:()=>ke,addN:()=>SL,all:()=>$w,any:()=>$y,argMax:()=>jd,argMin:()=>rT,asin:()=>sT,asinh:()=>iT,atan:()=>oT,atan2:()=>lT,atanh:()=>uT,avgPool:()=>Kl,avgPool3d:()=>dT,backend:()=>QI,backend_util:()=>W,basicLSTMCell:()=>EL,batchNorm:()=>cp,batchNorm2d:()=>hT,batchNorm3d:()=>pT,batchNorm4d:()=>fT,batchToSpaceND:()=>_b,bincount:()=>mT,bitwiseAnd:()=>IL,booleanMaskAsync:()=>gP,broadcastArgs:()=>TL,broadcastTo:()=>vd,broadcast_util:()=>fg,browser:()=>Wb,buffer:()=>Zt,callbacks:()=>zye,cast:()=>He,ceil:()=>gT,clipByValue:()=>ns,clone:()=>tl,complex:()=>Ul,concat:()=>Qn,concat1d:()=>xT,concat2d:()=>yT,concat3d:()=>bT,concat4d:()=>vT,constraints:()=>T6,conv1d:()=>Bw,conv2d:()=>ws,conv2dTranspose:()=>Fw,conv3d:()=>ST,conv3dTranspose:()=>kT,copyRegisteredKernels:()=>Yae,cos:()=>jb,cosh:()=>Ow,cosineWindow:()=>o2,cumprod:()=>Oy,cumsum:()=>Lw,customGrad:()=>il,data:()=>c7,denseBincount:()=>Av,deprecationWarn:()=>lL,depthToSpace:()=>NT,depthwiseConv2d:()=>dp,deregisterOp:()=>Vye,device_util:()=>Ib,diag:()=>_L,dilation2d:()=>CT,disableDeprecationWarnings:()=>Ere,dispose:()=>Kt,disposeVariables:()=>Ire,div:()=>ht,divNoNan:()=>ET,dot:()=>IT,dropout:()=>nA,einsum:()=>ud,elu:()=>mg,enableDebugMode:()=>Cre,enableProdMode:()=>Nre,enclosingPowerOfTwo:()=>aA,engine:()=>Ji,ensureShape:()=>DL,env:()=>fe,equal:()=>si,erf:()=>Pw,euclideanNorm:()=>_T,exp:()=>as,expandDims:()=>Dr,expm1:()=>jT,eye:()=>zw,fft:()=>zb,fill:()=>ri,findBackend:()=>Rre,findBackendFactory:()=>Mre,floor:()=>xg,floorDiv:()=>Mw,forceHalfFloat:()=>M9,fused:()=>Yf,gather:()=>yg,gatherND:()=>vP,gather_util:()=>mA,getBackend:()=>uL,getGradient:()=>BC,getKernel:()=>Dy,getKernelsForBackend:()=>Iv,getThreadsCount:()=>KOe,gpgpu_util:()=>d9,grad:()=>hoe,grads:()=>poe,greater:()=>Es,greaterEqual:()=>Xl,ifft:()=>Xf,imag:()=>Db,image:()=>Ii,inTopKAsync:()=>
vendor: 15,131 bytes, line 59
59wP,initializers:()=>A6,input:()=>K6,io:()=>Hr,irfft:()=>e2,isFinite:()=>DT,isInf:()=>RT,isNaN:()=>MT,keep:()=>xr,kernel_impls:()=>cl,layers:()=>_6,leakyRelu:()=>Rb,less:()=>Hf,lessEqual:()=>xc,linalg:()=>iA,linspace:()=>FL,loadGraphModel:()=>Ybe,loadGraphModelSync:()=>Jbe,loadLayersModel:()=>Bge,localResponseNormalization:()=>$T,log:()=>ii,log1p:()=>Mb,logSigmoid:()=>BT,logSoftmax:()=>Ww,logSumExp:()=>$b,logicalAnd:()=>to,logicalNot:()=>Bb,logicalOr:()=>Vw,logicalXor:()=>FT,losses:()=>RP,lowerBound:()=>LL,matMul:()=>Jt,math:()=>VP,max:()=>ji,maxPool:()=>Ar,maxPool3d:()=>OT,maxPoolWithArgmax:()=>PL,maximum:()=>ul,mean:()=>ba,memory:()=>HC,meshgrid:()=>zL,metrics:()=>Bz,min:()=>Vf,minimum:()=>ec,mirrorPad:()=>LT,mod:()=>PT,model:()=>Lge,models:()=>Fz,moments:()=>Fb,movingAverage:()=>xP,mul:()=>ie,multiRNNCell:()=>UL,multinomial:()=>WL,neg:()=>ua,nextFrame:()=>gA,norm:()=>gg,notEqual:()=>Md,oneHot:()=>Gf,ones:()=>$s,onesLike:()=>oi,op:()=>re,outerProduct:()=>VL,pad:()=>Ro,pad1d:()=>HL,pad2d:()=>GL,pad3d:()=>qL,pad4d:()=>KL,pool:()=>zT,pow:()=>sl,prelu:()=>Lb,print:()=>tT,prod:()=>UT,profile:()=>Tre,raggedGather:()=>XL,raggedRange:()=>YL,raggedTensorToTensor:()=>JL,rand:()=>QL,randomGamma:()=>nP,randomNormal:()=>Gw,randomStandardNormal:()=>aP,randomUniform:()=>yc,randomUniformInt:()=>rP,range:()=>$d,ready:()=>jre,real:()=>qf,reciprocal:()=>qT,registerBackend:()=>Rw,registerCallbackConstructor:()=>zge,registerGradient:()=>X8,registerKernel:()=>Nb,registerOp:()=>Wye,regularizers:()=>Oz,relu:()=>Vn,relu6:()=>qw,removeBackend:()=>Dre,reshape:()=>le,reverse:()=>Mi,reverse1d:()=>sP,reverse2d:()=>iP,reverse3d:()=>oP,reverse4d:()=>lP,rfft:()=>Ub,round:()=>Kw,rsqrt:()=>Xw,scalar:()=>Et,scatterND:()=>yP,scatter_util:()=>a2,searchSorted:()=>Hw,selu:()=>Yw,separableConv2d:()=>bg,sequential:()=>Pge,serialization:()=>De,setBackend:()=>_re,setPlatform:()=>$re,setThreadsCount:()=>qOe,setWasmPath:()=>HOe,setWasmPaths:()=>GOe,setWebGLContext:()=>$U,setdiff1dAsync:()=>uP,shared:()=>e4,sigmoid:()=>eo,sign:()=>KT,signal:()=>DP,sin:()=>Jw,sinh:()=>Qw,slice:()=>un,slice1d:()=>Pb,slice2d:()=>Zw,slice3d:()=>vg,slice4d:()=>Kf,slice_util:()=>vr,softmax:()=>bc,softplus:()=>hp,spaceToBatchND:()=>Ob,sparse:()=>MP,sparseToDense:()=>bP,spectral:()=>jP,split:()=>Bs,sqrt:()=>$r,square:()=>Jn,squaredDifference:()=>t2,squeeze:()=>vc,stack:()=>rr,step:()=>pp,stridedSlice:()=>XT,string:()=>$P,sub:()=>st,sum:()=>yt,sumOutType:()=>Dw,tan:()=>YT,tanh:()=>Zu,tensor:()=>bs,tensor1d:()=>Ln,tensor2d:()=>nl,tensor3d:()=>n2,tensor4d:()=>tc,tensor5d:()=>cP,tensor6d:()=>dP,tensorScatterUpdate:()=>pP,tensor_util:()=>Co,test_util:()=>ZL,tidy:()=>ue,tile:()=>ai,time:()=>Are,topk:()=>QT,train:()=>rd,transpose:()=>Qt,truncatedNormal:()=>s2,unique:()=>ZT,unregisterGradient:()=>Xae,unregisterKernel:()=>Kae,unsortedSegmentSum:()=>i2,unstack:()=>$a,upcastType:()=>Di,upperBound:()=>fP,util:()=>R,valueAndGrad:()=>foe,valueAndGrads:()=>moe,variable:()=>eA,variableGrads:()=>OL,version:()=>t8e,version_converter:()=>Zbe,version_core:()=>Lde,version_cpu:()=>eve,version_layers:()=>LA,version_wasm:()=>XOe,version_webgl:()=>WEe,webgl:()=>VEe,webgl_util:()=>MU,where:()=>Mr,whereAsync:()=>tA,zeros:()=>va,zerosLike:()=>pn});var Zne=Object.create,UI=Object.defineProperty,eae=Object.getOwnPropertyDescriptor,tae=Object.getOwnPropertyNames,nae=Object.getPrototypeOf,aae=Object.prototype.hasOwnProperty,ir=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Xt=(e,t)=>{for(var n in t)UI(e,n,{get:t[n],enumerable:!0})},rae=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of tae(t))!aae.call(e,r)&&r!==n&&UI(e,r,{get:()=>t[r],enumerable:!(a=eae(t,r))||a.enumerable});return e},dc=(e,t,n)=>(n=e!=null?Zne(nae(e)):{},rae(!e||!e.__esModule?UI(n,"default",{value:e,enumerable:!0}):n,e)),sae=ir((e,t)=>{t.exports=a;var n=null;try{n=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 a(j,G,X){this.low=j|0,this.high=G|0,this.unsigned=!!X}a.prototype.__isLong__,Object.defineProperty(a.prototype,"__isLong__",{value:!0});function r(j){return(j&&j.__isLong__)===!0}a.isLong=r;var s={},i={};function o(j,G){var X,J,V;return G?(j>>>=0,(V=0<=j&&j<256)&&(J=i[j],J)?J:(X=d(j,(j|0)<0?-1:0,!0),V&&(i[j]=X),X)):(j|=0,(V=-128<=j&&j<128)&&(J=s[j],J)?J:(X=d(j,j<0?-1:0,!1),V&&(s[j]=X),X))}a.fromInt=o;function l(j,G){if(isNaN(j))return G?E:C;if(G){if(j<0)return E;if(j>=w)return O}else{if(j<=-S)return z;if(j+1>=S)return $}return j<0?l(-j,G).neg():d(j%b|0,j/b|0,G)}a.fromNumber=l;function d(j,G,X){return new a(j,G,X)}a.fromBits=d;var c=Math.pow;function f(j,G,X){if(j.length===0)throw Error("empty string");if(j==="NaN"||j==="Infinity"||j==="+Infinity"||j==="-Infinity")return C;if(typeof G=="number"?(X=G,G=!1):G=!!G,X=X||10,X<2||36<X)throw RangeError("radix");var J;if((J=j.indexOf("-"))>0)throw Error("interior hyphen");if(J===0)return f(j.substring(1),G,X).neg();for(var V=l(c(X,8)),Q=C,F=0;F<j.length;F+=8){var H=Math.min(8,j.length-F),B=parseInt(j.substring(F,F+H),X);if(H<8){var Y=l(c(X,H));Q=Q.mul(Y).add(l(B))}else Q=Q.mul(V),Q=Q.add(l(B))}return Q.unsigned=G,Q}a.fromString=f;function m(j,G){return typeof j=="number"?l(j,G):typeof j=="string"?f(j,G):d(j.low,j.high,typeof G=="boolean"?G:j.unsigned)}a.fromValue=m;var x=65536,y=1<<24,b=x*x,w=b*b,S=w/2,k=o(y),C=o(0);a.ZERO=C;var E=o(0,!0);a.UZERO=E;var T=o(1);a.ONE=T;var _=o(1,!0);a.UONE=_;var A=o(-1);a.NEG_ONE=A;var $=d(-1,2147483647,!1);a.MAX_VALUE=$;var O=d(-1,-1,!0);a.MAX_UNSIGNED_VALUE=O;var z=d(0,-2147483648,!1);a.MIN_VALUE=z;var P=a.prototype;P.toInt=function(){return this.unsigned?this.low>>>0:this.low},P.toNumber=function(){return this.unsigned?(this.high>>>0)*b+(this.low>>>0):this.high*b+(this.low>>>0)},P.toString=function(j){if(j=j||10,j<2||36<j)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(z)){var G=l(j),X=this.div(G),J=X.mul(G).sub(this);return X.toString(j)+J.toInt().toString(j)}else return"-"+this.neg().toString(j);for(var V=l(c(j,6),this.unsigned),Q=this,F="";;){var H=Q.div(V),B=Q.sub(H.mul(V)).toInt()>>>0,Y=B.toString(j);if(Q=H,Q.isZero())return Y+F;for(;Y.length<6;)Y="0"+Y;F=""+Y+F}},P.getHighBits=function(){return this.high},P.getHighBitsUnsigned=function(){return this.high>>>0},P.getLowBits=function(){return this.low},P.getLowBitsUnsigned=function(){return this.low>>>0},P.getNumBitsAbs=function(){if(this.isNegative())return this.eq(z)?64:this.neg().getNumBitsAbs();for(var j=this.high!=0?this.high:this.low,G=31;G>0&&!(j&1<<G);G--);return this.high!=0?G+33:G+1},P.isZero=function(){return this.high===0&&this.low===0},P.eqz=P.isZero,P.isNegative=function(){return!this.unsigned&&this.high<0},P.isPositive=function(){return this.unsigned||this.high>=0},P.isOdd=function(){return(this.low&1)===1},P.isEven=function(){return(this.low&1)===0},P.equals=function(j){return r(j)||(j=m(j)),this.unsigned!==j.unsigned&&this.high>>>31===1&&j.high>>>31===1?!1:this.high===j.high&&this.low===j.low},P.eq=P.equals,P.notEquals=function(j){return!this.eq(j)},P.neq=P.notEquals,P.ne=P.notEquals,P.lessThan=function(j){return this.comp(j)<0},P.lt=P.lessThan,P.lessThanOrEqual=function(j){return this.comp(j)<=0},P.lte=P.lessThanOrEqual,P.le=P.lessThanOrEqual,P.greaterThan=function(j){return this.comp(j)>0},P.gt=P.greaterThan,P.greaterThanOrEqual=function(j){return this.comp(j)>=0},P.gte=P.greaterThanOrEqual,P.ge=P.greaterThanOrEqual,P.compare=function(j){if(r(j)||(j=m(j)),this.eq(j))return 0;var G=this.isNegative(),X=j.isNegative();return G&&!X?-1:!G&&X?1:this.unsigned?j.high>>>0>this.high>>>0||j.high===this.high&&j.low>>>0>this.low>>>0?-1:1:this.sub(j).isNegative()?-1:1},P.comp=P.compare,P.negate=function(){return!this.unsigned&&this.eq(z)?z:this.not().add(T)},P.neg=P.negate,P.add=function(j){r(j)||(j=m(j));var G=this.high>>>16,X=this.high&65535,J=this.low>>>16,V=this.low&65535,Q=j.high>>>16,F=j.high&65535,H=j.low>>>16,B=j.low&65535,Y=0,ne=0,ee=0,U=0;return U+=V+B,ee+=U>>>16,U&=65535,ee+=J+H,ne+=ee>>>16,ee&=65535,ne+=X+F,Y+=ne>>>16,ne&=65535,Y+=G+Q,Y&=65535,d(ee<<16|U,Y<<16|ne,this.unsigned)},P.subtract=function(j){return r(j)||(j=m(j)),this.add(j.neg())},P.sub=P.subtract,P.multiply=function(j){if(this.isZero())return C;if(r(j)||(j=m(j)),n){var G=n.mul(this.low,this.high,j.low,j.high);return d(G,n.get_high(),this.unsigned)}if(j.isZero())return C;if(this.eq(z))return j.isOdd()?z:C;if(j.eq(z))return this.isOdd()?z:C;if(this.isNegative())return j.isNegative()?this.neg().mul(j.neg()):this.neg().mul(j).neg();if(j.isNegative())return this.mul(j.neg()).neg();if(this.lt(k)&&j.lt(k))return l(this.toNumber()*j.toNumber(),this.unsigned);var X=this.high>>>16,J=this.high&65535,V=this.low>>>16,Q=this.low&65535,F=j.high>>>16,H=j.high&65535,B=j.low>>>16,Y=j.low&65535,ne=0,ee=0,U=0,oe=0;return oe+=Q*Y,U+=oe>>>16,oe&=65535,U+=V*Y,ee+=U>>>16,U&=65535,U+=Q*B,ee+=U>>>16,U&=65535,ee+=J*Y,ne+=ee>>>16,ee&=65535,ee+=V*B,ne+=ee>>>16,ee&=65535,ee+=Q*H,ne+=ee>>>16,ee&=65535,ne+=X*Y+J*B+V*H+Q*F,ne&=65535,d(U<<16|oe,ne<<16|ee,this.unsigned)},P.mul=P.multiply,P.divide=function(j){if(r(j)||(j=m(j)),j.isZero())throw Error("division by zero");if(n){if(!this.unsigned&&this.high===-2147483648&&j.low===-1&&j.high===-1)return this;var G=(this.unsigned?n.div_u:n.div_s)(this.low,this.high,j.low,j.high);return d(G,n.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?E:C;var X,J,V;if(this.unsigned){if(j.unsigned||(j=j.toUnsigned()),j.gt(this))return E;if(j.gt(this.shru(1)))return _;V=E}else{if(this.eq(z)){if(j.eq(T)||j.eq(A))return z;if(j.eq(z))return T;var Q=this.shr(1);return X=Q.div(j).shl(1),X.eq(C)?j.isNegative()?T:A:(J=this.sub(j.mul(X)),V=X.add(J.div(j)),V)}else if(j.eq(z))return this.unsigned?E:C;if(this.isNegative())return j.isNegative()?this.neg().div(j.neg()):this.neg().div(j).neg();if(j.isNegative())return this.div(j.neg()).neg();V=C}for(J=this;J.gte(j);){X=Math.max(1,Math.floor(J.toNumber()/j.toNumber()));for(var F=Math.ceil(Math.log(X)/Math.LN2),H=F<=48?1:c(2,F-48),B=l(X),Y=B.mul(j);Y.isNegative()||Y.gt(J);)X-=H,B=l(X,this.unsigned),Y=B.mul(j);B.isZero()&&(B=T),V=V.add(B),J=J.sub(Y)}return V},P.div=P.divide,P.modulo=function(j){if(r(j)||(j=m(j)),n){var G=(this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,j.low,j.high);return d(G,n.get_high(),this.unsigned)}return this.sub(this.div(j).mul(j))},P.mod=P.modulo,P.rem=P.modulo,P.not=function(){return d(~this.low,~this.high,this.unsigned)},P.and=function(j){return r(j)||(j=m(j)),d(this.low&j.low,this.high&j.high,this.unsigned)},P.or=function(j){return r(j)||(j=m(j)),d(this.low|j.low,this.high|j.high,this.unsigned)},P.xor=function(j){return r(j)||(j=m(j)),d(this.low^j.low,this.high^j.high,this.unsigned)},P.shiftLeft=function(j){return r(j)&&(j=j.toInt()),(j&=63)===0?this:j<32?d(this.low<<j,this.high<<j|this.low>>>32-j,this.unsigned):d(0,this.low<<j-32,this.unsigned)},P.shl=P.shiftLeft,P.shiftRight=function(j){return r(j)&&(j=j.toInt()),(j&=63)===0?this:j<32?d(this.low>>>j|this.high<<32-j,this.high>>j,this.unsigned):d(this.high>>j-32,this.high>=0?0:-1,this.unsigned)},P.shr=P.shiftRight,P.shiftRightUnsigned=function(j){if(r(j)&&(j=j.toInt()),j&=63,j===0)return this;var G=this.high;if(j<32){var X=this.low;return d(X>>>j|G<<32-j,G>>>j,this.unsigned)}else return j===32?d(G,0,this.unsigned):d(G>>>j-32,0,this.unsigned)},P.shru=P.shiftRightUnsigned,P.shr_u=P.shiftRightUnsigned,P.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},P.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},P.toBytes=function(j){return j?this.toBytesLE():this.toBytesBE()},P.toBytesLE=function(){var j=this.high,G=this.low;return[G&255,G>>>8&255,G>>>16&255,G>>>24,j&255,j>>>8&255,j>>>16&255,j>>>24]},P.toBytesBE=function(){var j=this.high,G=this.low;return[j>>>24,j>>>16&255,j>>>8&255,j&255,G>>>24,G>>>16&255,G>>>8&255,G&255]},a.fromBytes=function(j,G,X){return X?a.fromBytesLE(j,G):a.fromBytesBE(j,G)},a.fromBytesLE=function(j,G){return new a(j[0]|j[1]<<8|j[2]<<16|j[3]<<24,j[4]|j[5]<<8|j[6]<<16|j[7]<<24,G)},a.fromBytesBE=function(j,G){return new a(j[4]<<24|j[5]<<16|j[6]<<8|j[7],j[0]<<24|j[1]<<16|j[2]<<8|j[3],G)}}),iae=ir(()=>{}),oae=ir(()=>{}),lae=ir((e,t)=>{(function(n,a,r){function s(d){var c=this,f=l();c.next=function(){var m=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=m-(c.c=m|0)},c.c=1,c.s0=f(" "),c.s1=f(" "),c.s2=f(" "),c.s0-=f(d),c.s0<0&&(c.s0+=1),c.s1-=f(d),c.s1<0&&(c.s1+=1),c.s2-=f(d),c.s2<0&&(c.s2+=1),f=null}function i(d,c){return c.c=d.c,c.s0=d.s0,c.s1=d.s1,c.s2=d.s2,c}function o(d,c){var f=new s(d),m=c&&c.state,x=f.next;return x.int32=function(){return f.next()*4294967296|0},x.double=function(){return x()+(x()*2097152|0)*11102230246251565e-32},x.quick=x,m&&(typeof m=="object"&&i(m,f),x.state=function(){return i(f,{})}),x}function l(){var d=4022871197,c=function(f){f=String(f);for(var m=0;m<f.length;m++){d+=f.charCodeAt(m);var x=.02519603282416938*d;d=x>>>0,x-=d,x*=d,d=x>>>0,x-=d,d+=x*4294967296}return(d>>>0)*23283064365386963e-26};return c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),uae=ir((e,t)=>{(function(n,a,r){function s(l){var d=this,c="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var m=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^m^m>>>8},l===(l|0)?d.x=l:c+=l;for(var f=0;f<c.length+64;f++)d.x^=c.charCodeAt(f)|0,d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d}function o(l,d){var c=new s(l),f=d&&d.state,m=function(){return(c.next()>>>0)/4294967296};return m.double=function(){do var x=c.next()>>>11,y=(c.next()>>>0)/4294967296,b=(x+y)/(1<<21);while(b===0);return b},m.int32=c.next,m.quick=m,f&&(typeof f=="object"&&i(f,c),m.state=function(){return i(c,{})}),m}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),cae=ir((e,t)=>{(function(n,a,r){function s(l){var d=this,c="";d.next=function(){var m=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(m^m<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,l===(l|0)?d.x=l:c+=l;for(var f=0;f<c.length+64;f++)d.x^=c.charCodeAt(f)|0,f==c.length&&(d.d=d.x<<10^d.x>>>4),d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d.v=l.v,d.d=l.d,d}
vendor: 3,630 bytes, line 59
59function o(l,d){var c=new s(l),f=d&&d.state,m=function(){return(c.next()>>>0)/4294967296};return m.double=function(){do var x=c.next()>>>11,y=(c.next()>>>0)/4294967296,b=(x+y)/(1<<21);while(b===0);return b},m.int32=c.next,m.quick=m,f&&(typeof f=="object"&&i(f,c),m.state=function(){return i(c,{})}),m}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),dae=ir((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var f=d.x,m=d.i,x,y;return x=f[m],x^=x>>>7,y=x^x<<24,x=f[m+1&7],y^=x^x>>>10,x=f[m+3&7],y^=x^x>>>3,x=f[m+4&7],y^=x^x<<7,x=f[m+7&7],x=x^x<<13,y^=x^x<<9,f[m]=y,d.i=m+1&7,y};function c(f,m){var x,y=[];if(m===(m|0))y[0]=m;else for(m=""+m,x=0;x<m.length;++x)y[x&7]=y[x&7]<<15^m.charCodeAt(x)+y[x+1&7]<<13;for(;y.length<8;)y.push(0);for(x=0;x<8&&y[x]===0;++x);for(x==8?y[7]=-1:y[x],f.x=y,f.i=0,x=256;x>0;--x)f.next()}c(d,l)}function i(l,d){return d.x=l.x.slice(),d.i=l.i,d}function o(l,d){l==null&&(l=+new Date);var c=new s(l),f=d&&d.state,m=function(){return(c.next()>>>0)/4294967296};return m.double=function(){do var x=c.next()>>>11,y=(c.next()>>>0)/4294967296,b=(x+y)/(1<<21);while(b===0);return b},m.int32=c.next,m.quick=m,f&&(f.x&&i(f,c),m.state=function(){return i(c,{})}),m}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),hae=ir((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var f=d.w,m=d.X,x=d.i,y,b;return d.w=f=f+1640531527|0,b=m[x+34&127],y=m[x=x+1&127],b^=b<<13,y^=y<<17,b^=b>>>15,y^=y>>>12,b=m[x]=b^y,d.i=x,b+(f^f>>>16)|0};function c(f,m){var x,y,b,w,S,k=[],C=128;for(m===(m|0)?(y=m,m=null):(m=m+"\0",y=0,C=Math.max(C,m.length)),b=0,w=-32;w<C;++w)m&&(y^=m.charCodeAt((w+32)%m.length)),w===0&&(S=y),y^=y<<10,y^=y>>>15,y^=y<<4,y^=y>>>13,w>=0&&(S=S+1640531527|0,x=k[w&127]^=y+S,b=x==0?b+1:0);for(b>=128&&(k[(m&&m.length||0)&127]=-1),b=127,w=512;w>0;--w)y=k[b+34&127],x=k[b=b+1&127],y^=y<<13,x^=x<<17,y^=y>>>15,x^=x>>>12,k[b]=y^x;f.w=S,f.X=k,f.i=b}c(d,l)}function i(l,d){return d.i=l.i,d.w=l.w,d.X=l.X.slice(),d}function o(l,d){l==null&&(l=+new Date);var c=new s(l),f=d&&d.state,m=function(){return(c.next()>>>0)/4294967296};return m.double=function(){do var x=c.next()>>>11,y=(c.next()>>>0)/4294967296,b=(x+y)/(1<<21);while(b===0);return b},m.int32=c.next,m.quick=m,f&&(f.X&&i(f,c),m.state=function(){return i(c,{})}),m}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),pae=ir((e,t)=>{(function(n,a,r){function s(l){var d=this,c="";d.next=function(){var m=d.b,x=d.c,y=d.d,b=d.a;return m=m<<25^m>>>7^x,x=x-y|0,y=y<<24^y>>>8^b,b=b-m|0,d.b=m=m<<20^m>>>12^x,d.c=x=x-y|0,d.d=y<<16^x>>>16^b,d.a=b-m|0},d.a=0,d.b=0,d.c=-1640531527,d.d=1367130551,l===Math.floor(l)?(d.a=l/4294967296|0,d.b=l|0):c+=l;for(var f=0;f<c.length+20;f++)d.b^=c.charCodeAt(f)|0,d.next()}function i(l,d){return d.a=l.a,d.b=l.b,d.c=l.c,d.d=l.d,d}function o(l,d){var c=new s(l),f=d&&d.state,m=function(){return(c.next()>>>0)/4294967296};return m.double=function(){do var x=c.next()>>>11,y=(c.next()>>>0)/4294967296,b=(x+y)/(1<<21);while(b===0);return b},m.int32=c.next,m.quick=m,f&&(typeof f=="object"&&i(f,c),m.state=function(){return i(c,{})}),m}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),fae=ir(()=>{}),mae=ir((e,t)=>{(function(n,a,r){var s=256,i=6,o=52,l="random",d=r.pow(s,i),c=r.pow(2,o),f=c*2,m=s-1,x;function y(T,_,A){var $=[];_=_==!0?{entropy:!0}:_||{};
vendor: 6,859 bytes, lines 59-61
59var O=k(S(_.entropy?[T,E(a)]:T??C(),3),$),z=new b($),P=function(){for(var j=z.g(i),G=d,X=0;j<c;)j=(j+X)*s,G*=s,X=z.g(1);for(;j>=f;)j/=2,G/=2,X>>>=1;return(j+X)/G};return P.int32=function(){return z.g(4)|0},P.quick=function(){return z.g(4)/4294967296},P.double=P,k(E(z.S),a),(_.pass||A||function(j,G,X,J){return J&&(J.S&&w(J,z),j.state=function(){return w(z,{})}),X?(r[l]=j,G):j})(P,O,"global"in _?_.global:this==r,_.state)}function b(T){var _,A=T.length,$=this,O=0,z=$.i=$.j=0,P=$.S=[];for(A||(T=[A++]);O<s;)P[O]=O++;for(O=0;O<s;O++)P[O]=P[z=m&z+T[O%A]+(_=P[O])],P[z]=_;($.g=function(j){for(var G,X=0,J=$.i,V=$.j,Q=$.S;j--;)G=Q[J=m&J+1],X=X*s+Q[m&(Q[J]=Q[V=m&V+G])+(Q[V]=G)];return $.i=J,$.j=V,X})(s)}function w(T,_){return _.i=T.i,_.j=T.j,_.S=T.S.slice(),_}function S(T,_){var A=[],$=typeof T,O;if(_&&$=="object")for(O in T)try{A.push(S(T[O],_-1))}catch{}return A.length?A:$=="string"?T:T+"\0"}function k(T,_){for(var A=T+"",$,O=0;O<A.length;)_[m&O]=m&($^=_[m&O]*19)+A.charCodeAt(O++);return E(_)}function C(){try{var T;return x&&(T=x.randomBytes)?T=T(s):(T=new Uint8Array(s),(n.crypto||n.msCrypto).getRandomValues(T)),E(T)}catch{var _=n.navigator,A=_&&_.plugins;return[+new Date,n,A,n.screen,E(a)]}}function E(T){return String.fromCharCode.apply(0,T)}if(k(r.random(),a),typeof t=="object"&&t.exports){t.exports=y;try{x=fae()}catch{}}else typeof define=="function"&&define.amd?define(function(){return y}):r["seed"+l]=y})(typeof self<"u"?self:e,[],Math)}),fw=ir((e,t)=>{var n=lae(),a=uae(),r=cae(),s=dae(),i=hae(),o=pae(),l=mae();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),D8=ir(()=>{}),WI=ir(()=>{}),R8=ir(()=>{}),gae=ir(()=>{}),xae=ir(()=>{}),yae=ir(()=>{}),bae=ir((e,t)=>{var n=(()=>{var a=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(a=a||__filename),function(r){r=r||{};function s(){return F.buffer!=xe&&ze(F.buffer),Ie}function i(){return F.buffer!=xe&&ze(F.buffer),_e}function o(){return F.buffer!=xe&&ze(F.buffer),Oe}function l(){return F.buffer!=xe&&ze(F.buffer),Ye}function d(){return F.buffer!=xe&&ze(F.buffer),ft}var c=typeof r<"u"?r:{},f,m;c.ready=new Promise(function(te,ge){f=te,m=ge});var x;typeof process<"u"&&process.listeners&&(x={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var y=Object.assign({},c),b=(te,ge)=>{throw ge},w=typeof window=="object",S=typeof importScripts=="function",k=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C=c.ENVIRONMENT_IS_PTHREAD||!1,E="";function T(te){return c.locateFile?c.locateFile(te,E):E+te}var _,A,$;function O(te){te instanceof qa||J("exiting due to exception: "+te)}if(k){var z=WI(),P=R8();S?E=P.dirname(E)+"/":E=__dirname+"/",_=(ge,We)=>(ge=Ga(ge)?new URL(ge):P.normalize(ge),z.readFileSync(ge,We?void 0:"utf8")),$=ge=>{var We=_(ge,!0);return We.buffer||(We=new Uint8Array(We)),We},A=(ge,We,At)=>{ge=Ga(ge)?new URL(ge):P.normalize(ge),z.readFile(ge,function(Rt,Ft){Rt?At(Rt):We(Ft.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(ge){if(!(ge instanceof qa))throw ge}),process.on("unhandledRejection",function(ge){throw ge}),b=(ge,We)=>{if(Ut())throw process.exitCode=ge,We;O(We),process.exit(ge)},c.inspect=function(){return"[Emscripten Module object]"};let te;try{te=gae()}catch(ge){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),ge}global.Worker=te.Worker}else(w||S)&&(S?E=self.location.href:typeof document<"u"&&document.currentScript&&(E=document.currentScript.src),typeof a<"u"&&a&&(E=a),E.indexOf("blob:")!==0?E=E.substr(0,E.replace(/[?#].*/,"").lastIndexOf("/")+1):E="",k||(_=te=>{var ge=new XMLHttpRequest;return ge.open("GET",te,!1),ge.send(null),ge.responseText},S&&($=te=>{var ge=new XMLHttpRequest;return ge.open("GET",te,!1),ge.responseType="arraybuffer",ge.send(null),new Uint8Array(ge.response)}),A=(te,ge,We)=>{var At=new XMLHttpRequest;At.open("GET",te,!0),At.responseType="arraybuffer",At.onload=()=>{if(At.status==200||At.status==0&&At.response){ge(At.response);return}We()},At.onerror=We,At.send(null)}));k&&typeof performance>"u"&&(global.performance=xae().performance);var j=console.log.bind(console),G=console.warn.bind(console);k&&(j=te=>z.writeSync(1,te+`
60`),G=te=>z.writeSync(2,te+`
61`));var X=c.print||j,J=c.printErr||G;Object.assign(c,y),y=null,c.arguments&&c.arguments,c.thisProgram&&c.thisProgram,c.quit&&(b=c.quit);var V;c.wasmBinary&&(V=c.wasmBinary);var Q=c.noExitRuntime||!0;typeof WebAssembly!="object"&&Qe("no native wasm support detected");var F,H,B=!1,Y;function ne(te,ge){te||Qe(ge)}var ee=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function U(te,ge,We){ge>>>=0;for(var At=ge+We,Rt=ge;te[Rt]&&!(Rt>=At);)++Rt;if(Rt-ge>16&&te.buffer&&ee)return ee.decode(te.buffer instanceof SharedArrayBuffer?te.slice(ge,Rt):te.subarray(ge,Rt));for(var Ft="";ge<Rt;){var rt=te[ge++];if(!(rt&128)){Ft+=String.fromCharCode(rt);continue}var gt=te[ge++]&63;if((rt&224)==192){Ft+=String.fromCharCode((rt&31)<<6|gt);continue}var Dn=te[ge++]&63;if((rt&240)==224?rt=(rt&15)<<12|gt<<6|Dn:rt=(rt&7)<<18|gt<<12|Dn<<6|te[ge++]&63,rt<65536)Ft+=String.fromCharCode(rt);else{var Ja=rt-65536;Ft+=String.fromCharCode(55296|Ja>>10,56320|Ja&1023)}}return Ft}function oe(te,ge){return te>>>=0,te?U(i(),te,ge):""}function pe(te,ge,We,At){if(We>>>=0,!(At>0))return 0;for(var Rt=We,Ft=We+At-1,rt=0;rt<te.length;++rt){var gt=te.charCodeAt(rt);if(gt>=55296&&gt<=57343){var Dn=te.charCodeAt(++rt);gt=65536+((gt&1023)<<10)|Dn&1023}if(gt<=127){if(We>=Ft)break;ge[We++>>>0]=gt}else if(gt<=2047){if(We+1>=Ft)break;ge[We++>>>0]=192|gt>>6,ge[We++>>>0]=128|gt&63}else if(gt<=65535){if(We+2>=Ft)break;ge[We++>>>0]=224|gt>>12,ge[We++>>>0]=128|gt>>6&63,ge[We++>>>0]=128|gt&63}else{if(We+3>=Ft)break;ge[We++>>>0]=240|gt>>18,ge[We++>>>0]=128|gt>>12&63,ge[We++>>>0]=128|gt>>6&63,ge[We++>>>0]=128|gt&63}}return ge[We>>>0]=0,We-Rt}function he(te,ge,We){return pe(te,i(),ge,We)}var xe,Ie,_e,Oe,Ye,ft;C&&(xe=c.buffer);function ze(te){xe=te,c.HEAP8=Ie=new Int8Array(te),c.HEAP16=new Int16Array(te),c.HEAP32=Oe=new Int32Array(te),c.HEAPU8=_e=new Uint8Array(te),c.HEAPU16=new Uint16Array(te),c.HEAPU32=Ye=new Uint32Array(te),c.HEAPF32=new Float32Array(te),c.HEAPF64=ft=new Float64Array(te)}var ct=c.INITIAL_MEMORY||16777216;if(C)F=c.wasmMemory,xe=c.buffer;else if(c.wasmMemory)F=c.wasmMemory;else if(F=new WebAssembly.Memory({initial:ct/65536,maximum:65536,shared:!0}),!(F.buffer instanceof SharedArrayBuffer))throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may 
61need to set a flag"),k&&J("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");F&&(xe=F.buffer),ct=xe.byteLength,ze(xe);var ot,tt=[],Tt=[],bn=[];function Ut(){return Q}function Tn(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)sa(c.preRun.shift());qt(tt)}function Nn(){!C&&qt(Tt)}function Pn(){if(!C){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Be(c.postRun.shift());qt(bn)}}function sa(te){tt.unshift(te)}function pa(te){Tt.unshift(te)}function Be(te){bn.unshift(te)}var lt=0,$e=null;function Ue(te){lt++,c.monitorRunDependencies&&c.monitorRunDependencies(lt)}function dt(te){if(lt--,c.monitorRunDependencies&&c.monitorRunDependencies(lt),lt==0&&$e){var ge=$e;$e=null,ge()}}function Qe(te){c.onAbort&&c.onAbort(te),te="Aborted("+te+")",J(te),B=!0,Y=1,te+=". Build with -sASSERTIONS for more info.";var ge=new WebAssembly.RuntimeError(te);throw m(ge),ge}var An="data:application/octet-stream;base64,";function Bn(te){return te.startsWith(An)}function Ga(te){return te.startsWith("file://")}var _n;_n="tfjs-backend-wasm-threaded-simd.wasm",Bn(_n)||(_n=T(_n));function di(te){try{if(te==_n&&V)return new Uint8Array(V);if($)return $(te);throw"both async and sync fetching of the wasm failed"}catch(ge){Qe(ge)}}function qr(){if(!V&&(w||S)){if(typeof fetch=="function"&&!Ga(_n))return fetch(_n,{credentials:"same-origin"}).then(function(te){if(!te.ok)throw"failed to load wasm binary file at '"+_n+"'";return te.arrayBuffer()}).catch(function(){return di(_n)});if(A)return new Promise(function(te,ge){A(_n,function(We){te(new Uint8Array(We))},ge)})}return Promise.resolve().then(function(){return di(_n)})}function hi(){var te={env:Ts,wasi_snapshot_preview1:Ts};function ge(rt,gt){var Dn=rt.exports;if(c.asm=Dn,Fa(c.asm._emscripten_tls_init),ot=c.asm.__indirect_function_table,pa(c.asm.__wasm_call_ctors),H=gt,!C){var Ja=Xe.unusedWorkers.length;Xe.unusedWorkers.forEach(function(Gs){Xe.loadWasmModuleToWorker(Gs,function(){--Ja||dt()})})}}C||Ue();function We(rt){ge(rt.instance,rt.module)}function At(rt){return qr().then(function(gt){return WebAssembly.instantiate(gt,te)}).then(function(gt){return gt}).then(rt,function(gt){J("failed to asynchronously prepare wasm: "+gt),Qe(gt)})}function Rt(){return!V&&typeof WebAssembly.instantiateStreaming=="function"&&!Bn(_n)&&!Ga(_n)&&!k&&typeof fetch=="function"?fetch(_n,{credentials:"same-origin"}).then(function(rt){var gt=WebAssembly.instantiateStreaming(rt,te);return gt.then(We,function(Dn){return J("wasm streaming compile failed: "+Dn),J("falling back to ArrayBuffer instantiation"),At(We)})}):At(We)}if(c.instantiateWasm)try{var Ft=c.instantiateWasm(te,ge);return Ft}catch(rt){J("Module.instantiateWasm callback failed with error: "+rt),m(rt)}return Rt().catch(m),{}}var pi={};function qa(te){this.name="ExitStatus",this.message="Program terminated with exit("+te+")",this.status=te}function is(te){var ge=Xe.pthreads[te];delete Xe.pthreads[te],ge.terminate(),io(te),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(ge),1),ge.pthread_ptr=0}function Kr(te){var ge=Xe.pthreads[te];ge.postMessage({cmd:"cancel"})}function lr(te){var ge=Xe.pthreads[te];ne(ge),Xe.returnWorkerToPool(ge)}function Ba(te){var ge=Xe.getNewWorker();if(!ge)return 6;Xe.runningWorkers.push(ge),Xe.pthreads[te.pthread_ptr]=ge,ge.pthread_ptr=te.pthread_ptr;var We={cmd:"run",start_routine:te.startRoutine,arg:te.arg,pthread_ptr:te.pthread_ptr};return ge.runPthread=()=>{k&&ge.ref(),ge.postMessage(We,te.transferList),delete ge.runPthread},ge.loaded&&ge.runPthread(),0}function fi(te){if(C)return Ze(1,1,te);Y=te,Ut()||(Xe.terminateAllThreads(),c.onExit&&c.onExit(te),B=!0),b(te,new qa(te))}function we(te,ge){if(Y=te,!ge&&C)throw It(te),"unwind";fi(te)}var Fe=we;function xt(te){if(te instanceof qa||te=="unwind")return Y;b(1,te)}var Xe={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){C?Xe.initWorker():Xe.initMainThread()},initMainThread:function(){for(var te=8;te--;)Xe.allocateUnusedWorker()},initWorker:function(){Q=!1},setExitStatus:function(te){Y=te}
vendor: 5,106 bytes, line 61
61,terminateAllThreads:function(){for(var te of Object.values(Xe.pthreads))Xe.returnWorkerToPool(te);for(var te of Xe.unusedWorkers)te.terminate();Xe.unusedWorkers=[]},returnWorkerToPool:function(te){var ge=te.pthread_ptr;delete Xe.pthreads[ge],Xe.unusedWorkers.push(te),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(te),1),te.pthread_ptr=0,k&&te.unref(),io(ge)},receiveObjectTransfer:function(te){},threadInitTLS:function(){Xe.tlsInitFunctions.forEach(te=>te())},loadWasmModuleToWorker:function(te,ge){te.onmessage=Ft=>{var rt=Ft.data,gt=rt.cmd;if(te.pthread_ptr&&(Xe.currentProxiedOperationCallerThread=te.pthread_ptr),rt.targetThread&&rt.targetThread!=Oa()){var Dn=Xe.pthreads[rt.targetThread];Dn?Dn.postMessage(rt,rt.transferList):J('Internal error! Worker sent a message "'+gt+'" to target pthread '+rt.targetThread+", but that thread no longer exists!"),Xe.currentProxiedOperationCallerThread=void 0;return}gt==="processProxyingQueue"?Rn(rt.queue):gt==="spawnThread"?Ba(rt):gt==="cleanupThread"?lr(rt.thread):gt==="killThread"?is(rt.thread):gt==="cancelThread"?Kr(rt.thread):gt==="loaded"?(te.loaded=!0,k&&te.unref(),ge&&ge(te),te.runPthread&&te.runPthread()):gt==="print"?X("Thread "+rt.threadId+": "+rt.text):gt==="printErr"?J("Thread "+rt.threadId+": "+rt.text):gt==="alert"?alert("Thread "+rt.threadId+": "+rt.text):rt.target==="setimmediate"?te.postMessage(rt):gt==="callHandler"?c[rt.handler](...rt.args):gt&&J("worker sent an unknown command "+gt),Xe.currentProxiedOperationCallerThread=void 0},te.onerror=Ft=>{var rt="worker sent an error!";throw J(rt+" "+Ft.filename+":"+Ft.lineno+": "+Ft.message),Ft},k&&(te.on("message",function(Ft){te.onmessage({data:Ft})}),te.on("error",function(Ft){te.onerror(Ft)}),te.on("detachedExit",function(){}));var We=[],At=["onExit","onAbort","print","printErr"];for(var Rt of At)c.hasOwnProperty(Rt)&&We.push(Rt);te.postMessage({cmd:"load",handlers:We,urlOrBlob:c.mainScriptUrlOrBlob||a,wasmMemory:F,wasmModule:H})},allocateUnusedWorker:function(){var te,ge=T("tfjs-backend-wasm-threaded-simd.worker.js");te=new Worker(ge),Xe.unusedWorkers.push(te)},getNewWorker:function(){return Xe.unusedWorkers.length==0&&(Xe.allocateUnusedWorker(),Xe.loadWasmModuleToWorker(Xe.unusedWorkers[0])),Xe.unusedWorkers.pop()}};c.PThread=Xe;function qt(te){for(;te.length>0;)te.shift()(c)}function $t(){var te=Oa(),ge=o()[te+52>>>2],We=o()[te+56>>>2],At=ge-We;hl(ge,At),lo(ge)}c.establishStackSpace=$t;function It(te){if(C)return Ze(2,0,te);try{Fe(te)}catch(ge){xt(ge)}}var vt=[];function vn(te){var ge=vt[te];return ge||(te>=vt.length&&(vt.length=te+1),vt[te]=ge=ot.get(te)),ge}function Na(te,ge){var We=vn(te)(ge);Ut()?Xe.setExitStatus(We):oo(We)}c.invokeEntryPoint=Na;function Fa(te){Xe.tlsInitFunctions.push(te)}function Xr(te){Ya(te,!S,1,!w),Xe.threadInitTLS()}function fa(te){C?postMessage({cmd:"cleanupThread",thread:te}):lr(te)}function os(te,ge,We,At){return C?Ze(3,1,te,ge,We,At):sn(te,ge,We,At)}function sn(te,ge,We,At){if(typeof SharedArrayBuffer>"u")return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Rt=[],Ft=0;if(C&&(Rt.length===0||Ft))return os(te,ge,We,At);var rt={startRoutine:We,pthread_ptr:te,arg:At,transferList:Rt};return C?(rt.cmd="spawnThread",postMessage(rt,Rt),0):Ba(rt)}function wn(){return 65536}var Ka=!0;function Ca(){return Ka}function Rn(te){Atomics.store(o(),te>>2,1),Oa()&&ds(te),Atomics.compareExchange(o(),te>>2,1,0)}c.executeNotifiedProxyingQueue=Rn;function Or(te,ge,We,At){if(te==ge)setTimeout(()=>Rn(At));else if(C)postMessage({targetThread:te,cmd:"processProxyingQueue",queue:At});else{var Rt=Xe.pthreads[te];if(!Rt)return;Rt.postMessage({cmd:"processProxyingQueue",queue:At})}return 1}function ls(te,ge,We){return-1}function Hs(){Qe("")}function ur(te){ur.shown||(ur.shown={}),ur.shown[te]||(ur.shown[te]=1,k&&(te="warning: "+te),J(te))}function cr(){k||S||ur("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function us(){return Date.now()}function Xa(){return 4294901760}function Bi(){return Xa()}var Ee;k?Ee=()=>{var te=process.hrtime();return te[0]*1e3+te[1]/1e6}:Ee=()=>performance.timeOrigin+performance.now();function Le(te,ge,We){i().copyWithin(te>>>0,ge>>>0,ge+We>>>0)}function Ke(){return k?yae().cpus().length:navigator.hardwareConcurrency}function Je(te){var ge=Oi(),We=te();return lo(ge),We}function Ze(te,ge){var We=arguments.length-2,At=arguments;return Je(()=>{for(var Rt=We,Ft=uo(Rt*8),rt=Ft>>3,gt=0;gt<We;gt++){var Dn=At[2+gt];d()[rt+gt>>>0]=Dn}return Fi(te,Rt,Ft,ge)})}var ut=[];function mt(te,ge,We){ut.length=ge;for(var At=We>>3,Rt=0;Rt<ge;Rt++)ut[Rt]=d()[At+Rt>>>0];var Ft=te<0,rt=Ft?pi[-te-1]:cs[te];return rt.apply(null,ut)}function Yt(te){try{return F.grow(te-xe.byteLength+65535>>>16),ze(F.buffer),1}catch{}}function Wt(te){var ge=i().length;if(te=te>>>0,te<=ge)return!1;var We=Xa();if(te>We)return!1;let At=(Dn,Ja)=>Dn+(Ja-Dn%Ja)%Ja;for(var Rt=1;Rt<=4;Rt*=2){var Ft=ge*(1+.2/Rt);Ft=Math.min(Ft,te+100663296);var rt=Math.min(We,At(Math.max(te,Ft),65536)),gt=Yt(rt);
vendor: 4,849 bytes, line 61
61if(gt)return!0}return!1}function fn(){throw"unwind"}function Dt(te){return C?Ze(4,1,te):52}function Sn(te,ge,We,At,Rt){return C?Ze(5,1,te,ge,We,At,Rt):70}var qn=[null,[],[]];function Ea(te,ge){var We=qn[te];ge===0||ge===10?((te===1?X:J)(U(We,0)),We.length=0):We.push(ge)}function Ia(te,ge,We,At){if(C)return Ze(6,1,te,ge,We,At);for(var Rt=0,Ft=0;Ft<We;Ft++){var rt=l()[ge>>>2],gt=l()[ge+4>>>2];ge+=8;for(var Dn=0;Dn<gt;Dn++)Ea(te,i()[rt+Dn>>>0]);Rt+=gt}return l()[At>>>2]=Rt,0}function mn(te){var ge=c["_"+te];return ge}function Mn(te,ge){s().set(te,ge>>>0)}function jn(te,ge,We,At,Rt){var Ft={string:zn=>{var Aa=0;if(zn!=null&&zn!==0){var pl=(zn.length<<2)+1;Aa=uo(pl),he(zn,Aa,pl)}return Aa},array:zn=>{var Aa=uo(zn.length);return Mn(zn,Aa),Aa}};function rt(zn){return ge==="string"?oe(zn):ge==="boolean"?!!zn:zn}var gt=mn(te),Dn=[],Ja=0;if(At)for(var Gs=0;Gs<At.length;Gs++){var ho=Ft[We[Gs]];ho?(Ja===0&&(Ja=Oi()),Dn[Gs]=ho(At[Gs])):Dn[Gs]=At[Gs]}var Bo=gt.apply(null,Dn);function Tc(zn){return Ja!==0&&lo(Ja),rt(zn)}return Bo=Tc(Bo),Bo}function Ta(te,ge,We,At){We=We||[];var Rt=We.every(rt=>rt==="number"||rt==="boolean"),Ft=ge!=="string";return Ft&&Rt&&!At?mn(te):function(){return jn(te,ge,We,arguments)}}Xe.init();var cs=[null,fi,It,os,Dt,Sn,Ia],Ts={__emscripten_init_main_thread_js:Xr,__emscripten_thread_cleanup:fa,__pthread_create_js:sn,_emscripten_default_pthread_stack_size:wn,_emscripten_get_now_is_monotonic:Ca,_emscripten_notify_task_queue:Or,_emscripten_set_offscreencanvas_size:ls,abort:Hs,emscripten_check_blocking_allowed:cr,emscripten_date_now:us,emscripten_get_heap_max:Bi,emscripten_get_now:Ee,emscripten_memcpy_big:Le,emscripten_num_logical_cores:Ke,emscripten_receive_on_main_thread_js:mt,emscripten_resize_heap:Wt,emscripten_unwind_to_js_event_loop:fn,exit:Fe,fd_close:Dt,fd_seek:Sn,fd_write:Ia,memory:F||c.wasmMemory};hi(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.__wasm_call_ctors).apply(null,arguments)},c._init=function(){return(c._init=c.asm.init).apply(null,arguments)},c._init_with_threads_count=function(){return(c._init_with_threads_count=c.asm.init_with_threads_count).apply(null,arguments)},c._get_threads_count=function(){return(c._get_threads_count=c.asm.get_threads_count).apply(null,arguments)},c._register_tensor=function(){return(c._register_tensor=c.asm.register_tensor).apply(null,arguments)},c._dispose_data=function(){return(c._dispose_data=c.asm.dispose_data).apply(null,arguments)},c._dispose=function(){return(c._dispose=c.asm.dispose).apply(null,arguments)},c._Abs=function(){return(c._Abs=c.asm.Abs).apply(null,arguments)},c._Acos=function(){return(c._Acos=c.asm.Acos).apply(null,arguments)},c._Acosh=function(){return(c._Acosh=c.asm.Acosh).apply(null,arguments)},c._Add=function(){return(c._Add=c.asm.Add).apply(null,arguments)},c._AddN=function(){return(c._AddN=c.asm.AddN).apply(null,arguments)},c._All=function(){return(c._All=c.asm.All).apply(null,arguments)},c._Any=function(){return(c._Any=c.asm.Any).apply(null,arguments)},c._ArgMax=function(){return(c._ArgMax=c.asm.ArgMax).apply(null,arguments)},c._ArgMin=function(){return(c._ArgMin=c.asm.ArgMin).apply(null,arguments)},c._Asin=function(){return(c._Asin=c.asm.Asin).apply(null,arguments)},c._Asinh=function(){return(c._Asinh=c.asm.Asinh).apply(null,arguments)},c._Atan=function(){return(c._Atan=c.asm.Atan).apply(null,arguments)},c._Atan2=function(){return(c._Atan2=c.asm.Atan2).apply(null,arguments)},c._Atanh=function(){return(c._Atanh=c.asm.Atanh).apply(null,arguments)},c._AvgPool=function(){return(c._AvgPool=c.asm.AvgPool).apply(null,arguments)},c._AvgPool3D=function(){return(c._AvgPool3D=c.asm.AvgPool3D).apply(null,arguments)},c._AvgPool3DGrad=function(){return(c._AvgPool3DGrad=c.asm.AvgPool3DGrad).apply(null,arguments)},c._AvgPoolGrad=function(){return(c._AvgPoolGrad=c.asm.AvgPoolGrad).apply(null,arguments)},c._BatchMatMul=function(){return(c._BatchMatMul=c.asm.BatchMatMul).apply(null,arguments)},c._Bincount=function(){return(c._Bincount=c.asm.Bincount).apply(null,arguments)},c._BitwiseAnd=function(){return(c._BitwiseAnd=c.asm.BitwiseAnd).apply(null,arguments)},c._Ceil=function(){return(c._Ceil=c.asm.Ceil).apply(null,arguments)},c._ClipByValue=function(){return(c._ClipByValue=c.asm.ClipByValue).apply(null,arguments)},c._Conv2D=function(){return(c._Conv2D=c.asm.Conv2D).apply(null,arguments)},c._Conv2DBackpropInput=function(){return(c._Conv2DBackpropInput=c.asm.Conv2DBackpropInput).apply(null,arguments)},c._Conv3D=function(){return(c._Conv3D=c.asm.Conv3D).apply(null,arguments)},c._Conv3DBackpropFilterV2=function(){return(c._Conv3DBackpropFilterV2=c.asm.Conv3DBackpropFilterV2).apply(null,arguments)},c._Conv3DBackpropInputV2=function(){return(c._Conv3DBackpropInputV2=c.asm.Conv3DBackpropInputV2).apply(null,arguments)},c._Cos=function(){return(c._Cos=c.asm.Cos).apply(null,arguments)}
61,c._Cosh=function(){return(c._Cosh=c.asm.Cosh).apply(null,arguments)},c._CropAndResize=function(){return(c._CropAndResize=c.asm.CropAndResize).apply(null,arguments)},c._Cumprod=function(){return(c._Cumprod=c.asm.Cumprod).apply(null,arguments)},c._Cumsum=function(){return(c._Cumsum=c.asm.Cumsum).apply(null,arguments)},c._DenseBincount=function(){return(c._DenseBincount=c.asm.DenseBincount).apply(null,arguments)},c._DepthToSpace=function(){return(c._DepthToSpace=c.asm.DepthToSpace).apply(null,arguments)},c._DepthwiseConv2dNative=function(){return(c._DepthwiseConv2dNative=c.asm.DepthwiseConv2dNative).apply(null,arguments)},c._Diag=function(){return(c._Diag=c.asm.Diag).apply(null,arguments)},c._Dilation2D=function(){return(c._Dilation2D=c.asm.Dilation2D).apply(null,arguments)},c._Dilation2DBackpropFilter=function(){return(c._Dilation2DBackpropFilter=c.asm.Dilation2DBackpropFilter).apply(null,arguments)},c._Dilation2DBackpropInput=function(){return(c._Dilation2DBackpropInput=c.asm.Dilation2DBackpropInput).apply(null,arguments)},c._Elu=function(){return(c._Elu=c.asm.Elu).apply(null,arguments)},c._EluGrad=function(){return(c._EluGrad=c.asm.EluGrad).apply(null,arguments)},c._Equal=function(){return(c._Equal=c.asm.Equal).apply(null,arguments)},c._Erf=function(){return(c._Erf=c.asm.Erf).apply(null,arguments)},c._Exp=function(){return(c._Exp=c.asm.Exp).apply(null,arguments)},c._Expm1=function(){return(c._Expm1=c.asm.Expm1).apply(null,arguments)},c._FlipLeftRight=function(){return(c._FlipLeftRight=c.asm.FlipLeftRight).apply(null,arguments)},c._Floor=function(){return(c._Floor=c.asm.Floor).apply(null,arguments)},c._FloorDiv=function(){return(c._FloorDiv=c.asm.FloorDiv).apply(null,arguments)},c._FusedBatchNorm=function(){return(c._FusedBatchNorm=c.asm.FusedBatchNorm).apply(null,arguments)},c._FusedConv2D=function(){return(c._FusedConv2D=c.asm.FusedConv2D).apply(null,arguments)},c._FusedDepthwiseConv2D=function(){return(c._FusedDepthwiseConv2D=c.asm.FusedDepthwiseConv2D).apply(null,arguments)},c._Gather=function(){return(c._Gather=c.asm.Gather).apply(null,arguments)},c._GatherNd=function(){return(c._GatherNd=c.asm.GatherNd).apply(null,arguments)},c._Greater=function(){return(c._Greater=c.asm.Greater).apply(null,arguments)},c._GreaterEqual=function(){return(c._GreaterEqual=c.asm.GreaterEqual).apply(null,arguments)},c._IsFinite=function(){return(c._IsFinite=c.asm.IsFinite).apply(null,arguments)},c._IsInf=function(){return(c._IsInf=c.asm.IsInf).apply(null,arguments)},c._IsNan=function(){return(c._IsNan=c.asm.IsNan).apply(null,arguments)},c._LRN=function(){return(c._LRN=c.asm.LRN).apply(null,arguments)},c._LRNGrad=function(){return(c._LRNGrad=c.asm.LRNGrad).apply(null,arguments)},c._LeakyRelu=function(){return(c._LeakyRelu=c.asm.LeakyRelu).apply(null,arguments)},c._Less=function(){return(c._Less=c.asm.Less).apply(null,arguments)},c._LessEqual=function(){return(c._LessEqual=c.asm.LessEqual).apply(null,arguments)},c._LinSpace=function(){return(c._LinSpace=c.asm.LinSpace).apply(null,arguments)},c._Log=function(){return(c._Log=c.asm.Log).apply(null,arguments)},c._Log1p=function(){return(c._Log1p=c.asm.Log1p).apply(null,arguments)},c._LogicalAnd=function(){return(c._LogicalAnd=c.asm.LogicalAnd).apply(null,arguments)},c._LogicalNot=function(){return(c._LogicalNot=c.asm.LogicalNot).apply(null,arguments)},c._LogicalOr=function(){return(c._LogicalOr=c.asm.LogicalOr).apply(null,arguments)},c._LogicalXor=function(){return(c._LogicalXor=c.asm.LogicalXor).apply(null,arguments)},c._Max=function(){return(c._Max=c.asm.Max).apply(null,arguments)},c._MaxPool=function(){return(c._MaxPool=c.asm.MaxPool).apply(null,arguments)},c._MaxPool3D=function(){return(c._MaxPool3D=c.asm.MaxPool3D).apply(null,arguments)},c._MaxPool3DGrad=function(){return(c._MaxPool3DGrad=c.asm.MaxPool3DGrad).apply(null,arguments)},c._MaxPoolGrad=function(){return(c._MaxPoolGrad=c.asm.MaxPoolGrad).apply(null,arguments)},c._MaxPoolWithArgmax=function(){return(c._MaxPoolWithArgmax=c.asm.MaxPoolWithArgmax).apply(null,arguments)},c._Maximum=function(){return(c._Maximum=c.asm.Maximum).apply(null,arguments)},c._Mean=function(){return(c._Mean=c.asm.Mean).apply(null,arguments)},c._Min=function(){return(c._Min=c.asm.Min).apply(null,arguments)},c._Minimum=function(){return(c._Minimum=c.asm.Minimum).apply(null,arguments)},c._MirrorPad=function(){return(c._MirrorPad=c.asm.MirrorPad).apply(null,arguments)},c._Mod=function(){return(c._Mod=c.asm.Mod).apply(null,arguments)},c._Multinomial=function(){return(c._Multinomial=c.asm.Multinomial).apply(null,arguments)},c._Multiply=function(){return(c._Multiply=c.asm.Multiply).apply(null,arguments)},c._Neg=function(){return(c._Neg=c.asm.Neg).apply(null,arguments)},c._NonMaxSuppressionV3=function(){return(c._NonMaxSuppressionV3=c.asm.NonMaxSuppressionV3).apply(null,arguments)},c._NonMaxSuppressionV4=function(){return(c._NonMaxSuppressionV4=c.asm.NonMaxSuppressionV4).apply(null,arguments)},c._NonMaxSuppressionV5=function(){return(c._NonMaxSuppressionV5=c.asm.NonMaxSuppressionV5).apply(null,arguments)},c._NotEqual=function(){return(c._NotEqual=c.asm.NotEqual).apply(null,arguments)},c._OneHot=function(){return(c._OneHot=c.asm.OneHot).apply(null,arguments)},c._PadV2=function(){return(c._PadV2=c.asm.PadV2).apply(null,arguments)},c._Pow=function(){return(c._Pow=c.asm.Pow).apply(null,arguments)},c._Prelu=function(){return(c._Prelu=c.asm.Prelu).apply(null,arguments)},c._Prod=function(){return(c._Prod=c.asm.Prod).apply(null,arguments)},c._RealDiv=function(){return(c._RealDiv=c.asm.RealDiv).apply(null,arguments)},c._Reciprocal=function(){return(c._Reciprocal=c.asm.Reciprocal).apply(null,arguments)},c._Relu=function(){return(c._Relu=c.asm.Relu).apply(null,arguments)},c._Relu6=function(){return(c._Relu6=c.asm.Relu6).apply(null,arguments)},c._ResizeBilinear=function(){return(c._ResizeBilinear=c.asm.ResizeBilinear).apply(null,arguments)},c._ResizeBilinearGrad=function(){return(c._ResizeBilinearGrad=c.asm.ResizeBilinearGrad).apply(null,arguments)},c._ResizeNearestNeighbor=function(){return(c._ResizeNearestNeighbor=c.asm.ResizeNearestNeighbor).apply(null,arguments)},c._ResizeNearestNeighborGrad=function(){return(c._ResizeNearestNeighborGrad=c.asm.ResizeNearestNeighborGrad).apply(null,arguments)}
61,c._Reverse=function(){return(c._Reverse=c.asm.Reverse).apply(null,arguments)},c._RotateWithOffset=function(){return(c._RotateWithOffset=c.asm.RotateWithOffset).apply(null,arguments)},c._Round=function(){return(c._Round=c.asm.Round).apply(null,arguments)},c._Rsqrt=function(){return(c._Rsqrt=c.asm.Rsqrt).apply(null,arguments)},c._ScatterNd=function(){return(c._ScatterNd=c.asm.ScatterNd).apply(null,arguments)},c._SearchSorted=function(){return(c._SearchSorted=c.asm.SearchSorted).apply(null,arguments)},c._SelectV2=function(){return(c._SelectV2=c.asm.SelectV2).apply(null,arguments)},c._Selu=function(){return(c._Selu=c.asm.Selu).apply(null,arguments)},c._Sigmoid=function(){return(c._Sigmoid=c.asm.Sigmoid).apply(null,arguments)},c._Sign=function(){return(c._Sign=c.asm.Sign).apply(null,arguments)},c._Sin=function(){return(c._Sin=c.asm.Sin).apply(null,arguments)},c._Sinh=function(){return(c._Sinh=c.asm.Sinh).apply(null,arguments)},c._Softmax=function(){return(c._Softmax=c.asm.Softmax).apply(null,arguments)},c._Softplus=function(){return(c._Softplus=c.asm.Softplus).apply(null,arguments)},c._SparseFillEmptyRows=function(){return(c._SparseFillEmptyRows=c.asm.SparseFillEmptyRows).apply(null,arguments)},c._SparseReshape=function(){return(c._SparseReshape=c.asm.SparseReshape).apply(null,arguments)},c._SparseSegmentReduction=function(){return(c._SparseSegmentReduction=c.asm.SparseSegmentReduction).apply(null,arguments)},c._SparseToDense=function(){return(c._SparseToDense=c.asm.SparseToDense).apply(null,arguments)},c._Sqrt=function(){return(c._Sqrt=c.asm.Sqrt).apply(null,arguments)},c._Square=function(){return(c._Square=c.asm.Square).apply(null,arguments)},c._SquaredDifference=function(){return(c._SquaredDifference=c.asm.SquaredDifference).apply(null,arguments)},c._Step=function(){return(c._Step=c.asm.Step).apply(null,arguments)},c._StridedSlice=function(){return(c._StridedSlice=c.asm.StridedSlice).apply(null,arguments)},c._Sub=function(){return(c._Sub=c.asm.Sub).apply(null,arguments)},c._Sum=function(){return(c._Sum=c.asm.Sum).apply(null,arguments)},c._Tan=function(){return(c._Tan=c.asm.Tan).apply(null,arguments)},c._Tanh=function(){return(c._Tanh=c.asm.Tanh).apply(null,arguments)},c._TensorScatterUpdate=function(){return(c._TensorScatterUpdate=c.asm.TensorScatterUpdate).apply(null,arguments)},c._Tile=function(){return(c._Tile=c.asm.Tile).apply(null,arguments)},c._TopK=function(){return(c._TopK=c.asm.TopK).apply(null,arguments)},c._Transform=function(){return(c._Transform=c.asm.Transform).apply(null,arguments)},c._Transpose=function(){return(c._Transpose=c.asm.Transpose).apply(null,arguments)},c.__FusedMatMul=function(){return(c.__FusedMatMul=c.asm._FusedMatMul).apply(null,arguments)},c._malloc=function(){return(c._malloc=c.asm.malloc).apply(null,arguments)},c._free=function(){return(c._free=c.asm.free).apply(null,arguments)},c.__emscripten_tls_init=function(){return(c.__emscripten_tls_init=c.asm._emscripten_tls_init).apply(null,arguments)};var Oa=c._pthread_self=function(){return(Oa=c._pthread_self=c.asm.pthread_self).apply(null,arguments)};c.___errno_location=function(){return(c.___errno_location=c.asm.__errno_location).apply(null,arguments)};var Ya=c.__emscripten_thread_init=function(){return(Ya=c.__emscripten_thread_init=c.asm._emscripten_thread_init).apply(null,arguments)};c.__emscripten_thread_crashed=function(){return(c.__emscripten_thread_crashed=c.asm._emscripten_thread_crashed).apply(null,arguments)},c._emscripten_main_thread_process_queued_calls=function(){return(c._emscripten_main_thread_process_queued_calls=c.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},c._emscripten_main_browser_thread_id=function(){return(c._emscripten_main_browser_thread_id=c.asm.emscripten_main_browser_thread_id).apply(null,arguments)};var Fi=c._emscripten_run_in_main_runtime_thread_js=function(){return(Fi=c._emscripten_run_in_main_runtime_thread_js=c.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)};c._emscripten_dispatch_to_thread_=function(){return(c._emscripten_dispatch_to_thread_=c.asm.emscripten_dispatch_to_thread_).apply(null,arguments)};var ds=c.__emscripten_proxy_execute_task_queue=function(){return(ds=c.__emscripten_proxy_execute_task_queue=c.asm._emscripten_proxy_execute_task_queue).apply(null,arguments)},io=c.__emscripten_thread_free_data=function(){return(io=c.__emscripten_thread_free_data=c.asm._emscripten_thread_free_data).apply(null,arguments)},oo=c.__emscripten_thread_exit=function(){return(oo=c.__emscripten_thread_exit=c.asm._emscripten_thread_exit).apply(null,arguments)}
vendor: 4,237 bytes, lines 61-62
61,hl=c._emscripten_stack_set_limits=function(){return(hl=c._emscripten_stack_set_limits=c.asm.emscripten_stack_set_limits).apply(null,arguments)},Oi=c.stackSave=function(){return(Oi=c.stackSave=c.asm.stackSave).apply(null,arguments)},lo=c.stackRestore=function(){return(lo=c.stackRestore=c.asm.stackRestore).apply(null,arguments)},uo=c.stackAlloc=function(){return(uo=c.stackAlloc=c.asm.stackAlloc).apply(null,arguments)};c.dynCall_iijjiiii=function(){return(c.dynCall_iijjiiii=c.asm.dynCall_iijjiiii).apply(null,arguments)},c.dynCall_jiji=function(){return(c.dynCall_jiji=c.asm.dynCall_jiji).apply(null,arguments)},c.keepRuntimeAlive=Ut,c.wasmMemory=F,c.cwrap=Ta,c.ExitStatus=qa,c.PThread=Xe;var As;$e=function te(){As||_s(),As||($e=te)};function _s(te){if(lt>0)return;if(C){f(c),Nn(),startWorker(c);return}if(Tn(),lt>0)return;function ge(){As||(As=!0,c.calledRun=!0,!B&&(Nn(),f(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),Pn()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),ge()},1)):ge()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();_s();var co;x&&(co={uncaughtException:process.listeners("uncaughtException").filter(function(te){return!x.uncaughtException.indexOf(te)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(te){return!x.unhandledRejection.indexOf(te)>-1})});var mi;if(typeof WasmBackendModule<"u")mi=WasmBackendModule;else if(typeof r<"u")mi=r;else throw new Error("Could not find wasm module in post.js");if(co){var $o=mi._dispose;mi._dispose=function(){$o(),co.uncaughtException.forEach(function(te){process.removeListener("uncaughtException",te)}),co.unhandledRejection.forEach(function(te){process.removeListener("unhandledRejection",te)})}}return r.ready}})();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=n)}),vae=ir((e,t)=>{t.exports.wasmWorkerContents=`"use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f)},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"
62");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"})};self.onmessage=e=>{try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=function(){postMessage({cmd:"callHandler",handler:handler,args:[...arguments]})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();
62if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}};`}),wae=ir((e,t)=>{var n=(()=>{var a=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(a=a||__filename),function(r){r=r||{};var s=typeof r<"u"?r:{},i,o;s.ready=new Promise(function(we,Fe){i=we,o=Fe});var l;typeof process<"u"&&process.listeners&&(l={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var d=Object.assign({},s),c=typeof window=="object",f=typeof importScripts=="function",m=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",x="";function y(we){return s.locateFile?s.locateFile(we,x):x+we}var b,w,S;if(m){var k=WI(),C=R8();f?x=C.dirname(x)+"/":x=__dirname+"/",b=(we,Fe)=>(we=ct(we)?new URL(we):C.normalize(we),k.readFileSync(we,Fe?void 0:"utf8")),S=we=>{var Fe=b(we,!0);return Fe.buffer||(Fe=new Uint8Array(Fe)),Fe},w=(we,Fe,xt)=>{we=ct(we)?new URL(we):C.normalize(we),k.readFile(we,function(Xe,qt){Xe?xt(Xe):Fe(qt.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(we){if(!(we instanceof Ut))throw we}),process.on("unhandledRejection",function(we){throw we}),s.inspect=function(){return"[Emscripten Module object]"}}else(c||f)&&(f?x=self.location.href:typeof document<"u"&&document.currentScript&&(x=document.currentScript.src),a&&(x=a),x.indexOf("blob:")!==0?x=x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1):x="",b=we=>{var Fe=new XMLHttpRequest;return Fe.open("GET",we,!1),Fe.send(null),Fe.responseText},f&&(S=we=>{var Fe=new XMLHttpRequest;return Fe.open("GET",we,!1),Fe.responseType="arraybuffer",Fe.send(null),new Uint8Array(Fe.response)}),w=(we,Fe,xt)=>{var Xe=new XMLHttpRequest;Xe.open("GET",we,!0),Xe.responseType="arraybuffer",Xe.onload=()=>{if(Xe.status==200||Xe.status==0&&Xe.response){Fe(Xe.response);return}xt()},Xe.onerror=xt,Xe.send(null)});var E=s.print||console.log.bind(console),T=s.printErr||console.warn.bind(console);Object.assign(s,d),d=null,s.arguments&&s.arguments,s.thisProgram&&s.thisProgram,s.quit&&s.quit;var _;s.wasmBinary&&(_=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&Ye("no native wasm support detected");var A,$=!1,O=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function z(we,Fe,xt){Fe>>>=0;for(var Xe=Fe+xt,qt=Fe;we[qt]&&!(qt>=Xe);)++qt;if(qt-Fe>16&&we.buffer&&O)return O.decode(we.subarray(Fe,qt));for(var $t="";Fe<qt;){var It=we[Fe++];if(!(It&128)){$t+=String.fromCharCode(It);continue}var vt=we[Fe++]&63;if((It&224)==192){$t+=String.fromCharCode((It&31)<<6|vt);continue}var vn=we[Fe++]&63;if((It&240)==224?It=(It&15)<<12|vt<<6|vn:It=(It&7)<<18|vt<<12|vn<<6|we[Fe++]&63,It<65536)$t+=String.fromCharCode(It);else{var Na=It-65536;$t+=String.fromCharCode(55296|Na>>10,56320|Na&1023)}}return $t}function P(we,Fe){return we>>>=0,we?z(V,we,Fe):""}function j(we,Fe,xt,Xe){if(xt>>>=0,!(Xe>0))return 0;for(var qt=xt,$t=xt+Xe-1,It=0;It<we.length;++It){var vt=we.charCodeAt(It);if(vt>=55296&&vt<=57343){var vn=we.charCodeAt(++It);vt=65536+((vt&1023)<<10)|vn&1023}if(vt<=127){if(xt>=$t)break;Fe[xt++>>>0]=vt}else if(vt<=2047){if(xt+1>=$t)break;Fe[xt++>>>0]=192|vt>>6,Fe[xt++>>>0]=128|vt&63}else if(vt<=65535){if(xt+2>=$t)break;Fe[xt++>>>0]=224|vt>>12,Fe[xt++>>>0]=128|vt>>6&63,Fe[xt++>>>0]=128|vt&63}else{if(xt+3>=$t)break;Fe[xt++>>>0]=240|vt>>18,Fe[xt++>>>0]=128|vt>>12&63,Fe[xt++>>>0]=128|vt>>6&63,Fe[xt++>>>0]=128|vt&63}}return Fe[xt>>>0]=0,xt-qt}function G(we,Fe,xt){return j(we,V,Fe,xt)}var X,J,V,Q;function F(we){X=we,s.HEAP8=J=new Int8Array(we),s.HEAP16=new Int16Array(we),s.HEAP32=new Int32Array(we),s.HEAPU8=V=new Uint8Array(we),s.HEAPU16=new Uint16Array(we),s.HEAPU32=Q=new Uint32Array(we),s.HEAPF32=new Float32Array(we),s.HEAPF64=new Float64Array(we)}s.INITIAL_MEMORY;var H=[],B=[],Y=[];function ne(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)oe(s.preRun.shift());Tn(H)}function ee(){Tn(B)}
vendor: 4,122 bytes, line 62
62function U(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)he(s.postRun.shift());Tn(Y)}function oe(we){H.unshift(we)}function pe(we){B.unshift(we)}function he(we){Y.unshift(we)}var xe=0,Ie=null;function _e(we){xe++,s.monitorRunDependencies&&s.monitorRunDependencies(xe)}function Oe(we){if(xe--,s.monitorRunDependencies&&s.monitorRunDependencies(xe),xe==0&&Ie){var Fe=Ie;Ie=null,Fe()}}function Ye(we){s.onAbort&&s.onAbort(we),we="Aborted("+we+")",T(we),$=!0,we+=". Build with -sASSERTIONS for more info.";var Fe=new WebAssembly.RuntimeError(we);throw o(Fe),Fe}var ft="data:application/octet-stream;base64,";function ze(we){return we.startsWith(ft)}function ct(we){return we.startsWith("file://")}var ot;ot="tfjs-backend-wasm.wasm",ze(ot)||(ot=y(ot));function tt(we){try{if(we==ot&&_)return new Uint8Array(_);if(S)return S(we);throw"both async and sync fetching of the wasm failed"}catch(Fe){Ye(Fe)}}function Tt(){if(!_&&(c||f)){if(typeof fetch=="function"&&!ct(ot))return fetch(ot,{credentials:"same-origin"}).then(function(we){if(!we.ok)throw"failed to load wasm binary file at '"+ot+"'";return we.arrayBuffer()}).catch(function(){return tt(ot)});if(w)return new Promise(function(we,Fe){w(ot,function(xt){we(new Uint8Array(xt))},Fe)})}return Promise.resolve().then(function(){return tt(ot)})}function bn(){var we={env:qr,wasi_snapshot_preview1:qr};function Fe(It,vt){var vn=It.exports;s.asm=vn,A=s.asm.memory,F(A.buffer),s.asm.__indirect_function_table,pe(s.asm.__wasm_call_ctors),Oe()}_e();function xt(It){Fe(It.instance)}function Xe(It){return Tt().then(function(vt){return WebAssembly.instantiate(vt,we)}).then(function(vt){return vt}).then(It,function(vt){T("failed to asynchronously prepare wasm: "+vt),Ye(vt)})}function qt(){return!_&&typeof WebAssembly.instantiateStreaming=="function"&&!ze(ot)&&!ct(ot)&&!m&&typeof fetch=="function"?fetch(ot,{credentials:"same-origin"}).then(function(It){var vt=WebAssembly.instantiateStreaming(It,we);return vt.then(xt,function(vn){return T("wasm streaming compile failed: "+vn),T("falling back to ArrayBuffer instantiation"),Xe(xt)})}):Xe(xt)}if(s.instantiateWasm)try{var $t=s.instantiateWasm(we,Fe);return $t}catch(It){T("Module.instantiateWasm callback failed with error: "+It),o(It)}return qt().catch(o),{}}function Ut(we){this.name="ExitStatus",this.message="Program terminated with exit("+we+")",this.status=we}function Tn(we){for(;we.length>0;)we.shift()(s)}function Nn(){Ye("")}function Pn(){return 4294901760}function sa(){return Pn()}function pa(we,Fe,xt){V.copyWithin(we>>>0,Fe>>>0,Fe+xt>>>0)}function Be(we){try{return A.grow(we-X.byteLength+65535>>>16),F(A.buffer),1}catch{}}function lt(we){var Fe=V.length;we=we>>>0;var xt=Pn();if(we>xt)return!1;let Xe=(vn,Na)=>vn+(Na-vn%Na)%Na;for(var qt=1;qt<=4;qt*=2){var $t=Fe*(1+.2/qt);$t=Math.min($t,we+100663296);var It=Math.min(xt,Xe(Math.max(we,$t),65536)),vt=Be(It);if(vt)return!0}return!1}function $e(we){return 52}function Ue(we,Fe,xt,Xe,qt){return 70}var dt=[null,[],[]];function Qe(we,Fe){var xt=dt[we];Fe===0||Fe===10?((we===1?E:T)(z(xt,0)),xt.length=0):xt.push(Fe)}function An(we,Fe,xt,Xe){for(var qt=0,$t=0;$t<xt;$t++){var It=Q[Fe>>>2],vt=Q[Fe+4>>>2];Fe+=8;for(var vn=0;vn<vt;vn++)Qe(we,V[It+vn>>>0]);qt+=vt}return Q[Xe>>>2]=qt,0}function Bn(we){var Fe=s["_"+we];return Fe}function Ga(we,Fe){J.set(we,Fe>>>0)}function _n(we,Fe,xt,Xe,qt){var $t={string:sn=>{var wn=0;if(sn!=null&&sn!==0){var Ka=(sn.length<<2)+1;wn=qa(Ka),G(sn,wn,Ka)}return wn},array:sn=>{var wn=qa(sn.length);return Ga(sn,wn),wn}};function It(sn){return Fe==="string"?P(sn):Fe==="boolean"?!!sn:sn}var vt=Bn(we),vn=[],Na=0;if(Xe)for(var Fa=0;Fa<Xe.length;Fa++){var Xr=$t[xt[Fa]];Xr?(Na===0&&(Na=hi()),vn[Fa]=Xr(Xe[Fa])):vn[Fa]=Xe[Fa]}var fa=vt.apply(null,vn);function os(sn){return Na!==0&&pi(Na),It(sn)}return fa=os(fa),fa}function di(we,Fe,xt,Xe){xt=xt||[];var qt=xt.every(It=>It==="number"||It==="boolean"),$t=Fe!=="string";return $t&&qt&&!Xe?Bn(we):function(){return _n(we,Fe,xt,arguments)}}var qr={abort:Nn,emscripten_get_heap_max:sa,emscripten_memcpy_big:pa,emscripten_resize_heap:lt,fd_close:$e,fd_
62seek:Ue,fd_write:An};bn(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.__wasm_call_ctors).apply(null,arguments)},s._init=function(){return(s._init=s.asm.init).apply(null,arguments)},s._init_with_threads_count=function(){return(s._init_with_threads_count=s.asm.init_with_threads_count).apply(null,arguments)},s._get_threads_count=function(){return(s._get_threads_count=s.asm.get_threads_count).apply(null,arguments)},s._register_tensor=function(){return(s._register_tensor=s.asm.register_tensor).apply(null,arguments)},s._dispose_data=function(){return(s._dispose_data=s.asm.dispose_data).apply(null,arguments)},s._dispose=function(){return(s._dispose=s.asm.dispose).apply(null,arguments)},s._Abs=function(){return(s._Abs=s.asm.Abs).apply(null,arguments)},s._Acos=function(){return(s._Acos=s.asm.Acos).apply(null,arguments)},s._Acosh=function(){return(s._Acosh=s.asm.Acosh).apply(null,arguments)},s._Add=function(){return(s._Add=s.asm.Add).apply(null,arguments)},s._AddN=function(){return(s._AddN=s.asm.AddN).apply(null,arguments)},s._All=function(){return(s._All=s.asm.All).apply(null,arguments)},s._Any=function(){return(s._Any=s.asm.Any).apply(null,arguments)},s._ArgMax=function(){return(s._ArgMax=s.asm.ArgMax).apply(null,arguments)},s._ArgMin=function(){return(s._ArgMin=s.asm.ArgMin).apply(null,arguments)},s._Asin=function(){return(s._Asin=s.asm.Asin).apply(null,arguments)},s._Asinh=function(){return(s._Asinh=s.asm.Asinh).apply(null,arguments)},s._Atan=function(){return(s._Atan=s.asm.Atan).apply(null,arguments)},s._Atan2=function(){return(s._Atan2=s.asm.Atan2).apply(null,arguments)},s._Atanh=function(){return(s._Atanh=s.asm.Atanh).apply(null,arguments)},s._AvgPool=function(){return(s._AvgPool=s.asm.AvgPool).apply(null,arguments)},s._AvgPool3D=function(){return(s._AvgPool3D=s.asm.AvgPool3D).apply(null,arguments)},s._AvgPool3DGrad=function(){return(s._AvgPool3DGrad=s.asm.AvgPool3DGrad).apply(null,arguments)},s._AvgPoolGrad=function(){return(s._AvgPoolGrad=s.asm.AvgPoolGrad).apply(null,arguments)},s._BatchMatMul=function(){return(s._BatchMatMul=s.asm.BatchMatMul).apply(null,arguments)},s._Bincount=function(){return(s._Bincount=s.asm.Bincount).apply(null,arguments)},s._BitwiseAnd=function(){return(s._BitwiseAnd=s.asm.BitwiseAnd).apply(null,arguments)},s._Ceil=function(){return(s._Ceil=s.asm.Ceil).apply(null,arguments)},s._ClipByValue=function(){return(s._ClipByValue=s.asm.ClipByValue).apply(null,arguments)},s._Conv2D=function(){return(s._Conv2D=s.asm.Conv2D).apply(null,arguments)},s._Conv2DBackpropInput=function(){return(s._Conv2DBackpropInput=s.asm.Conv2DBackpropInput).apply(null,arguments)},s._Conv3D=function(){return(s._Conv3D=s.asm.Conv3D).apply(null,arguments)},s._Conv3DBackpropFilterV2=function(){return(s._Conv3DBackpropFilterV2=s.asm.Conv3DBackpropFilterV2).apply(null,arguments)},s._Conv3DBackpropInputV2=function(){return(s._Conv3DBackpropInputV2=s.asm.Conv3DBackpropInputV2).apply(null,arguments)},s._Cos=function(){return(s._Cos=s.asm.Cos).apply(null,arguments)},s._Cosh=function(){return(s._Cosh=s.asm.Cosh).apply(null,arguments)},s._CropAndResize=function(){return(s._CropAndResize=s.asm.CropAndResize).apply(null,arguments)},s._Cumprod=function(){return(s._Cumprod=s.asm.Cumprod).apply(null,arguments)},s._Cumsum=function(){return(s._Cumsum=s.asm.Cumsum).apply(null,arguments)},s._DenseBincount=function(){return(s._DenseBincount=s.asm.DenseBincount).apply(null,arguments)},s._DepthToSpace=function(){return(s._DepthToSpace=s.asm.DepthToSpace).apply(null,arguments)},s._DepthwiseConv2dNative=function(){return(s._DepthwiseConv2dNative=s.asm.DepthwiseConv2dNative).apply(null,arguments)},s._Diag=function(){return(s._Diag=s.asm.Diag).apply(null,arguments)},s._Dilation2D=function(){return(s._Dilation2D=s.asm.Dilation2D).apply(null,arguments)},s._Dilation2DBackpropFilter=function(){return(s._Dilation2DBackpropFilter=s.asm.Dilation2DBackpropFilter).apply(null,arguments)},s._Dilation2DBackpropInput=function(){return(s._Dilation2DBackpropInput=s.asm.Dilation2DBackpropInput).apply(null,arguments)},s._Elu=function(){return(s._Elu=s.asm.Elu).apply(null,arguments)},s._EluGrad=function(){return(s._EluGrad=s.asm.EluGrad).apply(null,arguments)},s._Equal=function(){return(s._Equal=s.asm.Equal).apply(null,arguments)},s._Erf=function(){return(s._Erf=s.asm.Erf).apply(null,arguments)},s._Exp=function(){return(s._Exp=s.asm.Exp).apply(null,arguments)},s._Expm1=function(){return(s._Expm1=s.asm.Expm1).apply(null,arguments)},s._FlipLeftRight=function(){return(s._FlipLeftRight=s.asm.FlipLeftRight).apply(null,arguments)},s._Floor=function(){return(s._Floor=s.asm.Floor).apply(null,arguments)},s._FloorDiv=function(){return(s._FloorDiv=s.asm.FloorDiv).apply(null,arguments)},s._FusedBatchNorm=function(){return(s._FusedBatchNorm=s.asm.FusedBatchNorm).apply(null,arguments)},s._FusedConv2D=function(){return(s._FusedConv2D=s.asm.FusedConv2D).apply(null,arguments)},s._FusedDepthwiseConv2D=function(){return(s._FusedDepthwiseConv2D=s.asm.FusedDepthwiseConv2D).apply(null,arguments)},s._Gather=function(){return(s._Gather=s.asm.Gather).apply(null,arguments)},s._GatherNd=function(){return(s._GatherNd=s.asm.GatherNd).apply(null,arguments)},s._Greater=function(){return(s._Greater=s.asm.Greater).apply(null,arguments)},s._GreaterEqual=function(){return(s._GreaterEqual=s.asm.GreaterEqual).apply(null,arguments)},s._IsFinite=function(){return(s._IsFinite=s.asm.IsFinite).apply(null,arguments)},s._IsInf=function(){return(s._IsInf=s.asm.IsInf).apply(null,arguments)},s._IsNan=function(){return(s._IsNan=s.asm.IsNan).apply(null,arguments)},s._LRN=function(){return(s._LRN=s.asm.LRN).apply(null,arguments)},s._LRNGrad=function(){return(s._LRNGrad=s.asm.LRNGrad).apply(null,arguments)},s._LeakyRelu=function(){return(s._LeakyRelu=s.asm.LeakyRelu).apply(null,arguments)},s._Less=function(){return(s._Less=s.asm.Less).apply(null,arguments)},s._LessEqual=function(){return(s._LessEqual=s.asm.LessEqual).apply(null,arguments)},s._LinSpace=function(){return(s._LinSpace=s.asm.LinSpace).apply(null,arguments)},s._Log=function(){return(s._Log=s.asm.Log).apply(null,arguments)},s._Log1p=function(){return(s._Log1p=s.asm.Log1p).apply(null,arguments)},s._LogicalAnd=function(){return(s._LogicalAnd=s.asm.LogicalAnd).apply(null,arguments)},s._LogicalNot=function(){return(s._LogicalNot=s.asm.LogicalNot).apply(null,arguments)},s._LogicalOr=function(){return(s._LogicalOr=s.asm.LogicalOr).apply(null,arguments)},s._LogicalXor=function(){return(s._LogicalXor=s.asm.LogicalXor).apply(null,arguments)},s._Max=function(){return(s._Max=s.asm.Max).apply(null,arguments)},s._MaxPool=function(){return(s._MaxPool=s.asm.MaxPool).apply(null,arguments)},s._MaxPool3D=function(){return(s._MaxPool3D=s.asm.MaxPool3D).apply(null,arguments)},s._MaxPool3DGrad=function(){return(s._MaxPool3DGrad=s.asm.MaxPool3DGrad).apply(null,arguments)},s._MaxPoolGrad=function(){return(s._MaxPoolGrad=s.asm.MaxPoolGrad).apply(null,arguments)},s._MaxPoolWithArgmax=function(){return(s._MaxPoolWithArgmax=s.asm.MaxPoolWithArgmax).apply(null,arguments)},s._Maximum=function(){return(s._Maximum=s.asm.Maximum).apply(null,arguments)},s._Mean=function(){return(s._Mean=s.asm.Mean).apply(null,arguments)},s._Min=function(){return(s._Min=s.asm.Min).apply(null,arguments)},s._Minimum=function(){return(s._Minimum=s.asm.Minimum).apply(null,arguments)},s._MirrorPad=function(){return(s._MirrorPad=s.asm.MirrorPad).apply(null,arguments)},s._Mod=function(){return(s._Mod=s.asm.Mod).apply(null,arguments)},s._Multinomial=function(){return(s._Multinomial=s.asm.Multinomial).apply(null,arguments)},s._Multiply=function(){return(s._Multiply=s.asm.Multiply).apply(null,arguments)},s._Neg=function(){return(s._Neg=s.asm.Neg).apply(null,arguments)},s._NonMaxSuppressionV3=function(){return(s._NonMaxSuppressionV3=s.asm.NonMaxSuppressionV3).apply(null,arguments)},s._NonMaxSuppressionV4=function(){return(s._NonMaxSuppressionV4=s.asm.NonMaxSuppressionV4).apply(null,arguments)},s._NonMaxSuppressionV5=function(){return(s._NonMaxSuppressionV5=s.asm.NonMaxSuppressionV5).apply(null,arguments)},s._NotEqual=function(){return(s._NotEqual=s.asm.NotEqual).apply(null,arguments)},s._OneHot=function(){return(s._OneHot=s.asm.OneHot).apply(null,arguments)},s._PadV2=function(){return(s._PadV2=s.asm.PadV2).apply(null,arguments)},s._Pow=function(){return(s._Pow=s.asm.Pow).apply(null,arguments)},s._Prelu=function(){return(s._Prelu=s.asm.Prelu).apply(null,arguments)},s._Prod=function(){return(s._Prod=s.asm.Prod).apply(null,arguments)},s._RealDiv=function(){return(s._RealDiv=s.asm.RealDiv).apply(null,arguments)},s._Reciprocal=function(){return(s._Reciprocal=s.asm.Reciprocal).apply(null,arguments)},s._Relu=function(){return(s._Relu=s.asm.Relu).apply(null,arguments)},s._Relu6=function(){return(s._Relu6=s.asm.Relu6).apply(null,arguments)},s._ResizeBilinear=function(){return(s._ResizeBilinear=s.asm.ResizeBilinear).apply(null,arguments)},s._ResizeBilinearGrad=function(){return(s._ResizeBilinearGrad=s.asm.ResizeBilinearGrad).apply(null,arguments)},s._ResizeNearestNeighbor=function(){return(s._ResizeNearestNeighbor=s.asm.ResizeNearestNeighbor).apply(null,arguments)},s._ResizeNearestNeighborGrad=function(){return(s._ResizeNearestNeighborGrad=s.asm.ResizeNearestNeighborGrad).apply(null,arguments)}
62,s._Reverse=function(){return(s._Reverse=s.asm.Reverse).apply(null,arguments)},s._RotateWithOffset=function(){return(s._RotateWithOffset=s.asm.RotateWithOffset).apply(null,arguments)},s._Round=function(){return(s._Round=s.asm.Round).apply(null,arguments)},s._Rsqrt=function(){return(s._Rsqrt=s.asm.Rsqrt).apply(null,arguments)},s._ScatterNd=function(){return(s._ScatterNd=s.asm.ScatterNd).apply(null,arguments)},s._SearchSorted=function(){return(s._SearchSorted=s.asm.SearchSorted).apply(null,arguments)},s._SelectV2=function(){return(s._SelectV2=s.asm.SelectV2).apply(null,arguments)},s._Selu=function(){return(s._Selu=s.asm.Selu).apply(null,arguments)},s._Sigmoid=function(){return(s._Sigmoid=s.asm.Sigmoid).apply(null,arguments)},s._Sign=function(){return(s._Sign=s.asm.Sign).apply(null,arguments)},s._Sin=function(){return(s._Sin=s.asm.Sin).apply(null,arguments)},s._Sinh=function(){return(s._Sinh=s.asm.Sinh).apply(null,arguments)},s._Softmax=function(){return(s._Softmax=s.asm.Softmax).apply(null,arguments)},s._Softplus=function(){return(s._Softplus=s.asm.Softplus).apply(null,arguments)},s._SparseFillEmptyRows=function(){return(s._SparseFillEmptyRows=s.asm.SparseFillEmptyRows).apply(null,arguments)},s._SparseReshape=function(){return(s._SparseReshape=s.asm.SparseReshape).apply(null,arguments)},s._SparseSegmentReduction=function(){return(s._SparseSegmentReduction=s.asm.SparseSegmentReduction).apply(null,arguments)},s._SparseToDense=function(){return(s._SparseToDense=s.asm.SparseToDense).apply(null,arguments)},s._Sqrt=function(){return(s._Sqrt=s.asm.Sqrt).apply(null,arguments)},s._Square=function(){return(s._Square=s.asm.Square).apply(null,arguments)},s._SquaredDifference=function(){return(s._SquaredDifference=s.asm.SquaredDifference).apply(null,arguments)},s._Step=function(){return(s._Step=s.asm.Step).apply(null,arguments)},s._StridedSlice=function(){return(s._StridedSlice=s.asm.StridedSlice).apply(null,arguments)},s._Sub=function(){return(s._Sub=s.asm.Sub).apply(null,arguments)},s._Sum=function(){return(s._Sum=s.asm.Sum).apply(null,arguments)},s._Tan=function(){return(s._Tan=s.asm.Tan).apply(null,arguments)},s._Tanh=function(){return(s._Tanh=s.asm.Tanh).apply(null,arguments)},s._TensorScatterUpdate=function(){return(s._TensorScatterUpdate=s.asm.TensorScatterUpdate).apply(null,arguments)},s._Tile=function(){return(s._Tile=s.asm.Tile).apply(null,arguments)},s._TopK=function(){return(s._TopK=s.asm.TopK).apply(null,arguments)},s._Transform=function(){return(s._Transform=s.asm.Transform).apply(null,arguments)},s._Transpose=function(){return(s._Transpose=s.asm.Transpose).apply(null,arguments)},s.__FusedMatMul=function(){return(s.__FusedMatMul=s.asm._FusedMatMul).apply(null,arguments)},s._malloc=function(){return(s._malloc=s.asm.malloc).apply(null,arguments)},s._free=function(){return(s._free=s.asm.free).apply(null,arguments)},s.___errno_location=function(){return(s.___errno_location=s.asm.__errno_location).apply(null,arguments)};var hi=s.stackSave=function(){return(hi=s.stackSave=s.asm.stackSave).apply(null,arguments)},pi=s.stackRestore=function(){return(pi=s.stackRestore=s.asm.stackRestore).apply(null,arguments)},qa=s.stackAlloc=function(){return(qa=s.stackAlloc=s.asm.stackAlloc).apply(null,arguments)};s.dynCall_iijjiiii=function(){return(s.dynCall_iijjiiii=s.asm.dynCall_iijjiiii).apply(null,arguments)},s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.dynCall_jiji).apply(null,arguments)},s.cwrap=di;var is;Ie=function we(){is||Kr(),is||(Ie=we)};function Kr(we){if(xe>0||(ne(),xe>0))return;function Fe(){is||(is=!0,s.calledRun=!0,!$&&(ee(),i(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),U()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),Fe()},1)):Fe()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();Kr();var lr;l&&(lr={uncaughtException:process.listeners("uncaughtException").filter(function(we){return!l.uncaughtException.indexOf(we)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(we){return!l.unhandledRejection.indexOf(we)>-1}
vendor: 24,164 bytes, lines 62-64
62)});var Ba;if(typeof r<"u")Ba=r;else if(typeof WasmBackendModuleThreadedSimd<"u")Ba=WasmBackendModuleThreadedSimd;else throw new Error("Could not find wasm module in post.js");if(lr){var fi=Ba._dispose;Ba._dispose=function(){fi(),lr.uncaughtException.forEach(function(we){process.removeListener("uncaughtException",we)}),lr.unhandledRejection.forEach(function(we){process.removeListener("unhandledRejection",we)})}}return r.ready}})();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModule=n)}),mw=class{constructor(e,t){this.backend=e,this.dataMover=t,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,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},tb=class{refCount(e){return Ys("refCount")}incRef(e){return Ys("incRef")}timerAvailable(){return!0}time(e){return Ys("time")}read(e){return Ys("read")}readSync(e){return Ys("readSync")}readToGPU(e,t){return Ys("readToGPU")}numDataIds(){return Ys("numDataIds")}disposeData(e,t){return Ys("disposeData")}write(e,t,n){return Ys("write")}move(e,t,n,a,r){return Ys("move")}createTensorFromGPUData(e,t,n){return Ys("createTensorFromGPUData")}memory(){return Ys("memory")}floatPrecision(){return Ys("floatPrecision")}epsilon(){return this.floatPrecision()===32?1e-7:1e-4}dispose(){return Ys("dispose")}};function Ys(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function M8(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,kv(e,t,n)}function Sae(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,a=0;for(;n>0;)a=Math.random()*n|0,n--,kv(e,n,a),kv(t,n,a)}function _y(e,t,n){return Math.max(e,Math.min(t,n))}function kae(e){return e%2===0?e:e+1}function kv(e,t,n){let a=e[t];e[t]=e[n],e[n]=a}function Nae(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function Cae(e,t){let n=Math.random();return t*n+(1-n)*e}function Eae(e,t){let n=0;for(let a=0;a<e.length;a++){let r=Number(e[a])-Number(t[a]);n+=r*r}return n}function Z(e,t){if(!e)throw new Error(typeof t=="string"?t:t())}function Ns(e,t,n=""){Z(Gl(e,t),()=>n+` Shapes ${e} and ${t} must match`)}function Hd(e){Z(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function Hn(e){if(e.length===0)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function Iae(e){return e.length===0}function $8(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==null&&t[n]!==null&&e[n]!==t[n])return!1;return!0}function Gl(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pf(e){return e%1===0}function Tae(e){if(Math.tanh!=null)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{let t=Math.exp(2*e);return(t-1)/(t+1)}}function Aae(e){let t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function _ae(e){let t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return M8(t),t}function oy(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function jae(e,t=r=>0,n,a){return new Promise((r,s)=>{let i=0,o=()=>{if(e()){r();return}i++;let l=t(i);if(n!=null&&i>=n){s();return}a!=null?a(o,l):setTimeout(o,l)};o()})}function Dae(e,t){let n=1,a=-1;for(let s=0;s<e.length;++s)if(e[s]>=0)n*=e[s];else if(e[s]===-1){if(a!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${a} and dim ${s}`);a=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(a===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);let r=e.slice();return r[a]=t/n,r}function no(e,t){let n=t.length;return e=e==null?t.map((a,r)=>r):[].concat(e),Z(e.every(a=>a>=-n&&a<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),Z(e.every(a=>Pf(a)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(a=>a<0?n+a:a)}function B8(e,t){let n=[],a=[],r=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||r?null:no(t,e).sort(),i=0;for(let o=0;o<e.length;++o){if(s!=null){if(s[i]===o&&e[o]!==1)throw new Error(`Can't squeeze axis ${o} since its dim '${e[o]}' is not 1`);(s[i]==null||s[i]>o)&&e[o]===1&&(n.push(e[o]),a.push(o)),s[i]<=o&&i++}e[o]!==1&&(n.push(e[o]),a.push(o))}return{newShape:n,keptDims:a}}function F8(e,t){return VI(e,t)}function VI(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function O8(e,t){for(let n=0;n<e.length;n++){let a=e[n];if(isNaN(a)||!isFinite(a))throw Error(`A tensor of type ${t} being uploaded contains ${a}.`)}}function L8(e){return e==="bool"||e==="complex64"||e==="float32"||e==="int32"||e==="string"}function Rae(e,t){return!(t==="complex64"||t==="float32"&&e!=="complex64"||t==="int32"&&e!=="float32"&&e!=="complex64"||t==="bool"&&e==="bool")}function Nv(e){if(e==="float32"||e==="int32")return 4;if(e==="complex64")return 8;if(e==="bool")return 1;throw new Error(`Unknown dtype ${e}`)}function P8(e){if(e==null)return 0;let t=0;return e.forEach(n=>t+=n.length),t}function Ou(e){return typeof e=="string"||e instanceof String}function z8(e){return typeof e=="boolean"}function U8(e){return typeof e=="number"}function nb(e){return Array.isArray(e)?nb(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":U8(e)?"float32":Ou(e)?"string":z8(e)?"bool":"float32"}function Ku(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Cv(e,t){for(let n=t;n<e;++n)if(e%n===0)return n;return e}function dm(e){let t=e.length;if(t<2)return[];let n=new Array(t-1);n[t-2]=e[t-1];for(let a=t-3;a>=0;--a)n[a]=n[a+1]*e[a+1];return n}function W8(e,t,n,a=!1){let r=new Array;if(t.length===1){let s=t[0]*(a?2:1);for(let i=0;i<s;i++)r[i]=n[e+i]}else{let s=t[0],i=t.slice(1),o=i.reduce((l,d)=>l*d)*(a?2:1);for(let l=0;l<s;l++)r[l]=W8(e+l*o,i,n,a)}return r}function Rf(e,t,n=!1){if(e.length===0)return t[0];let a=e.reduce((r,s)=>r*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return W8(0,e,t,n)}function Mae(e,t){if(Array.isArray(e))return e;if(t==="float32")return e instanceof Float32Array?e:new Float32Array(e);if(t==="int32")return e instanceof Int32Array?e:new Int32Array(e);if(t==="bool"||t==="string")return Uint8Array.from(new Int32Array(e));throw new Error(`Unknown dtype ${t}`)}function HI(e,t){let n=gw(e,t);for(let a=0;a<n.length;a++)n[a]=1;return n}function gw(e,t){if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool")return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function $ae(e,t){let n=e.reduce((a,r)=>a*r,1);if(t==null||t==="float32")return Rf(e,new Float32Array(n));if(t==="int32")return Rf(e,new Int32Array(n));if(t==="bool")return Rf(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function ci(e){e.forEach(t=>{Z(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function Bae(e,t,n){if(t===0)return 0;if(t===1)return e[0];let a=e[e.length-1];for(let r=0;r<e.length-1;++r)a+=n[r]*e[r];return a}function Fae(e,t,n){if(t===0)return[];if(t===1)return[e];let a=new Array(t);for(let r=0;r<a.length-1;++r)a[r]=Math.floor(e/n[r]),e-=a[r]*n[r];return a[a.length-1]=e,a}function xw(e){return e&&e.then&&typeof e.then=="function"}var M5="tfjsflags",V8=class{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Oae,this.populateURLFlags()}setPlatform(e,t){this.platform!=null&&(fe().getBool("IS_TEST")||fe().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},this.urlFlags[e]!=null){let a=this.urlFlags[e];fe().getBool("IS_TEST")||fe().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${a}.`),this.set(e,a)}}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];let t=this.evaluateFlag(e);if(xw(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,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,t){if(this.flagRegistry[e]==null)throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,this.flagRegistry[e].setHook!=null&&this.flagRegistry[e].setHook(t)}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;let e=this.getQueryParams(this.global.location.search);M5 in e&&e[M5].split(",").forEach(t=>{let[n,a]=t.split(":");this.urlFlags[n]=Pae(n,a)})}};function Oae(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...a)=>(Lae(t,a[0],a[1]),a.join("="))),t}function Lae(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function Pae(e,t){let n=t.toLowerCase();return n==="true"||n==="false"?n==="true":`${+n}`===n?+n:t}function fe(){return GI}var GI=null;function zae(e){GI=e}var SN;function H8(){if(SN==null){let e;if(typeof window<"u")e=window;else if(typeof global<"u")e=global;else if(typeof process<"u")e=process;else if(typeof self<"u")e=self;else throw new Error("Could not find a global object");SN=e}return SN}function Uae(){let e=H8();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function qI(e,t){let n=Uae();if(n.has(e))return n.get(e);{let a=t();return n.set(e,a),n.get(e)}}var hm="Abs",Gd="Acos",qd="Acosh",hc="Add",Kd="AddN",pm="All",fm="Any",mm="ArgMax",gm="ArgMin",Xd="Asin",Yd="Asinh",Jd="Atan",Qd="Atanh",Zd="Atan2",eh="AvgPool",ab="AvgPoolGrad",xm="AvgPool3D",rb="AvgPool3DGrad",th="BatchMatMul",ym="BatchToSpaceND",bm="Bincount",vm="BitwiseAnd",G8="BroadcastTo",sb="BroadcastArgs",nh="Cast",ah="Ceil",pc="ClipByValue",yw="Complex",ib="ComplexAbs",wm="Concat",rh="Conv2D",bw="Conv2DBackpropFilter",sh="Conv2DBackpropInput",ih="Conv3D",Sm="Conv3DBackpropFilterV2",km="Conv3DBackpropInputV2",oh="Cos",lh="Cosh",Nm="Cumprod",uh="Cumsum",Cm="CropAndResize",ob="DenseBincount",Em="DepthToSpace",ch="DepthwiseConv2dNative",vw="DepthwiseConv2dNativeBackpropFilter",ww="DepthwiseConv2dNativeBackpropInput",lb="Diag",dh="Dilation2D",zf="Dilation2DBackpropInput",Uf="Dilation2DBackpropFilter",Sw="Draw",hh="RealDiv",kw="Einsum",ph="Elu",Im="EluGrad",fh="Erf",Tm="Equal",mh="Exp",Am="ExpandDims",gh="Expm1",Nw="FFT",ub="Fill",_m="FlipLeftRight",xh="Floor",yh="FloorDiv",bh="FusedBatchNorm",jm="GatherV2",Dm="GatherNd",Rm="Greater",vh="GreaterEqual",wh="Identity",Cw="IFFT",Ew="Imag",Sh="IsFinite",kh="IsInf",Nh="IsNan",Ch="LeakyRelu",Mm="Less",$m="LessEqual",Bm="LinSpace",Eh="Log",Ih="Log1p",Fm="LogicalAnd",Om="LogicalNot",Lm="LogicalOr",q8="LogicalXor",K8="LogSoftmax",Wae="LowerBound",Th="LRN",Pm="LRNGrad",Vae="MatrixBandPart",Ah="Max",_h="Maximum",jh="MaxPool",cb="MaxPoolGrad",zm="MaxPool3D",db="MaxPool3DGrad",hb="MaxPoolWithArgmax",Dh="Mean",Rh="Min",Mh="Minimum",$h="MirrorPad",Bh="Mod",Um="Multinomial",Fh="Multiply",Wm="Neg",Vm="NotEqual",Hm="NonMaxSuppressionV3",Gm="NonMaxSuppressionV4",qm="NonMaxSuppressionV5",Km="OnesLike",Oh="OneHot",Xm="Pack",Lh="PadV2",Hae="Pool",Ph="Pow",zh="Prelu",Uh="Prod",Iw="RaggedGather",Tw="RaggedRange",Aw="RaggedTensorToTensor",pb="Range",_w="Real",Wh="Reciprocal",Vh="Relu",Ym="Reshape",Hh="ResizeNearestNeighbor",Jm="ResizeNearestNeighborGrad",Gh="ResizeBilinear",Qm="ResizeBilinearGrad",qh="Relu6",Kh="Reverse",Xh="Round",Yh="Rsqrt",Zm="ScatterNd",eg="TensorScatterUpdate",tg="SearchSorted",ng="Select",Jh="Selu",ag="Slice",Qh="Sin",Zh="Sinh",ep="Sign",tp="Sigmoid",np="Softplus",ap="Sqrt",rp="Sum",rg="SpaceToBatchND",sg="SplitV",sp="Softmax",fb="SparseFillEmptyRows",ig="SparseReshape",mb="SparseSegmentMean",gb="SparseSegmentSum",og="SparseToDense",ip="SquaredDifference",xb="Square",yb="StaticRegexReplace",lg="StridedSlice",bb="StringNGrams",vb="StringSplit",wb="StringToHashBucketFast",op="Sub",lp="Tan",up="Tanh",fc="Tile",ug="TopK",cg="Transform",Fl="Transpose",Sb="Unique",dg="Unpack",kb="UnsortedSegmentSum",Gae="UpperBound",hg="ZerosLike",mc="Step",Ev="FromPixels",pg="RotateWithOffset",Nd="_FusedMatMul",Cd="FusedConv2D",Ed="FusedDepthwiseConv2D";function Bu(...e){fe().getBool("IS_TEST")||fe().getBool("PROD")||console.warn(...e)}function qae(...e){fe().getBool("IS_TEST")||fe().getBool("PROD")||console.log(...e)}var Wf=qI("kernelRegistry",()=>new Map),jy=qI("gradRegistry",()=>new Map);function Dy(e,t){let n=KI(e,t);return Wf.get(n)}function BC(e){return jy.get(e)}function Iv(e){let t=Wf.entries(),n=[];for(;;){let{done:a,value:r}=t.next();if(a)break;let[s,i]=r,[o]=s.split("_");o===e&&n.push(i)}return n}function Nb(e){let{kernelName:t,backendName:n}=e,a=KI(t,n);Wf.has(a)&&Bu(`The kernel '${t}' for backend '${n}' is already registered`),Wf.set(a,e)}function X8(e){let{kernelName:t}=e;jy.has(t)&&fe().getBool("DEBUG")&&Bu(`Overriding the gradient for '${t}'`),jy.set(t,e)}function Kae(e,t){let n=KI(e,t);if(!Wf.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);Wf.delete(n)}function Xae(e){if(!jy.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);jy.delete(e)}function Yae(e,t){Iv(e).forEach(n=>{let a=Object.assign({},n,{backendName:t});Nb(a)})}function KI(e,t){return`${t}_${e}`}var R={};Xt(R,{arraysEqual:()=>Gl,arraysEqualWithNull:()=>$8,assert:()=>Z,assertNonNegativeIntegerDimensions:()=>ci,assertNonNull:()=>Hd,assertShapesMatch:()=>Ns,bytesFromStringArray:()=>P8,bytesPerElement:()=>Nv,checkConversionForErrors:()=>O8,clamp:()=>_y,computeStrides:()=>dm,convertBackendValuesAndArrayBuffer:()=>Mae,createScalarValue:()=>nre,createShuffledIndices:()=>_ae,decodeString:()=>Tv,distSquared:()=>Eae,encodeString:()=>Eb,fetch:()=>rre,fingerPrint64:()=>tre,flatten:()=>Xu,getArrayFromDType:()=>VI,getTypedArrayFromDType:()=>F8,hasEncodingLoss:()=>Rae,hexToLong:()=>Cb,indexToLoc:()=>Fae,inferDtype:()=>nb,inferFromImplicitShape:()=>Dae,isBoolean:()=>z8,isFunction:()=>Ku,isInt:()=>Pf,isNumber:()=>U8,isPromise:()=>xw,isScalarShape:()=>Iae,isString:()=>Ou,isTypedArray:()=>jr,isValidDtype:()=>L8,locToIndex:()=>Bae,makeOnesTypedArray:()=>HI,makeZerosNestedTypedArray:()=>$ae,makeZerosTypedArray:()=>gw,nearestDivisor:()=>Cv,nearestLargerEven:()=>kae,now:()=>Ry,parseAxisParam:()=>no,randUniform:()=>Cae,repeatedTry:()=>jae,rightPad:()=>oy,shuffle:()=>M8,shuffleCombo:()=>Sae,sizeFromShape:()=>Hn,sizeToSquarishShape:()=>Aae,squeezeShape:()=>B8,sum:()=>Nae,swap:()=>kv,tanh:()=>Tae,toNestedArray:()=>Rf,toTypedArray:()=>jw});function Y8(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var $5=dc(sae()),ld=$5.default||$5;function Cb(e){return ld.fromString(e,!0,16)}var J8=Cb("c3a5c85c97cb3127"),ad=Cb("b492b66fbe98f273"),ms=Cb("9ae16a3b2f90404f");function FC(e){return e.xor(e.shru(47))}function Q8(e,t,n){let a=e.slice(t,t+n);return ld.fromBytes(Array.from(a),!0,!0)}function la(e,t){return Q8(e,t,8)}function B5(e,t){return Q8(e,t,4)}function _r(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Wu(e,t,n=Cb("9ddfea08eb382d69")){let a=e.xor(t).mul(n);a=a.xor(a.shru(47));let r=t.xor(a).mul(n);return r=r.xor(r.shru(47)),r=r.mul(n),r}function Jae(e,t,n,a,r,s){r=r.add(e),s=_r(s.add(r).add(a),21);let i=r;return r=r.add(t),r=r.add(n),s=s.add(_r(r,44)),[r.add(a),s.add(i)]}function A1(e,t,n,a){return Jae(la(e,t),la(e,t+8),la(e,t+16),la(e,t+24),n,a)}function Qae(e,t=e.length){if(t>=8){let n=ms.add(t*2),a=la(e,0).add(ms),r=la(e,t-8),s=_r(r,37).mul(n).add(a),i=_r(a,25).add(r).mul(n);return Wu(s,i,n)}if(t>=4){let n=ms.add(t*2),a=B5(e,0);return Wu(a.shl(3).add(t),B5(e,t-4),n)}if(t>0){let n=e[0],a=e[t>>1],r=e[t-1],s=n+(a<<8),i=t+(r<<2);return FC(ms.mul(s).xor(J8.mul(i))).mul(ms)}return ms}function Zae(e,t=e.length){let n=ms.add(t*2),a=la(e,0).mul(ad),r=la(e,8),s=la(e,t-8).mul(n),i=la(e,t-16).mul(ms);return Wu(_r(a.add(r),43).add(_r(s,30)).add(i),a.add(_r(r.add(ms),18)).add(s),n)}function ere(e,t=e.length){let n=ms.add(t*2),a=la(e,0).mul(ms),r=la(e,8),s=la(e,t-8).mul(n),i=la(e,t-16).mul(ms),o=_r(a.add(r),43).add(_r(s,30)).add(i),l=Wu(o,a.add(_r(r.add(ms),18)).add(s),n),d=la(e,16).mul(n),c=la(e,24),f=o.add(la(e,t-32)).mul(n),m=l.add(la(e,t-24)).mul(n);return Wu(_r(d.add(c),43).add(_r(f,30)).add(m),d.add(_r(c.add(a),18)).add(f),n)}function tre(e,t=e.length){let n=ld.fromNumber(81,!0);if(t<=32)return t<=16?Qae(e,t):Zae(e,t);if(t<=64)return ere(e,t);let a=n,r=n.mul(ad).add(113),s=FC(r.mul(ms).add(113)).mul(ms),i=[ld.UZERO,ld.UZERO],o=[ld.UZERO,ld.UZERO];a=a.mul(ms).add(la(e,0));let l=0,d=(t-1>>6)*64,c=d+(t-1&63)-63;do a=_r(a.add(r).add(i[0]).add(la(e,l+8)),37).mul(ad),r=_r(r.add(i[1]).add(la(e,l+48)),42).mul(ad),a=a.xor(o[1]),r=r.add(i[0]).add(la(e,l+40)),s=_r(s.add(o[0]),33).mul(ad),i=A1(e,l,i[1].mul(ad),a.add(o[0])),o=A1(e,l+32,s.add(o[1]),r.add(la(e,l+16))),[s,a]=[a,s],l+=64;while(l!==d);let f=ad.add(s.and(255).shl(1));return l=c,o[0]=o[0].add(t-1&63),i[0]=i[0].add(o[0]),o[0]=o[0].add(i[0]),a=_r(a.add(r).add(i[0]).add(la(e,l+8)),37).mul(f),r=_r(r.add(i[1]).add(la(e,l+48)),42).mul(f),a=a.xor(o[1].mul(9)),r=r.add(i[0].mul(9).add(la(e,l+40))),s=_r(s.add(o[0]),33).mul(f),i=A1(e,l,i[1].mul(f),a.add(o[0])),o=A1(e,l+32,s.add(o[1]),r.add(la(e,l+16))),[s,a]=[a,s],Wu(Wu(i[0],o[0],f).add(FC(r).mul(J8)).add(s),Wu(i[1],o[1],f).add(a),f)}function nre(e,t){return t==="string"?Eb(e):jw([e],t)}function are(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function jw(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=Xu(e)),fe().getBool("DEBUG")&&O8(e,t),are(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let a=0;a<n.length;++a)Math.round(e[a])!==0&&(n[a]=1);return n}else throw new Error(`Unknown data type ${t}`)}function Ry(){return fe().platform.now()}function rre(e,t){return fe().platform.fetch(e,t)}function Eb(e,t="utf-8"){return t=t||"utf-8",fe().platform.encode(e,t)}function Tv(e,t="utf-8"){return t=t||"utf-8",fe().platform.decode(e,t)}function jr(e){return fe().platform.isTypedArray!=null?fe().platform.isTypedArray(e):Y8(e)}function Xu(e,t=[],n=!1){if(t==null&&(t=[]),typeof e=="boolean"||typeof e=="number"||typeof e=="string"||xw(e)||e==null||jr(e)&&n)t.push(e);else if(Array.isArray(e)||jr(e))for(let a=0;a<e.length;++a)Xu(e[a],t,n);else{let a=-1;for(let r of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(r)&&(a=Math.max(a,Number(r)));for(let r=0;r<=a;r++)Xu(e[r],t,n)}return t}var sre=class{constructor(e,t){this.backendTimer=e,this.logger=t,t==null&&(this.logger=new ore)}profileKernel(e,t,n){let a,r=()=>{a=n()},s,i=Ry();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(r);else{r();for(let o of a)o.dataSync();s=Promise.resolve({kernelMs:Ry()-i})}if(fe().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o<a.length;o++){let l=a[o];l.data().then(d=>{ire(d,l.dtype,e)})}return{kernelName:e,outputs:a,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:s}=e;n.forEach(i=>{Promise.all([i.data(),a,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],r,o[2])})})}};function ire(e,t,n){if(t!=="float32")return!1;for(let a=0;a<e.length;a++){let r=e[a];if(isNaN(r)||!isFinite(r))return console.warn(`Found ${r} in the result of '${n}'`),!0}return!1}var ore=class{logKernelProfile(e,t,n,a,r,s){let i=typeof a=="number"?oy(`${a}ms`,9):a.error,o=oy(e,25),l=t.rank,d=t.size,c=oy(t.shape.toString(),14),f="";for(let m in r){let x=r[m];if(x!=null){let y=x.shape||t.shape,b=y.length;f+=`${m}: ${b}D ${b>0?y:""} `}}console.log(`%c${o}	%c${i}	%c${l}D ${c}	%c${d}	%c${f}	%c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function lre(e,t,n){let a={},r={};for(let l=0;l<t.length;l++)a[t[l].id]=!0;for(let l=0;l<e.length;l++){let d=e[l],c=d.inputs;for(let f in c){let m=c[f],x=!1;for(let y=0;y<t.length;y++)if(a[m.id]){d.outputs.forEach(b=>a[b.id]=!0),x=!0,r[d.id]=!0;break}if(x)break}}let s={};s[n.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let d=e[l],c=d.inputs;for(let f=0;f<d.outputs.length;f++)if(s[d.outputs[f].id]){for(let m in c)s[c[m].id]=!0,i[d.id]=!0;break}}let o=[];for(let l=0;l<e.length;l++){let d=e[l];if(r[d.id]&&i[d.id]){let c={};for(let m in d.inputs){let x=d.inputs[m];a[x.id]&&(c[m]=x)}let f=Object.assign({},d);f.inputs=c,f.outputs=d.outputs,o.push(f)}}return o}function ure(e,t,n,a){for(let r=t.length-1;r>=0;r--){let s=t[r],i=[];if(s.outputs.forEach(l=>{let d=e[l.id];d!=null?i.push(d):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let d=n(()=>o[l]());if(d.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${d.dtype}'`);let c=s.inputs[l];if(!Gl(d.shape,c.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${d.shape}', which does not match the shape of the input '${c.shape}'`);if(e[c.id]==null)e[c.id]=d;else{let f=e[c.id];e[c.id]=a(f,d),f.dispose()}}}}var F5=20,Rx=3,kN=7;function cre(e,t,n,a){let r=dm(t),s=dre(e,t,n,r),i=t.length,o=av(e,t,n,r,s),l=["Tensor"];return a&&(l.push(`  dtype: ${n}`),l.push(`  rank: ${i}`),l.push(`  shape: [${t}]`),l.push("  values:")),l.push(o.map(d=>"    "+d).join(`
63`)),l.join(`
64`)}function dre(e,t,n,a){let r=Hn(t),s=a[a.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?Wx(e):e;if(o>1)for(let d=0;d<r/s;d++){let c=d*s;for(let f=0;f<s;f++)i[f]=Math.max(i[f],Ux(l[c+f],0,n).length)}return i}function Ux(e,t,n){let a;return Array.isArray(e)?a=`${parseFloat(e[0].toFixed(kN))} + ${parseFloat(e[1].toFixed(kN))}j`:Ou(e)?a=`'${e}'`:n==="bool"?a=Z8(e):a=parseFloat(e.toFixed(kN)).toString(),oy(a,t)}function Z8(e){return e===0?"false":"true"}function av(e,t,n,a,r,s=!0){let i=n==="complex64"?2:1,o=t[0],l=t.length;if(l===0){if(n==="complex64"){let b=Wx(e);return[Ux(b[0],0,n)]}return n==="bool"?[Z8(e[0])]:[e[0].toString()]}if(l===1){if(o>F5){let b=Rx*i,w=Array.from(e.slice(0,b)),S=Array.from(e.slice((o-Rx)*i,o*i));return n==="complex64"&&(w=Wx(w),S=Wx(S)),["["+w.map((k,C)=>Ux(k,r[C],n)).join(", ")+", ..., "+S.map((k,C)=>Ux(k,r[o-Rx+C],n)).join(", ")+"]"]}return["["+(n==="complex64"?Wx(e):Array.from(e)).map((b,w)=>Ux(b,r[w],n)).join(", ")+"]"]}let d=t.slice(1),c=a.slice(1),f=a[0]*i,m=[];
vendor: 8,526 bytes, lines 64-66
64if(o>F5){for(let b=0;b<Rx;b++){let w=b*f,S=w+f;m.push(...av(e.slice(w,S),d,n,c,r,!1))}m.push("...");for(let b=o-Rx;b<o;b++){let w=b*f,S=w+f;m.push(...av(e.slice(w,S),d,n,c,r,b===o-1))}}else for(let b=0;b<o;b++){let w=b*f,S=w+f;m.push(...av(e.slice(w,S),d,n,c,r,b===o-1))}let x=l===2?",":"";m[0]="["+(o>0?m[0]+x:"");for(let b=1;b<m.length-1;b++)m[b]=" "+m[b]+x;let y=`,
65`;for(let b=2;b<l;b++)y+=`
66`;return m[m.length-1]=" "+m[m.length-1]+"]"+(s?"":y),m}function Wx(e){let t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var ar=class{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=Hn(e),n!=null){let a=n.length;Z(a===this.size,()=>`Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="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=n||VI(t,this.size),this.strides=dm(e)}set(e,...t){t.length===0&&(t=[0]),Z(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r=`Requested out of range element at ${e}.   Buffer shape=${this.shape}`;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;a<e.length-1;++a)n+=this.strides[a]*e[a];return this.values[n]}locToIndex(e){if(this.rank===0)return 0;if(this.rank===1)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(this.rank===0)return[];if(this.rank===1)return[e];let t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return ko().makeTensor(this.values,this.shape,this.dtype)}},ko=null,vf=null;function hre(e){ko=e}function pre(e){vf=e}var en=class{constructor(e,t,n,a){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Hn(e),this.strides=dm(e),this.dataId=n,this.id=a,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){let e=await this.data();return vf.buffer(this.shape,this.dtype,e)}bufferSync(){return vf.buffer(this.shape,this.dtype,this.dataSync())}async array(){let e=await this.data();return Rf(this.shape,e,this.dtype==="complex64")}arraySync(){return Rf(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();let e=ko().read(this.dataId);if(this.dtype==="string"){let t=await e;try{return t.map(n=>Tv(n))}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(),ko().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();let e=ko().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>Tv(t))}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();let e=await ko().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),ko().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return vf.print(this,e)}clone(){return this.throwIfDisposed(),vf.clone(this)}toString(e=!1){let t=this.dataSync();return cre(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),vf.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),ko().makeVariable(this,e,t,n)}};Object.defineProperty(en,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Ce(){return qI("Tensor",()=>en)}Ce();var Id=class extends en{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a),this.trainable=t,this.name=n}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(!Gl(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);ko().disposeTensor(this),this.dataId=e.dataId,ko().incRef(this,null)}dispose(){ko().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Id,Symbol.hasInstance,{value:e=>e instanceof en&&e.assign!=null&&e.assign instanceof Function});var Co={};Xt(Co,{assertTypesMatch:()=>nL,getTensorsInContainer:()=>XI,isTensorInList:()=>mre,makeTypesMatch:()=>ka});var OC;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(OC||(OC={}));var LC;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(LC||(LC={}));var PC;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(PC||(PC={}));var zC;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(zC||(zC={}));var UC;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(UC||(UC={}));var fre={float32:zC,int32:LC,bool:PC,complex64:UC};function Di(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return fre[e][t]}function Dw(e){return Di(e,"int32")}function eL(e){return e!=null&&typeof e=="object"&&"texture"in e&&e.texture instanceof WebGLTexture}function tL(e){return typeof GPUBuffer<"u"&&e!=null&&typeof e=="object"&&"buffer"in e&&e.buffer instanceof GPUBuffer}function ka(e,t){if(e.dtype===t.dtype)return[e,t];let n=Di(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function nL(e,t){Z(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function mre(e,t){return t.some(n=>n.id===e.id)}function XI(e){let t=[];return aL(e,t,new Set),t}function aL(e,t,n){if(e==null)return;if(e instanceof en){t.push(e);return}if(!gre(e))return;let a=e;for(let r in a){let s=a[r];n.has(s)||(n.add(s),aL(s,t,n))}}function gre(e){return Array.isArray(e)||typeof e=="object"}function NN(e){return e.kernelName!=null}var O5=class{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(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},YI=class WC{constructor(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new O5}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let t=this.getSortedBackends();for(let n=0;n<t.length;n++){let a=t[n];if(await this.initializeBackend(a).success){await this.setBackend(a);return}}throw new Error("Could not initialize any backends, all backend initializations failed.")}get 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){let{name:t,asyncInit:n}=this.initializeBackendsAndReturnBest();if(n)throw new Error(`The highest priority backend '${t}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(t)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(t){if(!(t in this.registry))if(t in this.registryFactory){let{asyncInit:n}=this.initializeBackend(t);if(n)return null}else return null;return this.registry[t]}findBackendFactory(t){return t in this.registryFactory?this.registryFactory[t].factory:null}registerBackend(t,n,a=1){return t in this.registryFactory?(Bu(`${t} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[t]={factory:n,priority:a},!0)}async setBackend(t){if(this.registryFactory[t]==null)throw new Error(`Backend name '${t}' not found in registry`);
vendor: 9,228 bytes, line 66
66if(this.backendName=t,this.registry[t]==null){this.backendInstance=null;let{success:n,asyncInit:a}=this.initializeBackend(t);if(!(a?await n:n))return!1}return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new sre(this.backendInstance),!0}setupRegisteredKernels(){Iv(this.backendName).forEach(t=>{t.setupFunc!=null&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(t){Iv(t).forEach(n=>{n.disposeFunc!=null&&n.disposeFunc(this.registry[t])})}initializeBackend(t){let n=this.registryFactory[t];if(n==null)throw new Error(`Cannot initialize backend ${t}, no registration found.`);try{let a=n.factory();if(a&&!(a instanceof tb)&&typeof a.then=="function"){let r=++this.pendingBackendInitId,s=a.then(i=>r<this.pendingBackendInitId?!1:(this.registry[t]=i,this.pendingBackendInit=null,!0)).catch(i=>(r<this.pendingBackendInitId||(this.pendingBackendInit=null,Bu(`Initialization of backend ${t} failed`),Bu(i.stack||i.message)),!1));return this.pendingBackendInit=s,{success:s,asyncInit:!0}}else return this.registry[t]=a,{success:!0,asyncInit:!1}}catch(a){return Bu(`Initialization of backend ${t} failed`),Bu(a.stack||a.message),{success:!1,asyncInit:!1}}}removeBackend(t){if(!(t in this.registryFactory))throw new Error(`${t} backend not found in registry`);this.backendName===t&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,t in this.registry&&(this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(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((t,n)=>this.registryFactory[n].priority-this.registryFactory[t].priority)}initializeBackendsAndReturnBest(){let t=this.getSortedBackends();for(let n=0;n<t.length;n++){let a=t[n],{success:r,asyncInit:s}=this.initializeBackend(a);if(s||r)return{name:a,asyncInit:s}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(t,n){let a=this.state.tensorInfo.get(n),r=a.backend,s=this.readSync(n),i=r.refCount(n);r.disposeData(n,!0),a.backend=t,t.move(n,s,a.shape,a.dtype,i),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(t,n){let a=null;if(n==null){if(typeof t!="function")throw new Error("Please provide a function to tidy()");n=t}else{if(typeof t!="string"&&!(t 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");a=t}let r;return this.scopedRun(()=>this.startScope(a),()=>this.endScope(r),()=>(r=n(),r instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),r))}scopedRun(t,n,a){t();try{let r=a();return n(),r}catch(r){throw n(),r}}nextTensorId(){return WC.nextTensorId++}nextVariableId(){return WC.nextVariableId++}clone(t){let n=ae.runKernel(wh,{x:t}),a={x:t},r=i=>({x:()=>{let o="float32",l={x:i},d={dtype:o};return ae.runKernel(nh,l,d)}}),s=[];return this.addTapeNode(this.state.activeScope.name,a,[n],r,s,{}),n}runKernel(t,n,a){if(this.backendName==null&&this.backend,Dy(t,this.backendName)==null)throw new Error(`Kernel '${t}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:t,inputs:n,attrs:a})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(t,n,a){let r=this.backend.numDataIds(),s=0;a.forEach(l=>{s+=l.dtype==="complex64"?3:1});let i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-n-s-i;if(o>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${o} data ids) after running '${t}'`)}runKernelFunc(t){let n,a=[],r=this.isTapeOn(),s=this.state.numBytes,i=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let o;this.backendName==null&&this.backend;let l,d=NN(t)?t.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(NN(t)){let{kernelName:y,inputs:b,attrs:w}=t;this.backendName==null&&this.backend;let S=Dy(y,this.backendName);Z(S!=null,()=>`Cannot find registered kernel '${y}' for backend '${this.backendName}'`),o=()=>{let k=this.backend.numDataIds();l=S.kernelFunc({inputs:b,attrs:w,backend:this.backend});let C=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(y,k,C);let E=C.map(T=>T.rank!=null?T:this.makeTensorFromTensorInfo(T));if(r){let T=this.getTensorsForGradient(y,b,E);a=this.saveTensorsForBackwardMode(T)}return E}}else{let{forwardFunc:y}=t,b=w=>{r&&(a=w.map(S=>this.keep(this.clone(S))))};o=()=>{let w=this.backend.numDataIds();l=this.tidy(()=>y(this.backend,b));let S=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(d,w,S),S}}let{inputs:c,attrs:f}=t,m=NN(t)?null:t.backwardsFunc,x;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?n=o():(x=this.profiler.profileKernel(d,c,()=>o()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(x),n=x.outputs)}),r&&this.addTapeNode(d,c,n,m,a,f),this.state.profiling&&this.state.activeProfile.kernels.push({name:d,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(c).map(y=>c[y]!=null?c[y].shape:null),outputShapes:n.map(y=>y.shape),kernelTimeMs:x.timeMs,extraInfo:x.extraInfo}),Array.isArray(l)?n:n[0]}saveTensorsForBackwardMode(t){return t.map(n=>this.keep(this.clone(n)))}getTensorsForGradient(t,n,a){let r=BC(t);if(r!=null){let s=r.inputsToSave||[],i=r.outputsToSave||[],o;r.saveAllInputs?(Z(Array.isArray(n),()=>"saveAllInputs is true, expected inputs to be an array."),o=Object.keys(n).map(d=>n[d])):o=s.map(d=>n[d]);let l=a.filter((d,c)=>i[c]);return o.concat(l)}return[]}makeTensor(t,n,a,r){if(t==null)throw new Error("Values passed to engine.makeTensor() are null");a=a||"float32",r=r||this.backend;let s=t;a==="string"&&Ou(t[0])&&(s=t.map(l=>Eb(l)));let i=r.write(s,n,a),o=new en(n,a,i,this.nextTensorId());if(this.trackTensor(o,r),a==="string"){let l=this.state.tensorInfo.get(i),d=P8(s);this.state.numBytes+=d-l.bytes,l.bytes=d}return o}makeTensorFromDataId(t,n,a,r){a=a||"float32";let s={dataId:t,shape:n,dtype:a};return this.makeTensorFromTensorInfo(s,r)}makeTensorFromTensorInfo(t,n){let{dataId:a,shape:r,dtype:s}=t,i=new en(r,s,a,this.nextTensorId());return this.trackTensor(i,n),i}makeVariable(t,n=!0,a,r){a=a||this.nextVariableId().toString(),r!=null&&r!==t.dtype&&(t=t.cast(r));let s=new Id(t,n,a,this.nextTensorId());if(this.state.registeredVariables[s.name]!=null)throw new Error(`Variable with name ${s.name} was already registered`);return this.state.registeredVariables[s.name]=s,this.incRef(s,this.backend),s}trackTensor(t,n){this.state.numTensors++,t.dtype==="string"&&this.state.numStringTensors++;let a=0;t.dtype!=="complex64"&&t.dtype!=="string"&&(a=t.size*Nv(t.dtype)),this.state.numBytes+=a,this.state.tensorInfo.has(t.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(t.dataId,{backend:n||this.backend,dtype:t.dtype,shape:t.shape,bytes:a})),t instanceof Id||this.track(t)}incRef(t,n){this.trackTensor(t,n),this.backend.incRef(t.dataId)}removeDataId(t,n){this.state.tensorInfo.has(t)&&this.state.tensorInfo.get(t).backend===n&&(this.state.tensorInfo.delete(t),this.state.numDataBuffers--)}disposeTensor(t){if(!this.state.tensorInfo.has(t.dataId))return;let n=this.state.tensorInfo.get(t.dataId);if(this.state.numTensors--,t.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=n.bytes),t.dtype!=="complex64"&&t.dtype!=="string"){let a=t.size*Nv(t.dtype);this.state.numBytes-=a}n.backend.disposeData(t.dataId)&&this.removeDataId(t.dataId,n.backend)}disposeVariables(){for(let t in this.state.registeredVariables){let n=this.state.registeredVariables[t];this.disposeVariable(n)}}disposeVariable(t){this.disposeTensor(t),this.state.registeredVariables[t.name]!=null&&delete this.state.registeredVariables[t.name]}memory(){let t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,t.reasons==null&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t}async profile(t){this.state.profiling=!0;let n=this.state.numBytes,a=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(r=>r.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-n,this.state.activeProfile.newTensors=this.state.numTensors-a;for(let r of this.state.activeProfile.kernels)r.kernelTimeMs=await r.kernelTimeMs,r.extraInfo=await r.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>
660&&this.state.kernelDepth===0}addTapeNode(t,n,a,r,s,i){let o={id:this.state.nextTapeNodeId++,kernelName:t,inputs:n,outputs:a,saved:s},l=BC(t);l!=null&&(r=l.gradFunc),r!=null&&(o.gradient=d=>(d=d.map((c,f)=>{if(c==null){let m=a[f],x=gw(m.size,m.dtype);return this.makeTensor(x,m.shape,m.dtype)}return c}),r(d.length>1?d:d[0],s,i))),this.state.activeTape.push(o)}keep(t){return t.kept=!0,t}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(t){let n={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(n.name=t),this.state.scopeStack.push(n),this.state.activeScope=n}endScope(t){let n=XI(t),a=new Set(n.map(s=>s.id));for(let s=0;s<this.state.activeScope.track.length;s++){let i=this.state.activeScope.track[s];!i.kept&&!a.has(i.id)&&i.dispose()}let r=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(s=>{!s.kept&&s.scopeId===r.id&&this.track(s)})}gradients(t,n,a,r=!1){if(Z(n.length>0,()=>"gradients() received an empty list of xs."),a!=null&&a.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${a.dtype}'`);let s=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",t));Z(s instanceof en,()=>"The result y returned by f() must be a tensor.");let i=lre(this.state.activeTape,n,s);if(!r&&i.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",()=>{let o={};o[s.id]=a??xre(s.shape),ure(o,i,d=>this.tidy(d),yre);let l=n.map(d=>o[d.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(d=>{for(let c of d.saved)c.dispose()}),this.state.activeTape=null),{value:s,grads:l}})}customGrad(t){return Z(Ku(t),()=>"The f passed in customGrad(f) must be a function."),(...n)=>{Z(n.every(o=>o instanceof en),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let a,r={};n.forEach((o,l)=>{r[l]=o});let s=(o,l)=>(a=t(...n,l),Z(a.value instanceof en,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),Z(Ku(a.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),a.value),i=(o,l)=>{let d=a.gradFunc(o,l),c=Array.isArray(d)?d:[d];Z(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(...)."),Z(c.every(m=>m instanceof en),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let f={};return c.forEach((m,x)=>{f[x]=()=>m}),f};return this.runKernelFunc({forwardFunc:s,backwardsFunc:i,inputs:r})}}readSync(t){return this.state.tensorInfo.get(t).backend.readSync(t)}read(t){return this.state.tensorInfo.get(t).backend.read(t)}readToGPU(t,n){return this.state.tensorInfo.get(t).backend.readToGPU(t,n)}async time(t){let n=Ry(),a=await this.backend.time(t);return a.wallMs=Ry()-n,a}track(t){return this.state.activeScope!=null&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new O5;for(let t in this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};YI.nextTensorId=0;YI.nextVariableId=0;function xre(e){let t=HI(Hn(e),"float32");return ae.makeTensor(t,e,"float32")}function rL(){let e=H8();if(e._tfengine==null){let t=new V8(e);e._tfengine=new YI(t)}return zae(e._tfengine.ENV),hre(()=>e._tfengine),e._tfengine}var ae=rL();function yre(e,t){let n={a:e,b:t};return ae.runKernel(hc,n)}var Ib={};Xt(Ib,{isBrowser:()=>sL,isMobile:()=>wre,mockIsMobile:()=>vre});function bre(){return typeof navigator<"u"&&navigator!=null}var VC;function vre(e){VC=e}function wre(e){if(VC!==void 0)return VC;if(e||bre()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||(typeof window<"u"?window.opera:"");if(!t){let n=e;return n.userAgentData&&n.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
66sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function sL(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}var Os=fe();Os.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});Os.registerFlag("IS_BROWSER",()=>sL());Os.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u");Os.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));Os.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor));Os.registerFlag("PROD",()=>!1);Os.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Os.getBool("DEBUG"));Os.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);Os.registerFlag("IS_TEST",()=>!1);Os.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>Os.getBool("DEBUG"));Os.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);Os.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1);Os.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);function rl(e,t){let n=e;if(jr(e))return t==="string"?[]:[e.length];if(eL(e)){let r=e.channels||"RGBA";return[e.height,e.width*r.length]}else if(tL(e))return[e.buffer.size/(t==null?4:Nv(t))];if(!Array.isArray(e))return[];let a=[];for(;Array.isArray(n)||jr(n)&&t!=="string";)a.push(n.length),n=n[0];return Array.isArray(e)&&fe().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&iL(e,a,[]),a}function iL(e,t,n){if(n=n||[],!Array.isArray(e)&&!jr(e)){Z(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}Z(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),Z(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let a=t.slice(1);for(let r=0;r<e.length;++r)iL(e[r],a,n.concat(r))}function L5(e,t,n,a){if(e!=="string_or_numeric"){if(e==null)throw new Error("Expected dtype cannot be null.");if(e!=="numeric"&&e!==t||e==="numeric"&&t==="string")throw new Error(`Argument '${n}' passed to '${a}' must be ${e} tensor, but got ${t} tensor`)}}function q(e,t,n,a="numeric"){if(e instanceof Ce())return L5(a,e.dtype,t,n),e;let r=nb(e);if(r!=="string"&&["bool","int32","float32"].indexOf(a)>=0&&(r=a),L5(a,r,t,n),e==null||!jr(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${o}'`)}let s=rl(e,r);!jr(e)&&!Array.isArray(e)&&(e=[e]);let i=r!=="string"?jw(e,r):Xu(e,[],!0);return ae.makeTensor(i,s,r)}function My(e,t,n,a="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((r,s)=>q(r,`${t}[${s}]`,n,a))}var JI="__op";function re(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0],a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+JI;let r=(...s)=>{ae.startScope(n);try{let i=a(...s);return xw(i)&&console.error("Cannot return a Promise inside of tidy."),ae.endScope(i),i}catch(i){throw ae.endScope(null),i}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}function Sre(e,t){let n=q(e,"real","complex"),a=q(t,"imag","complex");Ns(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);let r={real:n,imag:a};return ae.runKernel(yw,r)}var Ul=re({complex_:Sre});function gc(e,t,n,a){if(a==null)a=nb(e);else if(a==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");
vendor: 15,053 bytes, line 66
66if(tL(e)||eL(e)){if(a!=="float32"&&a!=="int32")throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${a}.`);return ae.backend.createTensorFromGPUData(e,t||n,a)}if(!jr(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="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(t!=null){ci(t);let r=Hn(t),s=Hn(n);Z(r===s,()=>`Based on the provided shape, [${t}], the tensor should have ${r} values but has ${s}`);for(let i=0;i<n.length;++i){let o=n[i],l=i===n.length-1?o!==Hn(t.slice(i)):!0;Z(n[i]===t[i]||!l,()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!jr(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=a!=="string"?jw(e,a):Xu(e,[],!0),ae.makeTensor(e,t,a)}function bs(e,t,n){let a=rl(e,n);return gc(e,t,a,n)}var Td={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},ql=class oL{static join(t){return new oL(t).slice()}constructor(t){if(this.shards=[],this.previousShardIndex=0,t==null||(t instanceof Array||(t=[t]),t=t.map(a=>jr(a)?a.buffer:a),t.length===0))return;this.bufferUniformSize=t[0].byteLength;let n=0;for(let a=0;a<t.length;a++){let r=t[a];a!==t.length-1&&r.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);let s=n+r.byteLength;this.shards.push({buffer:r,start:n,end:s}),n=s}this.shards.length===0&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(t=0,n=this.byteLength){if(this.shards.length===0)return new ArrayBuffer(0);if(t=isNaN(Number(t))?0:t,n=isNaN(Number(n))?0:n,t=Math.max(0,t),n=Math.min(this.byteLength,n),n<=t)return new ArrayBuffer(0);let a=this.findShardForByte(t);if(a===-1)throw new Error(`Could not find start shard for byte ${t}`);let r=n-t,s=new ArrayBuffer(r),i=new Uint8Array(s),o=0;for(let l=a;l<this.shards.length;l++){let d=this.shards[l],c=t+o-d.start,f=o,m=Math.min(n,d.end)-d.start,x=new Uint8Array(d.buffer,c,m-c);if(i.set(x,f),o+=x.length,n<d.end)break}return s}findShardForByte(t){if(this.shards.length===0||t<0||t>=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(t/this.bufferUniformSize),this.previousShardIndex;function n(r){return t<r.start?-1:t>=r.end?1:0}if(n(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;let a=kre(this.shards,n);return a===-1?-1:(this.previousShardIndex=a,this.previousShardIndex)}};function kre(e,t){let n=0,a=e.length;for(;n<=a;){let r=Math.floor((a-n)/2)+n,s=t(e[r]);if(s===0)return r;s<0?a=r:n=r+1}return-1}function Nre(){fe().set("PROD",!0)}function Cre(){fe().set("DEBUG",!0)}function Ere(){fe().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function lL(e){fe().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Ire(){ae.disposeVariables()}function Ji(){return ae}function HC(){return ae.memory()}function Tre(e){return ae.profile(e)}function ue(e,t){return ae.tidy(e,t)}function Kt(e){XI(e).forEach(t=>t.dispose())}function xr(e){return ae.keep(e)}function Are(e){return ae.time(e)}function _re(e){return ae.setBackend(e)}function jre(){return ae.ready()}function uL(){return ae.backendName}function Dre(e){ae.removeBackend(e)}function Rre(e){return ae.findBackend(e)}function Mre(e){return ae.findBackendFactory(e)}function Rw(e,t,n=1){return ae.registerBackend(e,t,n)}function QI(){return ae.backend}function $re(e,t){fe().setPlatform(e,t)}var Yu=4;async function Bre(e,t){let n=[],a=[],r=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i<r.length;++i){let o=r[i],l=Array.isArray(e)?e[i].tensor:e[o];if(l.dtype!=="float32"&&l.dtype!=="int32"&&l.dtype!=="bool"&&l.dtype!=="string"&&l.dtype!=="complex64")throw new Error(`Unsupported dtype in weight '${o}': ${l.dtype}`);let d={name:o,shape:l.shape,dtype:l.dtype};if(l.dtype==="string"){let c=new Promise(async f=>{let m=await l.bytes(),x=m.reduce((w,S)=>w+S.length,0)+Yu*m.length,y=new Uint8Array(x),b=0;for(let w=0;w<m.length;w++){let S=m[w],k=new Uint8Array(new Uint32Array([S.length]).buffer);y.set(k,b),b+=Yu,y.set(S,b),b+=S.length}f(y)});a.push(c)}else a.push(l.data());t!=null&&(d.group=t),n.push(d)}let s=await Promise.all(a);return{data:Lre(s),specs:n}}function cL(e,t){let n=new ql(e),a={},r=0;for(let s of t){let i=Fre(s,(o,l)=>n.slice(r+o,r+l));a[s.name]=dL(s,n.slice(r,r+i)),r+=i}return a}function Fre(e,t){let n=Hn(e.shape),a;if("quantization"in e){let r=e.quantization;a=Td[r.dtype]}else if(e.dtype==="string"){let r=0;for(let s=0;s<n;s++)r+=Yu+new Uint32Array(t(r,r+Yu))[0];return r}else a=Td[e.dtype];return n*a}async function Ore(e,t){let n=Hn(e.shape),a;if("quantization"in e){let r=e.quantization;a=Td[r.dtype]}else if(e.dtype==="string"){let r=0;for(let s=0;s<n;s++)r+=Yu+new Uint32Array(await t(r,r+Yu))[0];return r}else a=Td[e.dtype];return n*a}function dL(e,t){let n=e.name,a=e.dtype,r=e.shape,s=Hn(r),i,o=0;if("quantization"in e){let l=e.quantization;if(l.dtype==="uint8"||l.dtype==="uint16"){if(!("min"in l&&"scale"in l))throw new Error(`Weight ${e.name} with quantization ${l.dtype} doesn't have corresponding metadata min and scale.`)}else if(l.dtype==="float16"){if(a!=="float32")throw new Error(`Weight ${e.name} is quantized with ${l.dtype} which only supports weights of type float32 not ${a}.`)}else throw new Error(`Weight ${e.name} has unknown quantization dtype ${l.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);let d=Td[l.dtype],c=l.dtype==="uint8"?new Uint8Array(t):new Uint16Array(t);if(a==="float32")if(l.dtype==="uint8"||l.dtype==="uint16"){i=new Float32Array(c.length);for(let f=0;f<c.length;f++){let m=c[f];i[f]=m*l.scale+l.min}}else if(l.dtype==="float16")i=Gre()(c);else throw new Error(`Unsupported quantization type ${l.dtype} for weight type float32.`);else if(a==="int32"){if(l.dtype!=="uint8"&&l.dtype!=="uint16")throw new Error(`Unsupported quantization type ${l.dtype} for weight type int32.`);i=new Int32Array(c.length);for(let f=0;f<c.length;f++){let m=c[f];i[f]=Math.round(m*l.scale+l.min)}}else throw new Error(`Unsupported dtype in weight '${n}': ${a}`);o+=s*d}else if(a==="string"){let l=Hn(e.shape);i=[];for(let d=0;d<l;d++){let c=new Uint32Array(t.slice(o,o+Yu))[0];o+=Yu;let f=new Uint8Array(t.slice(o,o+c));i.push(f),o+=c}}else{let l=Td[a];if(a==="float32")i=new Float32Array(t);else if(a==="int32")i=new Int32Array(t);else if(a==="bool")i=new Uint8Array(t);else if(a==="complex64"){i=new Float32Array(t);let d=new Float32Array(i.length/2),c=new Float32Array(i.length/2);for(let y=0;y<d.length;y++)d[y]=i[y*2],c[y]=i[y*2+1];let f=bs(d,r,"float32"),m=bs(c,r,"float32"),x=Ul(f,m);return f.dispose(),m.dispose(),x}else throw new Error(`Unsupported dtype in weight '${n}': ${a}`);o+=s*l}return bs(i,r,a)}async function P5(e,t,n){let a=new Uint8Array(t);for(;a.byteLength<n;){let{done:r,value:s}=await e.read();if(r&&s==null){let o=n-a.byteLength;throw new Error(`Reader is done but ${o} bytes are still expected`)}let i=new Uint8Array(a.length+s.byteLength);i.set(a,0),i.set(new Uint8Array(s),a.length),a=i}return a.buffer}async function hL(e,t){let n={},a=e.getReader(),r=new ArrayBuffer(0);for(let s of t){let i=await Ore(s,async(d,c)=>(r=await P5(a,r,c),r.slice(d,c)));r=await P5(a,r,i);let o=r.slice(0,i);r=r.slice(i);let l=dL(s,o);if(n[s.name]=l,uL()==="webgpu"){let d=QI();"uploadToGPU"in d&&Hn(l.shape)>=fe().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&d.uploadToGPU(l.dataId)}}return n}function Lre(e){if(e===null)throw new Error(`Invalid input value: ${JSON.stringify(e)}`);let t=0,n=[];e.forEach(s=>{if(t+=s.byteLength,n.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let a=new Uint8Array(t),r=0;return n.forEach(s=>{a.set(new Uint8Array(s.buffer),r),r+=s.byteLength}),a.buffer}var ZI=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function z5(e){return ZI?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function Pre(e){if(ZI)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let a=0,r=t.length;a<r;a++)n+=String.fromCharCode(t[a]);return btoa(n)}function zre(e){if(ZI){let a=Buffer.from(e,"base64");return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;++a)n.set([t.charCodeAt(a)],a);return n.buffer}function Ure(e){return ql.join(e)}function U5(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function pL(e,t){let n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return e.signature!=null&&(n.signature=e.signature),e.userDefinedMetadata!=null&&(n.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(n.modelInitializer=e.modelInitializer),e.initializerSignature!=null&&(n.initializerSignature=e.initializerSignature),e.trainingConfig!=null&&(n.trainingConfig=e.trainingConfig),n}function fL(e,t,n){let a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(e.trainingConfig!=null&&(a.trainingConfig=e.trainingConfig),e.weightsManifest!=null){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");a.weightSpecs=t,a.weightData=n}return e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),e.initializerSignature!=null&&(a.initializerSignature=e.initializerSignature),a}async function eT(e,t){let n,a;return e.weightsManifest!=null&&([n,a]=await t(e.weightsManifest)),fL(e,n,a)}function Tb(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:z5(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:z5(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:new ql(e.weightData).byteLength}}function GC(e){let t=[];for(let n of e)t.push(...n.weights);return t}function Wre(){let e=n=>{let a=n<<13,r=0;for(;!(a&8388608);)r-=8388608,a<<=1;return a&=-8388609,r+=947912704,a|r},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function Vre(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function Hre(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function Gre(){let e=Wre(),t=Vre(),n=Hre();return a=>{let r=new ArrayBuffer(4*a.length),s=new Uint32Array(r);for(let i=0;i<a.length;i++){let o=a[i],l=e[n[o>>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(r)}}var Ri=class yo{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return yo.instance==null&&(yo.instance=new yo),yo.instance}static registerSaveRouter(t){yo.getInstance().saveRouters.push(t)}static registerLoadRouter(t){yo.getInstance().loadRouters.push(t)}static getSaveHandlers(t){return yo.getHandlers(t,"save")}static getLoadHandlers(t,n){return yo.getHandlers(t,"load",n)}static getHandlers(t,n,a){let r=[];return(n==="load"?yo.getInstance().loadRouters:yo.getInstance().saveRouters).forEach(s=>{let i=s(t,a);i!==null&&r.push(i)}),r}},qre=e=>Ri.registerSaveRouter(e),Kre=e=>Ri.registerLoadRouter(e),Xre=e=>Ri.getSaveHandlers(e),Yre=(e,t)=>Ri.getLoadHandlers(e,t),qC="tensorflowjs",KC=1,gd="models_store",Lu="model_info_store";function mL(){if(!fe().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window>"u"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function XC(e){let t=e.result;t.createObjectStore(gd,{keyPath:"modelPath"}),t.createObjectStore(Lu,{keyPath:"modelPath"})}var Ad=class{constructor(e){if(this.indexedDB=mL(),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,t){return new Promise((n,a)=>{let r=this.indexedDB.open(qC,KC);r.onupgradeneeded=()=>XC(r),r.onsuccess=()=>{let s=r.result;if(t==null){let i=s.transaction(gd,"readonly"),o=i.objectStore(gd).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),a(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(o.result.modelArtifacts)},o.onerror=l=>(s.close(),a(o.error)),i.oncomplete=()=>s.close()}else{t.weightData=ql.join(t.weightData);let i=Tb(t),o=s.transaction(Lu,"readwrite"),l=o.objectStore(Lu),d;try{d=l.put({modelPath:this.modelPath,modelArtifactsInfo:i})}catch(f){return a(f)}let c;d.onsuccess=()=>{c=s.transaction(gd,"readwrite");let f=c.objectStore(gd),m;try{m=f.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i})}catch(x){return a(x)}m.onsuccess=()=>n({modelArtifactsInfo:i}),m.onerror=x=>{l=o.objectStore(Lu);let y=l.delete(this.modelPath);y.onsuccess=()=>(s.close(),a(m.error)),y.onerror=b=>(s.close(),a(m.error))}},d.onerror=f=>(s.close(),a(d.error)),o.oncomplete=()=>{c==null?s.close():c.oncomplete=()=>s.close()}}},r.onerror=s=>a(r.error)})}};Ad.URL_SCHEME="indexeddb://";var gL=e=>fe().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ad.URL_SCHEME)?Jre(e.slice(Ad.URL_SCHEME.length)):null;Ri.registerSaveRouter(gL);Ri.registerLoadRouter(gL);function Jre(e){return new Ad(e)}function Qre(e){return e.startsWith(Ad.URL_SCHEME)?e.slice(Ad.URL_SCHEME.length):e}var Zre=class{constructor(){this.indexedDB=mL()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(qC,KC);n.onupgradeneeded=()=>XC(n),n.onsuccess=()=>{let a=n.result,r=a.transaction(Lu,"readonly"),s=r.objectStore(Lu).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(a.close(),t(s.error)),r.oncomplete=()=>a.close()},n.onerror=a=>t(n.error)})}async removeModel(e){return e=Qre(e),new Promise((t,n)=>{let a=this.indexedDB.open(qC,KC);a.onupgradeneeded=()=>XC(a),a.onsuccess=()=>{let r=a.result,s=r.transaction(Lu,"readwrite"),i=s.objectStore(Lu),o=i.get(e),l;o.onsuccess=()=>
vendor: 8,643 bytes, line 66
66{if(o.result==null)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let d=i.delete(e),c=()=>{l=r.transaction(gd,"readwrite");let f=l.objectStore(gd).delete(e);f.onsuccess=()=>t(o.result.modelArtifactsInfo),f.onerror=m=>n(o.error)};d.onsuccess=c,d.onerror=f=>(c(),r.close(),n(o.error))}},o.onerror=d=>(r.close(),n(o.error)),s.oncomplete=()=>{l==null?r.close():l.oncomplete=()=>r.close()}},a.onerror=r=>n(a.error)})}},Bl="/",wf="tensorflowjs_models",xL="info",ese="model_topology",tse="weight_specs",nse="weight_data",ase="model_metadata";function yL(e){return{info:[wf,e,xL].join(Bl),topology:[wf,e,ese].join(Bl),weightSpecs:[wf,e,tse].join(Bl),weightData:[wf,e,nse].join(Bl),modelMetadata:[wf,e,ase].join(Bl)}}function bL(e){for(let t of Object.values(e))window.localStorage.removeItem(t)}function rse(e){let t=e.split(Bl);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Bl)}function sse(e){return e.startsWith(_d.URL_SCHEME)?e.slice(_d.URL_SCHEME.length):e}var _d=class{constructor(e){if(!fe().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=yL(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.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=Tb(e),r=ql.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,Pre(r));let s={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(s)),{modelArtifactsInfo:a}}catch{throw bL(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=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){let 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.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(a==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;let r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){let i=JSON.parse(r);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer),i.initializerSignature!=null&&(t.initializerSignature=i.initializerSignature),i.trainingConfig!=null&&(t.trainingConfig=i.trainingConfig)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=zre(s),t}};_d.URL_SCHEME="localstorage://";var vL=e=>fe().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(_d.URL_SCHEME)?ise(e.slice(_d.URL_SCHEME.length)):null;Ri.registerSaveRouter(vL);Ri.registerLoadRouter(vL);function ise(e){return new _d(e)}var ose=class{constructor(){Z(fe().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),Z(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=wf+Bl,n=Bl+xL;for(let a=0;a<this.LS.length;++a){let r=this.LS.key(a);if(r.startsWith(t)&&r.endsWith(n)){let s=rse(r);e[s]=JSON.parse(this.LS.getItem(r))}}return e}async removeModel(e){e=sse(e);let t=yL(e);if(this.LS.getItem(t.info)==null)throw new Error(`Cannot find model at path '${e}'`);let n=JSON.parse(this.LS.getItem(t.info));return bL(t),n}},Mf="://",Ju=class Tu{constructor(){this.managers={}}static getInstance(){return Tu.instance==null&&(Tu.instance=new Tu),Tu.instance}static registerManager(t,n){Z(t!=null,()=>"scheme must not be undefined or null."),t.endsWith(Mf)&&(t=t.slice(0,t.indexOf(Mf))),Z(t.length>0,()=>"scheme must not be an empty string.");let a=Tu.getInstance();Z(a.managers[t]==null,()=>`A model store manager is already registered for scheme '${t}'.`),a.managers[t]=n}static getManager(t){let n=Tu.getInstance().managers[t];if(n==null)throw new Error(`Cannot find model manager for scheme '${t}'`);return n}static getSchemes(){return Object.keys(Tu.getInstance().managers)}};function rv(e){if(e.indexOf(Mf)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Ju.getSchemes().join(",")}`);return{scheme:e.split(Mf)[0],path:e.split(Mf)[1]}}async function wL(e,t,n=!1){Z(e!==t,()=>`Old path and new path are the same: '${e}'`);let a=Ri.getLoadHandlers(e);Z(a.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),Z(a.length<2,()=>`Copying failed because more than one (${a.length}) load handlers for source URL ${e}.`);let r=a[0],s=Ri.getSaveHandlers(t);Z(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),Z(s.length<2,()=>`Copying failed because more than one (${a.length}) save handlers for destination URL ${t}.`);let i=s[0],o=rv(e).scheme,l=rv(e).path,d=o===rv(e).scheme,c=await r.load();n&&d&&await Ju.getManager(o).removeModel(l);let f=await i.save(c);return n&&!d&&await Ju.getManager(o).removeModel(l),f.modelArtifactsInfo}async function lse(){let e=Ju.getSchemes(),t={};for(let n of e){let a=await Ju.getManager(n).listModels();for(let r in a){let s=n+Mf+r;t[s]=a[r]}}return t}async function use(e){let t=rv(e);return Ju.getManager(t.scheme).removeModel(t.path)}async function cse(e,t){return wL(e,t,!1)}async function dse(e,t){return wL(e,t,!0)}var hse=class{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){if(typeof window>"u"||!fe().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(e,t);return}this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",n=>{if(n.source===window&&n.data.name===this.messageName){n.stopPropagation();let a=this.functionRefs[n.data.index];a(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(e){return Y8(e)}};if(fe().get("IS_BROWSER")){fe().setPlatform("browser",new hse);try{Ju.registerManager(_d.URL_SCHEME,new ose)}catch{}try{Ju.registerManager(Ad.URL_SCHEME,new Zre)}catch{}}var pse={importFetch:()=>iae()},CN,fse=class{constructor(){this.util=oae(),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return fe().global.fetch!=null?fe().global.fetch(e,t):(CN==null&&(CN=pse.importFetch()),CN(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).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)}};
vendor: 14,264 bytes, lines 66-67
66fe().get("IS_NODE")&&!fe().get("IS_BROWSER")&&fe().setPlatform("node",new fse);function Zt(e,t="float32",n){return t=t||"float32",ci(e),new ar(e,t,n)}function mse(e,t){let n=q(e,"x","cast");if(!L8(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let a={x:n},r={dtype:t};return ae.runKernel(nh,a,r)}var He=re({cast_:mse});function gse(e){let t={x:q(e,"x","clone","string_or_numeric")};return ae.runKernel(wh,t)}var tl=re({clone_:gse});function tT(e,t=!1){console.log(e.toString(t))}rL();var xse={buffer:Zt,cast:He,clone:tl,print:tT};pre(xse);function yse(e,t){let n=q(e,"a","add"),a=q(t,"b","add");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(hc,r)}var ke=re({add_:yse});function bse(e,t){let n=q(e,"a","floorDiv"),a=q(t,"b","floorDiv");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(yh,r)}var Mw=re({floorDiv_:bse});function vse(e,t){let n=q(e,"a","div"),a=q(t,"b","div");if([n,a]=ka(n,a),n.dtype==="int32"&&a.dtype==="int32")return Mw(n,a);let r={a:n,b:a},s={};return ae.runKernel(hh,r,s)}var ht=re({div_:vse});function wse(e,t){let n=q(e,"a","mul"),a=q(t,"b","mul");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(Fh,r)}var ie=re({mul_:wse});function Sse(e){let t=q(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return ae.runKernel(ib,n)}else{let n={x:t};return ae.runKernel(hm,n)}}var tr=re({abs_:Sse});function kse(e){let t={x:q(e,"x","acos")};return ae.runKernel(Gd,t)}var nT=re({acos_:kse});function Nse(e){let t={x:q(e,"x","acosh")};return ae.runKernel(qd,t)}var aT=re({acosh_:Nse});function Cse(e){Z(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),Z(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((r,s)=>q(r,`tensors${s}`,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!Gl(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return ae.runKernel(Kd,a)}var SL=re({addN_:Cse});function Ese(e,t=null,n=!1){let a={x:q(e,"x","all","bool")},r={axis:t,keepDims:n};return ae.runKernel(pm,a,r)}var $w=re({all_:Ese});function Ise(e,t=null,n=!1){let a={x:q(e,"x","any","bool")},r={axis:t,keepDims:n};return ae.runKernel(fm,a,r)}var $y=re({any_:Ise});function Tse(e,t=0){let n={x:q(e,"x","argMax")},a={axis:t};return ae.runKernel(mm,n,a)}var jd=re({argMax_:Tse});function Ase(e,t=0){let n={x:q(e,"x","argMin")},a={axis:t};return ae.runKernel(gm,n,a)}var rT=re({argMin_:Ase});function _se(e){let t={x:q(e,"x","asin")};return ae.runKernel(Xd,t)}var sT=re({asin_:_se});function jse(e){let t={x:q(e,"x","asinh")};return ae.runKernel(Yd,t)}var iT=re({asinh_:jse});function Dse(e){let t={x:q(e,"x","atan")};return ae.runKernel(Jd,t)}var oT=re({atan_:Dse});function Rse(e,t){let n=q(e,"a","atan2"),a=q(t,"b","atan2");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(Zd,r)}var lT=re({atan2_:Rse});function Mse(e){let t={x:q(e,"x","atanh")};return ae.runKernel(Qd,t)}var uT=re({atanh_:Mse});function $se(e,t,n,a,r="NHWC",s){let i=e[3],o=[...t,i],l=CL(r);return Ab(e,o,n,s,a,null,null,l)}function kL(e,t,n,a,r,s,i="channelsLast"){let[o,l]=By(t),d;if(i==="channelsLast")d=[o,l,e[3],e[3]];else if(i==="channelsFirst")d=[o,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Ab(e,d,n,a,r,s,!1,i)}function Bse(e,t,n,a,r,s,i="NDHWC"){let[o,l,d]=YC(t),c,f;if(i==="NDHWC")f="channelsLast",c=[o,l,d,e[4],e[4]];else if(i==="NCDHW")f="channelsFirst",c=[o,l,d,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return NL(e,c,n,a,r,!1,f,s)}function Ab(e,t,n,a,r,s,i=!1,o="channelsLast"){let[l,d,c,f]=[-1,-1,-1,-1];if(o==="channelsLast")[l,d,c,f]=e;else if(o==="channelsFirst")[l,f,d,c]=e;else throw new Error(`Unknown dataFormat ${o}`);let[m,x,,y]=t,[b,w]=By(n),[S,k]=By(a),C=$f(m,S),E=$f(x,k),{padInfo:T,outHeight:_,outWidth:A}=Lse(r,d,c,b,w,C,E,s,o),$=i?y*f:y,O;return o==="channelsFirst"?O=[l,$,_,A]:o==="channelsLast"&&(O=[l,_,A,$]),{batchSize:l,dataFormat:o,inHeight:d,inWidth:c,inChannels:f,outHeight:_,outWidth:A,outChannels:$,padInfo:T,strideHeight:b,strideWidth:w,filterHeight:m,filterWidth:x,effectiveFilterHeight:C,effectiveFilterWidth:E,dilationHeight:S,dilationWidth:k,inShape:e,outShape:O,filterShape:t}}function NL(e,t,n,a,r,s=!1,i="channelsLast",o){let[l,d,c,f,m]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,d,c,f,m]=e;else if(i==="channelsFirst")[l,m,d,c,f]=e;else throw new Error(`Unknown dataFormat ${i}`);let[x,y,b,,w]=t,[S,k,C]=YC(n),[E,T,_]=YC(a),A=$f(x,E),$=$f(y,T),O=$f(b,_),{padInfo:z,outDepth:P,outHeight:j,outWidth:G}=Pse(r,d,c,f,S,k,C,A,$,O,o),X=s?w*m:w,J;return i==="channelsFirst"?J=[l,X,P,j,G]:i==="channelsLast"&&(J=[l,P,j,G,X]),{batchSize:l,dataFormat:i,inDepth:d,inHeight:c,inWidth:f,inChannels:m,outDepth:P,outHeight:j,outWidth:G,outChannels:X,padInfo:z,strideDepth:S,strideHeight:k,strideWidth:C,filterDepth:x,filterHeight:y,filterWidth:b,effectiveFilterDepth:A,effectiveFilterHeight:$,effectiveFilterWidth:O,dilationDepth:E,dilationHeight:T,dilationWidth:_,inShape:e,outShape:J,filterShape:t}}function Fse(e,t,n,a,r){a==null&&(a=cT(e,t,n));let s=e[0],i=e[1],o=Fy((s-t+2*a)/n+1,r),l=Fy((i-t+2*a)/n+1,r);return[o,l]}function Ose(e,t,n,a,r,s){r==null&&(r=cT(e,t[0],a[0]));let i=[0,0,0,n];for(let o=0;o<3;o++)e[o]+2*r>=t[o]&&(i[o]=Fy((e[o]-t[o]+2*r)/a[o]+1,s));return i}function cT(e,t,n,a=1){let r=$f(t,a);return Math.floor((e[0]*(n-1)-n+r)/2)}function By(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function YC(e){return typeof e=="number"?[e,e,e]:e}function $f(e,t){return t<=1?e:e+(e-1)*(t-1)}function Lse(e,t,n,a,r,s,i,o,l){let d,c,f;if(typeof e=="number"){d={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let m=Fse([t,n],s,a,e,o);c=m[0],f=m[1]}else if(e==="same"){c=Math.ceil(t/a),f=Math.ceil(n/r);let m=Math.max(0,(c-1)*a+s-t),x=Math.max(0,(f-1)*r+i-n),y=Math.floor(m/2),b=m-y,w=Math.floor(x/2),S=x-w;d={top:y,bottom:b,left:w,right:S,type:"SAME"}}else if(e==="valid")d={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((t-s+1)/a),f=Math.ceil((n-i+1)/r);else if(typeof e=="object"){let m=l==="channelsLast"?e[1][0]:e[2][0],x=l==="channelsLast"?e[1][1]:e[2][1],y=l==="channelsLast"?e[2][0]:e[3][0],b=l==="channelsLast"?e[2][1]:e[3][1];d={top:m,bottom:x,left:y,right:b,type:m===0&&x===0&&y===0&&b===0?"VALID":"EXPLICIT"},c=Fy((t-s+m+x)/a+1,o),f=Fy((n-i+y+b)/r+1,o)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:d,outHeight:c,outWidth:f}}function Pse(e,t,n,a,r,s,i,o,l,d,c){let f,m,x,y;if(e==="valid"&&(e=0),typeof e=="number"){f={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let b=Ose([t,n,a,1],[o,l,d],1,[r,s,i],e,c);m=b[0],x=b[1],y=b[2]}else if(e==="same"){m=Math.ceil(t/r),x=Math.ceil(n/s),y=Math.ceil(a/i);let b=(m-1)*r+o-t,w=(x-1)*s+l-n,S=(y-1)*i+d-a,k=Math.floor(b/2),C=b-k,E=Math.floor(w/2),T=w-E,_=Math.floor(S/2),A=S-_;f={top:E,bottom:T,left:_,right:A,front:k,back:C,type:"SAME"}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:f,outDepth:m,outHeight:x,outWidth:y}}function Fy(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function Qu(e){let[t,n,a]=By(e);return t===1&&n===1&&a===1}function ll(e,t){return Qu(e)||Qu(t)}function Dd(e){return By(e).every(t=>t>0)}function CL(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function Cs(e,t,n){if(n!=null){if(typeof t=="string")throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);if(typeof t=="number")Z(Pf(t),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);else if(typeof t=="object")t.forEach(a=>{a.forEach(r=>{Z(Pf(r),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${r}.`)})});else throw Error(`Error in ${e}: Unknown padding parameter: ${t}`)}}function zse(e,t){let n={x:q(e,"x","reshape","string_or_numeric")},a={shape:t};return ae.runKernel(Ym,n,a)}var le=re({reshape_:zse});function Use(e,t,n,a,r){let s=q(e,"x","avgPool","float32"),i=1;Z(ll(n,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);let o=s,l=!1;s.rank===3&&(l=!0,o=le(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Z(o.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${o.rank}.`),Cs("avgPool",a,r);let d={x:o},c={filterSize:t,strides:n,pad:a,dimRoundingMode:r},f=ae.runKernel(eh,d,c);return f=He(f,s.dtype),l?le(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var Kl=re({avgPool_:Use});function Wse(e,t,n,a,r,s="NDHWC"){let i=q(e,"x","avgPool3d","float32"),o=i,l=!1;i.rank===4&&(l=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Z(o.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`),Z(s==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),Z(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}'`),Cs("avgPool3d",a,r);let d={x:o},c={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},f=ae.runKernel(xm,d,c);return f=He(f,o.dtype),l?le(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}var dT=re({avgPool3d_:Wse});function Vse(e,t=0){Z(e.length>=1,()=>"Pass at least one tensor to concat");let n=My(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(s=>{if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor
67          with dtype ${s.dtype}. `)}),n.length===1)return tl(n[0]);let a=n,r={axis:t};return ae.runKernel(wm,a,r)}var Qn=re({concat_:Vse});function Hse(e,t,n=!1,a=!1){let r=q(e,"a","matMul"),s=q(t,"b","matMul");[r,s]=ka(r,s);let i={a:r,b:s},o={transposeA:n,transposeB:a};return ae.runKernel(th,i,o)}var Jt=re({matMul_:Hse});function Gse(e){let t={x:q(e,"x","sigmoid","float32")};return ae.runKernel(tp,t)}var eo=re({sigmoid_:Gse});function qse(e,t,n){let a=q(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return ae.runKernel(ag,r,s)}var un=re({slice_:qse});function Kse(e){let t={x:q(e,"x","tanh","float32")};return ae.runKernel(up,t)}var Zu=re({tanh_:Kse});function Xse(e,t,n,a,r,s){let i=q(e,"forgetBias","basicLSTMCell"),o=q(t,"lstmKernel","basicLSTMCell"),l=q(n,"lstmBias","basicLSTMCell"),d=q(a,"data","basicLSTMCell"),c=q(r,"c","basicLSTMCell"),f=q(s,"h","basicLSTMCell"),m=Qn([d,f],1),x=Jt(m,o),y=ke(x,l),b=y.shape[0],w=y.shape[1]/4,S=[b,w],k=un(y,[0,0],S),C=un(y,[0,w],S),E=un(y,[0,w*2],S),T=un(y,[0,w*3],S),_=ke(ie(eo(k),Zu(C)),ie(c,eo(ke(i,E)))),A=ie(Zu(_),eo(T));return[_,A]}var EL=re({basicLSTMCell_:Xse});function Yse(e,t,n){let a=q(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);Z(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),Z(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length  ${t.length}`),Z(a.shape[0]%r===0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${r}`);let s={x:a},i={blockShape:t,crops:n};return ae.runKernel(ym,s,i)}var _b=re({batchToSpaceND_:Yse});function Jse(e){let t;return e.rank===0||e.rank===1?t=le(e,[1,1,1,e.size]):e.rank===2?t=le(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function Qse(e,t,n,a,r,s){s==null&&(s=.001);let i=q(e,"x","batchNorm"),o=q(t,"mean","batchNorm"),l=q(n,"variance","batchNorm"),d;r!=null&&(d=q(r,"scale","batchNorm"));let c;a!=null&&(c=q(a,"offset","batchNorm")),Z(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),Z(c==null||o.rank===c.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),Z(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let f={x:Jse(i),scale:d,offset:c,mean:o,variance:l},m={varianceEpsilon:s},x=ae.runKernel(bh,f,m);return le(x,i.shape)}var cp=re({batchNorm_:Qse});function Zse(e,t,n,a,r,s){let i=q(e,"x","batchNorm"),o=q(t,"mean","batchNorm"),l=q(n,"variance","batchNorm"),d;r!=null&&(d=q(r,"scale","batchNorm"));let c;return a!=null&&(c=q(a,"offset","batchNorm")),Z(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),Z(o.rank===2||o.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`),Z(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),d!=null&&Z(d.rank===2||d.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${d.rank}.`),c!=null&&Z(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`),cp(i,o,l,c,d,s)}var hT=re({batchNorm2d_:Zse});function eie(e,t,n,a,r,s){let i=q(e,"x","batchNorm"),o=q(t,"mean","batchNorm"),l=q(n,"variance","batchNorm"),d;r!=null&&(d=q(r,"scale","batchNorm"));let c;return a!=null&&(c=q(a,"offset","batchNorm")),Z(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),Z(o.rank===3||o.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`),Z(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),d!=null&&Z(d.rank===3||d.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${d.rank}.`),c!=null&&Z(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`),cp(i,o,l,c,d,s)}var pT=re({batchNorm3d_:eie});function tie(e,t,n,a,r,s){let i=q(e,"x","batchNorm"),o=q(t,"mean","batchNorm"),l=q(n,"variance","batchNorm"),d;r!=null&&(d=q(r,"scale","batchNorm"));let c;return a!=null&&(c=q(a,"offset","batchNorm")),Z(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}
67.`),Z(o.rank===4||o.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`),Z(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),d!=null&&Z(d.rank===4||d.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${d.rank}.`),c!=null&&Z(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`),cp(i,o,l,c,d,s)}var fT=re({batchNorm4d_:tie});function nie(e,t,n){let a=q(e,"x","bincount"),r=q(t,"weights","bincount");Z(a.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${a.dtype}`),Z(n>=0,()=>`size must be non-negative, but got ${n}.`),Z(r.size===a.size||r.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${a.shape}, weights shape: ${r.shape}.`);let s={x:a,weights:r},i={size:n};return ae.runKernel(bm,s,i)}var mT=re({bincount_:nie});function aie(e,t){let n=q(e,"x","bitwiseAnd"),a=q(t,"y","bitwiseAnd");if(!Gl(n.shape,a.shape))throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${n.shape}, y: ${a.shape}`);if(n.dtype!=="int32"||a.dtype!=="int32")throw new Error(`BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ${n.dtype} and type of y: ${a.dtype}`);let r={a:n,b:a};return ae.runKernel(vm,r)}var IL=re({bitwiseAnd_:aie});function rie(e,t){let n=q(e,"s0","broadcastArgs","int32"),a=q(t,"s1","broadcastArgs","int32");if(n.rank!==1)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${n.rank}`);if(a.rank!==1)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${a.rank}`);let r={s0:n,s1:a};return ae.runKernel(sb,r)}var TL=re({broadcastArgs_:rie});function sie(e,t){let n=q(e,"broadcastTo","x"),a=n.shape;if(ci(t),t.length<n.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${n.rank}.`);if(t.length>n.rank){let l=n.shape.slice();for(;l.length<t.length;)l.unshift(1);n=le(n,l)}let r=n.shape,s=Array.from(t);for(let l=t.length-1;l>=0;l--)if(r[l]===t[l])s[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${t}].`);if(s.map((l,d)=>l>1?d:-1).filter(l=>l>=0).length===0)return tl(n);let i={x:n},o={reps:s};return ae.runKernel(fc,i,o)}var vd=re({broadcastTo_:sie});function iie(e){let t={x:q(e,"x","ceil","float32")};return ae.runKernel(ah,t)}var gT=re({ceil_:iie});function ri(e,t,n){ci(e),n=n||nb(t);let a={shape:e,value:t,dtype:n};return ae.runKernel(ub,{},a)}function oie(e,t,n){let a=q(e,"x","clipByValue");if(Z(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`),t===n)return ri(a.shape,t,a.dtype);let r={x:a},s={clipValueMin:t,clipValueMax:n};return ae.runKernel(pc,r,s)}var ns=re({clipByValue_:oie});function lie(e){return Qn(e,0)}var xT=re({concat1d_:lie});function uie(e,t){return Qn(e,t)}var yT=re({concat2d_:uie});function cie(e,t){return Qn(e,t)}var bT=re({concat3d_:cie});function die(e,t){return Qn(e,t)}var vT=re({concat4d_:die});function hie(e,t,n,a,r="NHWC",s=[1,1],i){let o=q(e,"x","conv2d","float32"),l=q(t,"filter","conv2d","float32"),d=o,c=!1;o.rank===3&&(c=!0,d=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Z(d.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${d.rank}.`),Z(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),Cs("conv2d",a,i);let f=r==="NHWC"?d.shape[3]:d.shape[1];Z(f===l.shape[2],()=>`Error in conv2d: depth of input (${f}) must match input depth for filter ${l.shape[2]}.`),Z(ll(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),Z(Dd(s),()=>"Error in conv2D: Dilated rates should be larger than 0."),Z(Dd(n),()=>"Error in conv2D: Strides should be larger than 0.");let m={x:d,filter:l},x={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},y=ae.runKernel(rh,m,x);return c?le(y,[y.shape[1],y.shape[2],y.shape[3]]):y}var ws=re({conv2d_:hie});function pie(e,t,n,a,r="NWC",s=1,i){let o=q(e,"x","conv1d"),l=q(t,"filter","conv1d"),d=o,c=!1;o.rank===2&&(c=!0,d=le(o,[1,o.shape[0],o.shape[1]])),Z(d.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${d.rank}.`),Z(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}
67.`),Cs("conv1d",a,i),Z(d.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${d.shape[2]}) must match input depth for filter ${l.shape[1]}.`),Z(ll(n,s),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`),Z(Dd(s),()=>"Error in conv1D: Dilated rates should be larger than 0."),Z(Dd(n),()=>"Error in conv1D: Stride should be larger than 0."),Z(r==="NWC",()=>`Error in conv1d: got dataFormat of ${r} but only NWC is currently supported.`);let f=le(l,[1,l.shape[0],l.shape[1],l.shape[2]]),m=le(d,[d.shape[0],1,d.shape[1],d.shape[2]]),x=ws(m,f,[1,n],a,"NHWC",[1,s],i);return c?le(x,[x.shape[2],x.shape[3]]):le(x,[x.shape[0],x.shape[2],x.shape[3]])}var Bw=re({conv1d_:pie});function fie(e,t,n,a,r,s="NHWC",i){Z(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let o=e,l=t,d=!1;t.rank===3&&(d=!0,l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),Z(o.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`),Z(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),Z(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let c=s==="NHWC"?o[3]:o[1],f=s==="NHWC"?l.shape[3]:l.shape[1];Z(c===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`),Z(f===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${f}) must match output depth for filter ${n.shape[3]}.`),Cs("conv2dDerInput",r,i);let m={dy:l,filter:n},x={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,inputShape:o},y=ae.runKernel(sh,m,x);return d?le(y,[y.shape[1],y.shape[2],y.shape[3]]):y}var wT=re({conv2DBackpropInput_:fie});function mie(e,t,n,a,r,s){let i=q(e,"x","conv2dTranspose"),o=q(t,"filter","conv2dTranspose");return wT(n,i,o,a,r,"NHWC",s)}var Fw=re({conv2dTranspose_:mie});function gie(e,t,n,a,r="NDHWC",s=[1,1,1]){let i=q(e,"x","conv3d"),o=q(t,"filter","conv3d"),l=i,d=!1;i.rank===4&&(d=!0,l=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Z(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),Z(o.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`),Z(l.shape[4]===o.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`),Z(ll(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),Z(r==="NDHWC",()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`),Z(Dd(s),()=>"Error in conv3D: Dilated rates should be larger than 0."),Z(Dd(n),()=>"Error in conv3D: Strides should be larger than 0.");let c={x:l,filter:o},f={strides:n,pad:a,dataFormat:r,dilations:s},m=ae.runKernel(ih,c,f);return d?le(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}var ST=re({conv3d_:gie});function xie(e,t,n,a,r){Z(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,i=t,o=!1;t.rank===4&&(o=!0,i=le(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);let l=s[4],d=i.shape[4];Z(s.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`),Z(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),Z(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),Z(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),Z(d===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[4]}.`);let c={dy:i,filter:n},f={pad:r,strides:a,inputShape:s},m=ae.runKernel(km,c,f);return o?le(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}var AL=re({conv3DBackpropInput_:xie});function yie(e,t,n,a,r){let s=q(e,"x","conv3dTranspose"),i=q(t,"filter","conv3dTranspose");return AL(n,s,i,a,r)}var kT=re({conv3dTranspose_:yie});function bie(e){let t={x:q(e,"x","cos","float32")};return ae.runKernel(oh,t)}var jb=re({cos_:bie});function vie(e){let t={x:q(e,"x","cosh","float32")};return ae.runKernel(lh,t)}var Ow=re({cosh_:vie});function wie(e,t=0,n=!1,a=!1){let r={x:q(e,"x","cumprod")},s={axis:t,exclusive:n,reverse:a};return ae.runKernel(Nm,r,s)}var Oy=re({cumprod_:wie});function Sie(e,t=0,n=!1,a=!1){let r={x:q(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:a};return ae.runKernel(uh,r,s)}var Lw=re({cumsum_:Sie});function kie(e,t,n,a=!1){let r=q(e,"x","denseBincount"),s=q(t,"weights","denseBincount");Z(r.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),Z(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),Z(n>=0,()=>`size must be non-negative, but got ${n}.`),Z(s.size===r.size||s.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);let i={x:r,weights:s},o={size:n,binaryOutput:a};return ae.runKernel(ob,i,o)}var Av=re({denseBincount_:kie});function Nie(e,t,n="NHWC"){let a=q(e,"x","depthToSpace","float32"),r=n==="NHWC"?a.shape[1]:a.shape[2],s=n==="NHWC"?a.shape[2]:a.shape[3],i=n==="NHWC"?a.shape[3]:a.shape[1];Z(t>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`),Z(r*t>=0,()=>
vendor: 5,375 bytes, lines 67-71
67`Negative dimension size caused by overflow when multiplying
68    ${r} and ${t}  for depthToSpace with input shape
69    ${a.shape}`),Z(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying
70    ${s} and ${t} for depthToSpace with input shape
71        ${a.shape}`),Z(i%(t*t)===0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${a.shape}`);let o={x:a},l={blockSize:t,dataFormat:n};return ae.runKernel(Em,o,l)}var NT=re({depthToSpace_:Nie});function Cie(e,t,n,a,r="NHWC",s=[1,1],i){let o=q(e,"x","depthwiseConv2d","float32"),l=q(t,"filter","depthwiseConv2d","float32"),d=o,c=!1;o.rank===3&&(c=!0,d=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Z(d.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${d.rank}.`),Z(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`);let f=r==="NHWC"?d.shape[3]:d.shape[1];Z(f===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${f}) must match the inChannels dimension in filter ${l.shape[2]}.`),Cs("depthwiseConv2d",a,i);let m={x:d,filter:l},x={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},y=ae.runKernel(ch,m,x);return c?le(y,[y.shape[1],y.shape[2],y.shape[3]]):y}var dp=re({depthwiseConv2d_:Cie});function Eie(e){let t={x:q(e,"x","diag")};return ae.runKernel(lb,t)}var _L=re({diag_:Eie});function Iie(e,t,n,a,r=[1,1],s="NHWC"){let i=q(e,"x","dilation2d"),o=q(t,"filter","dilation2d");Z(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),Z(o.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`),Z(s==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`);let l=i,d=!1;i.rank===3&&(l=le(i,[1,i.shape[0],i.shape[1],i.shape[2]]),d=!0),Z(l.shape[3]===o.shape[2],()=>`Error in dilation2d:  input and filter must have the same depth: ${l.shape[3]} vs ${o.shape[2]}`);let c={x:l,filter:o},f={strides:n,pad:a,dilations:r},m=ae.runKernel(dh,c,f);return d?le(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var CT=re({dilation2d_:Iie}),fg={};Xt(fg,{assertAndGetBroadcastShape:()=>Zn,getBroadcastDims:()=>jL,getReductionAxes:()=>sr});function jL(e,t){let n=e.length,a=[];for(let r=0;r<n;r++){let s=n-1-r,i=e[s]||1;(t[t.length-1-r]||1)>1&&i===1&&a.unshift(s)}return a}function sr(e,t){let n=[];for(let a=0;a<t.length;a++){let r=e[e.length-a-1],s=t.length-a-1,i=t[s];(r==null||r===1&&i>1)&&n.unshift(s)}return n}function Zn(e,t){let n=Math.max(e.length,t.length),a=new Array(n);for(let r=0;r<n;r++){let s=e[e.length-r-1];s==null&&(s=1);let i=t[t.length-r-1];if(i==null&&(i=1),s===1)a[n-r-1]=i;else if(i===1)a[n-r-1]=s;else if(s!==i){let o=`Operands could not be broadcast together with shapes ${e} and ${t}.`;throw Error(o)}else a[n-r-1]=s}return a}function Tie(e,t){let n=q(e,"a","equal","string_or_numeric"),a=q(t,"b","equal","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Tm,r)}var si=re({equal_:Tie});function Aie(e,t,n){let a=q(t,"a","where"),r=q(n,"b","where"),s=q(e,"condition","where","bool"),i=Zn(Zn(s.shape,a.shape),r.shape),o=vd(s,i),l=vd(a,i),d=vd(r,i),c={condition:o,t:l,e:d};return ae.runKernel(ng,c)}var Mr=re({where_:Aie});function _ie(e){let t={x:q(e,"x","zerosLike")};return ae.runKernel(hg,t)}var pn=re({zerosLike_:_ie});function jie(e,t){let n=q(e,"a","div"),a=q(t,"b","div");[n,a]=ka(n,a);let r=ht(n,a),s=pn(r),i=si(a,s);return Mr(i,s,r)}var ET=re({divNoNan_:jie});function Die(e,t){let n=q(e,"t1","dot"),a=q(t,"t2","dot");Z((n.rank===1||n.rank===2)&&(a.rank===1||a.rank===2),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${a.rank}.`);let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(Z(r===s,()=>`Error in dot: inner dimensions of inputs must match, but got ${r} and ${s}.`),n.rank===1&&a.rank===1){let i=le(n,[1,-1]),o=le(a,[-1,1]),l=Jt(i,o);return le(l,[])}else if(n.rank===1&&a.rank===2){let i=le(n,[1,-1]),o=le(a,[a.shape[0],a.shape[1]]),l=Jt(i,o);return le(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=le(a,[-1,1]),o=Jt(n,i);return le(o,[o.size])}else{let i=le(a,[a.shape[0],a.shape[1]]);return Jt(n,i)}}var IT=re({dot_:Die});function Rie(e,...t){let n=t.map((r,s)=>q(r,`tensors${s}`,"einsum")),a={equation:e};return ae.runKernel(kw,n,a)}var ud=re({einsum_:Rie});function Mie(e){let t={x:q(e,"x","elu","float32")};return ae.runKernel(ph,t)}var mg=re({elu_:Mie});function $ie(e,t){let n=q(e,"x","ensureShape","string_or_numeric");if(!$8(n.shape,t))throw new Error(`EnsureShape: Shape of tensor ${n.shape} is not compatible with expected shape ${t}`);return e}var DL=re({ensureShape_:$ie});function Bie(e){let t=q(e,"x","erf");Z(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=He(t,"float32"));let n={x:t};return ae.runKernel(fh,n)}var Pw=re({erf_:Bie});function TT(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function RL(e,t,n){let a=e.length+t.length,r=[],s=0,i=0;for(let o=0;o<a;o++)n.indexOf(o)===-1?r.push(e[s++]):r.push(t[i++]);return r}function ML(e,t){let n=[],a=e.length;for(let s=0;s<a;s++)t.indexOf(s)===-1&&n.push(e[s]);let r=t.map(s=>e[s]);return[n,r]}function Rd(e,t){let n=t.map(a=>1);return RL(e,n,t)}function Fie(e,t,n){Z(TT(t,n),()=>`${e}
71 supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function $L(e,t){if(TT(e,t))return null;let n=[];for(let a=0;a<t;++a)e.indexOf(a)===-1&&n.push(a);return e.forEach(a=>n.push(a)),n}function AT(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function Oie(e,t){let n=[];for(let a=t-e;a<t;++a)n.push(a);return n}function Lie(e,t=null,n=!1){let a={x:q(e,"x","max")},r={reductionIndices:t,keepDims:n};return ae.runKernel(Ah,a,r)}var ji=re({max_:Lie});function Pie(e,t=null,n=!1){let a={x:q(e,"x","min")},r={axis:t,keepDims:n};return ae.runKernel(Rh,a,r)}var Vf=re({min_:Pie});function zie(e,t){let n=q(e,"base","pow"),a=q(t,"exp","pow");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(Ph,r)}var sl=re({pow_:zie});function Et(e,t){if((jr(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&jr(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return gc(e,[],[],t)}function Uie(e){let t={x:q(e,"x","sqrt","float32")};return ae.runKernel(ap,t)}var $r=re({sqrt_:Uie});function Wie(e){let t=q(e,"x","square"),n={};return ae.runKernel("Square",{x:t},n)}var Jn=re({square_:Wie});function Vie(e,t=null,n=!1){let a=q(e,"x","sum");a.dtype==="bool"&&(a=He(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return ae.runKernel(rp,r,s)}var yt=re({sum_:Vie});function Hie(e,t="euclidean",n=null,a=!1){e=q(e,"x","norm");let r=BL(e,t,n),s=r.shape;if(a){let i=no(n,e.shape);s=Rd(r.shape,i)}return le(r,s)}function BL(e,t,n=null){if(e.rank===0)return tr(e);if(e.rank!==1&&n===null)return BL(le(e,[-1]),t,n);if(e.rank===1||typeof n=="number"||Array.isArray(n)&&n.length===1){if(t===1)return yt(tr(e),n);if(t===1/0)return ji(tr(e),n);if(t===-1/0)return Vf(tr(e),n);if(t==="euclidean"||t===2)return $r(yt(sl(tr(e),Et(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(n)&&n.length===2){if(t===1)return ji(yt(tr(e),n[0]),n[1]-1);if(t===1/0)return ji(yt(tr(e),n[1]),n[0]);if(t===-1/0)return Vf(yt(tr(e),n[1]),n[0]);if(t==="fro"||t==="euclidean")return $r(yt(Jn(e),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}var gg=re({norm_:Hie});function Gie(e,t=null,n=!1){return gg(e,"euclidean",t,n)}var _T=re({euclideanNorm_:Gie});function qie(e){let t={x:q(e,"x","exp")};return ae.runKernel(mh,t)}var as=re({exp_:qie});function Kie(e,t=0){let n=q(e,"x","expandDims","string_or_numeric");Z(t<=n.rank,()=>"Axis must be <= rank of the tensor");let a={input:n},r={dim:t};return ae.runKernel(Am,a,r)}var Dr=re({expandDims_:Kie});function Xie(e){let t={x:q(e,"x","expm1")};return ae.runKernel(gh,t)}var jT=re({expm1_:Xie});function Yie(e,t){let n=q(e,"x","tile","string_or_numeric");Z(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let a={x:n},r={reps:t};return ae.runKernel(fc,a,r)}var ai=re({tile_:Yie});function Jie(e,t,n,a="float32"){t==null&&(t=e);let r=Zt([e,t],a),s=e<=t?e:t;for(let o=0;o<s;++o)r.set(1,o,o);let i=le(r.toTensor(),[e,t]);if(n==null)return i;if(n.length===1)return ai(Dr(i,0),[n[0],1,1]);if(n.length===2)return ai(Dr(Dr(i,0),0),[n[0],n[1],1,1]);if(n.length===3)return ai(Dr(Dr(Dr(i,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.`)}var zw=re({eye_:Jie});function Qie(e){let t={x:q(e,"x","floor","float32")};return ae.runKernel(xh,t)}var xg=re({floor_:Qie});function Zie(e,t,n=0,a=0){let r=q(e,"x","gather"),s=q(t,"indices","gather","int32"),i={x:r,indices:s},o={axis:n,batchDims:a};return ae.runKernel(jm,i,o)}var yg=re({gather_:Zie});function eoe(e,t){let n=q(e,"a","greater","string_or_numeric"),a=q(t,"b","greater","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Rm,r)}var Es=re({greater_:eoe});function toe(e,t){let n=q(e,"a","greaterEqual","string_or_numeric"),a=q(t,"b","greaterEqual","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(vh,r)}var Xl=re({greaterEqual_:toe});function noe(e){let t={input:q(e,"input","imag")};return ae.runKernel(Ew,t)}var Db=re({imag_:noe});
vendor: 5,378 bytes, lines 71-73
71function aoe(e){let t={x:q(e,"x","isFinite")};return ae.runKernel(Sh,t)}var DT=re({isFinite_:aoe});function roe(e){let t={x:q(e,"x","isInf")};return ae.runKernel(kh,t)}var RT=re({isInf_:roe});function soe(e){let t={x:q(e,"x","isNaN")};return ae.runKernel(Nh,t)}var MT=re({isNaN_:soe});function ioe(e,t=.2){let n={x:q(e,"x","leakyRelu")},a={alpha:t};return ae.runKernel(Ch,n,a)}var Rb=re({leakyRelu_:ioe});function ooe(e,t){let n=q(e,"a","less","string_or_numeric"),a=q(t,"b","less","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Mm,r)}var Hf=re({less_:ooe});function loe(e,t){let n=q(e,"a","lessEqual","string_or_numeric"),a=q(t,"b","lessEqual","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel($m,r)}var xc=re({lessEqual_:loe});function FL(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");let a={start:e,stop:t,num:n};return ae.runKernel(Bm,{},a)}function uoe(e,t=5,n=1,a=1,r=.5){let s=q(e,"x","localResponseNormalization");Z(s.rank===4||s.rank===3,()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got
72               rank ${s.rank}.`),Z(Pf(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=le(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},d={depthRadius:t,bias:n,alpha:a,beta:r},c=ae.runKernel(Th,l,d);return o?le(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var $T=re({localResponseNormalization_:uoe});function coe(e){let t={x:q(e,"x","log","float32")};return ae.runKernel(Eh,t)}var ii=re({log_:coe});function doe(e){let t={x:q(e,"x","log1p")};return ae.runKernel(Ih,t)}var Mb=re({log1p_:doe});function hoe(e){return Z(Ku(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=q(t,"x","tf.grad","string_or_numeric"),r=n!=null?q(n,"dy","tf.grad"):null;return ae.tidy(()=>{let{value:s,grads:i}=ae.gradients(()=>e(a),[a],r);return r!=null&&Ns(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Uw(i),i[0]})}}function poe(e){return Z(Ku(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{Z(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let a=My(t,"args","tf.grads","string_or_numeric"),r=n!=null?q(n,"dy","tf.grads"):null;return ae.tidy(()=>{let{value:s,grads:i}=ae.gradients(()=>e(...a),a,r);return r!=null&&Ns(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Uw(i),i})}}function foe(e){return Z(Ku(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{Z(t instanceof en,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),Z(n==null||n instanceof en,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=ae.gradients(()=>e(t),[t],n);return Uw(a),{grad:a[0],value:r}}}function moe(e){return Z(Ku(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{Z(Array.isArray(t)&&t.every(r=>r instanceof en),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),Z(n==null||n instanceof en,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=ae.gradients(()=>e(...t),t,n);return n!=null&&Ns(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Uw(a.grads),a}}function OL(e,t){Z(Ku(e),()=>"The f passed in variableGrads(f) must be a function"),Z(t==null||Array.isArray(t)&&t.every(d=>d instanceof Id),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let d in ae.registeredVariables)t.push(ae.registeredVariables[d])}let a=n?t.filter(d=>!d.trainable):null,r=t.length;t=t.filter(d=>d.trainable),Z(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=ae.gradients(e,t,null,s);Z(o.some(d=>d!=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()."),Z(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((d,c)=>{o[c]!=null&&(l[d.name]=o[c])}),a?.forEach(d=>l[d.name]=null),{value:i,grads:l}}function il(e){return ae.customGrad(e)}function Uw(e){if(e.filter(t=>t==null).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that
73    the f you passed encloses all operations that lead from x to y.`)}function goe(e){let t={x:q(e,"x","neg")};return ae.runKernel(Wm,t)}var ua=re({neg_:goe});function xoe(e){let t={x:q(e,"x","softplus")};return ae.runKernel(np,t)}var hp=re({softplus_:xoe});function yoe(e){let t=q(e,"x","logSigmoid");return il(n=>({value:ua(hp(ua(n))),gradFunc:a=>ie(a,eo(ua(n)))}))(t)}var BT=re({logSigmoid_:yoe});function boe(e,t){let n=q(e,"a","sub"),a=q(t,"b","sub");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(op,r)}var st=re({sub_:boe});function voe(e,t=-1){let n=q(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank}
73 and axis was ${t}`);return il((a,r)=>{let s=ji(a,t,!0),i=st(a,s),o=st(He(i,"float32"),ii(yt(as(i),t,!0)));return r([o]),{value:o,gradFunc:(l,d)=>{let[c]=d,f=!0,m=as(c);return st(l,ie(yt(l,t,f),m))}}})(n)}var Ww=re({logSoftmax_:voe});function woe(e,t=null,n=!1){let a=q(e,"x","logSumExp"),r=no(t,a.shape),s=ji(a,r,!0),i=st(a,s),o=as(i),l=yt(o,r),d=ii(l),c=ke(le(s,d.shape),d);if(n){let f=Rd(c.shape,r);return le(c,f)}return c}var $b=re({logSumExp_:woe});function Soe(e,t){let n=q(e,"a","logicalAnd","bool"),a=q(t,"b","logicalAnd","bool");Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Fm,r)}var to=re({logicalAnd_:Soe});function koe(e){let t={x:q(e,"x","logicalNot","bool")};return ae.runKernel(Om,t)}var Bb=re({logicalNot_:koe});function Noe(e,t){let n=q(e,"a","logicalOr","bool"),a=q(t,"b","logicalOr","bool");Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Lm,r)}var Vw=re({logicalOr_:Noe});function Coe(e,t){let n=q(e,"a","logicalXor","bool"),a=q(t,"b","logicalXor","bool");return Zn(n.shape,a.shape),to(Vw(e,t),Bb(to(e,t)))}var FT=re({logicalXor_:Coe}),_1=2147483648;function Eoe(e,t,n="left"){let a=q(e,"sortedSequence","searchSorted"),r=q(t,"values","searchSorted"),s=a.shape[a.shape.length-1],i=r.shape[r.shape.length-1],o=le(a,[-1,s]),l=le(r,[-1,i]);if(o.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(o.shape[0]!==l.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(Hn(l.shape)>=_1)throw new Error(`values tensor size must less than ${_1}`);if(o.shape[1]>=_1)throw new Error(`trailing dim_size must less than ${_1} for int32 output type, was ${o.shape[1]}`);let d={sortedSequence:o,values:l},c={side:n};return ae.runKernel(tg,d,c)}var Hw=re({searchSorted_:Eoe});function LL(e,t){return Hw(e,t,"left")}function Ioe(e,t,n,a,r){let s=q(e,"x","maxPool"),i=1,o=s,l=!1;s.rank===3&&(l=!0,o=le(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Z(o.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),Z(ll(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),Cs("maxPool",a,r);let d={x:o},c={filterSize:t,strides:n,pad:a,dimRoundingMode:r},f=ae.runKernel(jh,d,c);return l?le(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var Ar=re({maxPool_:Ioe});function Toe(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=q(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Z(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),Z(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),Cs("maxPool3d",a,r);let d={x:o},c={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},f=ae.runKernel(zm,d,c);return l?le(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}var OT=re({maxPool3d_:Toe});function Aoe(e,t,n,a,r=!1){let s={x:q(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=ae.runKernel(hb,s,i);return{result:o[0],indexes:o[1]}}var PL=re({maxPoolWithArgmax_:Aoe});function _oe(e,t){let n=q(e,"a","maximum"),a=q(t,"b","maximum");[n,a]=ka(n,a),n.dtype==="bool"&&(n=He(n,"int32"),a=He(a,"int32")),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(_h,r)}var ul=re({maximum_:_oe});function joe(e,t=null,n=!1){let a={x:q(e,"x","mean")},r={axis:t,keepDims:n};return ae.runKernel(Dh,a,r)}var ba=re({mean_:joe});function va(e,t="float32"){if(ci(e),t==="complex64"){let a=va(e,"float32"),r=va(e,"float32");return Ul(a,r)}let n=gw(Hn(e),t);return ae.makeTensor(n,e,t)}function $s(e,t="float32"){if(ci(e),t==="complex64"){let a=$s(e,"float32"),r=va(e,"float32");return Ul(a,r)}let n=HI(Hn(e),t);return ae.makeTensor(n,e,t)}function zL(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let a=q(e,"x","meshgrid",e instanceof en?e.dtype:"float32");if(t===void 0)return[a];let r=q(t,"y","meshgrid",t instanceof en?t.dtype:"float32"),s=Hn(a.shape),i=Hn(r.shape);return n==="xy"?(a=le(a,[1,-1]),r=le(r,[-1,1]),[Jt($s([i,1],a.dtype),a),Jt(r,$s([1,s],r.dtype))]):(a=le(a,[-1,1]),r=le(r,[1,-1]),[Jt(a,$s([1,i],a.dtype)),Jt($s([s,1],r.dtype),r)])}function Doe(e,t){let n=q(e,"a","minimum"),a=q(t,"b","minimum");
vendor: 17,039 bytes, lines 73-77
73[n,a]=ka(n,a),n.dtype==="bool"&&(n=He(n,"int32"),a=He(a,"int32")),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Mh,r)}var ec=re({minimum_:Doe});function Roe(e,t,n){Z(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=q(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");Z(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o<a.rank;o++)Z(t[o].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Z(t[o][0]>=0&&t[o][0]<=a.shape[o]-r&&t[o][1]>=0&&t[o][1]<=a.shape[o]-r,()=>`Padding in dimension ${o} cannot be greater than or equal to ${a.shape[o]-r} or less than 0 for input of shape ${a.shape}`);let s={paddings:t,mode:n},i={x:a};return ae.runKernel($h,i,s)}var LT=re({mirrorPad_:Roe});function Moe(e,t){let n=q(e,"a","mod"),a=q(t,"b","mod");[n,a]=ka(n,a);let r={a:n,b:a};return ae.runKernel(Bh,r)}var PT=re({mod_:Moe});function $oe(e,t=null,n=!1){e=q(e,"x","moments");let a=no(t,e.shape),r=ba(e,a,n),s=r.shape;n||(s=Rd(r.shape,a));let i=Jn(st(He(e,"float32"),le(r,s))),o=ba(i,a,n);return{mean:r,variance:o}}var Fb=re({moments_:$oe});function Boe(e,t,n,a){let r=q(t,"data","multiRNNCell"),s=My(n,"c","multiRNNCell"),i=My(a,"h","multiRNNCell"),o=r,l=[];for(let f=0;f<e.length;f++){let m=e[f](o,s[f],i[f]);l.push(m[0]),l.push(m[1]),o=m[1]}let d=[],c=[];for(let f=0;f<l.length;f+=2)d.push(l[f]),c.push(l[f+1]);return[d,c]}var UL=re({multiRNNCell_:Boe});function Foe(e,t,n,a=!1){let r=q(e,"logits","multinomial"),s=r.size,i=r.rank;if(s<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${s}.`);if(i>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();let o={logits:i===1?le(r,[1,-1]):r},l={numSamples:t,seed:n,normalized:a},d=ae.runKernel(Um,o,l);return i===1?le(d,[d.size]):d}var WL=re({multinomial_:Foe});function Ooe(e,t){let n=q(e,"a","notEqual","string_or_numeric"),a=q(t,"b","notEqual","string_or_numeric");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a};return ae.runKernel(Vm,r)}var Md=re({notEqual_:Ooe});function Loe(e,t,n=1,a=0,r="int32"){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let s={indices:q(e,"indices","oneHot","int32")},i={dtype:r,depth:t,onValue:n,offValue:a};return ae.runKernel(Oh,s,i)}var Gf=re({oneHot_:Loe});function Poe(e){let t={x:q(e,"x","onesLike")};return ae.runKernel(Km,t)}var oi=re({onesLike_:Poe});function zoe(e,t){let n=q(e,"v1","outerProduct"),a=q(t,"v2","outerProduct");Z(n.rank===1&&a.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${a.rank}.`);let r=le(n,[-1,1]),s=le(a,[1,-1]);return Jt(r,s)}var VL=re({outerProduct_:zoe});function Uoe(e,t,n=0){let a=q(e,"x","pad");if(a.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let r={paddings:t,constantValue:n},s={x:a};return ae.runKernel(Lh,s,r)}var Ro=re({pad_:Uoe});function Woe(e,t,n=0){return Z(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),Ro(e,[t],n)}var HL=re({pad1d_:Woe});function Voe(e,t,n=0){return Z(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Ro(e,t,n)}var GL=re({pad2d_:Voe});function Hoe(e,t,n=0){return Z(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Ro(e,t,n)}var qL=re({pad3d_:Hoe});function Goe(e,t,n=0){return Z(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Ro(e,t,n)}var KL=re({pad4d_:Goe});function qoe(e,t,n){let a=q(e,"x","spaceToBatchND");Z(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),Z(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),Z(a.shape.reduce((i,o,l)=>l>0&&l<=t.length?i&&(o+n[l-1][0]+n[l-1][1])%t[l-1]===0:i,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let r={x:a},s={blockShape:t,paddings:n};return ae.runKernel(rg,r,s)}var Ob=re({spaceToBatchND_:qoe});function Koe(e,t,n,a,r,s,i){r==null&&(r=[1,1]),s==null&&(s=1),a===0&&(a="valid");let o=q(e,"x","maxPool"),l=o,d=!1;o.rank===3&&(d=!0,l=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Z(ll(s,r),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${r}'`);let c=kL(l.shape,t,s,r,a),f=[c.dilationHeight,c.dilationWidth],m;a==="same"?m=Yoe([c.filterHeight,c.filterWidth],f):m=[[0,0],[0,0]];let x=f[0]===1&&f[1]===1,[y,b]=Xoe([c.inHeight,c.inWidth],f,m),w=x?a:"valid",S=x?l:Ob(l,f,y),k=(n==="avg"?()=>Kl(S,t,s,w,i):()=>Ar(S,t,s,w,i))(),C=x?k:_b(k,f,b);return d?le(C,[C.shape[1],C.shape[2],C.shape[3]]):C}function Xoe(e,t,n){let a=n.map(c=>c[0]),r=n.map(c=>c[1]),s=e.concat(a,r),i=t.map((c,f)=>(c-s[f]%c)%c),o=r.map((c,f)=>c+i[f]),l=t.map((c,f)=>[a[f],o[f]]),d=t.map((c,f)=>[0,i[f]]);return[l,d]}function Yoe(e,t){let n=e.map((s,i)=>s+(s-1)*(t[i]-1)).map(s=>s-1),a=n.map(s=>Math.floor(s/2)),r=n.map((s,i)=>s-a[i]);return n.map((s,i)=>[a[i],r[i]])}var zT=re({pool_:Koe});function Joe(e,t){let n=q(e,"x","prelu"),a=q(t,"alpha","prelu"),r={x:n,alpha:a};return ae.runKernel(zh,r)}var Lb=re({prelu_:Joe});function Qoe(e,t=null,n=!1){let a=q(e,"x","prod");a.dtype==="bool"&&(a=He(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return ae.runKernel(Uh,r,s)}var UT=re({prod_:Qoe});function Zoe(e,t,n,a){let r=e.map((c,f)=>q(c,`tensors${f}`,"raggedGather","int32")),s=q(t,"paramsDenseValues","raggedGather"),i=q(n,"indices","raggedGather","int32"),o={paramsNestedSplits:r,paramsDenseValues:s,indices:i},l={outputRaggedRank:a},d=ae.runKernel(Iw,o,l);return{outputNestedSplits:d.slice(0,d.length-1),outputDenseValues:d[d.length-1]}}var XL=re({raggedGather_:Zoe});function ele(e,t,n){let a=q(e,"starts","raggedRange"),r=q(t,"limits","raggedRange",a.dtype),s=q(n,"deltas","raggedRange",a.dtype),i={starts:a,limits:r,deltas:s},o=ae.runKernel(Tw,i);return{rtNestedSplits:o[0],rtDenseValues:o[1]}}var YL=re({raggedRange_:ele});function tle(e,t,n,a,r){let s=q(e,"shape","raggedTensorToTensor","int32"),i=q(t,"values","raggedTensorToTensor"),o=q(n,"defaultValue","raggedTensorToTensor",i.dtype),l=a.map((f,m)=>q(f,`tensors${m}`,"raggedTensorToTensor","int32")),d={shape:s,values:i,defaultValue:o,rowPartitionTensors:l},c={rowPartitionTypes:r};return ae.runKernel(Aw,d,c)}var JL=re({raggedTensorToTensor_:tle});function nle(e,t,n){ci(e);let a=Hn(e),r=null;if(n==null||n==="float32")r=new Float32Array(a);else if(n==="int32")r=new Int32Array(a);else if(n==="bool")r=new Uint8Array(a);else throw new Error(`Unknown data type ${n}`);for(let s=0;s<a;s++)r[s]=t();return ae.makeTensor(r,e,n)}var QL=re({rand_:nle}),WT=dc(fw()),ZL={};Xt(ZL,{TEST_EPSILON_FLOAT16:()=>eP,createVideoElement:()=>cle,encodeStrings:()=>tP,expectArrayBuffersEqual:()=>ule,expectArraysClose:()=>rle,expectArraysEqual:()=>ile,expectNumbersClose:()=>ole,expectPromiseToFail:()=>sle,expectValuesInRange:()=>lle,play:()=>dle,testEpsilon:()=>VT});var ale=.001,eP=.1;function rle(e,t,n){return n==null&&(n=VT()),JC(e,t,(a,r)=>HT(a,r,n))}function VT(){return ae.backend.floatPrecision()===32?ale:eP}function JC(e,t,n){let a=!0;if((jr(e)||jr(t))&&(a=!1),jr(e)&&jr(t)&&(a=!0),a){let i=e.constructor.name,o=t.constructor.name;if(i!==o)throw new Error(`Arrays are of different type. Actual: ${i}. Expected: ${o}`)}if(Array.isArray(e)&&Array.isArray(t)){let i=rl(e),o=rl(t);if(!Gl(i,o))throw new Error(`Arrays have different shapes. Actual: [${i}]. Expected: [${o}]`)}let r=jr(e)?e:Xu(e),s=jr(t)?t:Xu(t);if(r.length!==s.length)throw new Error(`Arrays have different lengths actual: ${r.length} vs expected: ${s.length}.
74Actual:   ${r}.
75Expected: ${s}.`);for(let i=0;i<s.length;++i){let o=r[i],l=s[i];if(!n(o,l))throw new Error(`Arrays differ: actual[${i}] = ${o}, expected[${i}] = ${l}.
76Actual:   ${r}.
77Expected: ${s}.`)}typeof expect<"u"&&expect().nothing()}function sle(e,t){e().then(()=>t.fail(),()=>t()),typeof expect<"u"&&expect().nothing()}function ile(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return Ou(e)||Ou(e[0])||Ou(t)||Ou(t[0])?JC(e,n,(a,r)=>a==r):JC(e,t,(a,r)=>HT(a,r,0))}function ole(e,t,n){if(n==null&&(n=VT()),!HT(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`);typeof expect<"u"&&expect().nothing()}function HT(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function lle(e,t,n){for(let a=0;a<e.length;a++)if(e[a]<t||e[a]>n)throw new Error(`Value out of range:${e[a]} low: ${t}, high: ${n}`)}function ule(e,t){let n=new Float32Array(e),a=new Float32Array(t);if(n.length!==a.length)throw new Error(`Expected ArrayBuffer to be of length ${a.length}, but it was ${n.length}`);for(let r=0;r<a.length;r++)if(n[r]!==a[r])throw new Error(`Expected ArrayBuffer value at ${r} to be ${a[r]} but got ${n[r]} instead`)}function tP(e){for(let t=0;t<e.length;t++){let n=e[t];Array.isArray(n)?tP(n):e[t]=Eb(n)}return e}function cle(e){let t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise(n=>{t.addEventListener("loadeddata",a=>n(t)),t.load()})}async function dle(e){await e.play(),"requestVideoFrameCallback"in e&&await new Promise(t=>{e.requestVideoFrameCallback(t)})}var GT=class{constructor(e,t,n,a,r){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=a,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);let s=r||Math.random();this.random=WT.alea(s.toString())}nextValue(){if(!isNaN(this.nextVal)){let a=this.nextVal;return this.nextVal=NaN,a}let e,t,n=!1;for(;!n;){let a,r,s;do a=2*this.random()-1,r=2*this.random()-1,s=a*a+r*r;while(s>=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*i,t=this.mean+this.stdDev*r*i,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),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}},hle=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;let r=a||Math.random();this.randu=WT.alea(r.toString()),this.randn=new GT(0,1,n,!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,t,n,a,r,s;for(;;){do a=this.randn.nextValue(),s=1+this.c*a;while(s<=0);if(s*=s*s,e=a*a,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),r<t||Math.log(r)<n)break}return s=1/this.beta*this.d*s,this.alpha<1&&(s*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(s)}convertValue(e){return this.dtype==="float32"?e:Math.round(e)}},ple=class{constructor(e=0,t=1,n,a){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,a==null&&(a=Math.random()),typeof a=="number"&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=WT.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function fle(e,t,n=1,a="float32",r){if(ci(e),n==null&&(n=1),a==null&&(a="float32"),a!=="float32"&&a!=="int32")throw new Error(`Unsupported data type ${a}`);let s=new hle(t,n,a,r),i=Zt(e,a);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}var nP=re({randomGamma_:fle});function mle(e,t=0,n=1,a,r){if(ci(e),a!=null&&a==="bool")throw new Error(`Unsupported data type ${a}`);let s=new GT(t,n,a,!1,r),i=Zt(e,a);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}var Gw=re({randomNormal_:mle});function gle(e,t,n){if(t!=null&&t==="bool")throw new Error(`Unsupported data type ${t}`);return Gw(e,0,1,t,n)}var aP=re({randomStandardNormal_:gle});function xle(e,t=0,n=1,a="float32",r){ci(e);let s=Zt(e,a),i=new ple(t,n,null,r);for(let o=0;o<s.values.length;o++)s.values[o]=i.nextValue();return s.toTensor()}var yc=re({randomUniform_:xle});function yle(e,t,n,a){return yc(e,t,n,"int32",a)}var rP=re({randomUniformInt_:yle});function $d(e,t,n=1,a="float32"){if(n===0)throw new Error("Cannot have a step of zero");let r={start:e,stop:t,step:n,dtype:a};return ae.runKernel(pb,{},r)}function ble(e){let t={input:q(e,"input","real")};return ae.runKernel(_w,t)}var qf=re({real_:ble});function vle(e){let t={x:q(e,"x","reciprocal")};return ae.runKernel(Wh,t)}var qT=re({reciprocal_:vle});function wle(e){let t={x:q(e,"x","relu")};return ae.runKernel(Vh,t)}var Vn=re({relu_:wle});function Sle(e){let t={x:q(e,"x","relu6")};return ae.runKernel(qh,t)}var qw=re({relu6_:Sle});function kle(e,t){let n={x:q(e,"x","reverse")},a={dims:t};return ae.runKernel(Kh,n,a)}var Mi=re({reverse_:kle});function Nle(e){let t=q(e,"x","reverse");return Z(t.rank===1,()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),Mi(t,0)}var sP=re({reverse1d_:Nle});function Cle(e,t){let n=q(e,"x","reverse");return Z(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),Mi(n,t)}var iP=re({reverse2d_:Cle});function Ele(e,t){let n=q(e,"x","reverse");return Z(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),Mi(n,t)}var oP=re({reverse3d_:Ele});function Ile(e,t){let n=q(e,"x","reverse");return Z(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),Mi(n,t)}var lP=re({reverse4d_:Ile});function Tle(e){let t={x:q(e,"x","round")};return ae.runKernel(Xh,t)}var Kw=re({round_:Tle});function Ale(e){let t={x:q(e,"x","rsqrt","float32")};return ae.runKernel(Yh,t)}var Xw=re({rsqrt_:Ale});function _le(e){let t={x:q(e,"x","selu")};return ae.runKernel(Jh,t)}var Yw=re({selu_:_le});function jle(e,t,n,a,r,s=[1,1],i="NHWC"){let o=q(e,"x","separableConv2d"),l=q(t,"depthwiseFilter","separableConv2d"),d=q(n,"pointwiseFilter","separableConv2d"),c=o,f=!1;if(o.rank===3&&(f=!0,c=le(o,[1,o.shape[0],o.shape[1],o.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");Z(c.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`),Z(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),Z(d.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),Z(d.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got ${d.shape[0]}.`),Z(d.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${d.shape[1]}.`);let m=l.shape[2],x=l.shape[3];Z(d.shape[2]===m*x,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${m*x}, but got ${d.shape[2]}.`);let y=dp(c,l,a,r,i,s),b=ws(y,d,1,"valid",i);return f?le(b,[b.shape[1],b.shape[2],b.shape[3]]):b}var bg=re({separableConv2d_:jle});async function Dle(e,t){let n=q(e,"x","setdiff1d"),a=q(t,"y","setdiff1d");Z(n.dtype===a.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${a.dtype}).`),Z(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),Z(a.rank===1,()=>`y should be 1D tensor, but got y (${a.shape}).`);let r=await n.data(),s=await a.data(),i=new Set(s),o=0;for(let c=0;c<r.length;c++)i.has(r[c])||o++;let l=new ar([o],n.dtype),d=new ar([o],"int32");for(let c=0,f=0;c<r.length;c++)i.has(r[c])||(l.values[f]=r[c],d.values[f]=c,f++);return[l.toTensor(),d.toTensor()]}var uP=Dle;function Rle(e){let t={x:q(e,"x","sign")};return ae.runKernel(ep,t)}var KT=re({sign_:Rle});function Mle(e){let t={x:q(e,"x","sin","float32")};return ae.runKernel(Qh,t)}var Jw=re({sin_:Mle});function $le(e){let t={x:q(e,"x","sinh")};return ae.runKernel(Zh,t)}var Qw=re({sinh_:$le});function Ble(e,t,n){let a=q(e,"x","slice1d");return Z(a.rank===1,()=>`slice1d expects a rank-1 tensor, but got a rank-${a.rank} tensor`),un(a,[t],[n])}var Pb=re({slice1d_:Ble});function Fle(e,t,n){let a=q(e,"x","slice2d");return Z(a.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${a.rank} tensor`),un(a,t,n)}var Zw=re({slice2d_:Fle});function Ole(e,t,n){let a=q(e,"x","slice3d");return Z(a.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${a.rank} tensor`),un(a,t,n)}var vg=re({slice3d_:Ole});function Lle(e,t,n){let a=q(e,"x","slice4d");return Z(a.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${a.rank} tensor`),un(a,t,n)}var Kf=re({slice4d_:Lle});function Ple(e,t=-1){let n=q(e,"logits","softmax","float32");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank}
77 and dim was ${t}`);let a={logits:n},r={dim:t};return ae.runKernel(sp,a,r)}var bc=re({softmax_:Ple});function zle(e){Z(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return ae.runKernel(Nw,t)}var zb=re({fft_:zle});function Ule(e){Z(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return ae.runKernel(Cw,t)}var Xf=re({ifft_:Ule});function Wle(e){let t=e.shape[e.shape.length-1],n=e.size/t,a;if(t<=2){let r=le(e,[n,t]);a=Xf(r)}else{let r=[n,2*(t-1)],s=le(qf(e),[n,t]),i=le(Db(e),[n,t]),o=Mi(un(s,[0,1],[n,t-2]),1),l=ie(Mi(un(i,[0,1],[n,t-2]),1),Et(-1)),d=Qn([s,o],1),c=Qn([i,l],1),f=le(Ul(d,c),[r[0],r[1]]);a=Xf(f)}if(a=qf(a),e.rank===3&&e.shape[0]!==0){let r=a,s=e.shape[0];a=le(a,[s,a.shape[0]/s,a.shape[1]]),r.dispose()}return a}var e2=re({irfft_:Wle});function Vle(e,t,n=0){let a={x:q(e,"x","split")},r={numOrSizeSplits:t,axis:n};return ae.runKernel(sg,a,r)}var Bs=re({split_:Vle});function Hle(e,t){Z(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],a=e.size/n,r;if(t!=null&&t<n){let y=e.shape.map(w=>0),b=e.shape.map(w=>w);b[e.shape.length-1]=t,r=un(e,y,b),n=t}else if(t!=null&&t>n){let y=e.shape.map(b=>b);y[e.shape.length-1]=t-n,r=Qn([e,va(y)],e.shape.length-1),n=t}else r=e;let s=pn(r),i=le(Ul(r,s),[a,n]),o=zb(i),l=Math.floor(n/2)+1,d=qf(o),c=Db(o),f=Bs(d,[l,n-l],d.shape.length-1),m=Bs(c,[l,n-l],c.shape.length-1),x=r.shape.slice();return x[r.shape.length-1]=l,le(Ul(f[0],m[0]),x)}var Ub=re({rfft_:Hle});function Gle(e,t){let n=q(e,"a","squaredDifference"),a=q(t,"b","squaredDifference");[n,a]=ka(n,a),Zn(n.shape,a.shape);let r={a:n,b:a},s={};return ae.runKernel(ip,r,s)}var t2=re({squaredDifference_:Gle});function qle(e,t){let n=q(e,"x","squeeze","string_or_numeric");return le(n,B8(n.shape,t).newShape)}var vc=re({squeeze_:qle});function Kle(e,t=0){let n=My(e,"tensors","stack","string_or_numeric");Z(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&Z(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let a=n,r={axis:t};return ae.runKernel(Xm,a,r)}var rr=re({stack_:Kle});function Xle(e,t=0){let n={x:q(e,"x","step")},a={alpha:t};return ae.runKernel(mc,n,a)}var pp=re({step_:Xle});function Yle(e,t,n,a,r=0,s=0,i=0,o=0,l=0){let d={x:q(e,"x","stridedSlice","string_or_numeric")},c={begin:t,end:n,strides:a,beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return ae.runKernel(lg,d,c)}var XT=re({stridedSlice_:Yle});function Jle(e){let t={x:q(e,"x","tan","float32")};return ae.runKernel(lp,t)}var YT=re({tan_:Jle});function Ln(e,t){Hd(e);let n=rl(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return gc(e,null,n,t)}function nl(e,t,n){if(Hd(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let a=rl(e,n);if(a.length!==2&&a.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return gc(e,t,a,n)}function n2(e,t,n){if(Hd(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let a=rl(e,n);if(a.length!==3&&a.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return gc(e,t,a,n)}function tc(e,t,n){if(Hd(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let a=rl(e,n);if(a.length!==4&&a.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return gc(e,t,a,n)}function cP(e,t,n){if(Hd(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let a=rl(e,n);if(a.length!==5&&a.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return gc(e,t,a,n)}function dP(e,t,n){if(Hd(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let a=rl(e,n);if(a.length!==6&&a.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||a,gc(e,t,a,n)}var a2={};Xt(a2,{calculateShapes:()=>hP,validateInput:()=>r2,validateUpdateShape:()=>JT});function JT(e,t,n){let a=t.rank>1?t.shape[t.rank-1]:1,r=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${a}, and batchDim: ${r}.`;if(n.rank<r)throw new Error(s+` update.rank < ${r}. `);if(e.length<a+(n.rank-r))throw new Error(s+` Output shape length < ${a+(n.rank-r)}`);if(n.rank!==r+e.length-a)throw new Error(s+` update.rank != ${r+e.length-a}`);for(let i=0;i<r;++i)if(n.shape[i]!==t.shape[i])throw new Error(s+` updates.shape[${i}] (${n.shape[i]}) != indices.shape[${i}] (${t.shape[i]}).`);for(let i=0;i<n.rank-r;++i)if(n.shape[i+r]!==e[i+a])throw new Error(s+` updates.shape[${i+r}] (${n.shape[i+r]}
77) != shape[${i+r}] (${e[i+r]})`)}function r2(e,t,n){if(t.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if(t.dtype!=="int32")throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.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(t.size===0)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(e.size===0)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}JT(n,t,e)}function hP(e,t,n){let a=t.shape.length,r=a>1?t.shape[a-1]:1,s=n.length,i=1;for(let f=r;f<s;++f)i*=n[f];let o=r<1?1:r,l=Hn(t.shape)/o,d=[...dm(n.slice(0,r)),1],c=Hn(n);return{sliceRank:r,numUpdates:l,sliceSize:i,strides:d,outputSize:c}}function Qle(e,t,n){let a=q(e,"tensor","tensorScatterupdate"),r=q(t,"indices","tensorScatterupdate","int32"),s=q(n,"updates","tensorScatterupdate");if(r2(s,r,a.shape),a.dtype!==s.dtype)throw new Error(`tensor and updates must have the same dtype, instead they are ${a.dtype} and ${s.dtype}.`);let i={tensor:a,indices:r,updates:s},o={};return ae.runKernel(eg,i,o)}var pP=re({tensorScatterUpdate_:Qle});function Zle(e,t=1,n=!0){let a=q(e,"x","topk");
vendor: 1,808 bytes, line 77
77if(a.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let r=a.shape[a.shape.length-1];if(t<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=ae.runKernel(ug,s,i);return{values:o,indices:l}}var QT=re({topk_:Zle});function eue(e,t=0,n=1,a,r){if(ci(e),a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new GT(t,n,a,!0,r),i=Zt(e,a);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}var s2=re({truncatedNormal_:eue});function tue(e,t=0){let n=q(e,"x","unique","string_or_numeric");Z(n.rank>0,()=>"The input tensor must be at least 1D");let a={x:n},r={axis:t},[s,i]=ae.runKernel(Sb,a,r);return{values:s,indices:i}}var ZT=re({unique_:tue});function nue(e,t,n){let a=q(e,"x","unsortedSegmentSum"),r=q(t,"segmentIds","unsortedSegmentSum","int32");Z(Pf(n),()=>"numSegments must be of dtype int");let s={x:a,segmentIds:r},i={numSegments:n};return ae.runKernel(kb,s,i)}var i2=re({unsortedSegmentSum_:nue});function aue(e,t=0){let n=q(e,"x","unstack","string_or_numeric");Z(t>=-n.shape.length&&t<n.shape.length,()=>`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let a={value:n},r={axis:t};return ae.runKernel(dg,a,r)}var $a=re({unstack_:aue});function fP(e,t){return Hw(e,t,"right")}function eA(e,t=!0,n,a){return ae.makeVariable(e,t,n,a)}function mP(e,t){let n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(s);let a=Zt(e,"int32"),r=Zt([n.length,e.length],"int32");for(let s=0;s<n.length;s++){let i=a.indexToLoc(n[s]),o=s*e.length;r.values.set(i,o)}return r.toTensor()}async function rue(e){let t=q(e,"condition","whereAsync","bool"),n=await t.data(),a=mP(t.shape,n);
vendor: 5,444 bytes, line 77
77return e!==t&&t.dispose(),a}var tA=rue;async function sue(e,t,n){let a=q(e,"tensor","boolMask"),r=q(t,"mask","boolMask","bool"),s=n??0,i=r.rank,o=a.shape;Z(i>0,()=>"mask cannot be scalar"),Ns(o.slice(s,s+i),r.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let b=s;b<s+i;b++)l*=o[b];let d=o.slice(0,s).concat([l],o.slice(s+i)),c=le(a,d),f=le(r,[-1]),m=await tA(f),x=vc(m,[1]),y=yg(c,x,s);return e!==a&&a.dispose(),t!==r&&r.dispose(),x.dispose(),c.dispose(),f.dispose(),m.dispose(),y}var gP=sue;function iue(e,t,n){let a=q(e,"x","transpose");if(t==null&&(t=a.shape.map((i,o)=>o).reverse()),Z(a.rank===t.length,()=>`Error in transpose: rank of input ${a.rank} must match length of perm ${t}.`),t.forEach(i=>{Z(i>=0&&i<a.rank,()=>`All entries in 'perm' must be between 0 and ${a.rank-1} but got ${t}`)}),a.rank<=1)return a.clone();let r={x:a},s={perm:t};return a.dtype==="complex64"?ue(()=>{let i=qf(a),o=Db(a);return i=ae.runKernel(Fl,{x:i},s),o=ae.runKernel(Fl,{x:o},s),n&&(o=ua(o)),Ul(i,o)}):ae.runKernel(Fl,r,s)}var Qt=re({transpose_:iue});function oue(e,t,n,a,r=!0){let s=q(e,"v","movingAverage"),i=q(t,"x","movingAverage"),o=q(n,"decay","movingAverage");nL(s,i),Z(Gl(s.shape,i.shape),()=>"Shape mismatch in v and x");let l=Et(1),d=st(l,o),c=ie(st(i,s),d);if(r){Z(a!=null,()=>"When using zeroDebias: true, step is required.");let f=q(a,"step","movingAverage");c=ht(c,st(l,sl(o,f)))}return ke(s,c)}var xP=re({movingAverage_:oue});function lue(e,t,n){ci(n);let a=q(e,"indices","scatterND","int32"),r=q(t,"updates","scatterND");r2(r,a,n);let s={indices:a,updates:r},i={shape:n};return ae.runKernel(Zm,s,i)}var yP=re({scatterND_:lue});function uue(e,t,n,a){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let r=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==a.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function cue(e,t,n,a=0){ci(n);let r=q(e,"sparseIndices","sparseToDense","int32"),s=q(t,"sparseValues","sparseToDense","string_or_numeric"),i=q(a,"defaultValue","sparseToDense",s.dtype);uue(r,s,n,i);let o={sparseIndices:r,sparseValues:s,defaultValue:i},l={outputShape:n};return ae.runKernel(og,o,l)}var bP=re({sparseToDense_:cue});function due(e,t){let n=q(t,"indices","gatherND","int32"),a={params:q(e,"x","gatherND","string_or_numeric"),indices:n};return ae.runKernel(Dm,a)}var vP=re({gatherND_:due});function hue(e,t){if(t==null)return e.shape.slice();if(Gl(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let a=0;a<e.shape.length;a++)t[a]==null&&e.shape[a]!=null?n.push(e.shape[a]):n.push(t[a]);return n}return t}function pue(e,t,n,a){let r=q(e,"x","dropout");if(Z(r.dtype==="float32",()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),Z(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof en?r.clone():r;let s=hue(r,n),i=1-t,o=ht(xg(ke(yc(s,0,1,"float32",a),i)),i);return ie(r,o)}var nA=re({dropout_:pue});function aA(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function o2(e,t,n){let a=1-e%2,r=new Float32Array(e);for(let s=0;s<e;++s){let i=2*Math.PI*s/(e+a-1);r[s]=t-n*Math.cos(i)}return Ln(r,"float32")}async function fue(e,t,n=1){let a=q(e,"predictions","inTopK"),r=q(t,"targets","inTopK");Z(a.rank>1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${a.rank}`),Z(a.rank-1===r.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${a.rank} and targets rank ${r.rank}`),Ns(a.shape.slice(0,a.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let s=a.shape[a.shape.length-1];Z(n>0&&n<=s,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`);let i=await a.data(),o=await r.data(),[l,d]=[i.length/s,s],c=F8("bool",l);for(let f=0;f<l;f++){let m=f*d,x=i.subarray(m,m+d),y=[];for(let b=0;b<x.length;b++)y.push({value:x[b],index:b});y.sort((b,w)=>w.value-b.value),c[f]=0;for(let b=0;b<n;b++)if(y[b].index===o[f]){c[f]=1;break}}return e!==a&&a.dispose(),t!==r&&r.dispose(),bs(c,r.shape,"bool")}var wP=fue,Yf={};Xt(Yf,{conv2d:()=>xue,depthwiseConv2d:()=>wue,matMul:()=>kue});function mue(e,t,n,a,r,s="NHWC",i){let o=e;e.rank===3&&(o=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]])),Z(o.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`),Z(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),Z(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let d=s==="NHWC"?o.shape[3]:o.shape[1],c=s==="NHWC"?l.shape[3]:l.shape[1];Z(d===n[2],()=>`Error in conv2dDerFilter: depth of input ${d}) must match input depth in filter (${n[2]}.`),Z(c===n[3],()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}
77).`),Cs("conv2dDerFilter",r,i);let f={x:o,dy:l},m={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,filterShape:n};return ae.runKernel(bw,f,m)}var rA=re({conv2DBackpropFilter_:mue});function l2(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return ie(e,pp(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function u2(e,t){let n=t,a=sr(e.shape,t.shape);return a.length>0&&(n=yt(n,a)),le(n,e.shape)}function c2(e,t,n,a){if(t==="linear")return e;if(t==="relu")return Vn(e);if(t==="elu")return mg(e);if(t==="relu6")return qw(e);if(t==="prelu")return Lb(e,n);if(t==="leakyrelu")return Rb(e,a);if(t==="sigmoid")return eo(e);throw new Error(`Unknown fused activation ${t}.`)}var d2=(e,t)=>!(e>0)||t==="linear";function gue({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:c}){if(l=l||"linear",d2(ae.state.gradientDepth,l)===!1){Z(r==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${r} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let _=ws(e,t,n,a,r,s,i);return o!=null&&(_=ke(_,o)),c2(_,l,d,c)}let f=q(e,"x","conv2d","float32"),m=q(t,"filter","conv2d","float32"),x=f,y=!1;f.rank===3&&(y=!0,x=le(f,[1,f.shape[0],f.shape[1],f.shape[2]])),Z(x.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${x.rank}.`),Z(m.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${m.rank}.`),Cs("fused conv2d",a,i);let b=r==="NHWC"?x.shape[3]:x.shape[1];Z(m.shape[2]===b,()=>`Error in conv2d: depth of input (${b}) must match input depth for filter ${m.shape[2]}.`),Z(ll(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);let w=Ab(x.shape,m.shape,n,s,a,i),S;o!=null&&(S=q(o,"bias","fused conv2d"),[S]=ka(S,f),r==="NHWC"?Zn(w.outShape,S.shape):(Z(S.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${S.shape.length}.`),Z(S.shape.length===0||S.shape[0]===w.outChannels||S.shape[0]===1,()=>`Error in fused conv2d: bias shape (${S.shape}) is not compatible with the number of output channels (${w.outChannels})`)));let k;if(d!=null){let _=d.shape;if(Z(_.length<=1||_.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-${_.length}.`),_.length===1)Z(_[0]===1||_[0]===w.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${_}) is not compatible with the number of output channels (${w.outChannels}).`);else if(_.length===3)try{Zn(_,w.outShape)}catch{let $=`Error in fused conv2d: PReLU activation weights (${_}) is not compatible with the output shape of the conv2d (${w.outShape}).`;throw Error($)}k=q(d,"prelu weights","fused conv2d")}let C=(_,A)=>{Z(r==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${r} but only NHWC is currently supported.`);let[$,O,z,P]=A,j=l2(_,z,l);Z(Qu(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);let G=wT(O.shape,j,$,n,a),X=rA(O,j,$.shape,n,a),J=[G,X];if(P!=null){let V=u2(P,j);J.push(V)}return J},E={x,filter:m,bias:S,preluActivationWeights:k},T={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:c};return o==null?il((_,A,$)=>{let O=ae.runKernel(Cd,E,T);return $([A,_,O]),y&&(O=le(O,[O.shape[1],O.shape[2],O.shape[3]])),{value:O,gradFunc:C}})(x,m):il((_,A,$,O)=>{let z=ae.runKernel(Cd,E,T);return O([A,_,z,$]),y&&(z=le(z,[z.shape[1],z.shape[2],z.shape[3]])),{value:z,gradFunc:C}})(x,m,S)}var xue=re({fusedConv2d_:gue});function yue(e,t,n,a,r,s=[1,1],i){let o=e;e.rank===3&&(o=le(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={x:o,dy:l},c={strides:a,pad:r,dimRoundingMode:i,dilations:s,filterShape:n};return ae.runKernel(vw,d,c)}var SP=re({depthwiseConv2dNativeBackpropFilter_:yue});function bue(e,t,n,a,r,s=[1,1],i){let o=t,l=!1;t.rank===3&&(l=!0,o=le(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={dy:o,filter:n},c={strides:a,pad:r,dimRoundingMode:i,dilations:s,inputShape:e},f=ae.runKernel(ww,d,c);return l?le(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var kP=re({depthwiseConv2dNativeBackpropInput_:bue});function vue({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:c}){if(d2(ae.state.gradientDepth,l)===!1){let T=dp(e,t,n,a,r,s,i);return o!=null&&(T=ke(T,o)),c2(T,l,d,c)}let f=q(e,"x","depthwiseConv2d","float32"),m=q(t,"filter","depthwiseConv2d","float32"),x=f,y=!1;f.rank===3&&(y=!0,x=le(f,[1,f.shape[0],f.shape[1],f.shape[2]])),Z(x.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${x.rank}.`),Z(m.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${m.rank}.`),Z(x.shape[3]===m.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${x.shape[3]}) must match the inChannels dimension in filter ${m.shape[2]}.`),s==null&&(s=[1,1]),Z(ll(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),Cs("fused depthwiseConv2d",a,i);let b=Ab(x.shape,m.shape,n,s,a,i,!0),w;
vendor: 35,877 bytes, lines 77-83
77o!=null&&(w=q(o,"bias","fused conv2d"),[w]=ka(w,f),Zn(b.outShape,w.shape));let S;d!=null&&(S=q(d,"prelu weights","fused depthwiseConv2d"));let k=(T,_)=>{Z(Qu(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);let[A,$,O,z]=_,P=l2(T,O,l),j=kP($.shape,P,A,n,a,s,i),G=SP($,P,A.shape,n,a,s,i);if(z!=null){let X=u2(w,P);return[j,G,X]}return[j,G]},C={x,filter:m,bias:w,preluActivationWeights:S},E={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:c};return o==null?il((T,_,A)=>{let $=ae.runKernel(Ed,C,E);return A([_,T,$]),y&&($=le($,[$.shape[1],$.shape[2],$.shape[3]])),{value:$,gradFunc:k}})(x,m):il((T,_,A,$)=>{let O=ae.runKernel(Ed,C,E);return $([_,T,O,A]),y&&(O=le(O,[O.shape[1],O.shape[2],O.shape[3]])),{value:O,gradFunc:k}})(x,m,w)}var wue=re({fusedDepthwiseConv2d_:vue});function Sue({a:e,b:t,transposeA:n=!1,transposeB:a=!1,bias:r,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o=.2}){if(d2(ae.state.gradientDepth,s)===!1){let z=Jt(e,t,n,a);return r!=null&&(z=ke(z,r)),c2(z,s,i,o)}let l=q(e,"a","fused matMul"),d=q(t,"b","fused matMul");[l,d]=ka(l,d);let c=n?l.shape[l.rank-2]:l.shape[l.rank-1],f=a?d.shape[d.rank-1]:d.shape[d.rank-2],m=n?l.shape[l.rank-1]:l.shape[l.rank-2],x=a?d.shape[d.rank-2]:d.shape[d.rank-1],y=l.shape.slice(0,-2),b=d.shape.slice(0,-2),w=Hn(y),S=Hn(b);Z(c===f,()=>`Error in fused matMul: inner shapes (${c}) and (${f}) of Tensors with shapes ${l.shape} and ${d.shape} and transposeA=${n} and transposeB=${a} must match.`);let k=Zn(l.shape.slice(0,-2),d.shape.slice(0,-2)).concat([m,x]),C=n?le(l,[w,c,m]):le(l,[w,m,c]),E=a?le(d,[S,x,f]):le(d,[S,f,x]),T;r!=null&&(T=q(r,"bias","fused matMul"),[T]=ka(T,l),Zn(k,T.shape));let _;i!=null&&(_=q(i,"prelu weights","fused matMul"));let A=(z,P)=>{let[j,G,X,J]=P,V=l2(le(z,X.shape),X,s),Q,F;if(!n&&!a?(Q=Jt(V,G,!1,!0),F=Jt(j,V,!0,!1)):!n&&a?(Q=Jt(V,G,!1,!1),F=Jt(V,j,!0,!1)):n&&!a?(Q=Jt(G,V,!1,!0),F=Jt(j,V,!1,!1)):(Q=Jt(G,V,!0,!0),F=Jt(V,j,!0,!0)),r!=null){let H=u2(J,V);return[Q,F,H]}else return[Q,F]},$={a:C,b:E,bias:T,preluActivationWeights:_},O={transposeA:n,transposeB:a,activation:s,leakyreluAlpha:o};return r==null?il((z,P,j)=>{let G=ae.runKernel(Nd,$,O);return j([z,P,G]),{value:le(G,k),gradFunc:A}})(C,E):il((z,P,j,G)=>{let X=ae.runKernel(Nd,$,O);return G([z,P,X,j]),{value:le(X,k),gradFunc:A}})(C,E,T)}var kue=re({fusedMatMul_:Sue});function Nue(e){return o2(e,.54,.46)}var Cue=re({hammingWindow_:Nue});function Eue(e){return o2(e,.5,.5)}var NP=re({hannWindow_:Eue});function Iue(e,t,n,a=!1,r=0){let s=0,i=[];for(;s+t<=e.size;)i.push(un(e,s,t)),s+=n;if(a)for(;s<e.size;){let o=s+t-e.size,l=Qn([un(e,s,t-o),ri([o],r)]);i.push(l),s+=n}return i.length===0?nl([],[0,t]):le(Qn(i),[i.length,t])}var CP=re({frame_:Iue});function Tue(e,t,n,a,r=NP){a==null&&(a=aA(t));let s=CP(e,t,n),i=ie(s,r(t));return Ub(i,a)}var Aue=re({stft_:Tue});function _ue(e,t,n,a,r="bilinear",s=0){let i=q(e,"image","cropAndResize"),o=q(t,"boxes","cropAndResize","float32"),l=q(n,"boxInd","cropAndResize","int32"),d=o.shape[0];Z(i.rank===4,()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),Z(o.rank===2&&o.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${d},4] but had shape ${o.shape}.`),Z(l.rank===1&&l.shape[0]===d,()=>`Error in cropAndResize: boxInd must be have size [${d}] but had shape ${o.shape}.`),Z(a.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${a.length}.`),Z(a[0]>=1&&a[1]>=1,()=>`cropSize must be atleast [1,1], but was ${a}`),Z(r==="bilinear"||r==="nearest",()=>`method must be bilinear or nearest, but was ${r}`);let c={image:i,boxes:o,boxInd:l},f={method:r,extrapolationValue:s,cropSize:a};return ae.runKernel(Cm,c,f)}var jue=re({cropAndResize_:_ue});function Due(e){let t=q(e,"image","flipLeftRight","float32");Z(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return ae.runKernel(_m,n,{})}var Rue=re({flipLeftRight_:Due});function Mue(e){let t=q(e,"image","grayscaleToRGB"),n=t.rank-1,a=t.shape[n];Z(t.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`),Z(a===1,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${a}.`);let r=new Array(t.rank);return r.fill(1,0,n),r[n]=3,ai(t,r)}var $ue=re({grayscaleToRGB_:Mue});function Bue(e){let t=q(e,"image","RGBToGrayscale"),n=t.rank-1,a=t.shape[n];Z(t.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`),Z(a===3,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${a}.`);let r=t.dtype,s=He(t,"float32"),i=Ln([.2989,.587,.114]),o;switch(t.rank){case 2:o=ud("ij,j->i",s,i);break;case 3:o=ud("ijk,k->ij",s,i);break;case 4:o=ud("ijkl,l->ijk",s,i);break;case 5:o=ud("ijklm,m->ijkl",s,i);break;case 6:o=ud("ijklmn,n->ijklm",s,i);break;default:throw new Error("Not a valid tensor rank.")}return o=Dr(o,-1),He(o,r)}var Fue=re({rgbToGrayscale_:Bue});function Oue(e,t,n=0,a=.5){let r=q(e,"image","rotateWithOffset","float32");Z(r.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);let s={image:r},i={radians:t,fillValue:n,center:a};return ae.runKernel(pg,s,i)}var Lue=re({rotateWithOffset_:Oue});function wg(e,t,n,a,r,s){a==null&&(a=.5),r==null&&(r=Number.NEGATIVE_INFINITY),s==null&&(s=0);let i=e.shape[0];return n=Math.min(n,i),Z(0<=a&&a<=1,()=>`iouThreshold must be in [0, 1], but was '${a}'`),Z(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),Z(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),Z(t.rank===1,()=>"scores must be a 1D tensor"),Z(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),Z(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s}}function Pue(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=q(e,"boxes","nonMaxSuppression","float32"),i=q(t,"scores","nonMaxSuppression","float32"),o=wg(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l={maxOutputSize:n,iouThreshold:a,scoreThreshold:r};return ae.runKernel(Hm,{boxes:s,scores:i},l)}var zue=re({nonMaxSuppression_:Pue});function Uue(e,t,n){let a=Wue(e,t,n),r=a<0?-(a+1):a;e.splice(r,0,t)}function Wue(e,t,n){return Hue(e,t,n||Vue)}function Vue(e,t){return e>t?1:e<t?-1:0}function Hue(e,t,n){let a=0,r=e.length,s=0,i=!1;for(;a<r;){s=a+(r-a>>>1);let o=n(t,e[s]);o>0?a=s+1:(r=s,i=!o)}return i?a:-a-1}function EP(e,t,n,a,r){return sA(e,t,n,a,r,0)}function IP(e,t,n,a,r,s){return sA(e,t,n,a,r,0,!1,s,!0)}function TP(e,t,n,a,r,s){return sA(e,t,n,a,r,s,!0)}function sA(e,t,n,a,r,s,i=!1,o=!1,l=!1){let d=[];for(let w=0;w<t.length;w++)t[w]>r&&d.push({score:t[w],boxIndex:w,suppressBeginIndex:0});d.sort(W5);let c=s>0?-.5/s:0,f=[],m=[];for(;f.length<n&&d.length>0;){let w=d.pop(),{score:S,boxIndex:k,suppressBeginIndex:C}=w;if(S<r)break;let E=!1;for(let T=f.length-1;T>=C;--T){let _=Gue(e,k,f[T]);if(_>=a){E=!0;break}if(w.score=w.score*que(a,c,_),w.score<=r)break}w.suppressBeginIndex=f.length,E||(w.score===S?(f.push(k),m.push(w.score)):w.score>r&&Uue(d,w,W5))}let x=f.length,y=n-x;o&&y>0&&(f.push(...new Array(y).fill(0)),m.push(...new Array(y).fill(0)));let b={selectedIndices:f};return i&&(b.selectedScores=m),l&&(b.validOutputs=x),b}function Gue(e,t,n){let a=e.subarray(t*4,t*4+4),r=e.subarray(n*4,n*4+4),s=Math.min(a[0],a[2]),i=Math.min(a[1],a[3]),o=Math.max(a[0],a[2]),l=Math.max(a[1],a[3]),d=Math.min(r[0],r[2]),c=Math.min(r[1],r[3]),f=Math.max(r[0],r[2]),m=Math.max(r[1],r[3]),x=(o-s)*(l-i),y=(f-d)*(m-c);if(x<=0||y<=0)return 0;let b=Math.max(s,d),w=Math.max(i,c),S=Math.min(o,f),k=Math.min(l,m),C=Math.max(S-b,0)*Math.max(k-w,0);return C/(x+y-C)}function que(e,t,n){let a=Math.exp(t*n*n);return n<=e?a:0}function W5(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function Kue(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=q(e,"boxes","nonMaxSuppressionAsync"),i=q(t,"scores","nonMaxSuppressionAsync"),o=wg(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l=await Promise.all([s.data(),i.data()]),d=l[0],c=l[1],{selectedIndices:f}=EP(d,c,n,a,r);return s!==e&&s.dispose(),i!==t&&i.dispose(),Ln(f,"int32")}var Xue=Kue;function Yue(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=q(e,"boxes","nonMaxSuppression"),o=q(t,"scores","nonMaxSuppression"),l=wg(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d={boxes:i,scores:o},c={maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s},f=ae.runKernel(qm,d,c);return{selectedIndices:f[0],selectedScores:f[1]}}var Jue=re({nonMaxSuppressionWithScore_:Yue});async function Que(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=q(e,"boxes","nonMaxSuppressionAsync"),o=q(t,"scores","nonMaxSuppressionAsync"),l=wg(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d=await Promise.all([i.data(),o.data()]),c=d[0],f=d[1],{selectedIndices:m,selectedScores:x}=TP(c,f,n,a,r,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Ln(m,"int32"),selectedScores:Ln(x)}}var Zue=Que;function ece(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=q(e,"boxes","nonMaxSuppression"),o=q(t,"scores","nonMaxSuppression"),l=wg(i,o,n,a,r,null),d=l.maxOutputSize,c=l.iouThreshold,f=l.scoreThreshold,m={boxes:i,scores:o},x={maxOutputSize:d,iouThreshold:c,scoreThreshold:f,padToMaxOutputSize:s},y=ae.runKernel(Gm,m,x);return{selectedIndices:y[0],validOutputs:y[1]}}var tce=re({nonMaxSuppressionPadded_:ece});async function nce(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=q(e,"boxes","nonMaxSuppressionAsync"),o=q(t,"scores","nonMaxSuppressionAsync"),l=wg(i,o,n,a,r,null),d=l.maxOutputSize,c=l.iouThreshold,f=l.scoreThreshold,[m,x]=await Promise.all([i.data(),o.data()]),{selectedIndices:y,validOutputs:b}=IP(m,x,d,c,f,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Ln(y,"int32"),validOutputs:Et(b,"int32")}}var ace=nce;function rce(e,t,n=!1,a=!1){let r=q(e,"images","resizeBilinear");Z(r.rank===3||r.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${r.rank}.`),Z(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),Z(a===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=le(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=ae.runKernel(Gh,o,l);return i?le(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var AP=re({resizeBilinear_:rce});function sce(e,t,n=!1,a=!1){let r=q(e,"images","resizeNearestNeighbor");Z(r.rank===3||r.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${r.rank}.`),Z(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),Z(r.dtype==="float32"||r.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),Z(a===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=le(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=ae.runKernel(Hh,o,l);return i?le(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var _P=re({resizeNearestNeighbor_:sce});function ice(e,t="binary",n=!1,a=.5){let r=q(e,"image","threshold"),s=.2989,i=.587,o=.114,l=r.shape[0]*r.shape[1],d=ie(Ln([a]),255),c,f,m,x;if(Z(r.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),Z(r.shape[2]===3||r.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),Z(r.dtype==="int32"||r.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),Z(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),r.shape[2]===3){[c,f,m]=Bs(r,[1,1,1],-1);let b=ie(c,s),w=ie(f,i),S=ie(m,o);x=ke(ke(b,w),S)}else x=e;if(t==="otsu"){let b=mT(He(Kw(x),"int32"),bs([]),256);d=oce(b,l)}let y=n?xc(x,d):Es(x,d);return He(ie(y,255),"int32")}function oce(e,t){let n=Ln([-1]),a=Ln([0]),r=Ln([0]),s,i,o,l,d,c;for(let f=0;f<e.size-1;f++){s=un(e,0,f+1),i=un(e,f+1),d=ht(yt(s),t),c=ht(yt(i),t);let m=yt(ie(s,$d(0,s.size)));o=ht(m,yt(s));let x=ri(i.shape,s.size),y=ke($d(0,i.size),x),b=ie(i,y);l=ht(yt(b),yt(i));let w=st(o,l),S=st(o,l),k=ie(d,c);r=ie(ie(k,w),S);let C=Es(r,a);a=Mr(C,r,a),n=Mr(C,Ln([f]),n)}return n}var lce=re({threshold_:ice});function uce(e,t,n="nearest",a="constant",r=0,s){let i=q(e,"image","transform","float32"),o=q(t,"transforms","transform","float32");Z(i.rank===4,()=>`Error in transform: image must be rank 4,but got rank ${i.rank}.`),Z(o.rank===2&&(o.shape[0]===i.shape[0]||o.shape[0]===1)&&o.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),Z(s==null||s.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);let l={image:i,transforms:o},d={interpolation:n,fillMode:a,fillValue:r,outputShape:s};return ae.runKernel(cg,l,d)}var cce=re({transform_:uce});function dce(e,t,n){let a=q(e,"a","bandPart");Z(a.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${a.rank}.`);let r=a.shape,[s,i]=a.shape.slice(-2),o,l;typeof t=="number"?(Z(t%1===0,()=>`bandPart(): numLower must be an integer, got ${t}.`),Z(t<=s,()=>`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`),o=q(t<0?s:t,"numLower","bandPart")):(Z(t.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),o=Mr(Hf(t,0),s,ec(t,s))),typeof n=="number"?(Z(n%1===0,()=>`bandPart(): numUpper must be an integer, got ${n}.`),Z(n<=i,()=>`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`),l=q(n<0?i:n,"numUpper","bandPart")):(Z(n.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),l=Mr(Hf(n,0),i,ec(n,i)));let d=le($d(0,s,1,"int32"),[-1,1]),c=$d(0,i,1,"int32"),f=st(d,c),m=to(xc(f,o),Xl(f,ua(l))),x=va([s,i],a.dtype);return le(rr($a(le(a,[-1,s,i])).map(y=>Mr(m,y,x))),r)}var hce=re({bandPart_:dce});function pce(e){let t;if(Array.isArray(e)){t=!1,Z(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let r=e[0].shape[0];for(let s=1;s<e.length;++s)Z(e[s].shape[0]===r,()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[s].shape[0]} vs. ${r})`)}else t=!0,e=Bs(e,e.shape[0],0).map(r=>vc(r,[0]));Z(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],a=e;for(let r=0;r<e.length;++r)n.push(ae.tidy(()=>{let s=a[r];if(r>0)for(let i=0;i<r;++i){let o=ie(yt(ie(n[i],s)),n[i]);s=st(s,o)}return ht(s,gg(s,"euclidean"))}));return t?rr(n,0):n}var fce=re({gramSchmidt_:pce});function mce(e,t=!1){if(Z(e.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return V5(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,d)=>l*d),a=$a(le(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];a.forEach(l=>{let[d,c]=V5(l,t);r.push(d),s.push(c)});let i=le(rr(r,0),e.shape),o=le(rr(s,0),e.shape);return[i,o]}}function V5(e,t=!1){return ae.tidy(()=>{Z(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],a=e.shape[1],r=zw(n),s=tl(e),i=nl([[1]],[1,1]),o=tl(i),l=n>=a?a:n;for(let d=0;d<l;++d){let c=s,f=o,m=r;[o,s,r]=ae.tidy(()=>{let x=un(s,[d,d],[n-d,1]),y=gg(x),b=un(s,[d,d],[1,1]),w=Mr(Es(b,0),nl([[-1]]),nl([[1]])),S=st(b,ie(w,y)),k=ht(x,S);k.shape[0]===1?o=tl(i):o=Qn([i,un(k,[1,0],[k.shape[0]-1,k.shape[1]])],0);let C=ua(ht(Jt(w,S),y)),E=un(s,[d,0],[n-d,a]),T=ie(C,o),_=Qt(o);if(d===0)s=st(E,Jt(T,Jt(_,E)));else{let O=st(E,Jt(T,Jt(_,E)));s=Qn([un(s,[0,0],[d,a]),O],0)}let A=Qt(T),$=un(r,[0,d],[n,r.shape[1]-d]);if(d===0)r=st($,Jt(Jt($,o),A));else{let O=st($,Jt(Jt($,o),A));r=Qn([un(r,[0,0],[n,d]),O],1)}return[o,s,r]}),Kt([c,f,m])}return!t&&n>a&&(r=un(r,[0,0],[n,a]),s=un(s,[0,0],[a,a])),[r,s]})}var gce=re({qr_:mce}),gs;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(gs||(gs={}));function xce(e,t,n=gs.SUM_BY_NONZERO_WEIGHTS){let a=q(e,"losses","computeWeightedLoss"),r=null;t!=null&&(r=q(t,"weights","computeWeightedLoss"));let s=r==null?a:ie(a,r);if(n===gs.NONE)return s;if(n===gs.SUM)return yt(s);if(n===gs.MEAN){if(r==null)return ba(s);{let i=a.size/r.size,o=ht(yt(s),yt(r));return i>1?ht(o,Et(i)):o}}if(n===gs.SUM_BY_NONZERO_WEIGHTS){if(r==null)return ht(yt(s),Et(a.size));{let i=ie(r,$s(a.shape)),o=He(yt(Md(i,Et(0))),"float32");return ht(yt(s),o)}}throw Error(`Unknown reduction: ${n}`)}var Yl=re({computeWeightedLoss_:xce});function yce(e,t,n,a=gs.SUM_BY_NONZERO_WEIGHTS){let r=q(e,"labels","absoluteDifference"),s=q(t,"predictions","absoluteDifference"),i=null;n!=null&&(i=q(n,"weights","absoluteDifference")),Ns(r.shape,s.shape,"Error in absoluteDifference: ");let o=tr(st(r,s));return Yl(o,i,a)}var bce=re({absoluteDifference_:yce});function vce(e,t,n,a,r=gs.SUM_BY_NONZERO_WEIGHTS){let s=q(e,"labels","cosineDistance"),i=q(t,"predictions","cosineDistance"),o=null;a!=null&&(o=q(a,"weights","cosineDistance")),Ns(s.shape,i.shape,"Error in cosineDistance: ");let l=Et(1),d=st(l,yt(ie(s,i),n,!0));return Yl(d,o,r)}var wce=re({cosineDistance_:vce});function Sce(e,t,n,a=gs.SUM_BY_NONZERO_WEIGHTS){let r=q(e,"labels","hingeLoss"),s=q(t,"predictions","hingeLoss"),i=null;n!=null&&(i=q(n,"weights","hingeLoss")),Ns(r.shape,s.shape,"Error in hingeLoss: ");let o=Et(1);r=st(ie(Et(2),r),o);let l=Vn(st(o,ie(r,s)));return Yl(l,i,a)}var kce=re({hingeLoss_:Sce});function Nce(e,t,n,a=1,r=gs.SUM_BY_NONZERO_WEIGHTS){let s=q(e,"labels","huberLoss"),i=q(t,"predictions","huberLoss"),o=null;n!=null&&(o=q(n,"weights","huberLoss")),Ns(s.shape,i.shape,"Error in huberLoss: ");let l=Et(a),d=tr(st(i,s)),c=ec(d,l),f=st(d,c),m=ke(ie(Et(.5),Jn(c)),ie(l,f));return Yl(m,o,r)}var Cce=re({huberLoss_:Nce});function Ece(e,t,n,a=1e-7,r=gs.SUM_BY_NONZERO_WEIGHTS){let s=q(e,"labels","logLoss"),i=q(t,"predictions","logLoss"),o=null;n!=null&&(o=q(n,"weights","logLoss")),Ns(s.shape,i.shape,"Error in logLoss: ");let l=Et(1),d=Et(a),c=ua(ie(s,ii(ke(i,d)))),f=ie(st(l,s),ii(ke(st(l,i),d))),m=st(c,f);return Yl(m,o,r)}var Ice=re({logLoss_:Ece});function Tce(e,t,n,a=gs.SUM_BY_NONZERO_WEIGHTS){let r=q(e,"labels","meanSquaredError"),s=q(t,"predictions","meanSquaredError"),i=null;n!=null&&(i=q(n,"weights","meanSquaredError")),Ns(r.shape,s.shape,"Error in meanSquaredError: ");let o=t2(r,s);return Yl(o,i,a)}var Ace=re({meanSquaredError_:Tce});function _ce(e,t){let n=q(e,"labels","sigmoidCrossEntropyWithLogits"),a=q(t,"logits","sigmoidCrossEntropyWithLogits");Ns(n.shape,a.shape,"Error in sigmoidCrossEntropyWithLogits: ");let r=Vn(a),s=ie(a,n),i=Mb(as(ua(tr(a))));return ke(st(r,s),i)}function jce(e,t,n,a=0,r=gs.SUM_BY_NONZERO_WEIGHTS){let s=q(e,"multiClassLabels","sigmoidCrossEntropy"),i=q(t,"logits","sigmoidCrossEntropy"),o=null;if(n!=null&&(o=q(n,"weights","sigmoidCrossEntropy")),Ns(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),a>0){let d=Et(a),c=Et(1),f=Et(.5);s=ke(ie(s,st(c,d)),ie(f,d))}let l=_ce(s,i);return Yl(l,o,r)}var Dce=re({sigmoidCrossEntropy_:jce});function Rce(e,t,n=-1){if(n===-1&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return il((a,r,s)=>{let i=$b(r,[n],!0),o=st(He(r,"float32"),i);s([a,o]);let l=ua(ie(o,a));return{value:yt(l,[n]),gradFunc:(d,c)=>{let[f,m]=c,x=Rd(d.shape,[n]);return[ie(le(d,x),st(He(f,"float32"),as(m))),ie(le(d,x),st(as(m),He(f,"float32")))]}}})(e,t)}function Mce(e,t,n,a=0,r=gs.SUM_BY_NONZERO_WEIGHTS){let s=q(e,"onehotLabels","softmaxCrossEntropy"),i=q(t,"logits","softmaxCrossEntropy"),o=null;if(n!=null&&(o=q(n,"weights","softmaxCrossEntropy")),Ns(s.shape,i.shape,"Error in softmaxCrossEntropy: "),a>0){let d=Et(a),c=Et(1),f=Et(s.shape[1]);s=ke(ie(s,st(c,d)),ht(d,f))}let l=Rce(s,i);return Yl(l,o,r)}var $ce=re({softmaxCrossEntropy_:Mce});function Bce(e,t,n,a){let r=q(e,"indices","sparseFillEmptyRows","int32"),s=q(t,"values","sparseFillEmptyRows"),i=q(n,"denseShape","sparseFillEmptyRows","int32"),o=q(a,"defaultValue","sparseFillEmptyRows",s.dtype);if(r.rank!==2)throw new Error(`Indices should be Tensor2D but received shape
78        ${r.shape}`);if(s.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(o.rank!==0)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);let l={indices:r,values:s,denseShape:i,defaultValue:o},d=ae.runKernel(fb,l);return{outputIndices:d[0],outputValues:d[1],emptyRowIndicator:d[2],reverseIndexMap:d[3]}}var Fce=re({sparseFillEmptyRows_:Bce});function Oce(e,t,n){let a=q(e,"inputIndices","sparseReshape","int32"),r=q(t,"inputShape","sparseReshape","int32"),s=q(n,"newShape","sparseReshape","int32");if(a.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape
79        ${a.shape}`);if(r.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(s.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);let i={inputIndices:a,inputShape:r,newShape:s},o=ae.runKernel(ig,i);return{outputIndices:o[0],outputShape:o[1]}}var Lce=re({sparseReshape_:Oce});function Pce(e,t,n){let a=q(e,"data","sparseSegmentMean"),r=q(t,"indices","sparseSegmentMean","int32"),s=q(n,"segmentIds","sparseSegmentMean","int32");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
80          ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
81          ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return ae.runKernel(mb,i)}var zce=re({sparseSegmentMean_:Pce});function Uce(e,t,n){let a=q(e,"data","sparseSegmentSum"),r=q(t,"indices","sparseSegmentSum","int32"),s=q(n,"segmentIds","sparseSegmentSum","int32");if(a.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
82         ${r.shape}`);if(s.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
83         ${s.shape}`);let i={data:a,indices:r,segmentIds:s};return ae.runKernel(gb,i)}var Wce=re({sparseSegmentSum_:Uce});function Vce(e,t,n,a,r,s,i,o){let l=q(e,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error(`Data must be a vector, saw: ${l.shape}`);let d=q(t,"dataSplits","stringNGrams");if(d.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let c={separator:n,nGramWidths:a,leftPad:r,rightPad:s,padWidth:i,preserveShortSequences:o},f={data:l,dataSplits:d},m=ae.runKernel(bb,f,c);return{nGrams:m[0],nGramsSplits:m[1]}}var Hce=re({stringNGrams_:Vce});function Gce(e,t,n=!0){let a=q(e,"input","stringSplit","string"),r=q(t,"delimiter","stringSplit","string");if(a.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${a.shape}`);if(r.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${r.shape}`);let s={skipEmpty:n},i={input:a,delimiter:r},o=ae.runKernel(vb,i,s);return{indices:o[0],values:o[1],shape:o[2]}}var qce=re({stringSplit_:Gce});function Kce(e,t){let n=q(e,"input","stringToHashBucketFast","string"),a={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let r={input:n};return ae.runKernel(wb,r,a)}var Xce=re({stringToHashBucketFast_:Kce});function Yce(e,t,n,a=!0){let r=q(e,"input","staticRegexReplace","string"),s={pattern:t,rewrite:n,replaceGlobal:a};return ae.runKernel(yb,{x:r},s)}var Jce=re({staticRegexReplace_:Yce}),jP={fft:zb,ifft:Xf,rfft:Ub,irfft:e2},DP={hammingWindow:Cue,hannWindow:NP,frame:CP,stft:Aue},Ii={flipLeftRight:Rue,grayscaleToRGB:$ue,resizeNearestNeighbor:_P,resizeBilinear:AP,rgbToGrayscale:Fue,rotateWithOffset:Lue,cropAndResize:jue,nonMaxSuppression:zue,nonMaxSuppressionAsync:Xue,nonMaxSuppressionWithScore:Jue,nonMaxSuppressionWithScoreAsync:Zue,nonMaxSuppressionPadded:tce,nonMaxSuppressionPaddedAsync:ace,threshold:lce,transform:cce},iA={bandPart:hce,gramSchmidt:fce,qr:gce},RP={absoluteDifference:bce,computeWeightedLoss:Yl,cosineDistance:wce,hingeLoss:kce,huberLoss:Cce,logLoss:Ice,meanSquaredError:Ace,sigmoidCrossEntropy:Dce,softmaxCrossEntropy:$ce},MP={sparseFillEmptyRows:Fce,sparseReshape:Lce,sparseSegmentMean:zce,sparseSegmentSum:Wce},$P={stringNGrams:Hce,stringSplit:qce,stringToHashBucketFast:Xce,staticRegexReplace:Jce},De={};Xt(De,{Serializable:()=>BP,SerializationMap:()=>FP,getRegisteredName:()=>Zce,registerClass:()=>OP});var Qce=new Map,QC=new Map,BP=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},FP=class Sf{constructor(){this.classNameMap={}}static getMap(){return Sf.instance==null&&(Sf.instance=new Sf),Sf.instance}static register(t){Sf.getMap().classNameMap[t.className]=[t,t.fromConfig]}};function OP(e,t,n){Z(e.className!=null,()=>"Class being registered does not have the static className property defined."),Z(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),Z(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof t>"u"&&(t="Custom"),typeof n>"u"&&(n=e.className);let a=n,r=t+">"+a;return FP.register(e),Qce.set(r,e),QC.set(e,r),e}function Zce(e){return QC.has(e)?QC.get(e):e.className}var Jl=class extends BP{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Kt(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return OL(e,t)}dispose(){this.iterations_!=null&&Kt(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Et(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(Jl,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var oA=class extends Jl{static get className(){return"Adadelta"}constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=ae.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=ae.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:ue(()=>pn(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:ue(()=>pn(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;ue(()=>{let l=ke(ie(i,this.rho),ie(Jn(s),1-this.rho)),d=ie(ht($r(ke(o,this.epsilon)),$r(ke(i,this.epsilon))),s),c=ke(ie(o,this.rho),ie(Jn(d),1-this.rho));i.assign(l),o.assign(c);let f=ke(ie(d,-this.learningRate),a);a.assign(f)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Kt(this.accumulatedGrads.map(e=>e.variable)),Kt(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}},lA=class extends Jl{static get className(){return"Adagrad"}constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=ae.registeredVariables[t];this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:ue(()=>ri(a.shape,this.initialAccumulatorValue).variable(!1))});let r=Array.isArray(e)?e[n].tensor:e[t];if(r==null)return;let s=this.accumulatedGrads[n].variable;ue(()=>{let i=ke(s,Jn(r));s.assign(i);let o=ke(ie(ht(r,$r(ke(i,ae.backend.epsilon()))),-this.learningRate),a);a.assign(o)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Kt(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);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}},uA=class extends Jl{static get className(){return"Adam"}constructor(e,t,n,a=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],ue(()=>{this.accBeta1=Et(t).variable(),this.accBeta2=Et(n).variable()}),a==null&&(this.epsilon=ae.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);ue(()=>{let n=st(1,this.accBeta1),a=st(1,this.accBeta2);t.forEach((r,s)=>{let i=ae.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:ue(()=>pn(i).variable(o))}),this.accumulatedSecondMoment[s]==null&&(this.accumulatedSecondMoment[s]={originalName:`${r}/v`,variable:ue(()=>pn(i).variable(o))});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,c=this.accumulatedSecondMoment[s].variable,f=ke(ie(d,this.beta1),ie(l,1-this.beta1)),m=ke(ie(c,this.beta2),ie(Jn(l),1-this.beta2)),x=ht(f,n),y=ht(m,a);d.assign(f),c.assign(m);let b=ke(ie(ht(x,ke($r(y),this.epsilon)),-this.learningRate),i);i.assign(b)}),this.accBeta1.assign(ie(this.accBeta1,this.beta1)),this.accBeta2.assign(ie(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Kt(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Kt(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),ue(()=>{this.accBeta1.assign(sl(this.beta1,this.iterations_+1)),this.accBeta2.assign(sl(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}},cA=class extends Jl{static get className(){return"Adamax"}constructor(e,t,n,a=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],ue(()=>{this.iteration=Et(0).variable(),this.accBeta1=Et(t).variable()}),a==null&&(this.epsilon=ae.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);ue(()=>{let n=st(1,this.accBeta1),a=ht(-this.learningRate,ke(ie(this.iteration,this.decay),1));t.forEach((r,s)=>{let i=ae.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:pn(i).variable(o)}),this.accumulatedWeightedInfNorm[s]==null&&(this.accumulatedWeightedInfNorm[s]={originalName:`${r}/v`,variable:pn(i).variable(o)});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,c=this.accumulatedWeightedInfNorm[s].variable,f=ke(ie(d,this.beta1),ie(l,1-this.beta1)),m=ie(c,this.beta2),x=tr(l),y=ul(m,x);d.assign(f),c.assign(y);let b=ke(ie(ht(a,n),ht(f,ke(y,this.epsilon))),i);i.assign(b)}),this.iteration.assign(ke(this.iteration,1)),this.accBeta1.assign(ie(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Kt(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Kt(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,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}},h2=class extends Jl{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=Array.isArray(e)?e[n].tensor:e[t];if(a==null)return;let r=ae.registeredVariables[t];ue(()=>{let s=ke(ie(this.c,a),r);r.assign(s)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=xr(Et(-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,t){return new e(t.learningRate)}},dA=class extends h2{static get className(){return"Momentum"}constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=Et(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=ae.registeredVariables[t];this.accumulations[n]==null&&(this.accumulations[n]={originalName:`${t}/momentum`,variable:ue(()=>pn(a).variable(!1))});let r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];s!=null&&ue(()=>{let i,o=ke(ie(this.m,r),s);this.useNesterov?i=ke(ie(this.c,ke(s,ie(o,this.m))),a):i=ke(ie(this.c,o),a),r.assign(o),a.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Kt(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}
vendor: 23,125 bytes, lines 83-84
83)))}async setWeights(e){e=await this.extractIterations(e);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}},hA=class extends Jl{static get className(){return"RMSProp"}constructor(e,t=.9,n=0,a=null,r=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,a==null&&(this.epsilon=ae.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=ae.registeredVariables[t],r=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:ue(()=>pn(a).variable(r))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:ue(()=>pn(a).variable(r))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:ue(()=>pn(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;ue(()=>{let l=ke(ie(i,this.decay),ie(Jn(s),1-this.decay));if(this.centered){let d=this.accumulatedMeanGrads[n].variable,c=ke(ie(d,this.decay),ie(s,1-this.decay)),f=ht(ie(s,this.learningRate),$r(st(l,ke(Jn(c),this.epsilon)))),m=ke(ie(o,this.momentum),f);i.assign(l),d.assign(c),o.assign(m);let x=st(a,m);a.assign(x)}else{let d=ke(ie(i,this.decay),ie(Jn(s),1-this.decay)),c=ke(ie(o,this.momentum),ht(ie(s,this.learningRate),$r(ke(d,this.epsilon))));i.assign(d),o.assign(c);let f=st(a,c);a.assign(f)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Kt(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Kt(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Kt(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}},ede=[oA,lA,uA,cA,dA,hA,h2];function tde(){for(let e of ede)OP(e)}var Hr={};Xt(Hr,{CompositeArrayBuffer:()=>ql,browserFiles:()=>lde,browserHTTPRequest:()=>fde,concatenateArrayBuffers:()=>Ure,copyModel:()=>cse,decodeWeights:()=>cL,decodeWeightsStream:()=>hL,encodeWeights:()=>Bre,fromMemory:()=>gde,fromMemorySync:()=>WP,getLoadHandlers:()=>Yre,getModelArtifactsForJSON:()=>eT,getModelArtifactsForJSONSync:()=>fL,getModelArtifactsInfoForJSON:()=>Tb,getSaveHandlers:()=>Xre,getWeightSpecs:()=>GC,http:()=>fA,isHTTPScheme:()=>eE,listModels:()=>lse,loadWeights:()=>cde,moveModel:()=>dse,registerLoadRouter:()=>Kre,registerSaveRouter:()=>qre,removeModel:()=>use,weightsLoaderFactory:()=>PP,withSaveHandler:()=>xde,withSaveHandlerSync:()=>yde});var nde="model",ade=".json",rde=".weights.bin";function H5(e){return new Promise(t=>setTimeout(t)).then(e)}var _v=class ZC{constructor(t){if(!fe().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(ZC.URL_SCHEME)&&(t=t.slice(ZC.URL_SCHEME.length)),(t==null||t.length===0)&&(t=nde),this.modelJsonFileName=t+ade,this.weightDataFileName=t+rde}async save(t){if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let n=ql.join(t.weightData),a=window.URL.createObjectURL(new Blob([n],{type:"application/octet-stream"}));if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let r=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],s=pL(t,r),i=window.URL.createObjectURL(new Blob([JSON.stringify(s)],{type:"application/json"})),o=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(o.download=this.modelJsonFileName,o.href=i,await H5(()=>o.dispatchEvent(new MouseEvent("click"))),t.weightData!=null){let l=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;l.download=this.weightDataFileName,l.href=a,await H5(()=>l.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:Tb(t)}}}};_v.URL_SCHEME="downloads://";var sde=class{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)}async load(){return new Promise((e,t)=>{let n=new FileReader;n.onload=a=>{let r=JSON.parse(a.target.result),s=r.modelTopology;if(s==null){t(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));return}if(r.weightsManifest==null){t(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));return}if(this.weightsFiles.length===0){e({modelTopology:s});return}let i=eT(r,o=>this.loadWeights(o));e(i)},n.onerror=a=>t(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),n.readAsText(this.jsonFile)})}loadWeights(e){let t=[],n=[];for(let s of e)t.push(...s.weights),n.push(...s.paths);let a=this.checkManifestAndWeightFiles(e),r=n.map(s=>this.loadWeightsFile(s,a[s]));return Promise.all(r).then(s=>[t,s])}loadWeightsFile(e,t){return new Promise((n,a)=>{let r=new FileReader;r.onload=s=>{let i=s.target.result;n(i)},r.onerror=s=>a(`Failed to weights data from file of path '${e}'.`),r.readAsArrayBuffer(t)})}checkManifestAndWeightFiles(e){let t=[],n=this.weightsFiles.map(r=>U5(r.name)),a={};for(let r of e)r.paths.forEach(s=>{let i=U5(s);if(t.indexOf(i)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${i}'`);if(t.push(i),n.indexOf(i)===-1)throw new Error(`Weight file with basename '${i}' is not provided.`);a[s]=this.weightsFiles[n.indexOf(i)]});if(t.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${t.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return a}},ide=e=>fe().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(_v.URL_SCHEME)?ode(e.slice(_v.URL_SCHEME.length)):null;Ri.registerSaveRouter(ide);function ode(e="model"){return new _v(e)}function lde(e){return new sde(e)}function G5(e,t,n,a){i(e),n=n??0,a=a??1,o(n,a);let r=0,s=l=>(l.then(d=>{let c=n+ ++r/e.length*(a-n);return t(c),d}),l);function i(l){Z(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,d){Z(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),Z(d>=0&&d<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${d}`),Z(d>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${d}`)}return Promise.all(e.map(s))}async function LP(e,t){t==null&&(t={});let n=t.fetchFunc==null?fe().platform.fetch:t.fetchFunc,a=e.map(s=>n(s,t.requestInit,{isBinary:!0})),r=(t.onProgress==null?await Promise.all(a):await G5(a,t.onProgress,0,.5)).map(s=>s.arrayBuffer());return t.onProgress==null?await Promise.all(r):await G5(r,t.onProgress,.5,1)}function ude(e,t){var n;let a=t.fetchFunc==null?fe().platform.fetch:t.fetchFunc,r=0,s;return(n=t.onProgress)===null||n===void 0||n.call(t,0),new ReadableStream({pull:async i=>{for(var o;r<e.length;){s||(s=(await a(e[r],t.requestInit,{isBinary:!0})).body.getReader());let{done:l,value:d}=await s.read();if(l){r++,s=void 0,(o=t.onProgress)===null||o===void 0||o.call(t,r/e.length);continue}i.enqueue(d);return}i.close()}})}async function cde(e,t="",n,a){return PP(r=>LP(r,{requestInit:a}))(e,t,n)}function PP(e){return async(t,n="",a)=>{let r=t.map(()=>!1),s={},i=a!=null?a.map(()=>!1):[],o=[];if(t.forEach((x,y)=>{let b=0;x.weights.forEach(w=>{let S="quantization"in w?w.quantization.dtype:w.dtype,k=Td[S]*Hn(w.shape),C=()=>{r[y]=!0,s[y]==null&&(s[y]=[]),s[y].push({manifestEntry:w,groupOffset:b,sizeBytes:k})};a!=null?a.forEach((E,T)=>{E===w.name&&(C(),i[T]=!0)}):C(),o.push(w.name),b+=k})}),!i.every(x=>x)){let x=a.filter((y,b)=>!i[b]);throw new Error(`Could not find weights in manifest with names: ${x.join(", ")}. 
84Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=r.reduce((x,y,b)=>(y&&x.push(b),x),[]),d=[];l.forEach(x=>{t[x].paths.forEach(y=>{let b=n+(n.endsWith("/")?"":"/")+y;d.push(b)})});let c=await e(d),f={},m=0;return l.forEach(x=>{let y=t[x].paths.length,b=new ql(c.slice(m,m+y));s[x].forEach(w=>{let S=b.slice(w.groupOffset,w.groupOffset+w.sizeBytes),k=cL(S,[w.manifestEntry]);for(let C in k)f[C]=k[C]}),m+=y}),f}}var dde="application/octet-stream",hde="application/json",pA=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(Z(typeof t.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=t.fetchFunc):this.fetch=fe().platform.fetch,Z(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&Z(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a=pL(e,n);if(t.body.append("model.json",new Blob([JSON.stringify(a)],{type:hde}),"model.json"),e.weightData!=null){let s=ql.join(e.weightData);t.body.append("model.weights.bin",new Blob([s],{type:dde}),"model.weights.bin")}let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:Tb(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async loadModelJSON(){let 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 t;try{t=await e.json()}catch{let s=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?s+=" 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.":s+=" Please make sure the server is serving valid JSON for this request.",new Error(s)}let n=t.modelTopology,a=t.weightsManifest;if(n==null&&a==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return t}async load(){if(this.loadOptions.streamWeights)return this.loadStream();let e=await this.loadModelJSON();return eT(e,t=>this.loadWeights(t))}async loadStream(){let e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),n=GC(e.weightsManifest),a=()=>ude(t,this.loadOptions);return Object.assign(Object.assign({},e),{weightSpecs:n,getWeightStream:a})}async getWeightUrls(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=pde(t),r=this.weightPathPrefix||n,s=[],i=[];for(let o of e)for(let l of o.paths)this.weightUrlConverter!=null?i.push(this.weightUrlConverter(l)):s.push(r+l+a);return this.weightUrlConverter&&s.push(...await Promise.all(i)),s}async loadWeights(e){let t=await this.getWeightUrls(e),n=GC(e),a=await LP(t,this.loadOptions);return[n,a]}};pA.URL_SCHEME_REGEX=/^https?:\/\//;function pde(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),a=e.substring(0,t),r=n>t?e.substring(n):"";return[a+"/",r]}function eE(e){return e.match(pA.URL_SCHEME_REGEX)!=null}var zP=(e,t)=>{if(typeof fetch>"u"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(a=>eE(a)):n=eE(e),n)return fA(e,t)}return null};Ri.registerSaveRouter(zP);Ri.registerLoadRouter(zP);function fA(e,t){return new pA(e,t)}function fde(e,t){return fA(e,t)}var EN=class{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}},UP=class{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}},mde=class{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=t=>Promise.resolve(e.save(t)))}};function gde(e,t,n,a){let r=arguments;return new mde(WP(...r))}function WP(e,t,n,a){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new EN(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new EN({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new EN({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:a}))}function xde(e){return new UP(e)}function yde(e){return new UP(e)}var VP={};Xt(VP,{confusionMatrix:()=>vde});function bde(e,t,n){let a=q(e,"labels","confusionMatrix"),r=q(t,"predictions","confusionMatrix");Z(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),Z(a.rank===1,()=>`Expected the rank of labels to be 1, but got ${a.rank}`),Z(r.rank===1,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),Z(a.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${a.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),Z(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let s=Gf(He(a,"int32"),n),i=Gf(He(r,"int32"),n),o=Qt(s),l=Jt(o,i);return He(l,"int32")}var vde=re({confusionMatrix_:bde}),Wb={};Xt(Wb,{draw:()=>Tde,fromPixels:()=>Ade,fromPixelsAsync:()=>Cde,toPixels:()=>Ide});var Qc,q5=!1;function HP(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,r=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData<"u"&&e instanceof ImageData)a=!0;else if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)r=!0;else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap<"u"&&e instanceof ImageBitmap)o=!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 ${e.constructor.name}`);if(Dy(Ev,ae.backendName)!=null){let m={pixels:e},x={numChannels:t};return ae.runKernel(Ev,m,x)}let[l,d]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height],c;if(i)c=e.getContext("2d").getImageData(0,0,l,d).data;else if(a||n)c=e.data;else if(s||r||o){if(Qc==null)if(typeof document>"u")if(typeof OffscreenCanvas<"u"&&typeof OffscreenCanvasRenderingContext2D<"u")Qc=new OffscreenCanvas(1,1).getContext("2d");else throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");else Qc=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});Qc.canvas.width=l,Qc.canvas.height=d,Qc.drawImage(e,0,0,l,d),c=Qc.getImageData(0,0,l,d).data}let f;if(t===4)f=new Int32Array(c);else{let m=l*d;f=new Int32Array(m*t);for(let x=0;x<m;x++)for(let y=0;y<t;++y)f[x*t+y]=c[x*4+y]}return n2(f,[d,l,t],"int32")}function wde(e){return e!=null&&e.data instanceof Uint8Array}function Sde(){return typeof window<"u"&&typeof ImageBitmap<"u"&&window.hasOwnProperty("createImageBitmap")}function kde(e){return e!=null&&e.width!==0&&e.height!==0}function Nde(e){return Sde()&&!(e instanceof ImageBitmap)&&kde(e)&&!wde(e)}async function Cde(e,t=3){let n=null;if(fe().getBool("WRAP_TO_IMAGEBITMAP")&&Nde(e)){let a;try{a=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch{a=null}a!=null&&a.width===e.width&&a.height===e.height?n=a:n=e}else n=e;return HP(n,t)}function GP(e){if(e.rank!==2&&e.rank!==3)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${e.rank}.`);let t=e.rank===2?1:e.shape[2];if(t>4||t===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${t}`);if(e.dtype!=="float32"&&e.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${e.dtype}. Please use float32 or int32 tensors.`)}function Ede(e){let t=e?.alpha||1;if(t>1||t<0)throw new Error(`Alpha value ${t} is suppoed to be in range [0 - 1].`)}async function Ide(e,t){let n=q(e,"img","toPixels");if(!(e instanceof en)){let d=n;n=He(d,"int32"),d.dispose()}GP(n);let[a,r]=n.shape.slice(0,2),s=n.rank===2?1:n.shape[2],i=await n.data(),o=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(r*a*4);for(let d=0;d<a*r;++d){let c=[0,0,0,255];for(let m=0;m<s;m++){let x=i[d*s+m];if(n.dtype==="float32"){if(x<0||x>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${x}.`)}else if(n.dtype==="int32"&&(x<0||x>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${x}.`);s===1?(c[0]=x*o,c[1]=x*o,c[2]=x*o):c[m]=x*o}let f=d*4;l[f+0]=Math.round(c[0]),l[f+1]=Math.round(c[1]),l[f+2]=Math.round(c[2]),l[f+3]=Math.round(c[3])}if(t!=null){q5||Dy(Sw,ae.backendName)!=null&&(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),q5=!0),t.width=r,t.height=a;let d=t.getContext("2d"),c=new ImageData(l,r,a);d.putImageData(c,0,0)}return n!==e&&n.dispose(),l}function Tde(e,t,n){let a=q(e,"img","draw");if(!(e instanceof en)){let i=a;a=He(i,"int32"),i.dispose()}GP(a),Ede(n?.imageOptions);let r={image:a},s={canvas:t,options:n};ae.runKernel(Sw,r,s)}var Ade=re({fromPixels_:HP}),mA={};Xt(mA,{prepareAndValidate:()=>qP});function qP(e,t){let n=e.shape.length,a=t.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(a<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${a}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[a-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[a-1]} vs. ${n}`);if(Hn(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let r=t.shape,s=r[r.length-1],i=1;for(let f=0;f<r.length-1;++f)i*=r[f];let o=e.shape,l=r.slice();l.pop();let d=1;for(let f=s;f<n;++f)d*=o[f],l.push(o[f]);let c=[...dm(e.shape).map(f=>f/d),1].slice(0,s);return[l,i,d,c]}var vr={};Xt(vr,{assertParamsValid:()=>jde,computeFlatOffset:()=>Bde,computeOutShape:()=>Rde,getNormalizedAxes:()=>Mde,isSliceContinous:()=>$de,maskToAxes:()=>Dde,parseSliceParams:()=>n6,sliceInfo:()=>Fde,startForAxis:()=>e6,startIndicesWithElidedDims:()=>JP,stopForAxis:()=>t6,stopIndicesWithElidedDims:()=>QP,stridesForAxis:()=>ZP,stridesWithElidedDims:()=>KP});var tE=-2,_de=-1;function jde(e,t,n){let a=e.shape.length;Z(a===t.length,()=>`Error in slice${a}D: Length of begin ${t} must match the rank of the array (${a}).`),Z(a===n.length,()=>`Error in slice${a}D: Length of size ${n} must match the rank of the array (${a}).`);for(let r=0;r<a;++r)Z(t[r]+n[r]<=e.shape[r],()=>`Error in slice${a}D: begin[${r}] + size[${r}] (${t[r]+n[r]}) would overflow input.shape[${r}] (${e.shape[r]})`)}function Dde(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function Rde(e,t,n){let a=[];for(let r=0;r<e.length;r++)a[r]=Math.ceil((t[r]-e[r])/n[r]);return a}function KP(e,t,n,a){let r=[...e];for(let s=r.length;s<a.length;s++)r.push(1);for(let s=0;s<n;s++)s===0?r[t]=1:(r.splice(t,0,1),r.pop());return r}function XP(e,t,n){return n<=e?n:n-(t-1)}function YP(e,t){let n=[];for(let a=0;a<e;a++)n.push(t+a);return n}function Mde(e,t,n,a,r,s,i,o,l){let d=e.length,c=new Array(d),f=new Array(d),m=new Array(d);if(t.length&&n>0){let x=t[0],y=n+1;c=JP(i,x,y,a,e),f=QP(o,x,y,r,e),m=KP(s,x,y,e)}else for(let x=0;x<d;x++)c[x]=e6(i,a,s,e,x,l),f[x]=t6(o,r,s,e,x,l),m[x]=ZP(s,x,l);return{begin:c,end:f,strides:m}}function JP(e,t,n,a,r){let s=[...r],i=YP(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=0;else{let l=XP(t,n,o),d=a[l];e&1<<l&&(d=0),s[o]=d}return s}function QP(e,t,n,a,r){let s=[...r],i=YP(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=Number.MAX_SAFE_INTEGER;else{let l=XP(t,n,o),d=a[l];e&1<<l&&(d=Number.MAX_SAFE_INTEGER),s[o]=d}for(let o=0;o<s.length;o++){let l=r[o];s[o]<0&&(s[o]+=l),s[o]=_y(0,s[o],r[o])}return s}function ZP(e,t,n){let a=e[t];return(n&1<<t||a==null)&&(a=1),a}function e6(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<<r||s&1<<r||i==null)&&(o>0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),i=_y(0,i,l-1),i}function t6(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<<r||s&1<<r||i==null)&&(o>0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),o>0?i=_y(0,i,l):i=_y(-1,i,l-1),i}function $de(e,t,n){let a=n.length;for(let r=0;r<n.length;r++)if(n[r]>1){a=r;break}for(let r=a+1;r<n.length;r++)if(t[r]>0||n[r]!==e[r])return!1;return!0}function Bde(e,t){let n=e.length>0?e[e.length-1]:1;for(let a=0;a<e.length-1;a++)n+=e[a]*t[a];return n}function n6(e,t,n){let a,r=e.shape.length;typeof t=="number"?a=[t,...new Array(r-1).fill(0)]:t.length<r?a=t.concat(new Array(r-t.length).fill(0)):a=t.slice(),a.forEach(i=>
vendor: 72,653 bytes, lines 84-92
84{Z(i!==-1,()=>"slice() does not support negative begin indexing.")});let s;return n==null?s=new Array(r).fill(-1):typeof n=="number"?s=[n,...new Array(r-1).fill(-1)]:n.length<r?s=n.concat(new Array(r-n.length).fill(-1)):s=n,s=s.map((i,o)=>i>=0?i:(Z(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${o}.`),e.shape[o]-a[o])),[a,s]}function Fde(e,t,n,a,r,s,i,o,l){let d;if(a==null?(d=new Array(t.length),d.fill(1)):d=a,i!=null&&i&i-1)throw new Error("Multiple ellipses in slice is not allowed.");let c=!1,f={dims:d.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:d.slice(),beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};for(let k=0;k<f.dims;k++)c&&1<<k&o&&f.numAddAxisAfterEllipsis++,1<<k&i&&(c=!0);c||(f.ellipsisMask|=1<<f.dims,f.dims++);let m={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};Ode(f,m);let x=!0,y=!0,b=!0,w=[],S=[];for(let k=0;k<e.length;++k){if(m.strides[k]===0)throw Error(`strides[${k}] must be non-zero`);let C=!!(m.shrinkAxisMask&1<<k),E=e[k];if(E===-1){w.push(C?1:-1);continue}let T=[m.beginMask&1<<k,m.endMask&1<<k],_=[m.strides[k]>0?0:-1,m.strides[k]>0?E:E-1];if(C&&m.strides[k]<=0)throw Error("only stride 1 allowed on non-range indexing.");b=b&&m.strides[k]===1;let A=!!(m.beginMask&1<<k&&m.endMask&1<<k);if(m.beginValid&&m.endValid){if(C){let P=m.begin[k]<0?E+m.begin[k]:m.begin[k];if(m.begin[k]=P,m.end[k]=m.begin[k]+1,P<0||P>=E)throw Error(`slice index ${m.begin[k]} of dimension ${k} out of bounds.`)}else m.begin[k]=K5(m.begin[k],0,m.strides[k],E,T,_),m.end[k]=K5(m.end[k],1,m.strides[k],E,T,_);let z=m.strides[k]===1&&m.begin[k]===0&&m.end[k]===E;x=x&&z,y=y&&(k===0&&m.strides[k]===1||z)}else x=x&&m.strides[k]===1&&A,y=y&&(k===0&&m.strides[k]===1||A);let $,O=!1;if(m.beginValid&&m.endValid?($=m.end[k]-m.begin[k],O=!0):C?($=1,O=!0):A&&E>=0&&(m.strides[k]<0?$=-E:$=E,O=!0),O){let z;$===0||$<0!=m.strides[k]<0?z=0:z=Math.trunc($/m.strides[k])+($%m.strides[k]!==0?1:0),w.push(z)}else w.push(-1)}for(let k=0;k<m.finalShapeGatherIndices.length;++k){let C=m.finalShapeGatherIndices[k];C>=0?S.push(w[C]):C===tE&&S.push(1)}return{finalShapeSparse:S.filter((k,C)=>m.finalShapeGatherIndices[C]!==tE),finalShape:S,isIdentity:x,sliceDim0:y,isSimpleSlice:b,begin:m.begin,end:m.end,strides:m.strides}}function Ode(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let n=0;t.beginValid=e.begin!=null,t.endValid=e.end!=null,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let a=0;a<e.dims;a++)if(1<<a&e.ellipsisMask){let r=Math.min(t.dims-(e.dims-a)+1+e.numAddAxisAfterEllipsis,t.dims);for(;n<r;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=a}else if(1<<a&e.newAxisMask)t.finalShapeGatherIndices.push(tE),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error(`Index out of range using input dim ${n}; input has only ${t.dims} dims, ${t.begin.length}.`);e.begin!=null&&(t.begin[n]=e.begin[a]),e.end!=null&&(t.end[n]=e.end[a]),t.strides[n]=e.strides[a],e.beginMask&1<<a&&(t.beginMask|=1<<n),e.endMask&1<<a&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<a?(t.finalShapeGatherIndices.push(_de),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(a)),t.inputShapeGatherIndicesSparse[n]=a,n++}}function K5(e,t,n,a,r,s){if(r[t])return n>0?s[t]:s[t+1&1];{let i=e<0?a+e:e;return i<s[0]?s[0]:i>s[1]?s[1]:i}}var Lde="4.22.0",a6=class{static sgd(e){return new h2(e)}static momentum(e,t,n=!1){return new dA(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new hA(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new uA(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new oA(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new cA(e,t,n,a,r)}static adagrad(e,t=.1){return new lA(e,t)}},rd=a6,Pde=typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:e=>e();function gA(){return new Promise(e=>Pde(()=>e()))}var W={};Xt(W,{ERF_A1:()=>the,ERF_A2:()=>nhe,ERF_A3:()=>ahe,ERF_A4:()=>rhe,ERF_A5:()=>she,ERF_P:()=>ehe,PARALLELIZE_THRESHOLD:()=>xA,RowPartitionType:()=>Go,SELU_SCALE:()=>s6,SELU_SCALEALPHA:()=>r6,applyActivation:()=>c2,assertAndGetBroadcastShape:()=>Zn,assertAxesAreInnerMostDims:()=>Fie,assertParamsConsistent:()=>zde,assignToTypedArray:()=>dhe,axesAreInnerMostDims:()=>TT,calculateShapes:()=>hP,checkEinsumDimSizes:()=>xhe,checkPadOnDimRoundingMode:()=>Cs,combineLocations:()=>RL,combineRaggedTensorToTensorShapes:()=>Wde,complexWithEvenIndex:()=>lhe,complexWithOddIndex:()=>uhe,computeConv2DInfo:()=>Ab,computeConv3DInfo:()=>NL,computeDefaultPad:()=>cT,computeDilation2DInfo:()=>$se,computeOptimalWindowSize:()=>qde,computeOutAndReduceShapes:()=>ML,computeOutShape:()=>Ude,computePool2DInfo:()=>kL,computePool3DInfo:()=>Bse,convertConv2DDataFormat:()=>CL,decodeEinsumEquation:()=>mhe,eitherStridesOrDilationsAreOne:()=>ll,expandShapeToKeepDim:()=>Rd,exponent:()=>phe,exponents:()=>hhe,fromStringArrayToUint8:()=>Ohe,fromUint8ToStringArray:()=>Fhe,getAxesPermutation:()=>$L,getBroadcastDims:()=>jL,getComplexWithIndex:()=>che,getEinsumComputePath:()=>yhe,getEinsumPermutation:()=>ghe,getFusedBiasGradient:()=>u2,getFusedDyActivation:()=>l2,getImageCenter:()=>Kde,getInnerMostAxes:()=>Oie,getPermuted:()=>Yde,getRaggedRank:()=>Hde,getReductionAxes:()=>sr,getReshaped:()=>Xde,getReshapedPermuted:()=>Jde,getRowPartitionTypesHelper:()=>Vde,getSliceBeginCoords:()=>Qde,getSliceSize:()=>Zde,getSparseFillEmptyRowsIndicesDenseShapeMismatch:()=>She,getSparseFillEmptyRowsNegativeIndexErrorMessage:()=>khe,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:()=>Nhe,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:()=>Ihe,getSparseReshapeInputOutputMismatchErrorMessage:()=>Ahe,getSparseReshapeInputOutputMultipleErrorMessage:()=>The,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:()=>Che,getSparseReshapeNegativeOutputDimErrorMessage:()=>Ehe,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:()=>Rhe,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:()=>_he,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:()=>jhe,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:()=>Dhe,getUndoAxesPermutation:()=>AT,isIdentityPermutation:()=>bhe,log:()=>qae,mergeRealAndImagArrays:()=>ihe,prepareAndValidate:()=>qP,prepareSplitSize:()=>whe,segment_util:()=>i6,shouldFuse:()=>d2,slice_util:()=>vr,splitRealAndImagArrays:()=>ohe,stridesOrDilationsArePositive:()=>Dd,tupleValuesAreOne:()=>Qu,upcastType:()=>Di,validateDefaultValueShape:()=>Gde,validateInput:()=>r2,validateUpdateShape:()=>JT,warn:()=>Bu});function zde(e,t){let n=e[0].length;e.forEach((r,s)=>{Z(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),Z(t>=0&&t<n,()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let a=e[0];e.forEach((r,s)=>{for(let i=0;i<n;i++)Z(i===t||r[i]===a[i],()=>`Error in concat${n}D: Shape of tensors[${s}] (${r}) does not match the shape of the rest (${a}) along the non-concatenated axis ${s}.`)})}function Ude(e,t){let n=e[0].slice();for(let a=1;a<e.length;a++)n[t]+=e[a][t];return n}var Go;(function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"})(Go||(Go={}));function Wde(e,t,n){let a=new Array;if(n==null&&t==null)return a;if(t==null)for(;a.length<e+n.length;)a.push(-1);else a=t.slice();if(n==null)return a;if(e+n.length!==a.length)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e+n.length}, but shape.rank = ${a.length}`);for(let r=1;r<n.length;++r){let s=n[r],i=a[a.length-n.length+r],o=a[i];if(s>=0)if(o>=0){if(o!==s)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${r+e}] = ${s} but shape[${r+e}] = ${o}`)}else a[i]=s}return a}function Vde(e){let t={FIRST_DIM_SIZE:Go.FIRST_DIM_SIZE,VALUE_ROWIDS:Go.VALUE_ROWIDS,ROW_LENGTHS:Go.ROW_LENGTHS,ROW_SPLITS:Go.ROW_SPLITS,ROW_LIMITS:Go.ROW_LIMITS,ROW_STARTS:Go.ROW_STARTS},n=[];for(let a of e)if(a in t)n.push(t[a]);else break;return n}function Hde(e){return e.length===0?0:e[0]===Go.FIRST_DIM_SIZE?e.length-1:e.length}function Gde(e,t){if(e==null||t==null)return;let n=e.length,a=t.length;if(n>=a)throw new Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${a})`);for(let r=0;r<Math.min(n,a-1);++r){let s=e[r],i=t[r+1];if(s>=0&&i>=0&&s!==1&&s!==i)throw new Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${r-e.length}] = ${s} but ragged tensor input.flatValues.shape[${r-e.length}] = ${i}`)}}var xA=30;function qde(e){return e<=xA?e:Cv(e,Math.floor(Math.sqrt(e)))}function Kde(e,t,n){let a=n*(typeof e=="number"?e:e[0]),r=t*(typeof e=="number"?e:e[1]);return[a,r]}function Xde(e,t,n,a=!0){let r=[];if(a)r=r.concat(t.slice(0)),r.push(e[0]/n),r=r.concat(e.slice(1));else{r=r.concat(e[0]);let s=t.length;for(let i=0;i<s;++i)r=r.concat([e[i+1]/t[i],t[i]]);r=r.concat(e.slice(s+1))}return r}function Yde(e,t,n=!0){let a=[];if(n){a.push(t);for(let r=t+1;r<e;++r)r<=2*t?(a.push(r),a.push(r-(t+1))):a.push(r)}else{let r=[],s=[];for(let i=1;i<e;++i)i>=t*2+1||i%2===1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function Jde(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s<e.length;++s)s<=t.length?a?r.push(t[s-1]*e[s]):r.push(e[s]/t[s-1]):r.push(e[s]);return r}function Qde(e,t){let n=[0];for(let a=0;a<t;++a)n.push(e[a][0]);return n}function Zde(e,t,n){let a=e.slice(0,1);for(let r=0;r<n;++r)a.push(e[r+1]-t[r][0]-t[r][1]);return a}var r6=1.7580993408473768,s6=1.0507009873554805,ehe=.3275911,the=.254829592,nhe=-.284496736,ahe=1.421413741,rhe=-1.453152027,she=1.061405429;function ihe(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${t.length}.`);let n=new Float32Array(e.length*2);for(let a=0;a<n.length;a+=2)n[a]=e[a/2],n[a+1]=t[a/2];return n}function ohe(e){let t=new Float32Array(e.length/2),n=new Float32Array(e.length/2);for(let a=0;a<e.length;a+=2)t[a/2]=e[a],n[a/2]=e[a+1];return{real:t,imag:n}}function lhe(e){let t=Math.ceil(e.length/4),n=new Float32Array(t),a=new Float32Array(t);for(let r=0;r<e.length;r+=4)n[Math.floor(r/4)]=e[r],a[Math.floor(r/4)]=e[r+1];return{real:n,imag:a}}function uhe(e){let t=Math.floor(e.length/4),n=new Float32Array(t),a=new Float32Array(t);for(let r=2;r<e.length;r+=4)n[Math.floor(r/4)]=e[r],a[Math.floor(r/4)]=e[r+1];return{real:n,imag:a}}function che(e,t){let n=e[t*2],a=e[t*2+1];return{real:n,imag:a}}function dhe(e,t,n,a){e[a*2]=t,e[a*2+1]=n}function hhe(e,t){let n=new Float32Array(e/2),a=new Float32Array(e/2);for(let r=0;r<Math.ceil(e/2);r++){let s=(t?2:-2)*Math.PI*(r/e);n[r]=Math.cos(s),a[r]=Math.sin(s)}return{real:n,imag:a}}function phe(e,t,n){let a=(n?2:-2)*Math.PI*(e/t),r=Math.cos(a),s=Math.sin(a);return{real:r,imag:s}}var IN="->",fhe=/->/g,X5=",",Y5="...";function mhe(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(fhe,"").length)/IN.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 ("${IN}").`);let[a,r]=e.split(IN);Z(a.indexOf(Y5)===-1,()=>`The ellipsis notation ("${Y5}") is not supported yet.`);let s=a.split(X5),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let o=[];for(let m=0;m<r.length;++m){let x=r[m];if(!s.some(y=>y.indexOf(x)!==-1))throw new Error(`Output subscripts contain the label ${x} not present in the input subscripts.`);o.indexOf(x)===-1&&o.push(x)}for(let m=0;m<a.length;++m){let x=a[m];o.indexOf(x)===-1&&x!==X5&&o.push(x)}let l=new Array(s.length);for(let m=0;m<i;++m){if(new Set(s[m].split("")).size!==s[m].length)throw new Error(`Found duplicate axes in input component ${s[m]}. Support for duplicate axes in input is not implemented yet.`);l[m]=[];for(let x=0;x<s[m].length;++x)l[m].push(o.indexOf(s[m][x]))}let d=o.length,c=r.length,f=[];for(let m=c;m<d;++m)f.push(m);return{allDims:o,summedDims:f,idDims:l}}function ghe(e,t){let n=new Array(e);n.fill(-1);for(let r=0;r<t.length;++r)n[t[r]]=r;let a=[];for(let r=0;r<e;++r)n[r]===-1&&a.push(r);return n=n.filter(r=>r!==-1),{permutationIndices:n,expandDims:a}}function xhe(e,t,n){let a=new Array(e);for(let r=0;r<n.length;++r){let s=n[r].shape;for(let i=0;i<t[r].length;++i)a[t[r][i]]===void 0?a[t[r][i]]=s[i]:Z(a[t[r][i]]===s[i],()=>`Expected dimension ${a[t[r][i]]} at axis ${i} of input shaped ${JSON.stringify(s)}, but got dimension ${s[i]}`)}}function yhe(e,t){let n=e,a=[],r=0;e.length===0&&n.push(-1),r=e.length+1;for(let i=0;i<r;++i)a.push([]);let s=[];for(let i=0;i<n.length;++i){let o=n[i],l=vhe(t,o);for(let d of l)s.indexOf(d)===-1&&(a[i].push(d),s.push(d))}return{path:n,steps:a}}function bhe(e){return e.every((t,n)=>t===n)}function vhe(e,t){let n=[];for(let a=0;a<e.length;++a)(e[a].length===0||e[a].indexOf(t)!==-1||t===-1)&&n.push(a);return n}function whe(e,t,n=0){let a=[];if(typeof t=="number")Z(e.shape[n]%t===0,()=>"Number of splits must evenly divide the axis."),a=new Array(t).fill(e.shape[n]/t);else{let r=t.reduce((i,o)=>(o===-1&&(i+=1),i),0);Z(r<=1,()=>"There should be only one negative value in split array.");let s=t.indexOf(-1);if(s!==-1){let i=t.reduce((o,l)=>l>0?o+l:o);t[s]=e.shape[n]-i}Z(e.shape[n]===t.reduce((i,o)=>i+o),()=>"The sum of sizes must match the size of the axis dimension."),a=t}return a}function She(e){return`Received SparseTensor with denseShape[0] = 0 but
85  indices.shape[0] = ${e}`}function khe(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function Nhe(e,t,n){return`indices(${e}, 0) is invalid: ${t} >= ${n}`}function Che(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function Ehe(e,t){return`size ${e} must be non-negative, not ${t}`}function Ihe(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function The(e,t){let n=Hn(e),a=Hn(t);return`Input to reshape is a SparseTensor with ${n}
86  dense values, but the requested shape requires a multiple of ${a}. inputShape=${e} outputShape= ${t}`}function Ahe(e,t){let n=Hn(e),a=Hn(t);return`Input to reshape is a tensor with ${n} dense values, but the requested shape has ${a}. inputShape=${e} outputShape=${t}`}function _he(){return"segment ids must be >= 0"}function jhe(){return"segment ids are not increasing"}function Dhe(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function Rhe(e,t,n){return`Bad: indices[${e}] == ${t} out of range [0, ${n})`}var i6={};Xt(i6,{collectGatherOpShapeInfo:()=>Bhe,computeOutShape:()=>$he,segOpComputeOptimalWindowSize:()=>Mhe});function Mhe(e,t){let n=!1,a;for(e<=xA?(a=e,n=!0):a=Cv(e,Math.floor(Math.sqrt(e)));!n;)a>t||a===e?n=!0:a=Cv(e,a+1);return a}function $he(e,t,n){let a=[],r=e.length;for(let s=0;s<r;s++)s!==t?a.push(e[s]):a.push(n);return a}function Bhe(e,t,n,a){let r=t.shape.length,s=e.shape.length;if(a!==0&&(a<-r||a>r))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${a}`);if(a<0&&(a+=r),a>s)throw new Error(`batchDims (${a}) must be less than rank(x) (
87    ${s}).`);if(n<a)throw new Error(`batchDims (${a}) must be less than or equal to axis (${n}).`);for(let f=0;f<a;++f)if(e.shape[f]!==t.shape[f])throw new Error(`x.shape[${f}]: ${e.shape[f]} should be equal to indices.shape[${f}]: ${t.shape[f]}.`);let i=e.shape[n],o=[],l=1,d=1,c=1;for(let f=0;f<a;++f)o.push(e.shape[f]),l*=e.shape[f];for(let f=a;f<n;f++)o.push(e.shape[f]),d*=e.shape[f];for(let f=a;f<r;f++)o.push(t.shape[f]);for(let f=n+1;f<s;f++)o.push(e.shape[f]),c*=e.shape[f];return{batchSize:l,sliceSize:c,outerSize:d,dimSize:i,outputShape:o}}function Fhe(e){try{return e.map(t=>Tv(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function Ohe(e){return e.map(t=>Eb(t))}var cl={};Xt(cl,{nonMaxSuppressionV3Impl:()=>EP,nonMaxSuppressionV4Impl:()=>IP,nonMaxSuppressionV5Impl:()=>TP,whereImpl:()=>mP});tde();var o6={kernelName:hm,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,pp(He(n,"float32"),-1))}}},Lhe={kernelName:Gd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Jn(He(n,"float32")),r=$r(st(Et(1),a));return ua(ht(e,r))}}}},Phe={kernelName:qd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=$r(st(Jn(He(n,"float32")),1));return ht(e,a)}}}},zhe={kernelName:hc,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=e,i=sr(n.shape,r);return i.length>0&&(s=yt(s,i)),le(s,n.shape)},b:()=>{let s=e,i=sr(a.shape,r);return i.length>0&&(s=yt(s,i)),le(s,a.shape)}}}},Uhe={kernelName:Kd,saveAllInputs:!0,gradFunc:(e,t)=>{let n={};return t.forEach((a,r)=>{n[r]=()=>e.clone()}),n}},Whe={kernelName:mm,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>pn(n)}}},Vhe={kernelName:gm,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>pn(n)}}},Hhe={kernelName:Xd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,$r(st(Et(1),Jn(He(n,"float32")))))}}},Ghe={kernelName:Yd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=$r(ke(Et(1),Jn(He(n,"float32"))));return ht(e,a)}}}},qhe={kernelName:Zd,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=ke(Jn(n),Jn(a)),i=ie(e,ht(a,s)),o=sr(n.shape,r);return o.length>0&&(i=yt(i,o)),le(i,n.shape)},b:()=>{let s=ke(Jn(n),Jn(a)),i=ua(ie(e,ht(n,s))),o=sr(a.shape,r);return o.length>0&&(i=yt(i,o)),le(i,a.shape)}}}},Khe={kernelName:Jd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,ke(Jn(He(n,"float32")),1))}}},Xhe={kernelName:Qd,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,st(Et(1),Jn(He(n,"float32"))))}}};function Yhe(e,t,n,a,r,s){let i=q(e,"dy","avgPool3dGrad"),o=q(t,"input","avgPool3dGrad"),l=i,d=o,c=!1;o.rank===4&&(c=!0,l=le(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),d=le(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),Z(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),Z(d.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${d.rank}.`),Cs("avgPool3dGrad",r,s);let f={dy:l,input:d},m={filterSize:n,strides:a,pad:r,dimRoundingMode:s},x=ae.runKernel(rb,f,m);return c?le(x,[x.shape[1],x.shape[2],x.shape[3],x.shape[4]]):x}var Jhe=re({avgPool3dGrad_:Yhe}),Qhe={kernelName:xm,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>Jhe(e,a,r,s,i,o)}}};function Zhe(e,t,n,a,r){let s=q(e,"dy","avgPoolGrad"),i=q(t,"input","avgPoolGrad");Z(i.rank===s.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${s.rank})`);let o=i,l=s,d=!1;i.rank===3&&(d=!0,o=le(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=le(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Z(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),Z(o.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${o.rank}.`);let c={dy:l,input:o},f={filterSize:n,strides:a,pad:r},m=ae.runKernel(ab,c,f);return d?le(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var epe=re({avgPoolGrad_:Zhe}),tpe={kernelName:eh,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i}=n;return{x:()=>epe(e,a,r,s,i)}}},npe={kernelName:th,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{let[a,r]=t,{transposeA:s,transposeB:i}=n;return!s&&!i?{a:()=>Jt(e,r,!1,!0),b:()=>Jt(a,e,!0,!1)}:!s&&i?{a:()=>Jt(e,r,!1,!1),b:()=>Jt(e,a,!0,!1)}:s&&!i?{a:()=>Jt(r,e,!1,!0),b:()=>Jt(a,e,!1,!1)}:{a:()=>Jt(r,e,!0,!0),b:()=>Jt(e,a,!0,!0)}}},ape={kernelName:ym,gradFunc:(e,t,n)=>{let{blockShape:a,crops:r}=n;return{x:()=>Ob(e,a,r)}}},rpe={kernelName:G8,gradFunc:(e,t,n)=>{let a=n,r=a.inputShape,s=a.shape,i=Array.from(s);for(let l=r.length-1;l>=0;l--)if(r[l]===s[l])i[l]=1;else if(r[l]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${s}].`);let o=[];for(let l=0;l<i.length;l++)i[l]>1&&o.push(l);return{x:()=>yt(e,o,!0)}}},spe={kernelName:nh,gradFunc:e=>({x:()=>e.clone()})},ipe={kernelName:ah,gradFunc:e=>({x:()=>pn(e)})},ope={kernelName:pc,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{clipValueMin:r,clipValueMax:s}=n;return{x:()=>Mr(to(Xl(a,r),xc(a,s)),e,pn(e))}}},lpe={kernelName:ib,inputsToSave:["x"],gradFunc:o6.gradFunc},upe={kernelName:wm,saveAllInputs:!0,gradFunc:(e,t,n)=>{let a=t.map(o=>o.shape),{axis:r}=n,s=no(r,t[0].shape)[0],i=a.map(o=>o[s]);return Bs(e,i,s).map(o=>()=>o)}},cpe={kernelName:rh,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return Z(Qu(s),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`),{x:()=>wT(a.shape,e,r,i,o,l),filter:()=>rA(a,e,r.shape,i,o,l)}}},dpe={kernelName:sh,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>ws(e,r,s,i,o,1,l),filter:()=>rA(e,a,r.shape,s,i,o,l)}}};function hpe(e,t,n,a,r){let s=e;e.rank===4&&(s=le(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;i.rank===4&&(i=le(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),Z(s.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`),Z(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),Z(n.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),Z(s.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`),Z(i.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${n[4]}).`);let o={x:s,dy:i},l={strides:a,pad:r,filterShape:n};return ae.runKernel(Sm,o,l)}var ppe=re({conv3DBackpropFilter_:hpe}),fpe={kernelName:ih,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s}=n;Z(Qu(a),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let[i,o]=t;return{x:()=>AL(i.shape,e,o,r,s),filter:()=>ppe(i,e,o.shape,r,s)}}},mpe={kernelName:oh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(ua(Jw(He(n,"float32"))),e)}}},gpe={kernelName:lh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(Qw(He(n,"float32")),e)}}},xpe={kernelName:uh,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r,exclusive:s,reverse:i}=n;return{x:()=>{let o=$L([r],a.rank),l=Lw(e,r,s,!i);return o!=null&&(l=Qt(l,o)),l}}}},ype={kernelName:ch,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s,dimRoundingMode:i}=n,o=a??[1,1];Z(Qu(o),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`);let[l,d]=t;return Z(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),Z(d.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${d.rank}.`),Z(l.shape[3]===d.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${d.shape[2]}.`),Z(ll(r,o),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be  1. Got strides ${r} and dilations '${o}'.`),Cs("depthwiseConv2d",s,i),{x:()=>kP(l.shape,e,d,r,s,o,i),filter:()=>SP(l,e,d.shape,r,s,o,i)}}},bpe={kernelName:dh,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,s={x:a,filter:r,dy:e},i={x:a,filter:r,dy:e};return{x:()=>ae.runKernel(zf,s,n),filter:()=>ae.runKernel(Uf,i,n)}}},vpe={kernelName:ph,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t,a={dy:e,y:n};return{x:()=>ae.runKernel(Im,a)}}},wpe={kernelName:fh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=ie(as(ua(Jn(n))),2/Math.sqrt(Math.PI));return{x:()=>ie(e,a)}}},Spe={kernelName:mh,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,n)}}},kpe={kernelName:Am,inputsToSave:["input"],gradFunc:(e,t)=>{let[n]=t;return{input:()=>le(e,n.shape)}}},Npe={kernelName:gh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,as(n))}}},Cpe={kernelName:xh,gradFunc:e=>({x:()=>pn(e)})},Epe={kernelName:yh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=ht(e,He(a,"float32")),i=sr(n.shape,r);return i.length>0?le(yt(s,i),n.shape):s},b:()=>{let s=ie(e,He(n,"float32")),i=sr(a.shape,r);i.length>0&&(s=le(yt(s,i),a.shape));let o=Jn(a);return ua(ht(s,He(o,"float32")))}}}},Ipe={kernelName:bh,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{let{varianceEpsilon:a}=n,[r,s,i,o]=t,l=o??Et(1),d=sr(s.shape,r.shape),c=[];if(s.rank===1){for(let b=0;b<r.shape.length-1;++b)c.push(r.shape[b]);c.push(1)}let f=st(r,s),m=ie(e,l),x=Xw(ke(i,Et(a))),y=ie(ie(ie(x,x),x),Et(-.5));return{x:()=>s.rank===1?le(ie(ie(e,ai(le(x,[1,1,1,s.shape[0]]),c)),l),r.shape):le(ie(ie(e,x),l),r.shape),mean:()=>{let b=ie(ie(x,Et(-1)),m);return s.rank===1&&(b=yt(b,d)),le(b,s.shape)},variance:()=>{let b=ie(ie(y,f),m);return s.rank===1&&(b=yt(b,d)),le(b,s.shape)},scale:()=>{let b=ie(f,x),w=ie(e,b);return s.rank===1&&(w=yt(w,d)),le(w,s.shape)},offset:()=>{let b=e;return s.rank===1&&(b=yt(b,d)),le(b,s.shape)}}}},Tpe={kernelName:jm,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{let[a,r]=t,{axis:s,batchDims:i}=n,o=no(s,a.shape)[0],l=(d,c,f)=>()=>{let m=d.shape,x=c.size,y=m.slice(0,o),b=y.length,w=m.slice(s,m.length).slice(1),S=w.length,k=J5(0,b),C=J5(b+1,b+1+S),E=Q5([y,[x],w]),T=le(f,E),_=le(c,[x]),A=Q5([[b],k,C]),$=Qt(T,A),O=i2($,_,d.shape[o]),z=AT(A);return O=Qt(O,z),O};if(i===1){let d=a.shape[0],c=a.split(d,0);return{x:()=>rr(c.map((f,m)=>l(f,r.slice(m,1),e.slice(m,1))())).reshape(a.shape),indices:()=>r}}else return{x:l(a,r,e),indices:()=>r}}};function J5(e,t){let n=[];for(let a=e;a<t;++a)n.push(a);return n}function Q5(e){let t=[];for(let n=0;n<e.length;++n)for(let a=0;a<e[n].length;++a)t.push(e[n][a]);return t}var Ape={kernelName:vh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>pn(n),b:()=>pn(a)}}},_pe={kernelName:wh,gradFunc:e=>({x:()=>He(e,"float32")})},jpe={kernelName:Sh,gradFunc:e=>({x:()=>pn(e)})},Dpe={kernelName:kh,gradFunc:e=>({x:()=>pn(e)})},Rpe={kernelName:Nh,gradFunc:e=>({x:()=>pn(e)})},Mpe={kernelName:Ch,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{alpha:r}=n,s=Es(a,0);return{x:()=>Mr(s,e,ie(e,r))}}},$pe={kernelName:Ih,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,ke(n,1))}}},Bpe={kernelName:Eh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,He(n,"float32"))}}},Fpe={kernelName:K8,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n;return{logits:()=>{let s=as(a);return st(e,ie(yt(e,r,!0),s))}}}};function Ope(e,t,n,a=5,r=1,s=1,i=.5){let o={x:e,y:t,dy:n},l={depthRadius:a,bias:r,alpha:s,beta:i};return ae.runKernel(Pm,o,l)}var Lpe=re({localResponseNormalizationBackprop_:Ope}),Ppe={kernelName:Th,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>Lpe(a,r,e,s,i,o,l)}}};function l6(e,t,n,a){return t.rank<n.rank&&(t=le(t,Rd(t.shape,a))),e.rank<n.rank&&(e=le(e,Rd(e.shape,a))),{x:()=>ie(e,He(si(n,t),e.dtype))}}var Z5={kernelName:Ah,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{reductionIndices:r}=a,s=t[0],i=t[1],o=no(r,s.shape),l=l6(e,i,s,o);return{x:()=>l.x()}}},zpe={kernelName:_h,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>ie(e,He(Xl(n,a),"float32")),b:()=>ie(e,He(Hf(n,a),"float32"))}}};function Upe(e,t,n,a,r,s,i){let o=q(e,"dy","maxPool3dGrad"),l=q(t,"input","maxPool3dGrad"),d=q(n,"output","maxPool3dGrad"),c=o,f=l,m=d,x=!1;l.rank===4&&(x=!0,c=le(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),f=le(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),m=le(d,[1,d.shape[0],d.shape[1],d.shape[2],d.shape[3]])),Z(c.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`),Z(f.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${f.rank}.`),Z(m.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${m.rank}.`),Cs("maxPool3dGrad",s,i);let y={dy:c,input:f,output:m},b={filterSize:a,strides:r,pad:s,dimRoundingMode:i},w=ae.runKernel(db,y,b);return x?le(w,[w.shape[1],w.shape[2],w.shape[3],w.shape[4]]):w}var Wpe=re({maxPool3dGrad_:Upe}),Vpe={kernelName:zm,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>Wpe(e,a,r,s,i,o,l)}}};function Hpe(e,t,n,a,r,s,i){let o=q(e,"dy","maxPoolGrad"),l=q(t,"input","maxPoolGrad"),d=q(n,"output","maxPoolGrad");Z(l.rank===o.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`),Z(o.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`),Z(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),Cs("maxPoolGrad",s,i);let c={dy:o,input:l,output:d},f={filterSize:a,strides:r,pad:s,dimRoundingMode:i};return ae.runKernel(cb,c,f)}var Gpe=re({maxPoolGrad_:Hpe}),qpe={kernelName:jh,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>Gpe(e,a,r,s,i,o)}}},Kpe={kernelName:Dh,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n,s=no(r,a.shape),i=ML(a.shape,s)[1],o=Hn(i);return{x:()=>{let l=a.shape.slice();s.forEach(c=>{l[c]=1});let d=le(e,l);return ht(ie(d,$s(a.shape,"float32")),o)}}}},Xpe={kernelName:Rh,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{axis:r}=a,[s,i]=t,o=no(r,s.shape),l=l6(e,i,s,o);return{x:()=>l.x()}}},Ype={kernelName:Mh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>ie(e,He(xc(n,a),"float32")),b:()=>ie(e,He(Es(n,a),"float32"))}}},Jpe={kernelName:$h,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>un(e,s,a.shape)}}},Qpe={kernelName:Bh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=sr(n.shape,r);return s.length>0?le(yt(e,s),n.shape):e},b:()=>{let s=ie(e,ua(xg(ht(n,a)))),i=sr(a.shape,r);return i.length>0?le(yt(s,i),a.shape):s}}}},Zpe={kernelName:Fh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=ie(e,He(a,"float32")),i=sr(n.shape,r);return i.length>0?le(yt(s,i),n.shape):s},b:()=>{let s=ie(e,He(n,"float32")),i=sr(a.shape,r);return i.length>0?le(yt(s,i),a.shape):s}}}},efe={kernelName:Wm,gradFunc:e=>({x:()=>ua(e)})},tfe={kernelName:Oh,inputsToSave:["indices"],gradFunc:(e,t)=>{let n=t[0];return{indices:()=>va(n.shape,"float32")}}},nfe={kernelName:Km,gradFunc:e=>({x:()=>pn(e)})},afe={kernelName:Xm,saveAllInputs:!0,gradFunc:(e,t,n)=>{let{axis:a}=n;return $a(e,a).map(r=>()=>r)}},e$={kernelName:Lh,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>un(e,s,a.shape)}}},rfe={kernelName:Ph,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{let[n,a,r]=t,s=n,i=a,o=Zn(s.shape,i.shape);return{a:()=>{let l=He(i,"float32"),d=ie(e,ie(l,sl(s,st(l,Et(1))))),c=sr(s.shape,o);return c.length>0&&(d=yt(d,c)),le(d,s.shape)},b:()=>{let l=Es(s,0),d=Mr(l,ii(s),pn(s)),c=ie(e,ie(r,d)),f=sr(i.shape,o);return f.length>0&&(c=yt(c,f)),le(c,i.shape)}}}},sfe={kernelName:zh,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{let[n,a]=t,r=Es(n,0);return{x:()=>Mr(r,e,ie(e,a)),alpha:()=>{let s=Mr(r,pn(e),ie(e,n)),i=sr(a.shape,e.shape);return i.length>0&&(s=yt(s,i)),le(s,a.shape)}}}};function ife(e,t,n){let a=e.shape.slice();a[n]=1;let r=le(t,a),s=Oy(e,n,!0,!1),i=Oy(e,n,!0,!0),o=ie(s,i);return ie(r,o)}function ofe(e,t,n){let a=e.shape.length,r=a-n.length,s=W.getAxesPermutation(n,a),i=e;s!=null&&(i=Qt(e,s));let o=i.shape.slice(),l=o.splice(a-n.length,n.length).reduce((f,m)=>f*m,1);o.push(l);let d=i.reshape(o),c=ife(d,t,r);if(c=c.reshape(i.shape),s!=null){let f=W.getUndoAxesPermutation(s);c=Qt(c,f)}return c}var lfe={kernelName:Uh,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n,s=[];return r==null?s=a.shape.map((i,o)=>o):typeof r=="number"?s=[r]:s=r,{x:()=>ofe(a,e,s)}}},ufe={kernelName:hh,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=ht(e,He(a,"float32")),i=sr(n.shape,r);return i.length>0?le(yt(s,i),n.shape):s},b:()=>{let s=ie(e,He(n,"float32")),i=sr(a.shape,r);i.length>0&&(s=le(yt(s,i),a.shape));let o=Jn(a);return ua(ht(s,He(o,"float32")))}}}},cfe={kernelName:Wh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,ua(Jn(n)))}}},dfe={kernelName:qh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=ie(xc(n,6),pp(n));return{x:()=>ie(e,He(a,"float32"))}}},hfe={kernelName:Vh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,He(pp(n),"float32"))}}},pfe={kernelName:Ym,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>le(e,n.shape)}}},ffe={kernelName:Gh,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>ae.runKernel(Qm,r,n)}}},mfe={kernelName:Hh,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>ae.runKernel(Jm,r,n)}}},gfe={kernelName:Kh,gradFunc:(e,t,n)=>{let{dims:a}=n,r=no(a,e.shape);return{x:()=>Mi(e,r)}}},xfe={kernelName:Xh,gradFunc:e=>({x:()=>pn(e)})},yfe={kernelName:Yh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ua(ht(e,ie(sl(n,1.5),2)))}}},bfe={kernelName:ng,inputsToSave:["condition"],gradFunc:(e,t)=>{let[n]=t;return{condition:()=>He(pn(n),"float32"),t:()=>ie(e,He(n,e.dtype)),e:()=>ie(e,He(Bb(n),e.dtype))}}},vfe={kernelName:Jh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Es(n,Et(0)),r=Et(r6),s=Et(s6),i=ie(e,s),o=ie(ie(e,r),as(He(n,"float32")));return Mr(a,i,o)}}}},wfe={kernelName:tp,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,ie(n,st(Et(1),n)))}}},Sfe={kernelName:ep,gradFunc:e=>({x:()=>pn(e)})},kfe={kernelName:Qh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(jb(He(n,"float32")),e)}}},Nfe={kernelName:Zh,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(Ow(He(n,"float32")),e)}}},Cfe={kernelName:ag,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{begin:r,size:s}=n,i=a.shape,[o,l]=n6(a,r,s),d=[];for(let c=0;c<e.rank;c++)d.push([o[c],i[c]-o[c]-l[c]]);return{x:()=>Ro(e,d)}}},Efe={kernelName:sp,outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{dim:r}=n,s=!0,i=ie(e,a);return{logits:()=>st(i,ie(yt(i,[r],s),a))}}},Ife={kernelName:np,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,eo(n))}}},t$={kernelName:rg,gradFunc:(e,t,n)=>{let{blockShape:a,paddings:r}=n;return{x:()=>_b(e,a,r)}}},n$={kernelName:sg,gradFunc:(e,t,n)=>{let{axis:a}=n;return{x:()=>Qn(e,a)}}},Tfe={kernelName:ap,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,ie($r(He(n,"float32")),2))}}},Afe={kernelName:xb,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(e,ie(He(n,"float32"),2))}}},_fe={kernelName:ip,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Et(2);return{a:()=>ie(e,ie(r,st(n,a))),b:()=>ie(e,ie(r,st(a,n)))}}},jfe={kernelName:mc,gradFunc:e=>({x:()=>pn(e)})},Dfe={kernelName:op,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Zn(n.shape,a.shape);return{a:()=>{let s=e,i=sr(n.shape,r);return i.length>0&&(s=yt(s,i)),le(s,n.shape)},b:()=>{let s=e,i=sr(a.shape,r);return i.length>0&&(s=yt(s,i)),le(ua(s),a.shape)}}}},Rfe={kernelName:rp,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,r=a.shape.slice(),{axis:s}=n;no(s,a.shape).forEach(l=>{r[l]=1});let i=le(e,r),o=ie(i,$s(a.shape,"float32"));return{x:()=>o}}},Mfe={kernelName:lp,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ht(e,Jn(jb(n)))}}},$fe={kernelName:up,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>ie(st(Et(1),Jn(n)),e)}}},Bfe={kernelName:fc,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{reps:r}=n;return{x:()=>{let s=pn(a);if(a.rank===1)for(let i=0;i<r[0];++i)s=ke(s,un(e,[i*a.shape[0]],[a.shape[0]]));else if(a.rank===2)for(let i=0;i<r[0];++i)for(let o=0;o<r[1];++o)s=ke(s,un(e,[i*a.shape[0],o*a.shape[1]],[a.shape[0],a.shape[1]]));else if(a.rank===3)for(let i=0;i<r[0];++i)for(let o=0;o<r[1];++o)for(let l=0;l<r[2];++l)s=ke(s,un(e,[i*a.shape[0],o*a.shape[1],l*a.shape[2]],[a.shape[0],a.shape[1],a.shape[2]]));else if(a.rank===4)for(let i=0;i<r[0];++i)for(let o=0;o<r[1];++o)for(let l=0;l<r[2];++l)for(let d=0;d<r[3];++d)s=ke(s,un(e,[i*a.shape[0],o*a.shape[1],l*a.shape[2],d*a.shape[3]],[a.shape[0],a.shape[1],a.shape[2],a.shape[3]]));else throw new Error(`Gradient for tile operation is not implemented for rank-${a.rank} tensors yet.`);return s}}}},Ffe={kernelName:Fl,gradFunc:(e,t,n)=>{let a=n,{perm:r}=a,s=AT(r);return{x:()=>Qt(e,s)}}},Ofe={kernelName:dg,gradFunc:(e,t,n)=>{let a=n,{axis:r}=a;return{value:()=>rr(e,r)}}},Lfe={kernelName:kb,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Pfe(e,n)}}};function Pfe(e,t){let n=ul(t,pn(t)),a=yg(e,n),r=Xl(t,Et(0,"int32")),s=a.rank-r.rank;for(let o=0;o<s;++o)r=Dr(r,o+1);r=to(r,$s(a.shape,"bool"));let i=pn(a);return Mr(r,a,i)}var zfe={kernelName:hg,gradFunc:e=>({x:()=>pn(e)})},Ufe=[o6,Lhe,Phe,zhe,Uhe,Whe,Vhe,Hhe,Ghe,qhe,Khe,Xhe,Qhe,tpe,npe,ape,rpe,spe,ipe,ope,lpe,upe,dpe,cpe,fpe,mpe,gpe,xpe,ype,bpe,ufe,vpe,wpe,Spe,kpe,Npe,Epe,Cpe,Ipe,Tpe,Ape,_pe,jpe,Dpe,Rpe,Mpe,$pe,Bpe,Fpe,Ppe,Z5,Z5,zpe,Vpe,qpe,Kpe,Xpe,Ype,Jpe,Qpe,Zpe,efe,tfe,nfe,afe,e$,e$,rfe,sfe,lfe,cfe,dfe,hfe,pfe,ffe,mfe,gfe,xfe,yfe,bfe,vfe,wfe,Sfe,kfe,Nfe,Cfe,Efe,Ife,t$,t$,n$,n$,Tfe,_fe,Afe,jfe,Dfe,Rfe,Mfe,$fe,Bfe,Ffe,Ofe,Lfe,zfe];for(let e of Ufe)X8(e);Ce().prototype.abs=function(){return this.throwIfDisposed(),tr(this)};Ce().prototype.acos=function(){return this.throwIfDisposed(),nT(this)};Ce().prototype.acosh=function(){return this.throwIfDisposed(),aT(this)};Ce().prototype.add=function(e){return this.throwIfDisposed(),ke(this,e)};Ce().prototype.all=function(e,t){return this.throwIfDisposed(),$w(this,e,t)};Ce().prototype.any=function(e,t){return this.throwIfDisposed(),$y(this,e,t)};Ce().prototype.argMax=function(e){return this.throwIfDisposed(),jd(this,e)};Ce().prototype.argMin=function(e){return this.throwIfDisposed(),rT(this,e)};Ce().prototype.asScalar=function(){return this.throwIfDisposed(),Z(this.size===1,()=>"The array must have only 1 element."),le(this,[])};Ce().prototype.asType=function(e){return this.throwIfDisposed(),He(this,e)};Ce().prototype.as1D=function(){return this.throwIfDisposed(),le(this,[this.size])};Ce().prototype.as2D=function(e,t){return this.throwIfDisposed(),le(this,[e,t])};Ce().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),le(this,[e,t,n])};Ce().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),le(this,[e,t,n,a])};Ce().prototype.as5D=function(e,t,n,a,r){return this.throwIfDisposed(),le(this,[e,t,n,a,r])};Ce().prototype.asin=function(){return this.throwIfDisposed(),sT(this)};Ce().prototype.asinh=function(){return this.throwIfDisposed(),iT(this)};Ce().prototype.atan=function(){return this.throwIfDisposed(),oT(this)};Ce().prototype.atan2=function(e){return this.throwIfDisposed(),lT(this,e)};Ce().prototype.atanh=function(){return this.throwIfDisposed(),uT(this)};Ce().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),Kl(this,e,t,n,a)};Ce().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),_b(this,e,t)};Ce().prototype.batchNorm=function(e,t,n,a,r){return this.throwIfDisposed(),cp(this,e,t,n,a,r)};Ce().prototype.broadcastTo=function(e){return this.throwIfDisposed(),vd(this,e)};Ce().prototype.cast=function(e){return this.throwIfDisposed(),He(this,e)};Ce().prototype.ceil=function(){return this.throwIfDisposed(),gT(this)};Ce().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),ns(this,e,t)};Ce().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof en&&(e=[e]),Qn([this,...e],t)};Ce().prototype.conv1d=function(e,t,n,a,r,s){return this.throwIfDisposed(),Bw(this,e,t,n,a,r,s)};Ce().prototype.conv2dTranspose=function(e,t,n,a,r){return this.throwIfDisposed(),Fw(this,e,t,n,a,r)};Ce().prototype.conv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),ws(this,e,t,n,a,r,s)};Ce().prototype.cos=function(){return this.throwIfDisposed(),jb(this)};Ce().prototype.cosh=function(){return this.throwIfDisposed(),Ow(this)};Ce().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),Oy(this,e,t,n)};Ce().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),Lw(this,e,t,n)};Ce().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),NT(this,e,t)};Ce().prototype.depthwiseConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),dp(this,e,t,n,a,r,s)};Ce().prototype.dilation2d=function(e,t,n,a,r){return this.throwIfDisposed(),CT(this,e,t,n,a,r)};Ce().prototype.divNoNan=function(e){return this.throwIfDisposed(),ET(this,e)};Ce().prototype.div=function(e){return this.throwIfDisposed(),ht(this,e)};Ce().prototype.dot=function(e){return this.throwIfDisposed(),IT(this,e)};Ce().prototype.elu=function(){return this.throwIfDisposed(),mg(this)};Ce().prototype.equal=function(e){return this.throwIfDisposed(),si(this,e)};Ce().prototype.erf=function(){return this.throwIfDisposed(),Pw(this)};Ce().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),_T(this,e,t)};Ce().prototype.exp=function(){return this.throwIfDisposed(),as(this)};Ce().prototype.expandDims=function(e){return this.throwIfDisposed(),Dr(this,e)};Ce().prototype.expm1=function(){return this.throwIfDisposed(),jT(this)};Ce().prototype.fft=function(){return this.throwIfDisposed(),zb(this)};Ce().prototype.flatten=function(){return this.throwIfDisposed(),le(this,[this.size])};Ce().prototype.floor=function(){return this.throwIfDisposed(),xg(this)};Ce().prototype.floorDiv=function(e){return this.throwIfDisposed(),Mw(this,e)};Ce().prototype.gather=function(e,t,n){return this.throwIfDisposed(),yg(this,e,t,n)};Ce().prototype.greaterEqual=function(e){return this.throwIfDisposed(),Xl(this,e)};Ce().prototype.greater=function(e){return this.throwIfDisposed(),Es(this,e)};Ce().prototype.ifft=function(){return this.throwIfDisposed(),Xf(this)};Ce().prototype.irfft=function(){return this.throwIfDisposed(),e2(this)};Ce().prototype.isFinite=function(){return this.throwIfDisposed(),DT(this)};Ce().prototype.isInf=function(){return this.throwIfDisposed(),RT(this)};Ce().prototype.isNaN=function(){return this.throwIfDisposed(),MT(this)};Ce().prototype.leakyRelu=function(e){return this.throwIfDisposed(),Rb(this,e)};Ce().prototype.lessEqual=function(e){return this.throwIfDisposed(),xc(this,e)};Ce().prototype.less=function(e){return this.throwIfDisposed(),Hf(this,e)};Ce().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),$T(this,e,t,n,a)};Ce().prototype.logSigmoid=function(){return this.throwIfDisposed(),BT(this)};Ce().prototype.logSoftmax=function(e){return this.throwIfDisposed(),Ww(this,e)};Ce().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),$b(this,e,t)};Ce().prototype.log=function(){return this.throwIfDisposed(),ii(this)};Ce().prototype.log1p=function(){return this.throwIfDisposed(),Mb(this)};Ce().prototype.logicalAnd=function(e){return this.throwIfDisposed(),to(this,e)};Ce().prototype.logicalNot=function(){return this.throwIfDisposed(),Bb(this)};Ce().prototype.logicalOr=function(e){return this.throwIfDisposed(),Vw(this,e)};Ce().prototype.logicalXor=function(e){return this.throwIfDisposed(),FT(this,e)};Ce().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),Jt(this,e,t,n)};Ce().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),Ar(this,e,t,n,a)};Ce().prototype.max=function(e,t){return this.throwIfDisposed(),ji(this,e,t)};Ce().prototype.maximum=function(e){return this.throwIfDisposed(),ul(this,e)};Ce().prototype.mean=function(e,t){return this.throwIfDisposed(),ba(this,e,t)};Ce().prototype.min=function(e,t){return this.throwIfDisposed(),Vf(this,e,t)};Ce().prototype.minimum=function(e){return this.throwIfDisposed(),ec(this,e)};Ce().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),LT(this,e,t)};Ce().prototype.mod=function(e){return this.throwIfDisposed(),PT(this,e)};Ce().prototype.mul=function(e){return this.throwIfDisposed(),ie(this,e)};Ce().prototype.neg=function(){return this.throwIfDisposed(),ua(this)};Ce().prototype.norm=function(e,t,n){return this.throwIfDisposed(),gg(this,e,t,n)};Ce().prototype.notEqual=function(e){return this.throwIfDisposed(),Md(this,e)};Ce().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),Gf(this,e,t,n)};Ce().prototype.onesLike=function(){return this.throwIfDisposed(),oi(this)};Ce().prototype.pad=function(e,t){return this.throwIfDisposed(),Ro(this,e,t)};Ce().prototype.pool=function(e,t,n,a,r,s){return this.throwIfDisposed(),zT(this,e,t,n,a,r,s)};Ce().prototype.pow=function(e){return this.throwIfDisposed(),sl(this,e)};Ce().prototype.prelu=function(e){return this.throwIfDisposed(),Lb(this,e)};Ce().prototype.prod=function(e,t){return this.throwIfDisposed(),UT(this,e,t)};Ce().prototype.reciprocal=function(){return this.throwIfDisposed(),qT(this)};Ce().prototype.relu=function(){return this.throwIfDisposed(),Vn(this)};Ce().prototype.relu6=function(){return this.throwIfDisposed(),qw(this)};Ce().prototype.reshapeAs=function(e){return this.throwIfDisposed(),le(this,e.shape)};Ce().prototype.reshape=function(e){return this.throwIfDisposed(),le(this,e)};Ce().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),AP(this,e,t,n)};Ce().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),_P(this,e,t,n)};Ce().prototype.reverse=function(e){return this.throwIfDisposed(),Mi(this,e)};Ce().prototype.rfft=function(){return this.throwIfDisposed(),Ub(this)};Ce().prototype.round=function(){return this.throwIfDisposed(),Kw(this)};Ce().prototype.rsqrt=function(){return this.throwIfDisposed(),Xw(this)};Ce().prototype.selu=function(){return this.throwIfDisposed(),Yw(this)};Ce().prototype.separableConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),bg(this,e,t,n,a,r,s)};Ce().prototype.sigmoid=function(){return this.throwIfDisposed(),eo(this)};Ce().prototype.sign=function(){return this.throwIfDisposed(),KT(this)};Ce().prototype.sin=function(){return this.throwIfDisposed(),Jw(this)};Ce().prototype.sinh=function(){return this.throwIfDisposed(),Qw(this)};Ce().prototype.slice=function(e,t){return this.throwIfDisposed(),un(this,e,t)};Ce().prototype.softmax=function(e){return this.throwIfDisposed(),bc(this,e)};Ce().prototype.softplus=function(){return this.throwIfDisposed(),hp(this)};Ce().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),Ob(this,e,t)};Ce().prototype.split=function(e,t){return this.throwIfDisposed(),Bs(this,e,t)};Ce().prototype.sqrt=function(){return this.throwIfDisposed(),$r(this)};Ce().prototype.square=function(){return this.throwIfDisposed(),Jn(this)};Ce().prototype.squaredDifference=function(e){return this.throwIfDisposed(),t2(this,e)};Ce().prototype.squeeze=function(e){return this.throwIfDisposed(),vc(this,e)};Ce().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof en?[this,e]:[this,...e];return rr(n,t)};Ce().prototype.step=function(e){return this.throwIfDisposed(),pp(this,e)};Ce().prototype.stridedSlice=function(e,t,n,a,r,s,i,o){return this.throwIfDisposed(),XT(this,e,t,n,a,r,s,i,o)};Ce().prototype.sub=function(e){return this.throwIfDisposed(),st(this,e)};Ce().prototype.sum=function(e,t){return this.throwIfDisposed(),yt(this,e,t)};Ce().prototype.tan=function(){return this.throwIfDisposed(),YT(this)};Ce().prototype.tanh=function(){return this.throwIfDisposed(),Zu(this)};Ce().prototype.tile=function(e){return this.throwIfDisposed(),ai(this,e)};Ce().prototype.toBool=function(){return this.throwIfDisposed(),He(this,"bool")};Ce().prototype.toFloat=function(){return this.throwIfDisposed(),He(this,"float32")};Ce().prototype.toInt=function(){return this.throwIfDisposed(),He(this,"int32")};Ce().prototype.topk=function(e,t){return this.throwIfDisposed(),QT(this,e,t)};Ce().prototype.transpose=function(e){return this.throwIfDisposed(),Qt(this,e)};Ce().prototype.unique=function(e){return this.throwIfDisposed(),ZT(this,e)};Ce().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),i2(this,e,t)};Ce().prototype.unstack=function(e){return this.throwIfDisposed(),$a(this,e)};Ce().prototype.where=function(e,t){return this.throwIfDisposed(),Mr(e,this,t)};Ce().prototype.zerosLike=function(){return this.throwIfDisposed(),pn(this)};var Ru=class u6 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,u6.prototype)}},Xo=class c6 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,c6.prototype)}},ce=class d6 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,d6.prototype)}},an=class h6 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,h6.prototype)}},Wfe=class p6 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,p6.prototype)}},f6=class{constructor(e){this.maxEntries=e||100,this.cache=new Map}get(e){let t;return this.cache.has(e)&&(t=this.cache.get(e),this.cache.delete(e),this.cache.set(e,t)),t}put(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxEntries){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,t)}getMaxEntries(){return this.maxEntries}setMaxEntries(e){if(e<0)throw new Error(`The maxEntries of LRU caches must be at least 0, but got ${e}.`);if(this.maxEntries>e)for(let t=0;t<this.maxEntries-e;t++){let n=this.cache.keys().next().value;this.cache.delete(n)}this.maxEntries=e}};function Bd(e,t){if(Array.isArray(e)){let n=[];for(let a=0;a<t;a++)n=n.concat(e);return n}else{let n=new Array(t);return n.fill(e),n}}function qo(e,t){if(!e)throw new Wfe(t)}function a$(e,t){let n=0;for(let a of e)a===t&&n++;return n}function Ds(e){return e.length===1?e[0]:e}function Wn(e){return Array.isArray(e)?e:[e]}function Dl(e){let t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return t[0]!=="_"?t:"private"+t}function cd(e){return e.length<=1||e.indexOf("_")===-1?e:e.replace(/[_]+(\w|$)/g,(t,n)=>n.toUpperCase())}var Ki={};function yA(e){if(e==null)return null;let t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function nE(e){if(!(e==null||typeof e!="object"))if(Array.isArray(e))e.forEach(t=>nE(t));else{let t=Object.keys(e);for(let n of t){let a=e[n];a!=null&&typeof a=="object"&&(!Array.isArray(a)&&a.type==="ndarray"&&typeof a.value=="number"?e[n]=a.value:nE(a))}}}function Vb(e,t={},n={},a="object",r=!1){if(typeof e=="string"){let s=e,i;if(s in n)i=n[s];else if(s in Ki)i=Ki[s];else if(i=t[s],i==null)throw new ce(`Unknown ${a}: ${e}. This may be due to one of the following reasons:
881. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
892. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return i}else{let s=e;if(s.className==null||s.config==null)throw new ce(`${a}: Improper config format: ${JSON.stringify(s)}.
90'className' and 'config' must set.`);let i=s.className,o,l;if(i in n?[o,l]=n[i]:i in Ki?[o,l]=Ki.className:i in t&&([o,l]=t[i]),o==null)throw new ce(`Unknown ${a}: ${i}. This may be due to one of the following reasons:
911. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
922. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){let d={};for(let x of Object.keys(Ki))d[x]=Ki[x];for(let x of Object.keys(n))d[x]=n[x];let c=s.config;c.customObjects=d;let f=Object.assign({},Ki);for(let x of Object.keys(n))Ki[x]=n[x];nE(s.config);let m=l(o,s.config,n,r);return Ki=Object.assign({},f),m}else{let d=Object.assign({},Ki);for(let f of Object.keys(n))Ki[f]=n[f];let c=new o(s.config);return Ki=Object.assign({},d),c}}}function Vfe(e,t){return e<t?-1:e>t?1:0}function j1(e,t){return-1*Vfe(e,t)}function Vu(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function Hfe(e){if(e==null)throw new ce(`Invalid value in obj: ${JSON.stringify(e)}`);for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function fp(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new ce(`${n} is not a valid ${t}.  Valid values are ${e} or null/undefined.`)}function bA(e,t,n=0,a=1/0){return qo(n>=0),qo(a>=n),Array.isArray(e)&&e.length>=n&&e.length<=a&&e.every(r=>typeof r===t)}function Rr(e,t){Array.isArray(e)?(R.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((n,a)=>Rr(n,`element ${a+1} of ${t}`))):R.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${m6(e)}.`)}function m6(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>m6(t)).join(",")+"]":typeof e=="string"?`"${e}"`:`${e}`}function Gfe(e,t,n){let a=n!=null?n():R.now(),r;return(...s)=>{let i=n!=null?n():R.now();return i-a<t||(a=i,r=e(...s)),r}}function g6(e){return e==="relu"?"relu":e==="linear"?"linear":e==="elu"?"elu":null}var qfe=0;function x6(){return qfe++}var D1={};function p2(e=""){return e in D1||(D1[e]=0),D1[e]+=1,e+D1[e].toString()}var Kfe=["channelsFirst","channelsLast"],Xfe=["nearest","bilinear"],Yfe=["valid","same","causal"],Jfe=["max","avg"],Qfe=["sum","mul","concat","ave"],uf=new Map;function Va(e){fp(Kfe,"DataFormat",e)}function Zfe(e){fp(Xfe,"InterpolationFormat",e)}function $i(e){fp(Yfe,"PaddingMode",e)}function y6(e){fp(Jfe,"PoolMode",e)}var ly=[],r$="/";function wd(e,t){ly.push(e);try{let n=t();return ly.pop(),n}catch(n){throw ly.pop(),n}}function eme(){return ly.length===0?"":ly.join(r$)+r$}function b6(e){if(!w6(e))throw new Error("Not a valid tensor name: '"+e+"'");return eme()+e}function v6(e){if(!w6(e))throw new Error("Not a valid tensor name: '"+e+"'");uf.has(e)||uf.set(e,0);let t=uf.get(e);if(uf.set(e,uf.get(e)+1),t>0){let n=`${e}_${t}`;return uf.set(n,1),n}else return e}var tme=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function w6(e){return!!e.match(tme)}function nme(e){return e===parseInt(e.toString(),10)}function Hu(e,t,n){t==null&&(t=0),n==null&&(n=e.length);let a=1;for(let r=t;r<n;++r)a*=e[r];return a}function Jf(e){if(e.length===0)return Number.NaN;let t=Number.POSITIVE_INFINITY;for(let n=0;n<e.length;n++){let a=e[n];a<t&&(t=a)}return t}function nc(e){if(e.length===0)return Number.NaN;let t=Number.NEGATIVE_INFINITY;for(let n=0;n<e.length;n++){let a=e[n];a>t&&(t=a)}return t}function To(e,t){if(t<e)throw new ce(`end (${t}) < begin (${e}) is forbidden.`);let n=[];for(let a=e;a<t;++a)n.push(a);return n}var TN;function yr(){return TN==null&&(TN=QI().epsilon()),TN}function Ao(){return"channelsLast"}function Wl(e,t){return He(e,t)}function Hb(e,t=-1){let n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),le(e,n)}function ame(e,t){return ue(()=>{if(e.shape.length!==2)throw new ce(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);let n=Hb(e,1);return aE(n,[1,t,1])})}function rme(e){let t=[Hu(e.shape)];return le(e,t)}function sme(e){if(e.rank<=1)throw new ce(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);let t=[e.shape[0],Hu(e.shape,1)];return le(e,t)}function Sd(e,t,n){return ue(()=>{switch(e.rank){case 1:return Pb(e,t,n);case 2:return Zw(e,[t,0],[n,e.shape[1]]);case 3:return vg(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return Kf(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return un(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return un(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new ce(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function AN(e,t,n){return ue(()=>{switch(e.rank){case 1:return Pb(e,t,n);case 2:return Zw(e,[0,t],[e.shape[0],n]);case 3:return vg(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return Kf(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new ce(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function R1(e,t,n,a){return ue(()=>{switch(e.rank){case 1:return Pb(e,t,n);case 2:switch(a){case 1:return Sd(e,t,n);case 2:return AN(e,t,n);default:throw new ce(`The axis is not within the rank of the tensor ${a}`)}case 3:switch(a){case 1:return Sd(e,t,n);case 2:return vg(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return AN(e,t,n);default:throw new ce(`The axis is not within the rank of the tensor ${a}`)}case 4:switch(a){case 1:return Sd(e,t,n);case 2:return Kf(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return Kf(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return AN(e,t,n);default:throw new ce(`The axis is not within the rank of the tensor ${a}`)}default:throw new ce(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function vA(e,t=-1){let n;return t<0&&(n=e[0].rank,n!==0?t=n:t=0),t===e[0].rank&&(t=-1),Qn(e,t)}function s$(e,t){switch(e.rank){case 1:return xT([e,t]);case 2:return yT([e,t],0);case 3:return bT([e,t],0);case 4:return vT([e,t],0);default:throw new ce(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function aE(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new ce(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return ai(e,t)}function f2(e,t=0,n=1,a,r){return Gw(e,t,n,a,r)}function al(e,t,n,a){if(e.rank<2||t.rank<2)throw new an(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){let r=e.shape.slice(-1)[0],s=t.shape.slice(-2)[0];if(r!==s)throw new an(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and  y shape = ${t.shape}`)}if(e.rank===2&&t.rank===2)return Yf.matMul({a:e,b:t,transposeA:!1,transposeB:!1,bias:a?rE(e.rank,a,Ao()):null,activation:n});{let r=e.shape.slice(),s=r.pop();e=le(e,[-1,s]);let i=t.shape.slice(),o=i.pop(),l=i.pop(),d=[...i,o],c=Array.from({length:t.rank},(m,x)=>x===0?t.rank-2:x<=t.rank-2?x-1:x);t=le(Qt(t,c),[l,-1]);let f=[...r,...d];return le(Yf.matMul({a:e,b:t,transposeA:!1,transposeB:!1,bias:a?rE(e.rank,a,Ao()):null,activation:n}),f)}}function S6(e,t,n){return ue(()=>(Array.isArray(t)?t=Ln(t,"int32"):t=He(t,"int32"),yg(e,t,n)))}function Gb(e){return ie(e,e)}function rE(e,t,n){let a=t.shape;if(t.rank!==1&&t.rank!==e)throw new ce(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(e===5){if(n==="channelsFirst")return a.length===1?le(t,[1,a[0],1,1,1]):le(t,[1,a[3],a[0],a[1],a[2]]);if(n==="channelsLast")return a.length===1?le(t,[1,1,1,1,a[0]]):le(t,[1].concat(a))}else if(e===4){if(n==="channelsFirst")return a.length===1?le(t,[1,a[0],1,1]):le(t,[1,a[2],a[0],a[1]]);if(n==="channelsLast")return a.length===1?le(t,[1,1,1,a[0]]):le(t,[1].concat(a))}else if(e===3){if(n==="channelsFirst")return a.length===1?le(t,[1,a[0],1]):le(t,[1,a[1],a[0]]);if(n==="channelsLast")return a.length===1?le(t,[1,1,a[0]]):le(t,[1].concat(a))}else if(e<3)return t;throw new ce(`Unsupported input rank by biasAdd: ${t.rank}`)}function Mo(e,t,n){return ue(()=>(n==null&&(n=Ao()),Va(n),ke(e,rE(e.rank,t,n))))}function ime(e,t=1){if(t!==1)throw new an(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return mg(e)}function ome(e){return ue(()=>ht(e,ke(tr(e),1)))}function k6(e,t,n,a){return ue(()=>nA(e,t,n,a))}function lme(e){return ue(()=>{let t=ke(.5,ie(.2,e));return ns(t,0,1)})}function qb(e,t,n=!1){return n?e():t()}var ume=["fanIn","fanOut","fanAvg"],cme=["normal","uniform","truncatedNormal"];function dme(e){fp(ume,"FanMode",e)}function hme(e){fp(cme,"Distribution",e)}var ao=class extends De.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}},wA=class extends ao{apply(e,t){return va(e,t)}};wA.className="Zeros";De.registerClass(wA);var m2=class extends ao{apply(e,t){return $s(e,t)}};m2.className="Ones";De.registerClass(m2);var SA=class extends ao{constructor(e){if(super(),typeof e!="object")throw new ce(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new ce(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return ue(()=>ie(Et(this.value),$s(e,t)))}getConfig(){return{value:this.value}}};SA.className="Constant";De.registerClass(SA);var kA=class extends ao{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return yc(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}};kA.className="RandomUniform";De.registerClass(kA);var NA=class extends ao{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new an(`randomNormal does not support dType ${t}.`);return f2(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};NA.className="RandomNormal";De.registerClass(NA);var CA=class extends ao{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new an(`truncatedNormal does not support dType ${t}.`);return s2(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};CA.className="TruncatedNormal";De.registerClass(CA);var EA=class extends ao{constructor(e){super(),this.gain=e.gain!=null?e.gain:1}apply(e,t){return ue(()=>{if(e.length!==2||e[0]!==e[1])throw new ce("Identity matrix initializer can only be used for 2D square matrices.");return ie(this.gain,zw(e[0]))})}getConfig(){return{gain:this.gain}}};EA.className="Identity";De.registerClass(EA);function pme(e,t="channelsLast"){let n,a;if(Va(t),e.length===2)n=e[0],a=e[1];else if([3,4,5].indexOf(e.length)!==-1){if(t==="channelsFirst"){let r=Hu(e,2);n=e[1]*r,a=e[0]*r}else if(t==="channelsLast"){let r=Hu(e,0,e.length-2);n=e[e.length-2]*r,a=e[e.length-1]*r}}else{let r=Hu(e);n=Math.sqrt(r),a=Math.sqrt(r)}return[n,a]}var Ls=class extends ao{constructor(e){if(super(),e.scale<0)throw new ce(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,dme(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,hme(this.distribution),this.seed=e.seed}apply(e,t){let n=pme(e),a=n[0],r=n[1],s=this.scale;if(this.mode==="fanIn"?s/=Math.max(1,a):this.mode==="fanOut"?s/=Math.max(1,r):s/=Math.max(1,(a+r)/2),this.distribution==="normal"){let i=Math.sqrt(s);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new an(`${this.getClassName()} does not support dType ${t}.`);return s2(e,0,i,t,this.seed)}else{let i=Math.sqrt(3*s);return yc(e,-i,i,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}};Ls.className="VarianceScaling";De.registerClass(Ls);var g2=class extends Ls{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};g2.className="GlorotUniform";De.registerClass(g2);var x2=class extends Ls{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};x2.className="GlorotNormal";De.registerClass(x2);var y2=class extends Ls{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};y2.className="HeNormal";De.registerClass(y2);var b2=class extends Ls{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};b2.className="HeUniform";De.registerClass(b2);var v2=class extends Ls{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};v2.className="LeCunNormal";De.registerClass(v2);var w2=class extends Ls{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Ls.className}};w2.className="LeCunUniform";De.registerClass(w2);var IA=class extends ao{constructor(e){super(),this.DEFAULT_GAIN=1,this.ELEMENTS_WARN_SLOW=2e3,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed}apply(e,t){return ue(()=>{if(e.length<2)throw new an("Shape must be at least 2D.");if(t!=="int32"&&t!=="float32"&&t!==void 0)throw new TypeError(`Unsupported data type ${t}.`);t=t;let n=R.sizeFromShape(e.slice(0,-1)),a=e[e.length-1],r=n*a;r>this.ELEMENTS_WARN_SLOW&&console.warn(`Orthogonal initializer is being called on a matrix with more than ${this.ELEMENTS_WARN_SLOW} (${r}) elements: Slowness may result.`);let s=[Math.max(a,n),Math.min(a,n)],i=f2(s,0,1,t,this.seed),o=iA.qr(i,!1),l=o[0],d=o[1].flatten().stridedSlice([0],[Math.min(a,n)*Math.min(a,n)],[Math.min(a,n)+1]);return l=ie(l,d.sign()),n<a&&(l=l.transpose()),ie(Et(this.gain),l.reshape(e))})}getConfig(){return{gain:this.gain,seed:this.seed}}};IA.className="Orthogonal";De.registerClass(IA);var i$={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function o$(e,t={}){return Vb(e,De.SerializationMap.getMap().classNameMap,t,"initializer")}function Sa(e){return yA(e)}function ga(e){if(typeof e=="string"){let t=e in i$?i$[e]:e;if(t==="GlorotNormal")return new x2;if(t==="GlorotUniform")return new g2;if(t==="HeNormal")return new y2;if(t==="HeUniform")return new b2;if(t==="LeCunNormal")return new v2;if(t==="LeCunUniform")return new w2;{let n={};return n.className=t,n.config={},o$(n)}}else return e instanceof ao?e:o$(e)}function sE(e){return Array.isArray(e)&&Array.isArray(e[0])}function jv(e){return e.length===0?[]:Array.isArray(e[0])?e:[e]}function zt(e){let t;if(Array.isArray(e)){if(e.length!==1)throw new ce(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function En(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(e.length===1)return e=e,e[0];throw new ce(`Expected exactly 1 Shape; got ${e.length}`)}else return e}function Dv(e){let t=0;for(let n of e)n.shape.length===0?t+=1:t+=n.shape.reduce((a,r)=>a*r);return t}var l$="Variable",N6=class{constructor(e,t="float32",n=l$,a=!0,r=null){this.dtype=t??"float32",this.shape=e.shape,this.id=x6(),n=n??l$,this.originalName=b6(n),this.name=v6(this.originalName),this.trainable_=a,this.constraint=r,this.val=eA(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),fme(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}};function fme(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}function iE(e){return e.map(t=>t.read())}function TA(e){e.forEach(t=>{t[0].write(t[1])})}var nr=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}},_o=class{constructor(e,t,n,a,r,s,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=a,this.callArgs=r,this.outputTensorIndex=i,this.id=x6(),s!=null&&(this.originalName=b6(s),this.name=v6(this.originalName)),this.rank=t.length}},mme=0,S2=class{constructor(e,t){this.callArgs=t,this.id=mme++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(let n of e.inboundLayers)n?.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){let e=[];for(let t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}},gme=0,rn=class extends De.Serializable{constructor(e={}){super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=gme++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){let n=this.getClassName();t=Dl(n)+"_"+p2(n)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let n;if(e.batchInputShape!=null)n=e.batchInputShape;else if(e.inputShape!=null){let r=null;e.batchSize!=null&&(r=e.batchSize),n=[r].concat(e.inputShape)}this.batchInputShape=n;let a=e.dtype;a==null&&(a=e.inputDType),a==null&&(a="float32"),this.dtype=a}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new Xo(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new ce(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Ds(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Ds(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new Ru(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new Ru(`Layer ${this.name} is not connected, no input to return.`);return Ds(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new Ru(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new Ru(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Ds(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){let t=Wn(e);if(this.inputSpec==null||this.inputSpec.length===0)return;let n=Wn(this.inputSpec);if(t.length!==n.length)throw new ce(`Layer ${this.name} expects ${n.length}
92 inputs, but it received ${t.length} input tensors. Input received: ${e}`);for(let a=0;a<t.length;a++){let r=t[a],s=n[a];if(s==null)continue;let i=r.rank;if(s.ndim!=null&&i!==s.ndim)throw new ce(`Input ${a} is incompatible with layer ${this.name}: expected ndim=${s.ndim}, found ndim=${i}`);if(s.maxNDim!=null&&i>s.maxNDim)throw new ce(`Input ${a} is incompatible with layer ${this.name}: expected max_ndim=${s.maxNDim}, found ndim=${i}`);if(s.minNDim!=null&&i<s.minNDim)throw new ce(`Input ${a} is incompatible with layer ${this.name}: expected min_ndim=${s.minNDim}, found ndim=${i}.`);if(s.dtype!=null&&r.dtype!==s.dtype)throw new ce(`Input ${a} is incompatible with layer ${this.name} : expected dtype=${s.dtype}, found dtype=${r.dtype}.`);if(s.axes){let o=r.shape;for(let l in s.axes){let d=Number(l),c=s.axes[l],f=d>=0?o[d]:o[o.length+d];if(c!=null&&[c,null].indexOf(f)===-1)throw new ce(`Input ${a} is incompatible with layer ${this.name}: expected axis ${d} of input shape to have value ${c} but got shape ${o}.`)}}if(s.shape!=null)for(let o=0;o<s.shape.length;++o){let l=s.shape[o],d=r.shape[o];if(l!=null&&d!=null&&l!==d)throw new ce(`Input ${a} is incompatible with layer ${this.name}: expected shape=${s.shape}, found shape=${r.shape}.`)}}}call(e,t){return e}invokeCallHook(e,t){this._callHook!=null&&this._callHook(e,t)}setCallHook(e){this._callHook=e}clearCallHook(){this._callHook=null}apply(e,t){t=t||{},this.assertNotDisposed();let n=Wn(e),a=bme(e),r=vme(e);if(a===r)throw new ce("Arguments to apply() must be all SymbolicTensors or all Tensors");return wd(this.name,()=>{if(!this.built){this.assertInputCompatibility(e);let s=[];for(let i of Wn(e))s.push(i.shape);this.build(Ds(s)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let s=this.call(e,t);this.supportsMasking&&this.setMaskMetadata(e,s);let i=Wn(s),o=[];for(let l of i)n.indexOf(l)!==-1&&(l=l.clone()),o.push(l);if(s=Ds(o),this.activityRegularizer!=null)throw new an("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return s}else{let s=xme(e),i=this.computeOutputShape(s),o,l=yme(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?s[0]:s),i!=null&&i.length>0&&Array.isArray(i[0])?o=i.map((d,c)=>new _o(l,d,this,Wn(e),t,this.name,c)):o=new _o(l,i,this,Wn(e),t,this.name),this.addInboundNode(e,o,null,null,s,i,t),this._refCount++,this.activityRegularizer!=null)throw new an("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return o}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,a)=>{n!=null&&e[a]!=null&&e[a]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new Ru(`The layer ${this.name} has never been called and thus has no defined output shape.`);let e=[];for(let t of this.inboundNodes){let n=JSON.stringify(t.outputShapes);e.indexOf(n)===-1&&e.push(n)}if(e.length===1){let t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new Ru(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new Xo(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return Dv(this.weights)}build(e){this.built=!0}getWeights(e=!1){return iE(e?this.trainableWeights:this.weights)}setWeights(e){ue(()=>{let t=this.weights;if(t.length!==e.length)throw new ce(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;let n=[],a=iE(t);for(let r=0;r<a.length;++r){let s=a[r],i=t[r],o=e[r];if(!R.arraysEqual(s.shape,o.shape))throw new ce(`Layer weight shape ${s.shape} not compatible with provided weight shape ${o.shape}`);
vendor: 62,470 bytes, line 92
92n.push([i,o])}TA(n)})}addWeight(e,t,n,a,r,s,i,o){if(this._addedWeightNames.indexOf(e)!==-1)throw new ce(`Duplicate weight name ${e} for layer ${this.name}`);this._addedWeightNames.push(e),n==null&&(n="float32"),this.fastWeightInitDuringBuild&&(a=o!=null?o():ga("zeros"));let l=a.apply(t,n),d=new N6(l,n,e,s,i);return l.dispose(),r!=null&&this.addLoss(()=>r.apply(d.read())),s==null&&(s=!0),s?this._trainableWeights.push(d):this._nonTrainableWeights.push(d),d}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=Wn(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(n=>{if(n!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}setMaskMetadata(e,t,n){if(!this.supportsMasking)return;let a=this.computeMask(e,n),r=Wn(t),s=Wn(a);if(r.length!==s.length)throw new Error(`${this.name} outputs ${r.length} tensors but ${r.length} masks for those tensors`);for(let i=0;i<r.length;i++)r[i].kerasMask=s[i]}addInboundNode(e,t,n,a,r,s,i=null){let o=Wn(e);t=Wn(t),n=Wn(n),a=Wn(a),r=jv(r),s=jv(s);let l=[],d=[],c=[];for(let f of o)l.push(f.sourceLayer),d.push(f.nodeIndex),c.push(f.tensorIndex);new S2({outboundLayer:this,inboundLayers:l,nodeIndices:d,tensorIndices:c,inputTensors:o,outputTensors:t,inputMasks:n,outputMasks:a,inputShapes:r,outputShapes:s},i);for(let f=0;f<t.length;f++)t[f].sourceLayer=this,t[f].nodeIndex=this.inboundNodes.length-1,t[f].tensorIndex=f}getConfig(){let e={name:this.name,trainable:this.trainable};return this.batchInputShape!=null&&(e.batchInputShape=this.batchInputShape),this.dtype!=null&&(e.dtype=this.dtype),e}disposeWeights(){return this.weights.forEach(e=>e.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount===0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}};function xme(e){e=Wn(e);let t=[];for(let n of e)t.push(n.shape);return Ds(t)}function yme(e){return"float32"}function C6(e,t,n){if((t==null||n!=null&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),t.inboundNodes.length===0)return[e];{let a=t.inboundNodes[n];if(a.inboundLayers.length===0)return a.inputTensors;{let r=[];for(let s=0;s<a.inboundLayers.length;s++){let i=a.inputTensors[s],o=a.inboundLayers[s],l=a.nodeIndices[s],d=C6(i,o,l);for(let c of d)r.indexOf(c)===-1&&r.push(c)}return r}}}function bme(e){let t=!0;for(let n of Wn(e))if(!(n instanceof _o)){t=!1;break}return t}function vme(e){let t=!0;for(let n of Wn(e))if(n instanceof _o){t=!1;break}return t}var Sg=class extends rn{constructor(e){if(super({dtype:e.dtype,name:e.name!=null?e.name:p2("input").toString()}),e.batchSize==null&&(e.batchSize=null),e.sparse==null&&(e.sparse=!1),this.trainable=!1,this.built=!0,this.sparse=e.sparse,e.inputShape!=null&&e.batchInputShape!=null)throw new ce("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");let t=e.batchInputShape;if(t==null){if(e.inputShape==null)throw new ce("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");t=[e.batchSize].concat(e.inputShape)}else if(e.batchSize!=null)throw new ce("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");let n=e.dtype||"float32";this.batchInputShape=t,this.dtype=n,this.inputSpec=[{shape:t}];let a=new _o(this.dtype,this.batchInputShape,this,[],{},this.name);a.nodeIndex=0,a.tensorIndex=0,new S2({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[a],outputTensors:[a],inputMasks:[null],outputMasks:[null],inputShapes:[t],outputShapes:[t]})}apply(e,t){throw new ce(`Cannot pass any input to an InputLayer's apply() method. InputLayer name: ${this.name}`)}dispose(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}}getConfig(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}}};Sg.className="InputLayer";De.registerClass(Sg);function E6(e){if(e.batchShape==null&&e.shape==null)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(e.batchShape!=null&&e.shape!=null)throw new ce("Please provide either a `shape` or `batchShape` argument to Input, but not both.");let t=e.batchShape;e.shape!=null&&t==null&&(t=[null].concat(e.shape));let n=e.dtype;return n==null&&(n="float32"),new Sg({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}function wme(e,t){if(e.dtype==null||e.dtype===t.dtype)return t;try{return He(t,e.dtype)}catch{throw new ce(`The dtype of the feed (${t.dtype}) can not be cast to the dtype of the key '${e.name}' (${e.dtype}).`)}}var _f=class I6{constructor(t){if(this.id2Value={},this.id2Mask={},this.name2Id={},t instanceof I6)for(let n in t.id2Value)this.id2Value[n]=t.id2Value[n],n in t.id2Mask&&(this.id2Mask[n]=t.id2Mask[n]);else{if(t==null)return;for(let n of t)this.add(n.key,n.value)}}add(t,n,a){if(this.id2Value[t.id]==null)this.id2Value[t.id]=wme(t,n),this.name2Id[t.name]=t.id,a!=null&&(this.id2Mask[t.id]=a);else throw new ce(`Duplicate key: name=${t.name}, id=${t.id}`);return this}addFeed(t){this.add(t.key,t.value)}hasKey(t){return this.id2Value[t.id]!=null}names(){return Object.keys(this.name2Id)}getValue(t){if(t instanceof _o){if(this.id2Value[t.id]==null)throw new ce(`Nonexistent key: ${t.name}`);return this.id2Value[t.id]}else{let n=this.name2Id[t];if(n==null)throw new ce(`Feed dict has no SymbolicTensor name: ${t}`);return this.id2Value[n]}}getMask(t){if(t instanceof _o){if(this.id2Value[t.id]==null)throw new ce(`Nonexistent key: ${t.name}`);return this.id2Mask[t.id]}else{let n=this.name2Id[t];if(n==null)throw new ce(`Feed dict has no SymbolicTensor name: ${t}`);return this.id2Mask[n]}}disposeMasks(){this.id2Mask!=null&&Kt(this.id2Mask)}},Rv=new f6,Mv=new f6;function Sme(e){Rv?.setMaxEntries(e),Mv?.setMaxEntries(e)}function Vx(e,t,n,a){let r=n==null?!1:n.training,s=Array.isArray(e),i=s?e:[e],o=i.map(y=>y.name),l=[],d=t.names();for(let y of o)d.indexOf(y)!==-1?l.push(t.getValue(y)):l.push(null);let c=o.join(",")+"|"+t.names().sort().join(","),f=Rv.get(c),m;if(f==null){let y=kme(i,t);f=y.sorted,m=y.recipientCounts,Rv.put(c,f),Mv.put(c,m)}m={},r||Object.assign(m,Mv.get(c));let x=new _f(t);for(let y=0;y<f.length;++y){let b=f[y],w=b.sourceLayer;if(w instanceof Sg)continue;let S=[],k=[],C=[],E=!1;for(let O of b.inputs){let z=x.getValue(O),P=x.getMask(O);S.push(z),k.push(P),P!=null&&(E=!0),r||(m[O.name]--,m[O.name]===0&&!t.hasKey(O)&&o.indexOf(O.name)===-1&&!z.isDisposed&&O.sourceLayer.stateful!==!0&&C.push(z))}E&&(n=n||{},n.mask=k[0]);let T=Wn(w.apply(S,n)),_=null;w.supportsMasking&&(_=w.computeMask(S,k));let A=Cme(b),$=Array.isArray(A)?A:[A];for(let O=0;O<$.length;++O){x.hasKey($[O])||x.add($[O],T[O],Array.isArray(_)?_[0]:_);let z=o.indexOf($[O].name);z!==-1&&(l[z]=T[O])}r||Kt(C)}return x.disposeMasks(),s?l:l[0]}function kme(e,t){R.assert(e!=null&&e.length>0,()=>"Expected at least one fetch, got none");let n=[],a={};if(e.length===1){let r=u$(e[0],t);n=r.sorted,a=r.recipientMap}else{let r=new Set;for(let s of e){let{sorted:i,recipientMap:o}=u$(s,t);for(let l of i)r.has(l.name)||(n.push(l),r.add(l.name));for(let l in o)a[l]==null&&(a[l]=new Set),o[l].forEach(d=>a[l].add(d))}}return{sorted:n,recipientCounts:Nme(a)}}function Nme(e){let t={};for(let n in e)t[n]=e[n].size;return t}function u$(e,t){let n=new Set,a=[],r={};for(let o of t.names())n.add(o);let s=[],i=[];for(s.push(e);s.length>0;){let o=s[s.length-1];if(n.has(o.name)){s.pop();continue}let l=i[i.length-1]===s.length-1;if(o.inputs.length===0||l)s.pop(),a.push(o),n.add(o.name),l&&i.pop();else{i.push(s.length-1);for(let d of o.inputs)r[d.name]==null&&(r[d.name]=new Set),r[d.name].add(o.name),!n.has(d.name)&&s.push(d)}}return{sorted:a,recipientMap:r}}function Cme(e){let t;if(e.sourceLayer.inboundNodes.length===1)t=e.sourceLayer.output;else{let n=null;for(let a=0;a<e.sourceLayer.inboundNodes.length;++a)for(let r of e.sourceLayer.inboundNodes[a].outputTensors)if(r.id===e.id){n=a;break}t=e.sourceLayer.getOutputAt(n)}return t}var Eme=fe();Eme.registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",()=>100,Sme);var T6={};Xt(T6,{maxNorm:()=>Ime,minMaxNorm:()=>_me,nonNeg:()=>Ame,unitNorm:()=>Tme});function AA(e,t){return ue(()=>$r(yt(ie(e,e),t,!0)))}var Kb=class extends De.Serializable{getConfig(){return{}}},_A=class extends Kb{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return ue(()=>{let t=AA(e,this.axis),n=ns(t,0,this.maxValue);return ie(e,ht(n,ke(yr(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};_A.className="MaxNorm";De.registerClass(_A);var jA=class extends Kb{constructor(e){super(),this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return ue(()=>ht(e,ke(yr(),AA(e,this.axis))))}getConfig(){return{axis:this.axis}}};jA.className="UnitNorm";De.registerClass(jA);var DA=class extends Kb{apply(e){return Vn(e)}};DA.className="NonNeg";De.registerClass(DA);var RA=class extends Kb{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return ue(()=>{let t=AA(e,this.axis),n=ke(ie(this.rate,ns(t,this.minValue,this.maxValue)),ie(1-this.rate,t));return ie(e,ht(n,ke(yr(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};RA.className="MinMaxNorm";De.registerClass(RA);var c$={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function wr(e){return yA(e)}function d$(e,t={}){return Vb(e,De.SerializationMap.getMap().classNameMap,t,"constraint")}function Sr(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in c$?c$[e]:e,config:{}};return d$(t)}else return e instanceof Kb?e:d$(e)}function Ime(e){return new _A(e)}function Tme(e){return new jA(e)}function Ame(){return new DA}function _me(e){return new RA(e)}var A6={};Xt(A6,{constant:()=>Rme,glorotNormal:()=>Pme,glorotUniform:()=>Lme,heNormal:()=>zme,heUniform:()=>Ume,identity:()=>Fme,leCunNormal:()=>Wme,leCunUniform:()=>Vme,ones:()=>Dme,orthogonal:()=>Hme,randomNormal:()=>$me,randomUniform:()=>Mme,truncatedNormal:()=>Bme,varianceScaling:()=>Ome,zeros:()=>jme});function jme(){return new wA}function Dme(){return new m2}function Rme(e){return new SA(e)}function Mme(e){return new kA(e)}function $me(e){return new NA(e)}function Bme(e){return new CA(e)}function Fme(e){return new EA(e)}function Ome(e){return new Ls(e)}function Lme(e){return new g2(e)}function Pme(e){return new x2(e)}function zme(e){return new y2(e)}function Ume(e){return new b2(e)}function Wme(e){return new v2(e)}function Vme(e){return new w2(e)}function Hme(e){return new IA(e)}var _6={};Xt(_6,{Layer:()=>rn,RNN:()=>Ql,RNNCell:()=>Yb,activation:()=>Sxe,add:()=>jxe,alphaDropout:()=>fye,average:()=>Dxe,averagePooling1d:()=>H_,averagePooling2d:()=>G_,averagePooling3d:()=>q_,avgPool1d:()=>zxe,avgPool2d:()=>Wxe,avgPool3d:()=>Hxe,avgPooling1d:()=>Uxe,avgPooling2d:()=>Vxe,avgPooling3d:()=>Gxe,batchNormalization:()=>Oxe,bidirectional:()=>iye,categoryEncoding:()=>bye,centerCrop:()=>xye,concatenate:()=>Rxe,conv1d:()=>pxe,conv2d:()=>fxe,conv2dTranspose:()=>mxe,conv3d:()=>gxe,conv3dTranspose:()=>xxe,convLstm2d:()=>nye,convLstm2dCell:()=>aye,cropping2D:()=>bxe,dense:()=>kxe,depthwiseConv2d:()=>wxe,dot:()=>Fxe,dropout:()=>Nxe,elu:()=>oxe,embedding:()=>_xe,flatten:()=>Exe,gaussianDropout:()=>pye,gaussianNoise:()=>hye,globalAveragePooling1d:()=>qxe,globalAveragePooling2d:()=>Kxe,globalMaxPool1d:()=>lye,globalMaxPool2d:()=>uye,globalMaxPooling1d:()=>Dz,globalMaxPooling2d:()=>Rz,gru:()=>Yxe,gruCell:()=>Jxe,input:()=>K6,inputLayer:()=>ixe,layerNormalization:()=>Lxe,leakyReLU:()=>uxe,lstm:()=>Qxe,lstmCell:()=>Zxe,masking:()=>mye,maxPool1d:()=>cye,maxPool2d:()=>dye,maxPooling1d:()=>Mz,maxPooling2d:()=>$z,maxPooling3d:()=>Xxe,maximum:()=>Mxe,minimum:()=>$xe,multiply:()=>Bxe,permute:()=>Axe,prelu:()=>cxe,randomWidth:()=>vye,reLU:()=>lxe,repeatVector:()=>Ixe,rescaling:()=>gye,reshape:()=>Txe,resizing:()=>yye,rnn:()=>rye,separableConv2d:()=>yxe,simpleRNN:()=>eye,simpleRNNCell:()=>tye,softmax:()=>dxe,spatialDropout1d:()=>Cxe,stackedRNNCells:()=>sye,thresholdedReLU:()=>hxe,timeDistributed:()=>oye,upSampling2d:()=>vxe,zeroPadding2d:()=>Pxe});async function Au(e){if(e==null)return;let t=[],n=[],a=[];for(let r in e){let s=e[r];if(typeof s!="number"){let i=s;t.push(i.data()),n.push(r),a.push(i)}}if(t.length>0){let r=await Promise.all(t);for(let s=0;s<r.length;++s)e[n[s]]=r[s][0];Kt(a)}}function j6(e){if(e!=null)for(let t in e){let n=e[t];typeof n!="number"&&n.dispose()}}var h$;(function(e){e[e.SILENT=0]="SILENT",e[e.VERBOSE=1]="VERBOSE"})(h$||(h$={}));var Gme=125,Qf=class{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}},D6=class{constructor(e,t=10){e==null&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(let t of this.callbacks)t.setParams(e)}setModel(e){for(let t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){t==null&&(t={});for(let n of this.callbacks)await n.onEpochBegin(e,t)}async onEpochEnd(e,t){t==null&&(t={});for(let n of this.callbacks)await n.onEpochEnd(e,t)}async onBatchBegin(e,t){t==null&&(t={});for(let n of this.callbacks)await n.onBatchBegin(e,t)}async onBatchEnd(e,t){t==null&&(t={});for(let n of this.callbacks)await n.onBatchEnd(e,t)}async onTrainBegin(e){e==null&&(e={});for(let t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){e==null&&(e={});for(let t of this.callbacks)await t.onTrainEnd(e)}},qme=class extends Qf{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){t==null&&(t={});let n=t.size==null?0:t.size;this.seen+=n;for(let a in t){let r=t[a];if(typeof r=="number")this.totals.hasOwnProperty(a)||(this.totals[a]=0),this.totals[a]=this.totals[a]+r*n;else{let s;a in this.totals?s=this.totals[a]:this.totals[a]=0;let i=ue(()=>ke(this.totals[a],ie(r,n)));this.totals[a]=i,s?.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(let n of this.params.metrics)this.totals[n]!=null&&(typeof this.totals[n]=="number"?t[n]=this.totals[n]/this.seen:ue(()=>{let a=ie(ht(1,this.seen),this.totals[n]);t[n]=a,this.totals[n].dispose(),xr(t[n])}))}},R6=class extends Qf{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(let n in t)this.history[n]==null&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){let e=[],t=[],n=[];for(let r in this.history){let s=this.history[r];for(let i=0;i<s.length;++i)if(typeof s[i]!="number"){let o=s[i];e.push(o.data()),t.push(r),n.push(i)}}let a=await Promise.all(e);for(let r=0;r<a.length;++r)this.history[t[r]][n[r]].dispose(),this.history[t[r]][n[r]]=a[r][0]}},M6=class extends Qf{constructor(e,t){if(super(),this.currentEpoch=0,this.nowFunc=e.nowFunc,this.nextFrameFunc=e.nextFrameFunc||gA,this.yieldEvery=t||"auto",this.yieldEvery==="auto"&&(this.yieldEvery=Gme),this.yieldEvery==="never"&&e.onYield!=null)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");R.isNumber(this.yieldEvery)&&(this.maybeWait=Gfe(this.maybeWait.bind(this),this.yieldEvery,this.nowFunc)),this.trainBegin=e.onTrainBegin,this.trainEnd=e.onTrainEnd,this.epochBegin=e.onEpochBegin,this.epochEnd=e.onEpochEnd,this.batchBegin=e.onBatchBegin,this.batchEnd=e.onBatchEnd,this.yield=e.onYield}async maybeWait(e,t,n){let a=[];this.yield!=null&&(await Au(n),a.push(this.yield(e,t,n))),a.push(this.nextFrameFunc()),await Promise.all(a)}async onEpochBegin(e,t){this.currentEpoch=e,this.epochBegin!=null&&(await Au(t),await this.epochBegin(e,t))}async onEpochEnd(e,t){let n=[];this.epochEnd!=null&&(await Au(t),n.push(this.epochEnd(e,t))),this.yieldEvery==="epoch"&&n.push(this.nextFrameFunc()),await Promise.all(n)}async onBatchBegin(e,t){this.batchBegin!=null&&(await Au(t),await this.batchBegin(e,t))}async onBatchEnd(e,t){let n=[];this.batchEnd!=null&&(await Au(t),n.push(this.batchEnd(e,t))),this.yieldEvery==="batch"?n.push(this.nextFrameFunc()):R.isNumber(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,e,t)),await Promise.all(n)}async onTrainBegin(e){this.trainBegin!=null&&(await Au(e),await this.trainBegin(e))}async onTrainEnd(e){this.trainEnd!=null&&(await Au(e),await this.trainEnd(e))}};function $6(e,t){return e==null&&(e={}),e instanceof Qf?[e]:Array.isArray(e)&&e[0]instanceof Qf?e:Wn(e).map(n=>new M6(n,t))}var MA=class Wo{constructor(){}static registerCallbackConstructor(t,n){R.assert(t>=0&&Number.isInteger(t),()=>`Verbosity level is expected to be an integer >= 0, but got ${t}`),Wo.checkForDuplicate(n),Wo.constructors[t]==null&&(Wo.constructors[t]=[]),Wo.constructors[t].push(n)}static checkForDuplicate(t){for(let n in Wo.constructors)Wo.constructors[+n].forEach(a=>{if(a===t)throw new ce("Duplicate callback constructor.")})}static clear(){Wo.constructors={}}static createCallbacks(t){let n=[];for(let a in Wo.constructors){let r=+a;t>=r&&n.push(...Wo.constructors[r])}return n.map(a=>new a)}};MA.constructors={};function B6(e,t,n,a,r,s,i,o,l){let d=new R6,c=[new qme,...MA.createCallbacks(t)];e!=null&&c.push(...e),c.push(d);let f=new D6(c);return f.setParams({epochs:n,initialEpoch:a,samples:r,steps:s,batchSize:i,verbose:t,doValidation:o,metrics:l}),{callbackList:f,history:d}}function Eo(e,t={},n=!1){return Vb(e,De.SerializationMap.getMap().classNameMap,t,"layer",n)}function $v(e,t){return ue(()=>{e.dtype!=="float32"&&(e=He(e,"float32"));let n=yt(Gb(e),t,!0),a=ri(n.shape,yr()),r=$r(ul(n,a));return ht(e,r)})}function mp(e,t){return ue(()=>ba(Gb(st(t,e)),-1))}function k2(e,t){return ue(()=>ba(tr(st(t,e)),-1))}function kg(e,t){return ue(()=>{let n=st(e,t),a=ns(tr(e),yr(),Number.MAX_VALUE),r=tr(ht(n,a));return ie(100,ba(r,-1))})}function Kme(e,t){return ue(()=>{let n=ns(t,yr(),Number.MAX_VALUE),a=ii(ke(1,n)),r=ns(e,yr(),Number.MAX_VALUE),s=ii(ke(1,r));return ba(Gb(st(a,s)),-1)})}function Xme(e,t){return ue(()=>{let n=ul(0,st(1,ie(e,t)));return ba(Gb(n),-1)})}function Yme(e,t){return ue(()=>{let n=ul(0,st(1,ie(e,t)));return ba(n,-1)})}function Jme(e,t){return ue(()=>{let n=yt(ie(e,t),-1),a=ji(ie(st(1,e),t),-1);return ul(0,ke(1,st(a,n)))})}function Qme(e,t){return ue(()=>{let n=Math.log(2),a=st(t,e),r=st(ke(a,hp(ie(-2,a))),n);return ba(r,-1)})}function Ly(e,t,n=!1){return ue(()=>{if(n)t=bc(t);else{let a=yt(t,t.shape.length-1,!0);t=ht(t,a)}return t=ns(t,yr(),1-yr()),ua(yt(ie(He(e,"float32"),ii(t)),t.shape.length-1))})}function Bv(e,t,n=!1){return ue(()=>{let a=He(xg(rme(e)),"int32");t=ns(t,yr(),1-yr());let r=t.shape,s=le(Gf(a,r[r.length-1]),r);return Ly(s,t,n)})}function Zme(e,t){if(!R.arraysEqual(e.shape,t.shape))throw new ce(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return ue(()=>{let n=Vn(t),a=ua(tr(t));return ke(st(n,ie(t,e)),Mb(as(a)))})}function N2(e,t){return ue(()=>{let n;return n=ns(t,yr(),1-yr()),n=ii(ht(n,st(1,n))),ba(Zme(e,n),-1)})}function ege(e,t){return ue(()=>{let n=ns(e,yr(),1),a=ns(t,yr(),1);return yt(ie(e,ii(ht(n,a))),-1)})}function tge(e,t){return ue(()=>{let n=ii(ke(yr(),t));return ba(st(t,ie(e,n)),-1)})}function $A(e,t){return ue(()=>{let n=$v(e,-1),a=$v(t,-1),r=ie(n,a);return ua(yt(r,-1))})}var Fv={meanSquaredError:mp,meanAbsoluteError:k2,meanAbsolutePercentageError:kg,meanSquaredLogarithmicError:Kme,squaredHinge:Xme,hinge:Yme,categoricalHinge:Jme,logcosh:Qme,categoricalCrossentropy:Ly,sparseCategoricalCrossentropy:Bv,binaryCrossentropy:N2,kullbackLeiblerDivergence:ege,poisson:tge,cosineProximity:$A};function _N(e){if(typeof e=="string"){if(e in Fv)return Fv[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new ce(t)}else return e}function BA(e,t){return ue(()=>{let n=ie(.5,oi(t)),a=Wl(Es(t,n),e.dtype);return ba(si(e,a),-1)})}function FA(e,t){return ue(()=>Wl(si(jd(e,-1),jd(t,-1)),"float32"))}function F6(e,t){return ue(()=>He(yt(to(si(e,1),si(t,1))),"float32"))}function nge(e,t){return ue(()=>He(yt(to(si(e,1),si(t,0))),"float32"))}function age(e,t){return ue(()=>He(yt(to(si(e,0),si(t,1))),"float32"))}function O6(e,t){return ue(()=>{let n=F6(e,t),a=age(e,t),r=ke(n,a);return He(Mr(Es(r,0),ht(n,r),0),"float32")})}function rge(e,t){return ue(()=>{let n=F6(e,t),a=nge(e,t),r=ke(n,a);return He(Mr(Es(r,0),ht(n,r),0),"float32")})}function L6(e,t){return N2(e,t)}function P6(e,t){return e.rank===t.rank&&(e=vc(e,[e.rank-1])),t=jd(t,-1),t.dtype!==e.dtype&&(t=He(t,e.dtype)),He(si(e,t),"float32")}function sge(e,t){return ue(()=>{let n=e.sub(t).square().sum(),a=e.sub(e.mean()).square().sum();return Et(1).sub(n.div(a))})}var ige=mp,oge=mp,lge=k2,uge=k2,cge=kg,dge=kg,OA=Ly,hge=$A,z6=Bv,Ov={binaryAccuracy:BA,categoricalAccuracy:FA,precision:O6,categoricalCrossentropy:OA,sparseCategoricalCrossentropy:z6,mse:ige,MSE:oge,mae:lge,MAE:uge,mape:cge,MAPE:dge,cosine:hge};function pge(e){if(typeof e=="string"&&e in Ov)return Ov[e];if(typeof e!="string"&&e!=null)return e;throw new ce(`Unknown metric ${e}`)}function M1(e){if(qo(e!==null,`Unknown LossOrMetricFn ${e}`),typeof e=="string")return e;{let t;for(let n of Object.keys(Fv))if(Fv[n]===e){t=n;break}if(t!==void 0)return t;for(let n of Object.keys(Ov))if(Ov[n]===e){t=n;break}return t!==void 0?t:e.name}}function fge(e){let t={Adagrad:()=>rd.adagrad(.01),Adadelta:()=>rd.adadelta(1,.95,yr()),Adam:()=>rd.adam(.001,.9,.999,yr()),Adamax:()=>rd.adamax(.002,.9,.999,yr(),0),RMSProp:()=>rd.rmsprop(.001,.9,0,yr()),SGD:()=>rd.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new ce(`Unknown Optimizer ${e}`)}function p$(e,t,n=!1){if(e==null||typeof e!="object"||Object.getPrototypeOf(e)!==Object.prototype||!oE(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){let a=JSON.stringify(e);a.length>1048576&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${a.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= 1048576.`)}}function oE(e){if(e===null)return!0;if(typeof e=="object")if(Object.getPrototypeOf(e)===Object.prototype){let t=Object.keys(e);for(let n of t)if(typeof n!="string"||!oE(e[n]))return!1;return!0}else if(Array.isArray(e)){for(let t of e)if(!oE(t))return!1;return!0}else return!1;else{let t=typeof e;return t==="string"||t==="number"||t==="boolean"}}function mge(e,t,n,a=console.log){let r=xge(e),s=["Layer (type)","Input Shape","Output shape","Param #"];r?(t=t||90,n=n||[.32,.61,.89,1]):(t=t||115,n=n||[.24,.48,.7,.8,1]),n[n.length-1]<=1&&(n=n.map(c=>Math.floor(t*c)));let i;if(!r){s.push("Receives inputs"),i=[];for(let c in e.nodesByDepth)i.push(...e.nodesByDepth[c])}a("_".repeat(t)),Lv(s,n,a),a("=".repeat(t));let o=e.layers;for(let c=0;c<o.length;++c)r?yge(o[c],n,a):bge(o[c],n,i,a),a((c===o.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();let l=gge(e),d=Dv(e.nonTrainableWeights);a(`Total params: ${l+d}`),a(`Trainable params: ${l}`),a(`Non-trainable params: ${d}`),a("_".repeat(t))}function gge(e){let t;return e.collectedTrainableWeights!=null?t=Dv(e.collectedTrainableWeights):t=Dv(e.trainableWeights),t}function xge(e){let t=!0,n=[],a=[];for(let r in e.nodesByDepth)n.push(e.nodesByDepth[r]);for(let r of n){if(r.length>1||r.length===1&&r[0].inboundLayers.length>1){t=!1;break}a.push(...r)}if(t)for(let r of e.layers){let s=!1;for(let i of r.inboundNodes)if(a.indexOf(i)!==-1)if(s){t=!1;break}else s=!0;if(!t)break}return t}function Lv(e,t,n=console.log){let a="";for(let r=0;r<e.length;++r)r>0&&(a=a.slice(0,a.length-1)+" "),a+=e[r],a=a.slice(0,t[r]),a+=" ".repeat(t[r]-a.length);n(a)}function yge(e,t,n){let a,r;try{r=e.inboundNodes.map(l=>JSON.stringify(l.inputShapes)).join(",")}catch{r="multiple"}try{a=JSON.stringify(e.outputShape)}catch{a="multiple"}let s=e.name,i=e.getClassName(),o=[`${s} (${i})`,r,a,e.countParams().toString()];Lv(o,t,n)}function bge(e,t,n,a){let r,s;try{s=e.inboundNodes.map(f=>JSON.stringify(f.inputShapes)).join(",")}catch{s="multiple"}try{r=JSON.stringify(e.outputShape)}catch{r="multiple"}let i=[];for(let f of e.inboundNodes)if(!(n!=null&&n.length>0&&n.indexOf(f)===-1))for(let m=0;m<f.inboundLayers.length;++m){let x=f.inboundLayers[m].name,y=f.nodeIndices[m],b=f.tensorIndices[m];i.push(`${x}[${y}][${b}]`)}let o=e.name,l=e.getClassName(),d=i.length===0?"":i[0],c=[`${o} (${l})`,s,r,e.countParams().toString(),d];Lv(c,t,a);for(let f=1;f<i.length;++f)Lv(["","","","",i[f]],t,a)}function U6(e,t,n){return(e==="inboundNodes"||e==="outputLayers"||e==="inputLayers")&&t===0&&typeof n=="string"}function Py(e,t){if(e===null)return null;if(typeof e=="string")return cd(e);if(typeof e=="number"||typeof e=="boolean")return e;if(e instanceof Array){let n=[],a=e.length;for(let r=0;r<a;++r){let s=e[r];U6(t,r,s)?n.push(s):n.push(Py(s,t))}return n}else{let n={};for(let a of Object.keys(e)){let r=e[a];if(a==="name"&&typeof r=="string")n[a]=r;else{let s=cd(a);n[s]=Py(r,s)}}return n}}function lE(e,t){if(e==null)return null;if(typeof e=="string")return Dl(e);if(typeof e=="number"||typeof e=="boolean")return e;if(e instanceof Array){let n=[],a=e.length;for(let r=0;r<a;++r){let s=e[r];U6(t,r,s)?n.push(s):n.push(lE(s,t))}return n}else{let n={};for(let a of Object.keys(e)){let r=e[a],s=Dl(a);(a==="name"||a==="className")&&typeof r=="string"?n[s]=r:n[s]=lE(r,a)}return n}}var LA="4.22.0",vge=e=>{let t=Object.keys(e);if(t.length===0)return!1;let n=t[0].split("/");return!isNaN(parseInt(n[n.length-1],10))},wge=class Vo extends rn{constructor(t){if(super({}),this.containerNodes=new Set,this.name=t.name,this.name==null){let k=this.getClassName().toLowerCase();this.name=p2(k)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(t.inputs)?this.inputs=t.inputs.slice():this.inputs=[t.inputs],Array.isArray(t.outputs)?this.outputs=t.outputs.slice():this.outputs=[t.outputs],Vu(this.inputs).length!==this.inputs.length)throw new ce(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(k=>k.name)}`);Vu(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(k=>k.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(let k of this.outputs){let C=k.sourceLayer,E=k.nodeIndex,T=k.tensorIndex;this.outputLayers.push(C),this.outputLayersNodeIndices.push(E),this.outputLayersTensorIndices.push(T)}for(let k of this.inputs){let C=k.sourceLayer,E=k.nodeIndex,T=k.tensorIndex;qo(E===0,"input layer has >1 nodes"),qo(T===0,"input layer has >1 tensors"),this.inputLayers.push(C),this.inputLayersNodeIndices.push(E),this.inputLayersTensorIndices.push(T)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let k=0;k<this.inputLayers.length;k++){let C=this.inputLayers[k];if(!(C instanceof Sg))throw new TypeError(`Input layers to a LayersModel must be InputLayer objects. Received inputs: ${t.inputs}. Input ${k} (0-based) originates from layer type ${C.getClassName()}.`);this.inputNames.push(C.name),this.feedInputShapes.push(C.batchInputShape),this.feedInputNames.push(C.name)}for(let k of this.outputLayers)this.outputNames.push(k.name);this.internalInputShapes=this.inputs.map(k=>k.shape),this.internalOutputShapes=this.outputs.map(k=>k.shape);let n={},a={},r={},s={},i={},o=[],l=(k,C,E,T,_,A)=>{(T==null||_==null||A==null)&&(T=k.sourceLayer,_=k.nodeIndex,A=k.tensorIndex);let $=T.inboundNodes[_];if(E.indexOf($)!==-1)throw new Xo(`The tensor ${k.name} at layer "${T.name}" is part of a cycle.`);if(C.indexOf($)!==-1)return;this.containerNodes.add(Vo.nodeKey(T,_)),T.id in i||(i[T.id]=Object.keys(i).length),E.indexOf($)===-1&&E.push($);let O=$.inboundLayers.length;for(let z=0;z<O;z++){let P=$.inputTensors[z],j=$.inboundLayers[z],G=$.nodeIndices[z],X=$.tensorIndices[z];l(P,C,E,j,G,X)}for(C.push($);E.indexOf($)>=0;)E.splice(E.indexOf($),1);o.push($)},d=[],c=[];for(let k of this.outputs)l(k,d,c);let f=o.slice().reverse();for(let k of f){a[k.id]=k,k.id in n||(n[k.id]=0);let C=n[k.id],E=r[k.outboundLayer.id]==null?0:r[k.outboundLayer.id];C=Math.max(C,E),r[k.outboundLayer.id]=C,s[k.outboundLayer.id]=k.outboundLayer,n[k.id]=C;for(let T=0;T<k.inboundLayers.length;T++){let _=k.inboundLayers[T],A=k.nodeIndices[T],$=_.inboundNodes[A],O=n[$.id]==null?0:n[$.id];n[$.id]=Math.max(C+1,O),a[$.id]=$}}let m={};for(let k in n){let C=n[k];C in m||(m[C]=[]),m[C].push(a[k])}let x={};for(let k in r){let C=r[k];C in x||(x[C]=[]),x[C].push(s[k])}let y=Object.keys(x).map(k=>parseInt(k,10)).sort(j1);this.layers=[];for(let k of y){let C=x[k];C.sort((E,T)=>{let _=i[E.id],A=i[T.id];return _<A?-1:_>A?1:0});for(let E of C)E instanceof Vo&&this.internalContainerRefs.push(E),this.layers.push(E)}this.layersByDepth=x,y=Object.keys(m).map(k=>parseInt(k,10)).sort(j1);let b=this.inputs.slice(),w=[];for(let k of y)for(let C of m[k]){let E=C.outboundLayer;if(E!=null){for(let T of C.inputTensors)if(b.indexOf(T)===-1)throw new Xo(`Graph disconnected: cannot obtain value for tensor ${T} at layer "${E.name}". The following previous layers were accessed without issue: ${w}`);for(let T of C.outputTensors)b.push(T);w.push(E.name)}}this.nodesByDepth=m;let S=this.layers.map(k=>k.name);for(let k of S){let C=S.filter(E=>E===k).length;if(C!==1)throw new Xo(`The name "${k}" is used ${C} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(S))}this.outboundNodes=[],this.inboundNodes=[],new S2({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(k=>null),outputMasks:this.outputs.map(k=>null),inputShapes:this.inputs.map(k=>k.shape),outputShapes:this.outputs.map(k=>k.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();let t={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount===0){for(let n of this.layers)t.numDisposedVariables+=n.dispose().numDisposedVariables;for(let n of this.internalContainerRefs)t.numDisposedVariables+=n.dispose().numDisposedVariables}return t.refCountAfterDispose=this._refCount,t}get trainable(){return this.trainable_}set trainable(t){this.layers.forEach(n=>{n._trainableWeights.forEach(a=>a.trainable=t)}),this.trainable_=t}get trainableWeights(){if(this._trainableWeights.length>0)throw new ce("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let t=[];for(let n of this.layers)t=t.concat(n.trainableWeights);return t}get nonTrainableWeights(){let t=[];for(let n of this.layers)t.push(...n.nonTrainableWeights);if(!this.trainable){let n=[];for(let a of this.layers)n.push(...a.trainableWeights);return n.concat(t)}return t}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(t,n=!0){let a={},r=0,s=vge(t);s&&this.parseWeights(t);for(let o of this.layers)for(let[l,d]of o.weights.entries()){let c=s?`${d.name.split("/").slice(0,-1).join("/")+"/"}${l}`:d.originalName;if(a[c]!=null)throw new ce(`Duplicate weight name: ${c}`);a[c]=d,r++}let i=[];for(let o in t){let l=o;if(a[o]==null){let d=o.split("/");l=d.slice(0,-2).concat([d[d.length-1]]).join("/")}if(a[l]!=null)i.push([a[l],t[o]]);else if(n)throw new ce(`Provided weight data has no target variable: ${o}`);delete a[l]}if(n){let o=[];for(let l in a)o.push(l);if(o.length>0)throw new ce(`${o.length} of ${r} weights are not set: ${o}`)}TA(i)}parseWeights(t){for(let n in Object.keys(t)){let a=n.split("/"),r=["vars","layer_checkpoint_dependencies"],s=a.map(i=>i.startsWith("_")?i.slice(1):i).filter(i=>!r.includes(i)).join("/");s!==n&&(t[s]=t[n],delete t[n])}}updatedConfig(){let t=this.getConfig(),n={};return n.className=this.getClassName(),n.config=t,n.kerasVersion=`tfjs-layers ${LA}`,n.backend="TensorFlow.js",n}toJSON(t,n=!0){let a=lE(this.updatedConfig());return n?JSON.stringify(a):a}call(t,n){return ue(()=>{t=Wn(t);let a=new _f;for(let r=0;r<this.inputs.length;++r)a.add(this.inputs[r],t[r]);return Vx(this.outputs,a,n)})}computeMask(t,n){return ue(()=>{t=Wn(t);let a;return n==null?a=Bd(null,t.length):a=Wn(n),this.runInternalGraph(t,a)[1]})}computeOutputShape(t){let n=jv(t);if(n.length!==this.inputLayers.length)throw new ce(`Invalid inputShape argument ${t}: model has ${this.inputLayers.length} tensor inputs.`);let a={};for(let o=0;o<n.length;o++){let l=this.inputLayers[o],d=n[o],c=l.name+"_0_0";a[c]=d}let r=Object.keys(this.nodesByDepth).map(o=>parseInt(o,10)).sort(j1);if(r.length>1)for(let o of r){let l=this.nodesByDepth[o];for(let d of l){let c=d.outboundLayer;if(this.inputLayers.map(b=>b.id).indexOf(c.id)!==-1)continue;let f=[];for(let b=0;b<d.inboundLayers.length;b++){let w=d.inboundLayers[b],S=d.nodeIndices[b],k=d.tensorIndices[b],C=`${w.name}_${S}_${k}`,E=a[C];f.push(E)}let m=c.computeOutputShape(Ds(f)),x=jv(m),y=c.inboundNodes.indexOf(d);for(let b=0;b<x.length;b++){let w=`${c.name}_${y}_${b}`;a[w]=x[b]}}}let s=[],i=[];for(let o=0;o<this.outputLayers.length;o++){let l=this.outputLayers[o],d=this.outputLayersNodeIndices[o],c=this.outputLayersTensorIndices[o],f=`${l.name}_${d}_${c}`;i.push(f)}for(let o=0;o<i.length;o++){let l=i[o];qo(l in a),s.push(a[l])}return Ds(s)}runInternalGraph(t,n){n==null&&(n=Bd(null,t.length));let a={};for(let l=0;l<this.inputs.length;++l){let d=this.inputs[l],c=t[l],f=n[l];a[d.id]=[c,f]}let r=Object.keys(this.nodesByDepth).map(l=>parseInt(l,10)).sort(j1);for(let l of r){let d=this.nodesByDepth[l];for(let c of d){let f=c.outboundLayer,m=c.inputTensors,x=c.outputTensors,y=new Array;for(let b of m)b.id in a&&y.push(a[b.id]);if(y.length===m.length){let b={},w,S,k,C;if(c.callArgs!=null&&(b=c.callArgs),y.length===1){let[E,T]=y[0];b.mask==null&&(b.mask=T),k=Wn(f.call(E,b)),C=Wn(f.computeMask(E,T)),w=[E],S=[T]}else w=y.map(E=>E[0]),S=y.map(E=>E[1]),b.mask==null&&(b.mask=S),k=Wn(f.call(w,b)),C=Wn(f.computeMask(w,S));if(f.activityRegularizer)throw new an("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let E=0;E<x.length;++E){let T=x[E],_=k[E],A=C[E];a[T.id]=[_,A]}}}}let s=[],i=[],o=[];for(let l of this.outputs){qo(l.id in a,`Could not compute output ${l.name} : ${l.id}`);let[d,c]=a[l.id];o.push(d.shape),s.push(d),i.push(c)}return[s,i,o]}buildNodeConversionMap(t){let n={},a;for(let r of this.layers){a=r instanceof Vo?1:0;for(let s=0;s<r.inboundNodes.length;s++){let i=Vo.nodeKey(r,s);this.containerNodes.has(i)&&(n[i]=a,a+=1)}}return n}getLayer(t,n){if(n!=null)return this.findLayer(n);if(t==null)throw new ce("Provide either a layer name or layer index");if(typeof t=="number")return this.findLayer(t);for(let a of this.layers)if(a.name===t)return a;throw new ce(`No such layer: ${t}`)}findLayer(t){if(this.layers.length<=t)throw new ce(`Was asked to retrieve layer at index ${t}, but model only has ${this.layers.length} layer(s).`);return this.layers[t]}calculateLosses(){return ue(()=>{let t=[];for(let n of this.layers)for(let a=0;a<n.inboundNodes.length;++a){let r=Vo.nodeKey(n,a);this.containerNodes.has(r)&&t.push(...n.calculateLosses())}return t})}getConfig(){let t={name:this.name},n=this.buildNodeConversionMap(this.layers),a=[];for(let i of this.layers){let o=i.getClassName(),l=i.getConfig(),d=[];for(let f=0;f<i.inboundNodes.length;f++){let m=i.inboundNodes[f],x=Vo.nodeKey(i,f),y={};if(this.containerNodes.has(x)){if(m.callArgs)try{JSON.stringify(m.callArgs),y=m.callArgs}catch{console.warn(`Layer ${i.name} was passed non-serializable keyword arguments: ${m.callArgs}. They will not be included in the serialized model (and thus will be missing at deserialization time).`),y={}}if(m.inboundLayers.length>0){let b=[];for(let w=0;w<m.inboundLayers.length;w++){let S=m.inboundLayers[w],k=m.nodeIndices[w],C=m.tensorIndices[w],E=Vo.nodeKey(S,k),T=n[E];T==null&&(T=0),b.push([S.name,T,C,y])}d.push(b)}}}let c={};c.name=i.name,c.className=o,c.config=l,c.inboundNodes=d,a.push(c)}t.layers=a;let r=[];for(let i=0;i<this.inputLayers.length;i++){let o=this.inputLayers[i],l=this.inputLayersNodeIndices[i],d=Vo.nodeKey(o,l);if(!this.containerNodes.has(d))continue;let c=n[d];c==null&&(c=0);let f=this.inputLayersTensorIndices[i];r.push([o.name,c,f])}t.inputLayers=r;let s=[];for(let i=0;i<this.outputLayers.length;i++){let o=this.outputLayers[i],l=this.outputLayersNodeIndices[i],d=Vo.nodeKey(o,l);if(!this.containerNodes.has(d))continue;let c=n[d];c==null&&(c=0);let f=this.outputLayersTensorIndices[i];s.push([o.name,c,f])}return t.outputLayers=s,t}static fromConfig(t,n,a={},r=!1){let s={},i={};function o(w,S){w.name in i?i[w.name].push(S):i[w.name]=[S]}function l(w,S){let k=[],C;for(let E of S){let T=E[0],_=E[1],A=E[2];if(C=E[3]==null?{}:E[3],!(T in s)){o(w,S);return}let $=s[T];if($.inboundNodes.length<=_){o(w,S);return}let O=$.inboundNodes[_];k.push(O.outputTensors[A])}k.length>0&&w.apply(Ds(k),C)}function d(w){let S=w.name,k=Eo(w,n.customObjects!=null?n.customObjects:{});k.setFastWeightInitDuringBuild(r),s[S]=k,w.inboundNodes.forEach(C=>{if(!(C instanceof Array))throw new ce(`Corrupted configuration, expected array for nodeData: ${C}`);o(k,C)})}let c=n.name,f=n.layers;for(let w of f)d(w);for(;!Hfe(i);)for(let w of f){let S=s[w.name];if(S.name in i){let k=i[S.name];delete i[S.name];for(let C of k)l(S,C)}}let m=[],x=[],y=n.inputLayers;for(let w of y){let S=w[0],k=w[1],C=w[2];qo(S in s);let E=s[S].inboundNodes[k].outputTensors;m.push(E[C])}let b=n.outputLayers;for(let w of b){let S=w[0],k=w[1],C=w[2];qo(S in s);let E=s[S].inboundNodes[k].outputTensors;x.push(E[C])}return new t({inputs:m,outputs:x,name:c})}get stateful(){if(this._stateful)throw new ce("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(let t of this.layers)if(t.stateful)return!0;return!1}resetStates(){ue(()=>{this.layers.forEach(t=>{t.stateful&&t.resetStates()})})}};function Sge(e,t,n){let a=t.length;if(e==null||Array.isArray(e)&&e.length===0)return t.map(r=>null);if(a===1)return Array.isArray(e)&&e.length===1?e:typeof e=="object"&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==a)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${a} outputs. Make sure a set of weights is provided for each model output.`);return e}else if(typeof e=="object"&&Object.keys(e).length>0&&typeof e[Object.keys(e)[0]]=="object"){let r=[];return t.forEach(s=>{s in e?r.push(e[s]):r.push(null)}),r}else throw new Error(`The model has multiple (${a}) outputs, so ${n} must be either an array with ${a} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function W6(e,t){return Sge(e,t,"classWeight")}async function V6(e,t,n,a){if(n!=null){let r=ue(()=>{if(e.shape.length===1)return tl(e);if(e.shape.length===2){if(e.shape[1]>1)return jd(e,1);if(e.shape[1]===1)return le(e,[e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),s=Array.from(await r.data());Kt(r);let i=[];return s.forEach(o=>{if(n[o]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${o} exists in the data but not in classWeight`);i.push(n[o])}),Ln(i,"float32")}else return null}function kge(e,t){return ie(e,t)}var Nge=32;function H6(e,t){let n,a,r=t;n=r.xs,a=r.ys,R.assert(n!=null&&a!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor.  The provided Dataset instead generates ${t}`);let s=f$("input",e.inputNames,n),i=f$("output",e.outputNames,a),o=s[0].shape[0];R.assert(s.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs.  (Expected input keys: ${JSON.stringify(e.inputNames)})`),R.assert(i.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${i.length} outputs.  (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let l=0;l<s.length;l++)R.assert(s[l].shape[0]===o,()=>`Batch size mismatch: input ${e.inputNames[l]} has ${s[l].shape[0]}; expected  ${o} based on input ${e.inputNames[0]}.`);for(let l=0;l<i.length;l++)R.assert(i[l].shape[0]===o,()=>`Batch size mismatch: output ${e.outputNames[l]} has ${i[l].shape[0]}; expected  ${o} based on input ${e.inputNames[0]}.`);return{xs:s,ys:i}}function f$(e,t,n){if(n instanceof en)return[n];if(Array.isArray(n))return R.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{let a=[];for(let r of t){if(n[r]==null)throw new ce(`The feature data generated by the dataset lacks the required ${e} key '${r}'.`);a.push(n[r])}return a}}function Cge(e){if(e.length===3)throw new an("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}async function Ege(e,t,n){let a=n.batchesPerEpoch!=null;if(R.assert(e.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),R.assert(n!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),R.assert(n.epochs!=null&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),R.assert(!a||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),R.assert(n.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{let r=n.validationData!=null,s,i;if(r)if(m$(n.validationData))R.assert(n.validationBatches==null||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{let w=Cge(n.validationData);s=w.xs,i=w.ys}let o=e.makeTrainFunction(),l=e.getDedupedMetricsNames(),d;r?d=l.slice().concat(l.map(w=>"val_"+w)):d=l.slice();let c=$6(n.callbacks,n.yieldEvery),f=n.verbose==null?1:n.verbose,{callbackList:m,history:x}=B6(c,f,n.epochs,null,null,Ige(t,n),null,r,d);m.setModel(e),e.history=x,await m.onTrainBegin(),e.stopTraining_=!1;let y=n.initialEpoch==null?0:n.initialEpoch,b=await t.iterator();for(;y<n.epochs;){let w={};await m.onEpochBegin(y);let S=0,k=0;for(a||(b=await t.iterator());!a||S<n.batchesPerEpoch;){let C=await b.next();if(a&&C.done){console.warn(`You provided \`batchesPerEpoch\` as ${n.batchesPerEpoch}, but your dataset iterator ran out of data after ${S} batches; interrupting training. Make sure that your dataset can generate at least \`batchesPerEpoch * epochs\` batches (in this case, ${n.batchesPerEpoch*n.epochs} batches). You may need to use the repeat() function when building your dataset.`);break}if(C.value!=null){let{xs:E,ys:T}=H6(e,C.value),_={};_.batch=k,_.size=E[0].shape[0],await m.onBatchBegin(k,_);let A=[];if(n.classWeight!=null){let z=W6(n.classWeight,e.outputNames);for(let P=0;P<z.length;++P)A.push(await V6(T[P],null,z[P]))}let $=E.concat(T).concat(A),O=o($);Kt($);for(let z=0;z<l.length;++z){let P=l[z],j=O[z];_[P]=j,xr(j)}await m.onBatchEnd(k,_),j6(_),k++,S++}if(a?S>=n.batchesPerEpoch:C.done){if(r){let E;m$(n.validationData)?E=Wn(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):E=Wn(e.evaluate(s,i,{batchSize:n.validationBatchSize==null?Nge:n.validationBatchSize,verbose:0}));for(let T=0;T<e.metricsNames.length;++T)w[`val_${e.metricsNames[T]}`]=E[T]}break}if(e.stopTraining_)break}if(await m.onEpochEnd(y,w),y++,e.stopTraining_)break}return await m.onTrainEnd(),await e.history.syncData(),e.history}finally{e.isTraining=!1}}function Ige(e,t){let n=null;return t.batchesPerEpoch!=null?n=t.batchesPerEpoch:Number.isFinite(e.size)&&(n=e.size),n}function m$(e){return typeof e.iterator=="function"}function Tge(e){return typeof e.next=="function"}async function Age(e,t,n){n=n||{};let a=n.batches!=null,r=e.testFunction,s=[];if(n.verbose>0)throw new an("Verbose mode is not implemented yet.");R.assert(!a||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);let i=Tge(t)?t:await t.iterator(),o=0,l=0;for(;!a||l<n.batches;){let d=await i.next();if(s=ue(()=>{if(d.value){let{xs:c,ys:f}=H6(e,d.value),m=c.concat(f),x=ue(()=>r(m));if(Kt(m),l===0)for(let b=0;b<x.length;++b)s.push(Et(0));let y=m[0].shape[0];for(let b=0;b<x.length;++b){let w=x[b],S=s[b];s[b]=ue(()=>ke(s[b],ie(y,w))),l>0&&Kt(S)}Kt(x),o+=y,++l}return s}),d.done){a&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let d=0;d<s.length;++d){let c=s[d];s[d]=ht(s[d],o),Kt(c)}return Ds(s)}function jN(e){R.assert(e>0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function Mx(e,t,n){return e==null?[null]:Array.isArray(e)?e.map(a=>Sd(a,t,n-t)):Sd(e,t,n-t)}function uE(e,t){return ue(()=>e==null?null:Array.isArray(e)?e.map(n=>uE(n,t)):S6(e,t.dtype==="int32"?t:He(t,"int32")))}function DN(e,t){let n=[],a=0,r=null;for(;a<e;)r=a+t,r>=e&&(r=e),n.push([a,r]),a=r;return n}function G6(e){let t=[];e instanceof en&&(e=[e]);for(let n=0;n<e.length;++n){let a=e[n];if(a.rank===1)t.push(Hb(a,1));else{if(a.rank===0)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");t.push(a)}}return t}function go(e,t){if(e==null)return;let n=[];if(t instanceof en)n.push(t.id);else if(Array.isArray(t))t.forEach(r=>n.push(r.id));else if(t!=null)for(let r in t){let s=t[r];n.push(s.id)}let a=[];if(e instanceof en)n.indexOf(e.id)===-1&&a.push(e);else if(Array.isArray(e))e.forEach(r=>{n.indexOf(r.id)===-1&&a.push(r)});else if(e!=null)for(let r in e){let s=e[r];n.indexOf(s.id)===-1&&a.push(s)}a.forEach(r=>{r.isDisposed||r.dispose()})}function _ge(e){return e instanceof en}function cE(e){return Array.isArray(e)}function g$(e){return!_ge(e)&&!cE(e)}function x$(e,t,n,a=!0,r=""){if(t==null||t.length===0){if(e!=null){let i=!1;if(cE(e)&&e.length>0)i=!0;else if(g$(e)){for(let o in e)if(e.hasOwnProperty(o)){i=!0;break}}else i=!0;if(i)throw new ce(`Error when checking model ${r} expected no data, but got ${e}`)}return[]}if(e==null)return t.map(i=>null);let s;if(g$(e)){e=e,s=[];for(let i of t){if(e[i]==null)throw new ce(`No data provided for "${i}". Need data for each key in: ${t}`);s.push(e[i])}}else if(cE(e)){if(e=e,e.length!==t.length)throw new ce(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(e=e,t.length>1)throw new ce(`The model ${r} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=G6(s),n!=null)for(let i=0;i<t.length;++i){if(n[i]==null)continue;let o=s[i];if(o.shape.length!==n[i].length)throw new ce(`Error when checking ${r}: expected ${t[i]} to have ${n[i].length} dimension(s). but got array with shape ${o.shape}`);for(let l=0;l<n[i].length;++l){if(l===0&&!a)continue;let d=o.shape[l],c=n[i][l];if(c!=null&&c>=0&&d!==c)throw new ce(`${r} expected a batch of elements where each example has shape [${n[i].slice(1,n[i].length)}] (i.e.,tensor shape [*,${n[i].slice(1,n[i].length)}]) but the ${r} received an input with ${o.shape[0]} examples, each with shape [${o.shape.slice(1,o.shape.length)}] (tensor shape [${o.shape}])`)}}return s}function jge(e,t,n){let a=Vu(e.map(s=>s.shape[0]));a.sort();let r=Vu(t.map(s=>s.shape[0]));if(r.sort(),a.length>1)throw new ce(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(s=>s.shape))}`);if(r.length>1)throw new ce(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(s=>s.shape))}`);if(a.length>0&&r.length>0&&!R.arraysEqual(a,r))throw new ce(`Input Tensors should have the same number of samples as target Tensors. Found ${a[0]} input sample(s) and ${r[0]} target sample(s).`)}function Dge(e,t,n){let a=[mp,N2,Ly];for(let r=0;r<e.length;++r){let s=e[r],i=t[r],o=n[r];if(i!=null){if(i===Ly&&s.shape[s.shape.length-1]===1)throw new ce(`You are passing a target array of shape ${s.shape} while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].`);if(a.indexOf(i)!==-1){let l=s.shape.slice(1),d=o.slice(1);for(let c=0;c<l.length;++c){let f=l[c],m=d[c];if(m!=null&&f!==m)throw new ce(`A target Tensor with shape ${s.shape} was passed for an output of shape ${o}, while using a loss function that expects targets to have the same shape as the output.`)}}}}}function y$(e,t,n,a=!0,r=""){let s;if(Array.isArray(e)){if(e.length!==t.length)throw new ce(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see ${t.length} Tensor(s), but instead got ${e.length} Tensors(s).`);s=e}else{if(t.length>1)throw new ce(`The model expects ${t.length} ${r} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(n!=null)for(let i=0;i<t.length;++i){if(n[i]==null)continue;let o=s[i];if(o.shape.length!==n[i].length)throw new ce(`Error when checking ${r}: expected ${t[i]} to have ${n[i].length} dimension(s), but got array with shape ${JSON.stringify(o.shape)}`);for(let l=0;l<n[i].length;++l){if(l===0&&!a)continue;let d=o.shape[l],c=n[i][l];if(c!=null&&c!==d)throw new ce(`Error when checking ${r}: expected ${t[i]} to have shape ${JSON.stringify(n[i])} but got array with shape ${JSON.stringify(o.shape)}.`)}}}function Rge(e,t){if(e==null||Array.isArray(e)&&e.length===0)return t.map(a=>[]);let n;if(typeof e=="string"||typeof e=="function")n=[e];else if(Array.isArray(e)||typeof e=="object")n=e;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);if(Array.isArray(n))return t.map(a=>n);{let a=[];for(let r of t){let s=n.hasOwnProperty(r)?n[r]:[];Array.isArray(s)||(s=[s]),a.push(s)}return a}}var Mge="layers-model",Ol=class extends wge{constructor(e){super(e),this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new ce("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");mge(this,e,t,n)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=fge(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof Jl))throw new ce("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(let s in e.loss)if(this.outputNames.indexOf(s)===-1)throw new ce(`Unknown entry in loss dictionary: "${s}". Only expected the following keys: ${this.outputNames}`);for(let s of this.outputNames)e.loss[s]==null&&console.warn(`Output "${s}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${s} during training`),t.push(_N(e.loss[s]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new ce(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(s=>_N(s))}else{let s=_N(e.loss);this.outputs.forEach(i=>{t.push(s)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let s=0;s<this.outputs.length;++s){let i=this.internalOutputShapes[s],o=this.outputNames[s];this.feedOutputNames.push(o),this.feedOutputShapes.push(i),this.feedLossFns.push(this.lossFunctions[s])}let n=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],wd("loss",()=>{for(let s=0;s<this.outputs.length;++s){if(n.indexOf(s)!==-1)continue;let i=this.lossFunctions[s];this.outputs.length>1&&(this.metricsTensors.push([i,s]),this.metricsNames.push(this.outputNames[s]+"_loss"))}});let a=Rge(e.metrics,this.outputNames),r=(s,i,o)=>{this.outputNames.length>1&&(i=this.outputNames[s]+"_"+i),this.metricsNames.push(i),this.metricsTensors.push([o,s])};wd("metric",()=>{for(let s=0;s<this.outputs.length;++s){if(n.indexOf(s)!==-1)continue;let i=a[s];(o=>{let l="",d,c,f;for(let m of o){if(typeof m=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(m)!==-1){let y=this.internalOutputShapes[s];y[y.length-1]===1||this.lossFunctions[s]===N2?["accuracy","acc"].indexOf(m)!==-1?c=BA:["crossentropy","ce"].indexOf(m)!==-1&&(c=L6):this.lossFunctions[s]===Bv?["accuracy","acc"].indexOf(m)!==-1?c=P6:["crossentropy","ce"].indexOf(m)!==-1&&(c=z6):["accuracy","acc"].indexOf(m)!==-1?c=FA:["crossentropy","ce"].indexOf(m)!==-1&&(c=OA);let b;["accuracy","acc"].indexOf(m)!==-1?b="acc":["crossentropy","ce"].indexOf(m)!==-1&&(b="ce"),f=c,d=l+b}else f=pge(m),d=l+M1(m);let x;wd(d,()=>{x=f}),r(s,d,x)}})(i)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){let a=n.batchSize==null?32:n.batchSize;jN(a);let r=this.standardizeUserDataXY(e,t,!0,a);try{let s=r[0].concat(r[1]);this.makeTestFunction();let i=this.testFunction,o=this.testLoop(i,s,a,n.verbose,n.steps);return Ds(o)}finally{go(r[0],e),go(r[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),Age(this,e,t)}checkNumSamples(e,t,n,a="steps"){let r;if(n!=null){if(r=null,t!=null)throw new ce(`If ${a} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new ce(`Either the input data should have a defined shape, or ${a} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new ce("`outputs` is an empty Array, which is not allowed.");let n=Array.isArray(t),a=n?t:[t],r=this.retrieveSymbolicTensors(a),s=new _f;if(e instanceof en&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new ce(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let o=0;o<this.inputs.length;++o)s.add(this.inputs[o],e[o])}else for(let o of this.inputs){let l=e[o.name];if(l==null)throw new ce(`No value is provided for the model's input ${o.name}`);s.add(o,l)}let i=Vx(r,s);return n?i:i[0]}retrieveSymbolicTensors(e){let t=Bd(null,e.length),n=e.length;for(let a of this.layers){let r=Array.isArray(a.output)?a.output:[a.output],s=r.map(i=>i.name);for(let i=0;i<e.length;++i){let o=s.indexOf(e[i]);if(o!==-1&&(t[i]=r[o],n--),n===0)break}if(n===0)break}if(n>0){let a=[];throw t.forEach((r,s)=>{r==null&&a.push(e[s])}),new ce(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(a)}`)}return t}predictLoop(e,t=32,n=!1){return ue(()=>{let a=this.checkNumSamples(e);if(n)throw new an("Verbose predictLoop() is not implemented yet.");let r=DN(a,t),s=this.outputs.map(i=>[]);for(let i=0;i<r.length;++i)ue(()=>{let o=r[i][0],l=r[i][1],d=Mx(e,o,l),c=[];if(Array.isArray(d))for(let m=0;m<d.length;++m)c.push({key:this.inputs[m],value:d[m]});else c.push({key:this.inputs[0],value:d});let f=new _f(c);return Vx(this.outputs,f)}).forEach((o,l)=>s[l].push(o));return Ds(s.map(i=>Qn(i,0)))})}predict(e,t={}){let n=G6(e);y$(n,this.inputNames,this.feedInputShapes,!1);try{let a=t.batchSize==null?32:t.batchSize;return jN(a),this.predictLoop(n,a)}finally{go(n,e)}}predictOnBatch(e){y$(e,this.inputNames,this.feedInputShapes,!0);let t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,a){if(this.optimizer_==null)throw new Xo("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");let r=[];for(let s=0;s<this.feedOutputShapes.length;++s){let i=this.feedOutputShapes[s];this.feedLossFns[s]===Bv?r.push(i.slice(0,i.length-1).concat([1])):r.push(i)}if(e=x$(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=x$(t,this.feedOutputNames,r,!1,"target"),jge(e,t),Dge(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&a!=null&&a>0&&e[0].shape[0]%a!==0)throw new ce(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${a}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,a,r=!0,s){let[i,o]=this.standardizeUserDataXY(e,t,r,s);if(n!=null)throw new Error("sample weight is not supported yet.");let l=null;if(a!=null){let d=W6(a,this.outputNames);l=[];for(let c=0;c<d.length;++c)l.push(await V6(o[c],null,d[c]))}return[i,o,l]}testLoop(e,t,n,a=0,r){return ue(()=>{let s=this.checkNumSamples(t,n,r,"steps"),i=[];if(a>0)throw new an("Verbose mode is not implemented yet.");if(r!=null)throw new an("steps mode in testLoop() is not implemented yet");{let o=DN(s,n),l=Ln(To(0,s));for(let d=0;d<o.length;++d){let c=o[d][0],f=o[d][1],m=Sd(l,c,f-c),x=uE(t,m),y=e(x);if(d===0)for(let b=0;b<y.length;++b)i.push(Et(0));for(let b=0;b<y.length;++b){let w=y[b];i[b]=ke(i[b],ie(f-c,w))}}for(let d=0;d<i.length;++d)i[d]=ht(i[d],s)}return i})}getDedupedMetricsNames(){let e=this.metricsNames,t=[];for(let n=0;n<e.length;++n){let a=e[n],r=a;if(a$(e,a)>1){let s=a$(e.slice(0,n),a);r+=`_${s}`}t.push(r)}return t}makeTrainFunction(){return e=>{let t=[],n=e.slice(0,this.inputs.length),a=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),s=[],i=()=>{let l=[];for(let m=0;m<this.inputs.length;++m)l.push({key:this.inputs[m],value:n[m]});let d=new _f(l),c=Vx(this.outputs,d,{training:!0}),f;for(let m=0;m<this.lossFunctions.length;++m){let x=this.lossFunctions[m],y=x(a[m],c[m]);r[m]!=null&&(y=kge(y,r[m]));let b=ba(y);t.push(b),m===0?f=y:f=ke(f,y)}for(let m=0;m<this.metricsTensors.length;++m){let x;if(this.outputs.length>1&&m<this.outputs.length)x=t[m];else{let y=this.metricsTensors[m][0],b=this.metricsTensors[m][1];x=ba(y(a[b],c[b]))}xr(x),s.push(x)}return f=ba(f),this.calculateLosses().forEach(m=>{f=ke(f,m)}),f},o=this.collectedTrainableWeights.map(l=>l.read());return[this.optimizer_.minimize(i,!0,o)].concat(s)}}makeTestFunction(){this.testFunction=e=>ue(()=>{let t=[],n,a=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let l=0;l<this.inputs.length;++l)s.push({key:this.inputs[l],value:a[l]});let i=new _f(s),o=Vx(this.outputs,i);for(let l=0;l<this.lossFunctions.length;++l){let d=this.lossFunctions[l],c=ba(d(r[l],o[l]));l===0?n=c:n=ke(n,c),t.push(n)}for(let l=0;l<this.metricsTensors.length;++l){let d=this.metricsTensors[l][0],c=this.metricsTensors[l][1],f=ba(d(r[c],o[c]));t.push(f)}return t})}async fit(e,t,n={}){if(this.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");this.isTraining=!0;let a,r,s,i,o,l,d,c,f;try{let m=n.batchSize==null?32:n.batchSize;jN(m);let x=await this.standardizeUserData(e,t,n.sampleWeight,n.classWeight,!1,m);a=x[0],r=x[1],f=x[2];let y=!1,b;if(n.validationData!=null&&n.validationData.length>0){if(y=!0,n.validationData.length===2)o=n.validationData[0],l=n.validationData[1];else throw n.validationData.length===3?new an("validationData including sample weights is not supported yet."):new ce(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items;
92 ${n.validationData} is invalid.`);let _=await this.standardizeUserData(o,l,null,null,!0,m);d=_[0],c=_[1],b=d.concat(c)}else if(n.validationSplit!=null&&n.validationSplit>0&&n.validationSplit<1){y=!0;let _=Math.floor(a[0].shape[0]*(1-n.validationSplit)),A=a[0].shape[0];d=Mx(a,_,A),s=a,a=Mx(a,0,_),c=Mx(r,_,A),i=r,r=Mx(r,0,_),b=d.concat(c)}else n.validationSteps!=null&&(y=!0);let w=a.concat(r).concat(f);this.checkTrainableWeightsConsistency();let S=this.makeTrainFunction(),k=this.getDedupedMetricsNames(),C,E;y?(this.makeTestFunction(),C=this.testFunction,E=k.slice().concat(k.map(_=>"val_"+_))):(C=null,b=[],E=k.slice());let T=$6(n.callbacks,n.yieldEvery);return await this.fitLoop(S,w,k,m,n.epochs,n.verbose,T,C,b,n.shuffle,E,n.initialEpoch,null,null)}finally{this.isTraining=!1,go(a,e),go(r,t),go(s,e),go(i,t),go(d,o),go(c,l),f!=null&&Kt(f)}}async fitLoop(e,t,n,a,r,s,i,o,l,d,c,f,m,x){a==null&&(a=32),r==null&&(r=1),d==null&&(d=!0),f==null&&(f=0);let y=!1;if(o!=null&&l!=null&&(y=!0),x!=null&&(y=!0,m==null))throw new ce("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");let b=this.checkNumSamples(t,a,m,"steps_per_epoch"),w;b!=null&&(w=To(0,b)),s==null&&(s=1);let{callbackList:S,history:k}=B6(i,s,r,f,b,m,a,y,c);S.setModel(this),this.history=k,await S.onTrainBegin(),this.stopTraining_=!1;for(let C=f;C<r;++C){await S.onEpochBegin(C);let E={};if(m!=null)throw new an("stepsPerEpoch mode is not implemented yet.");{if(d==="batch")throw new an("batch shuffling is not implemneted yet");d&&R.shuffle(w);let T=Ln(w),_=DN(b,a);for(let A=0;A<_.length;++A){let $={};if(await S.onBatchBegin(A,$),ue(()=>{let O=_[A][0],z=_[A][1],P=Sd(T,O,z-O);$.batch=A,$.size=z-O;let j=uE(t,P),G=e(j);for(let X=0;X<n.length;++X){let J=n[X],V=G[X];$[J]=V,xr(V)}if(A===_.length-1&&y){let X=this.testLoop(o,l,a);for(let J=0;J<n.length;++J){let V=n[J],Q=X[J];xr(Q),E["val_"+V]=Q}}}),await S.onBatchEnd(A,$),j6($),this.stopTraining_)break}T.dispose()}if(await S.onEpochEnd(C,E),this.stopTraining_)break}return await S.onTrainEnd(),await this.history.syncData(),this.history}async fitDataset(e,t){return Ege(this,e,t)}async trainOnBatch(e,t){let n=await this.standardizeUserData(e,t),a=n[0],r=n[1],s=this.makeTrainFunction()(a.concat(r)),i=[];for(let o of s){let l=await o.data();i.push(l[0])}return Kt(s),go(n[0],e),go(n[1],t),Ds(i)}getNamedWeights(e){let t=[],n=e!=null&&e.trainableOnly,a=n?this.trainableWeights:this.weights,r=this.getWeights(n);for(let s=0;s<a.length;++s)n&&!a[s].trainable||t.push({name:a[s].originalName,tensor:r[s]});return t}set stopTraining(e){this.stopTraining_=e}get stopTraining(){return this.stopTraining_}get optimizer(){return this.optimizer_}set optimizer(e){this.optimizer_!==e&&(this.optimizer_=e,this.isOptimizerOwned=!1)}dispose(){let e=super.dispose();if(e.refCountAfterDispose===0&&this.optimizer!=null&&this.isOptimizerOwned){let t=HC().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-HC().numTensors}return e}getLossIdentifiers(){let e;if(typeof this.loss=="string")e=Dl(this.loss);else if(Array.isArray(this.loss)){for(let t of this.loss)if(typeof t!="string")throw new Error("Serialization of non-string loss is not supported.");e=this.loss.map(t=>Dl(t))}else{let t=Object.keys(this.loss);e={};let n=this.loss;for(let a of t)if(typeof n[a]=="string")e[a]=Dl(n[a]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[Dl(M1(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>Dl(M1(e)));{let e={};for(let t in this.metrics)e[t]=Dl(M1(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");let t=Py(e.optimizer_config),n=Eo(t),a;if(typeof e.loss=="string")a=cd(e.loss);else if(Array.isArray(e.loss))a=e.loss.map(s=>cd(s));else if(e.loss!=null){a={};for(let s in e.loss)a[s]=cd(e.loss[s])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(s=>cd(s));else if(e.metrics!=null){r={};for(let s in e.metrics)r[s]=cd(e.metrics[s])}this.compile({loss:a,metrics:r,optimizer:n})}async save(e,t){if(typeof e=="string"){let r=Hr.getSaveHandlers(e);if(r.length===0)throw new ce(`Cannot find any save handlers for URL '${e}'`);if(r.length>1)throw new ce(`Found more than one (${r.length}) save handlers for URL '${e}'`);e=r[0]}if(e.save==null)throw new ce("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");let n=await Hr.encodeWeights(this.getNamedWeights(t)),a={modelTopology:this.toJSON(null,!1),format:Mge,generatedBy:`TensorFlow.js tfjs-layers v${LA}`,convertedBy:null};if(t!=null&&t.includeOptimizer&&this.optimizer!=null){a.trainingConfig=this.getTrainingConfig();let r="optimizer",{data:s,specs:i}=await Hr.encodeWeights(await this.optimizer.getWeights(),r);n.specs.push(...i),n.data=Hr.concatenateArrayBuffers([n.data,s])}return this.userDefinedMetadata!=null&&(p$(this.userDefinedMetadata,this.name,!0),a.userDefinedMetadata=this.userDefinedMetadata),a.weightData=n.data,a.weightSpecs=n.specs,e.save(a)}setUserDefinedMetadata(e){p$(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}};Ol.className="Model";De.registerClass(Ol);var q6=class extends Ol{};q6.className="Functional";De.registerClass(q6);async function $ge(e,t){"modelTopology"in e||(e={modelTopology:e}),e=e;let n=e.modelTopology;n.model_config!=null&&(n=n.model_config);let a=Py(n),r=Eo(a,t);
vendor: 35,675 bytes, line 92
92if(e.weightsManifest!=null){let s=await Hr.loadWeights(e.weightsManifest,e.pathPrefix,r.weights.map(o=>o.originalName)),i={};for(let o of r.weights)i[o.originalName]=s[o.originalName];r.loadWeights(i),Kt(s)}return r}async function Bge(e,t){if(t==null&&(t={}),typeof e=="string"){let n=Hr.getLoadHandlers(e,t);if(n.length===0)n.push(Hr.browserHTTPRequest(e,t));else if(n.length>1)throw new ce(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return Fge(e,void 0,t)}async function Fge(e,t,n){if(n==null&&(n={}),e.load==null)throw new ce("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let a=await e.load(),r=a.modelTopology;r.model_config!=null&&(r=r.model_config);let s=n.strict==null?!0:n.strict,i=a.weightData!=null&&a.weightSpecs!=null&&s,o=Eo(Py(r),t,i),l=a.trainingConfig;if(l!=null&&o.loadTrainingConfig(l),a.userDefinedMetadata!=null&&o.setUserDefinedMetadata(a.userDefinedMetadata),a.weightData!=null){if(a.weightSpecs==null)throw new ce("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");let{modelWeights:d,optimizerWeights:c}=Oge(a.weightData,a.weightSpecs);o.loadWeights(d,s),o.optimizer!=null&&c.length>0&&await o.optimizer.setWeights(c),Kt(d),Kt(c.map(f=>f.tensor))}return o}function Oge(e,t){let n=Hr.decodeWeights(e,t),a={},r=[];return t.forEach(s=>{s.group==="optimizer"?r.push({name:s.name,tensor:n[s.name]}):a[s.name]=n[s.name]}),{modelWeights:a,optimizerWeights:r}}var C2=class dE extends Ol{constructor(t){if(super({inputs:[],outputs:[]}),t=t||{},this.trainable=!0,this.built=!1,this.name=t.name!=null?t.name:p2("sequential_"),t.layers!=null)for(let n of t.layers)this.add(n)}checkShape(t){if(t.inboundNodes[0].outputTensors[0].shape.some(n=>n<0))throw new ce(`Negative dimension size caused by adding layer ${t.name} with input shape [${t.inboundNodes[0].inputTensors[0].shape}]`)}add(t){let n=t instanceof dE||t instanceof Ol,a;if(n){if(a=t,a.outputs.length!==1)throw new ce("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(a.inputs.length!==1)throw new ce("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(t.inboundNodes.length===0){if(t.batchInputShape==null)throw new ce("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");let r=E6({batchShape:t.batchInputShape,dtype:t.dtype,name:t.name+"_input"});t.apply(r)}if(n)this.outputs=a.outputs,this.inputs=a.inputs;else{if(t.inboundNodes.length!==1)throw new ce(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${t.name} which has ${t.inboundNodes.length} pre-existing inbound connections.`);if(t.inboundNodes[0].outputTensors.length!==1)throw new ce("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[t.inboundNodes[0].outputTensors[0]],this.inputs=C6(this.outputs[0])}this.inboundNodes=[],new S2({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:Bd(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(r=>r.shape),outputShapes:this.outputs[0].shape})}else{let r=t.apply(this.outputs[0]);if(Array.isArray(r))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[r],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(t),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{let t=this.layers.length-1;this.layers[t].outboundNodes=[],this.outputs=[this.layers[t].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(t,n){return this.model==null&&this.build(),this.model.call(t,n)}build(t){if(En(t),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new Ol({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(t,n,a=console.log){this.built||this.build(),super.summary(t,n,a)}setWeights(t){this.model==null&&this.build(),this.model.setWeights(t)}evaluate(t,n,a={}){if(!this.built)throw new Xo("The model needs to be compiled before being used.");return this.model.evaluate(t,n,a)}async evaluateDataset(t,n){if(!this.built)throw new Xo("The model needs to be compiled before being used.");return this.model.evaluateDataset(t,n)}predict(t,n={}){return this.model==null&&this.build(),this.model.predict(t,n)}predictOnBatch(t){return this.model==null&&this.build(),this.model.predictOnBatch(t)}compile(t){this.build(),this.model.compile(t),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(t){this.model.optimizer=t}async fit(t,n,a={}){if(!this.built)throw new Xo("The model needs to be compiled before being used.");return this.model.fit(t,n,a)}async fitDataset(t,n){if(!this.built)throw new Xo("The model needs to be compiled before being used.");return this.model.fitDataset(t,n)}async trainOnBatch(t,n){return this.model.trainOnBatch(t,n)}static fromConfig(t,n,a={},r=!1){let s,i={};if(n instanceof Array){if(n[0].className==null||n[0].className==="Merge")throw new ce("Legacy serialization format not supported yet.");s=n}else R.assert(n.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),s=n.layers,delete n.layers,i=n;let o=new t(i);if(!(o instanceof dE))throw new an(`Sequential.fromConfig called on non-Sequential input: ${o}`);for(let l of s){let d=Eo(l,void 0,r);r&&d.setFastWeightInitDuringBuild(!0),o.add(d)}return o}set stopTraining(t){if(this.model==null)throw new ce("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=t}get stopTraining(){if(this.model==null)throw new ce("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){let t=[];for(let n of this.layers){let a={};a.className=n.getClassName(),a.config=n.getConfig(),t.push(a)}return{name:this.name,layers:t}}};C2.className="Sequential";De.registerClass(C2);function Lge(e){return new Ol(e)}function Pge(e){return new C2(e)}function K6(e){return E6(e)}function zge(e,t){MA.registerCallbackConstructor(e,t)}var rs=class extends De.Serializable{getConfig(){return{}}},X6=class extends rs{apply(e,t=1){return ime(e,t)}};X6.className="elu";De.registerClass(X6);var Y6=class extends rs{apply(e){return Yw(e)}};Y6.className="selu";De.registerClass(Y6);var J6=class extends rs{apply(e){return Vn(e)}};J6.className="relu";De.registerClass(J6);var Q6=class extends rs{apply(e){return ue(()=>ec(6,Vn(e)))}};Q6.className="relu6";De.registerClass(Q6);var Z6=class extends rs{apply(e){return e}};Z6.className="linear";De.registerClass(Z6);var ez=class extends rs{apply(e){return eo(e)}};ez.className="sigmoid";De.registerClass(ez);var tz=class extends rs{apply(e){return lme(e)}};tz.className="hardSigmoid";De.registerClass(tz);var nz=class extends rs{apply(e){return hp(e)}};nz.className="softplus";De.registerClass(nz);var az=class extends rs{apply(e){return ome(e)}};az.className="softsign";De.registerClass(az);var rz=class extends rs{apply(e){return Zu(e)}};rz.className="tanh";De.registerClass(rz);var PA=class extends rs{apply(e,t=-1){return bc(e,t)}};PA.className="softmax";De.registerClass(PA);var sz=class extends rs{apply(e,t=-1){return Ww(e,t)}};sz.className="logSoftmax";De.registerClass(sz);var iz=class extends rs{apply(e){return ue(()=>ue(()=>{let t=Math.sqrt(2),n=ie(.5,ke(1,Pw(ht(e,t))));return ie(e,n)}))}};iz.className="gelu";De.registerClass(iz);var oz=class extends rs{apply(e){return ue(()=>ie(.5,ie(e,ke(1,Zu(ie($r(ht(2,Math.PI)),ke(e,ie(.044715,sl(e,3)))))))))}};oz.className="gelu_new";De.registerClass(oz);var lz=class extends rs{apply(e){return ue(()=>ie(e,Zu(hp(e))))}};lz.className="mish";De.registerClass(lz);var uz=class extends rs{apply(e,t=1){return ue(()=>ie(eo(ie(e,t)),e))}};uz.className="swish";De.registerClass(uz);function ac(e){return e.getClassName()}function RN(e,t={}){return Vb(e,De.SerializationMap.getMap().classNameMap,t,"activation")}function rc(e){if(e==null){let t={};return t.className="linear",t.config={},RN(t)}if(typeof e=="string"){let t={};return t.className=e,t.config={},RN(t)}else return e instanceof rs?e:RN(e)}function zA(e){if(e!=null&&typeof e!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}var cz=class extends De.Serializable{},Xb=class extends cz{constructor(e){super(),zA(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return ue(()=>{let t=va([1]);return this.hasL1&&(t=ke(t,yt(ie(this.l1,tr(e))))),this.hasL2&&(t=ke(t,yt(ie(this.l2,Gb(e))))),le(t,[])})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}};Xb.className="L1L2";De.registerClass(Xb);function Uge(e){return zA(e),new Xb({l1:e!=null?e.l1:null,l2:0})}function Wge(e){return zA(e),new Xb({l2:e!=null?e.l2:null,l1:0})}var b$={l1l2:"L1L2"};function ra(e){return yA(e)}function v$(e,t={}){return Vb(e,De.SerializationMap.getMap().classNameMap,t,"regularizer")}function xa(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in b$?b$[e]:e,config:{}};return v$(t)}else return e instanceof cz?e:v$(e)}var UA=class extends rn{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=zt(e);let n=Vn(e);return this.maxValue!=null&&(n=ns(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){let e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}};UA.className="ReLU";De.registerClass(UA);var WA=class extends rn{constructor(e){super(e??{}),this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=zt(e);return Rb(n,this.alpha)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};WA.className="LeakyReLU";De.registerClass(WA);var VA=class extends rn{constructor(e){if(super(e??{}),this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=ga(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=xa(e.alphaRegularizer),this.alphaConstraint=Sr(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new ce(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=En(e);let t=e.slice(1);if(this.sharedAxes!=null)for(let a of this.sharedAxes)t[a-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);let n={};if(this.sharedAxes!=null)for(let a=1;a<e.length;++a)n[a]=e[a];this.inputSpec=[new nr({ndim:e.length,axes:n})],this.built=!0}call(e,t){return e=zt(e),Lb(e,this.alpha.read())}getConfig(){let e={alphaInitializer:Sa(this.alphaInitializer),alphaRegularizer:ra(this.alphaRegularizer),alphaConstraint:wr(this.alphaConstraint),sharedAxes:this.sharedAxes},t=super.getConfig();return Object.assign(e,t),e}};VA.className="PReLU";De.registerClass(VA);var HA=class extends rn{constructor(e){if(super(e??{}),this.DEFAULT_ALPHA=1,e==null&&(e={}),e.alpha!=null&&e.alpha!==this.DEFAULT_ALPHA)throw new an(`Non-default alpha value (${e.alpha}) is not supported by the ELU layer yet.`);this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=zt(e);return mg(n)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};HA.className="ELU";De.registerClass(HA);var GA=class extends rn{constructor(e){super(e??{}),this.DEFAULT_THETA=1,e==null&&(e={}),this.theta=e.theta==null?this.DEFAULT_THETA:e.theta}call(e,t){let n=zt(e);return ie(n,He(Es(n,this.theta),"float32"))}computeOutputShape(e){return e}getConfig(){let e={theta:this.theta},t=super.getConfig();return Object.assign(e,t),e}};GA.className="ThresholdedReLU";De.registerClass(GA);var qA=class extends rn{constructor(e){super(e??{}),this.DEFAULT_AXIS=1,e==null&&(e={}),this.softmax=new PA().apply,this.axis=e.axis==null?this.DEFAULT_AXIS:e.axis}call(e,t){return ue(()=>{let n=zt(e),a=t.mask;if(a!=null){let r=ie(st($s(n.shape),He(a,n.dtype)),Et(-1e9));n=ke(n,r)}return this.axis instanceof Array?this.axis.length>1?as(st(n,$b(n,this.axis,!0))):this.softmax(n,this.axis[0]):this.softmax(n,this.axis)})}computeOutputShape(e){return e}getConfig(){let e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}};qA.className="Softmax";De.registerClass(qA);function Bf(e,t,n){if(typeof e=="number")return Bd(e,t);if(e.length!==t)throw new ce(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${e.length} elements.`);for(let a=0;a<t;++a){let r=e[a];if(!nme(r))throw new ce(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${JSON.stringify(e)} including a non-integer number ${r}`)}return e}function Io(e,t,n,a,r=1){if(e==null)return e;let s=t+(t-1)*(r-1),i;return n==="same"?i=e:i=e-s+1,Math.floor((i+a-1)/a)}function Ko(e,t,n,a){if(e==null)return null;if(a==="valid")e=e*t+nc([n-t,0]);else if(a==="same")e=e*t;else throw new ce(`Unsupport padding mode: ${a}.`);return e}function KA(e,t){return ue(()=>(Va(t),t==="channelsFirst"?Qt(e,[0,2,3,1]):e))}function dz(e,t){return ue(()=>(Va(t),t==="channelsFirst"?Qt(e,[0,2,3,4,1]):e))}function Vge(e,t,n,a=1,r="valid",s,i=1){return ue(()=>{if(s==null&&(s=Ao()),Va(s),e.shape.length!==3)throw new ce(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(t.shape.length!==3)throw new ce(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(n!=null&&n.shape.length!==1)throw new ce(`The bias for a conv1dWithBias operation should be 1, but is ${n.shape.length} instead`);if(s==="channelsFirst"&&(e=Qt(e,[0,2,1])),r==="causal")throw new an("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=Bw(e,t,a,r==="same"?"same":"valid","NWC",i);return n!=null&&(o=Mo(o,n)),o})}function w$(e,t,n,a=[1,1],r="valid",s,i,o=null){return ue(()=>{if(s==null&&(s=Ao()),Va(s),e.rank!==3&&e.rank!==4)throw new ce(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(t.rank!==3&&t.rank!==4)throw new ce(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=KA(e,s);if(r==="causal")throw new an("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=Yf.conv2d({x:l,filter:t,strides:a,pad:r==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),s==="channelsFirst"&&(l=Qt(l,[0,3,1,2])),l})}function Hge(e,t,n,a=[1,1,1],r="valid",s,i){return ue(()=>{if(s==null&&(s=Ao()),Va(s),e.rank!==4&&e.rank!==5)throw new ce(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(t.rank!==4&&t.rank!==5)throw new ce(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=dz(e,s);if(r==="causal")throw new an("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=ST(o,t,a,r==="same"?"same":"valid","NDHWC",i),n!=null&&(o=Mo(o,n)),s==="channelsFirst"&&(o=Qt(o,[0,4,1,2,3])),o})}var hz=class pz extends rn{constructor(t,n){if(super(n),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",pz.verifyArgs(n),this.rank=t,Rr(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new an(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=Bf(n.kernelSize,t,"kernelSize"),this.strides=Bf(n.strides==null?1:n.strides,t,"strides"),this.padding=n.padding==null?"valid":n.padding,$i(this.padding),this.dataFormat=n.dataFormat==null?"channelsLast":n.dataFormat,Va(this.dataFormat),this.activation=rc(n.activation),this.useBias=n.useBias==null?!0:n.useBias,this.biasInitializer=ga(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=Sr(n.biasConstraint),this.biasRegularizer=xa(n.biasRegularizer),this.activityRegularizer=xa(n.activityRegularizer),this.dilationRate=Bf(n.dilationRate==null?1:n.dilationRate,t,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new ce(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new ce(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new ce(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(t){if(qo("kernelSize"in t,"required key 'kernelSize' not in config"),typeof t.kernelSize!="number"&&!bA(t.kernelSize,"number",1,3))throw new ce(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(t.kernelSize)}.`)}getConfig(){let t={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:ac(this.activation),useBias:this.useBias,biasInitializer:Sa(this.biasInitializer),biasRegularizer:ra(this.biasRegularizer),activityRegularizer:ra(this.activityRegularizer),biasConstraint:wr(this.biasConstraint)},n=super.getConfig();return Object.assign(t,n),t}},E2=class fz extends hz{constructor(t,n){super(t,n),this.kernel=null,fz.verifyArgs(n),this.filters=n.filters,Rr(this.filters,"filters"),this.kernelInitializer=ga(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=Sr(n.kernelConstraint),this.kernelRegularizer=xa(n.kernelRegularizer)}build(t){t=En(t);let n=this.dataFormat==="channelsFirst"?1:t.length-1;if(t[n]==null)throw new ce(`The channel dimension of the input should be defined. Found ${t[n]}`);let a=t[n],r=this.kernelSize.concat([a,this.filters]);this.kernel=this.addWeight("kernel",r,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[n]:a}}],this.built=!0}call(t,n){return ue(()=>{t=zt(t);let a,r=this.bias==null?null:this.bias.read(),s=g6(this.activation.getClassName());if(s!=null&&this.rank===2)a=w$(t,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate,s);else{if(this.rank===1)a=Vge(t,this.kernel.read(),r,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)a=w$(t,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)a=Hge(t,this.kernel.read(),r,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new an("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(a=this.activation.apply(a))}return a})}computeOutputShape(t){t=En(t);let n=[],a=this.dataFormat==="channelsLast"?t.slice(1,t.length-1):t.slice(2);for(let s=0;s<a.length;++s){let i=Io(a[s],this.kernelSize[s],this.padding,this.strides[s],typeof this.dilationRate=="number"?this.dilationRate:this.dilationRate[s]);n.push(i)}let r=[t[0]];return this.dataFormat==="channelsLast"?(r=r.concat(n),r.push(this.filters)):(r.push(this.filters),r=r.concat(n)),r}getConfig(){let t={filters:this.filters,kernelInitializer:Sa(this.kernelInitializer),kernelRegularizer:ra(this.kernelRegularizer),kernelConstraint:wr(this.kernelConstraint)},n=super.getConfig();return Object.assign(t,n),t}static verifyArgs(t){if(!("filters"in t)||typeof t.filters!="number"||t.filters<1)throw new ce(`Convolution layer expected config.filters to be a 'number' > 0 but got ${JSON.stringify(t.filters)}`)}},I2=class mz extends E2{constructor(t){super(2,t),mz.verifyArgs(t)}getConfig(){let t=super.getConfig();return delete t.rank,t}static verifyArgs(t){if(typeof t.kernelSize!="number"&&!bA(t.kernelSize,"number",1,2))throw new ce(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(t.kernelSize)}.`)}};I2.className="Conv2D";De.registerClass(I2);var T2=class gz extends E2{constructor(t){super(3,t),gz.verifyArgs(t)}getConfig(){let t=super.getConfig();return delete t.rank,t}static verifyArgs(t){if(typeof t.kernelSize!="number"&&!(Array.isArray(t.kernelSize)&&(t.kernelSize.length===1||t.kernelSize.length===3)))throw new ce(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(t.kernelSize)}.`)}};T2.className="Conv3D";De.registerClass(T2);var XA=class extends I2{constructor(e){if(super(e),this.inputSpec=[new nr({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new ce(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=En(e),e.length!==4)throw new ce("Input should have rank 4; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new ce("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new nr({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return ue(()=>{let n=zt(e);if(n.shape.length!==4)throw new ce(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i;this.dataFormat==="channelsFirst"?(s=2,i=3):(s=1,i=2);let o=a[s],l=a[i],d=this.kernelSize[0],c=this.kernelSize[1],f=this.strides[0],m=this.strides[1],x=Ko(o,f,d,this.padding),y=Ko(l,m,c,this.padding),b=[r,x,y,this.filters];this.dataFormat!=="channelsLast"&&(n=Qt(n,[0,2,3,1]));let w=Fw(n,this.kernel.read(),b,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(w=Qt(w,[0,3,1,2])),this.bias!=null&&(w=Mo(w,this.bias.read(),this.dataFormat)),this.activation!=null&&(w=this.activation.apply(w)),w})}computeOutputShape(e){e=En(e);let t=e.slice(),n,a,r;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3):(n=3,a=1,r=2);let s=this.kernelSize[0],i=this.kernelSize[1],o=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[a]=Ko(t[a],o,s,this.padding),t[r]=Ko(t[r],l,i,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};XA.className="Conv2DTranspose";De.registerClass(XA);var YA=class extends T2{constructor(e){if(super(e),this.inputSpec=[new nr({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new ce(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=En(e),e.length!==5)throw new ce("Input should have rank 5; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new ce("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new nr({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return ue(()=>{let n=zt(e);if(n.shape.length!==5)throw new ce(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i,o;this.dataFormat==="channelsFirst"?(o=2,s=3,i=4):(o=1,s=2,i=3);let l=a[o],d=a[s],c=a[i],f=this.kernelSize[0],m=this.kernelSize[1],x=this.kernelSize[2],y=this.strides[0],b=this.strides[1],w=this.strides[2],S=Ko(l,y,f,this.padding),k=Ko(d,b,m,this.padding),C=Ko(c,w,x,this.padding),E=[r,S,k,C,this.filters];this.dataFormat!=="channelsLast"&&(n=Qt(n,[0,2,3,4,1]));let T=kT(n,this.kernel.read(),E,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(T=Qt(T,[0,4,1,2,3])),this.bias!==null&&(T=Mo(T,this.bias.read(),this.dataFormat)),this.activation!==null&&(T=this.activation.apply(T)),T})}computeOutputShape(e){e=En(e);let t=e.slice(),n,a,r,s;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3,s=4):(n=4,a=1,r=2,s=3);let i=this.kernelSize[0],o=this.kernelSize[1],l=this.kernelSize[2],d=this.strides[0],c=this.strides[1],f=this.strides[2];return t[n]=this.filters,t[a]=Ko(t[a],d,i,this.padding),t[r]=Ko(t[r],c,o,this.padding),t[s]=Ko(t[s],f,l,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};YA.className="Conv3DTranspose";De.registerClass(YA);var xz=class extends E2{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new ce("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new ce("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new ce(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=ga(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=xa(t.depthwiseRegularizer),this.depthwiseConstraint=Sr(t.depthwiseConstraint),this.pointwiseInitializer=ga(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=xa(t.pointwiseRegularizer),this.pointwiseConstraint=Sr(t.pointwiseConstraint)}build(e){if(e=En(e),e.length<this.rank+2)throw new ce(`Inputs to SeparableConv${this.rank}D should have rank ${this.rank+2}, but received input shape: ${JSON.stringify(e)}`);let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null||e[t]<0)throw new ce(`The channel dimension of the inputs should be defined, but found ${JSON.stringify(e[t])}`);let n=e[t],a=this.kernelSize.concat([n,this.depthMultiplier]),r=[];for(let i=0;i<this.rank;++i)r.push(1);r.push(n*this.depthMultiplier,this.filters);let s=!0;this.depthwiseKernel=this.addWeight("depthwise_kernel",a,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,s,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",r,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,s,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,s,this.biasConstraint):this.bias=null,this.inputSpec=[new nr({ndim:this.rank+2,axes:{[t]:n}})],this.built=!0}call(e,t){return ue(()=>{e=zt(e);let n;if(this.rank===1)throw new an("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=Qt(e,[0,2,3,1])),n=bg(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(n=Mo(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),this.dataFormat==="channelsFirst"&&(n=Qt(n,[0,3,1,2])),n})}getConfig(){let e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Sa(this.depthwiseInitializer),e.pointwiseInitializer=Sa(this.pointwiseInitializer),e.depthwiseRegularizer=ra(this.depthwiseRegularizer),e.pointwiseRegularizer=ra(this.pointwiseRegularizer),e.depthwiseConstraint=wr(this.depthwiseConstraint),e.pointwiseConstraint=wr(this.pointwiseConstraint),e}};xz.className="SeparableConv";var JA=class extends xz{constructor(e){super(2,e)}};JA.className="SeparableConv2D";De.registerClass(JA);var QA=class yz extends E2{constructor(t){super(1,t),yz.verifyArgs(t),this.inputSpec=[{ndim:3}]}getConfig(){let t=super.getConfig();return delete t.rank,delete t.dataFormat,t}static verifyArgs(t){if(typeof t.kernelSize!="number"&&!bA(t.kernelSize,"number",1,1))throw new ce(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(t.kernelSize)}.`)}};QA.className="Conv1D";De.registerClass(QA);var ZA=class extends rn{constructor(e){super(e),typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return ue(()=>{if(e=zt(e),this.dataFormat==="channelsLast"){let n=R1(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return R1(n,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{let n=R1(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return R1(n,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){let e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};ZA.className="Cropping2D";De.registerClass(ZA);var e_=class extends rn{constructor(e){super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Va(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,Zfe(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){let t=e[2]==null?null:this.size[0]*e[2],n=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,n]}else{let t=e[1]==null?null:this.size[0]*e[1],n=e[2]==null?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return ue(()=>{let n=zt(e),a=n.shape;if(this.dataFormat==="channelsFirst"){n=Qt(n,[0,2,3,1]);let r=this.size[0]*a[2],s=this.size[1]*a[3],i=this.interpolation==="nearest"?Ii.resizeNearestNeighbor(n,[r,s]):Ii.resizeBilinear(n,[r,s]);return Qt(i,[0,3,1,2])}else{let r=this.size[0]*a[1],s=this.size[1]*a[2];return this.interpolation==="nearest"?Ii.resizeNearestNeighbor(n,[r,s]):Ii.resizeBilinear(n,[r,s])}})}getConfig(){let e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}};e_.className="UpSampling2D";De.registerClass(e_);function Gge(e,t,n=[1,1],a="valid",r,s){return ue(()=>{r==null&&(r=Ao()),Va(r);let i=KA(e,r);if(e.rank!==4)throw new ce(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(t.rank!==4)throw new ce(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=dp(i,t,n,a==="same"?"same":"valid","NHWC",s),r==="channelsFirst"&&(i=Qt(i,[0,3,1,2])),i})}var t_=class extends hz{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=ga(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=Sr(e.depthwiseConstraint),this.depthwiseRegularizer=xa(e.depthwiseRegularizer)}build(e){if(e=En(e),e.length<4)throw new ce(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);let t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new ce(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);let n=e[t],a=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",a,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return ue(()=>{e=zt(e);let n=Gge(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(n=Mo(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),n})}computeOutputShape(e){e=En(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=Io(t,this.kernelSize[0],this.padding,this.strides[0]),s=Io(n,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],a,r,s]:[e[0],r,s,a]}getConfig(){let e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Sa(this.depthwiseInitializer),e.depthwiseRegularizer=ra(this.depthwiseRegularizer),e.depthwiseConstraint=wr(this.depthwiseRegularizer),e}};t_.className="DepthwiseConv2D";De.registerClass(t_);function bz(e,t,n,a){if(Array.isArray(e)){if(t!=null||n!=null)throw new ce("When input
92s is an array, neither initialState or constants should be provided");a!=null&&(n=e.slice(e.length-a,e.length),e=e.slice(0,e.length-a)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(s){return s==null||Array.isArray(s)?s:[s]}return t=r(t),n=r(n),{inputs:e,initialState:t,constants:n}}function vz(e,t,n,a=!1,r,s,i=!1,o=!1){return ue(()=>{let l=t.shape.length;if(l<3)throw new ce(`Input should be at least 3D, but is ${l}D.`);let d=[1,0].concat(To(2,l));t=Qt(t,d),s!=null,i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r!=null&&(r=He(He(r,"bool"),"float32"),r.rank===l-1&&(r=Dr(r,-1)),r=Qt(r,d)),a&&(t=Mi(t,0),r!=null&&(r=Mi(r,0)));let c=[],f,m=n,x=t.shape[0],y=$a(t),b;r!=null&&(b=$a(r));for(let S=0;S<x;++S){let k=y[S],C=ue(()=>e(k,m));if(r==null)f=C[0],m=C[1];else{let E=ue(()=>{let T=b[S],_=st(oi(T),T),A=ke(ie(C[0],T),ie(m[0],_)),$=m.map((O,z)=>ke(ie(C[1][z],T),ie(O,_)));return{output:A,newStates:$}});f=E.output,m=E.newStates}o&&c.push(f)}let w;return o&&(w=rr(c,1)),[f,w,m]})}var Ql=class wz extends rn{constructor(t){super(t);let n;if(t.cell==null)throw new ce("cell property is missing for the constructor of RNN.");if(Array.isArray(t.cell)?n=new j2({cells:t.cell}):n=t.cell,n.stateSize==null)throw new ce("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=n,this.returnSequences=t.returnSequences==null?!1:t.returnSequences,this.returnState=t.returnState==null?!1:t.returnState,this.goBackwards=t.goBackwards==null?!1:t.goBackwards,this._stateful=t.stateful==null?!1:t.stateful,this.unroll=t.unroll==null?!1:t.unroll,this.supportsMasking=!0,this.inputSpec=[new nr({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){let t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return To(0,t).map(n=>null)}else return this.states_}setStates(t){this.states_=t}computeOutputShape(t){sE(t)&&(t=t[0]),t=t;let n=this.cell.stateSize;Array.isArray(n)||(n=[n]);let a=n[0],r;if(this.returnSequences?r=[t[0],t[1],a]:r=[t[0],a],this.returnState){let s=[];for(let i of n)s.push([t[0],i]);return[r].concat(s)}else return r}computeMask(t,n){return ue(()=>{Array.isArray(n)&&(n=n[0]);let a=this.returnSequences?n:null;if(this.returnState){let r=this.states.map(s=>null);return[a].concat(r)}else return a})}get states(){if(this.states_==null){let t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,n=[];for(let a=0;a<t;++a)n.push(null);return n}else return this.states_}set states(t){this.states_=t}build(t){if(this.numConstants!=null)throw new an("Constants support is not implemented in RNN yet.");sE(t)&&(t=t[0]),t=t;let n=this.stateful?t[0]:null,a=t.slice(2);this.inputSpec[0]=new nr({shape:[n,null,...a]});let r=[t[0]].concat(t.slice(2));this.cell.build(r);let s;if(Array.isArray(this.cell.stateSize)?s=this.cell.stateSize:s=[this.cell.stateSize],this.stateSpec!=null){if(!R.arraysEqual(this.stateSpec.map(i=>i.shape[i.shape.length-1]),s))throw new ce(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=s.map(i=>new nr({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(t,n=!1){ue(()=>{if(!this.stateful)throw new Ru("Cannot call resetStates() on an RNN Layer that is not stateful.");let a=this.inputSpec[0].shape[0];if(a==null)throw new ce("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(r=>va([a,r])):this.states_=[va([a,this.cell.stateSize])];else if(t==null)Kt(this.states_),this.keptStates!=null&&(Kt(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(r=>va([a,r])):this.states_[0]=va([a,this.cell.stateSize]);else{if(Array.isArray(t)||(t=[t]),t.length!==this.states_.length)throw new ce(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${t.length} state value(s). Input received: ${t}`);n===!0?this.keptStates.push(this.states_.slice()):Kt(this.states_);for(let r=0;r<this.states_.length;++r){let s=t[r],i=Array.isArray(this.cell.stateSize)?this.cell.stateSize[r]:this.cell.stateSize,o=[a,i];if(!R.arraysEqual(s.shape,o))throw new ce(`State ${r} is incompatible with layer ${this.name}: expected shape=${o}, received shape=${s.shape}`);this.states_[r]=s}}this.states_=this.states_.map(r=>xr(r.clone()))})}apply(t,n){let a=n==null?null:n.initialState,r=n==null?null:n.constants;n==null&&(n={});let s=bz(t,a,r,this.numConstants);t=s.inputs,a=s.initialState,r=s.constants;let i=[],o=[];
vendor: 74,168 bytes, lines 92-97
92if(a!=null){n.initialState=a,i=i.concat(a),this.stateSpec=[];for(let l of a)this.stateSpec.push(new nr({shape:l.shape}));o=o.concat(this.stateSpec)}if(r!=null&&(n.constants=r,i=i.concat(r),this.numConstants=r.length),i[0]instanceof _o){let l=[t].concat(i),d=this.inputSpec.concat(o),c=this.inputSpec;this.inputSpec=d;let f=super.apply(l,n);return this.inputSpec=c,f}else return super.apply(t,n)}call(t,n){return ue(()=>{let a=n==null?null:n.mask,r=n==null?null:n.training,s=n==null?null:n.initialState;t=zt(t),s==null&&(this.stateful?s=this.states_:s=this.getInitialState(t));let i=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(s.length!==i)throw new ce(`RNN Layer has ${i} state(s) but was passed ${s.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");let o={training:r},l=vz((x,y)=>{let b=this.cell.call([x].concat(y),o);return[b[0],b.slice(1)]},t,s,this.goBackwards,a,null,this.unroll,this.returnSequences),d=l[0],c=l[1],f=l[2];this.stateful&&this.resetStates(f,r);let m=this.returnSequences?c:d;return this.returnState?[m].concat(f):m})}getInitialState(t){return ue(()=>{let n=va(t.shape);return n=yt(n,[1,2]),n=Hb(n),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(a=>a>1?aE(n,[1,a]):n):this.cell.stateSize>1?[aE(n,[1,this.cell.stateSize])]:[n]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(t){super.setFastWeightInitDuringBuild(t),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(t)}getConfig(){let t=super.getConfig(),n={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(n.numConstants=this.numConstants);let a=this.cell.getConfig();return this.getClassName()===wz.className&&(n.cell={className:this.cell.getClassName(),config:a}),Object.assign(Object.assign(Object.assign({},a),t),n)}static fromConfig(t,n,a={}){let r=n.cell,s=Eo(r,a);return new t(Object.assign(n,{cell:s}))}};Ql.className="RNN";De.registerClass(Ql);var Yb=class extends rn{},A2=class extends Yb{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Rr(this.units,"units"),this.activation=rc(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=ga(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=ga(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=ga(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=xa(e.kernelRegularizer),this.recurrentRegularizer=xa(e.recurrentRegularizer),this.biasRegularizer=xa(e.biasRegularizer),this.kernelConstraint=Sr(e.kernelConstraint),this.recurrentConstraint=Sr(e.recurrentConstraint),this.biasConstraint=Sr(e.biasConstraint),this.dropout=Jf([1,nc([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Jf([1,nc([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=En(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return ue(()=>{if(e=e,e.length!==2)throw new ce(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];let a=t.training==null?!1:t.training;0<this.dropout&&this.dropout<1&&this.dropoutMask==null&&(this.dropoutMask=sc({ones:()=>oi(e),rate:this.dropout,training:a,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&this.recurrentDropoutMask==null&&(this.recurrentDropoutMask=sc({ones:()=>oi(n),rate:this.recurrentDropout,training:a,dropoutFunc:this.dropoutFunc}));let r,s=this.dropoutMask,i=this.recurrentDropoutMask;s!=null?r=al(ie(e,s),this.kernel.read()):r=al(e,this.kernel.read()),this.bias!=null&&(r=Mo(r,this.bias.read())),i!=null&&(n=ie(n,i));let o=ke(r,al(n,this.recurrentKernel.read()));return this.activation!=null&&(o=this.activation.apply(o)),[o,o]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:ac(this.activation),useBias:this.useBias,kernelInitializer:Sa(this.kernelInitializer),recurrentInitializer:Sa(this.recurrentInitializer),biasInitializer:Sa(this.biasInitializer),kernelRegularizer:ra(this.kernelRegularizer),recurrentRegularizer:ra(this.recurrentRegularizer),biasRegularizer:ra(this.biasRegularizer),activityRegularizer:ra(this.activityRegularizer),kernelConstraint:wr(this.kernelConstraint),recurrentConstraint:wr(this.recurrentConstraint),biasConstraint:wr(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}};A2.className="SimpleRNNCell";De.registerClass(A2);var n_=class extends Ql{constructor(e){e.cell=new A2(e),super(e)}call(e,t){return ue(()=>{this.cell.dropoutMask!=null&&(Kt(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Kt(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return new e(t)}};n_.className="SimpleRNN";De.registerClass(n_);var _2=class extends Yb{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new ce("GRUCell does not support reset_after parameter set to true.");this.units=e.units,Rr(this.units,"units"),this.activation=rc(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=rc(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=ga(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=ga(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=ga(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=xa(e.kernelRegularizer),this.recurrentRegularizer=xa(e.recurrentRegularizer),this.biasRegularizer=xa(e.biasRegularizer),this.kernelConstraint=Sr(e.kernelConstraint),this.recurrentConstraint=Sr(e.recurrentConstraint),this.biasConstraint=Sr(e.biasConstraint),this.dropout=Jf([1,nc([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Jf([1,nc([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=En(e);let t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return ue(()=>{if(e=e,e.length!==2)throw new ce(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training==null?!1:t.training,a=e[1];e=e[0],0<this.dropout&&this.dropout<1&&this.dropoutMask==null&&(this.dropoutMask=sc({ones:()=>oi(e),rate:this.dropout,training:n,count:3,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&this.recurrentDropoutMask==null&&(this.recurrentDropoutMask=sc({ones:()=>oi(a),rate:this.recurrentDropout,training:n,count:3,dropoutFunc:this.dropoutFunc}));let r=this.dropoutMask,s=this.recurrentDropoutMask,i,o,l;0<this.dropout&&this.dropout<1&&(e=ie(e,r[0]));let d=al(e,this.kernel.read());this.useBias&&(d=Mo(d,this.bias.read())),0<this.recurrentDropout&&this.recurrentDropout<1&&(a=ie(a,s[0]));let c=this.recurrentKernel.read(),[f,m]=Bs(c,[2*this.units,this.units],c.rank-1),x=al(a,f),[y,b,w]=Bs(d,3,d.rank-1),[S,k]=Bs(x,2,x.rank-1);i=this.recurrentActivation.apply(ke(y,S)),o=this.recurrentActivation.apply(ke(b,k));let C=al(ie(o,a),m);l=this.activation.apply(ke(w,C));let E=ke(ie(i,a),ie(ke(1,ua(i)),l));return[E,E]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:ac(this.activation),recurrentActivation:ac(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Sa(this.kernelInitializer),recurrentInitializer:Sa(this.recurrentInitializer),biasInitializer:Sa(this.biasInitializer),kernelRegularizer:ra(this.kernelRegularizer),recurrentRegularizer:ra(this.recurrentRegularizer),biasRegularizer:ra(this.biasRegularizer),activityRegularizer:ra(this.activityRegularizer),kernelConstraint:wr(this.kernelConstraint),recurrentConstraint:wr(this.recurrentConstraint),biasConstraint:wr(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign(Object.assign({},e),t)}};_2.className="GRUCell";De.registerClass(_2);var a_=class extends Ql{constructor(e){e.implementation===0&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new _2(e),super(e)}call(e,t){return ue(()=>{this.cell.dropoutMask!=null&&(Kt(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Kt(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};a_.className="GRU";De.registerClass(a_);var Jb=class extends Yb{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Rr(this.units,"units"),this.activation=rc(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=rc(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=ga(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=ga(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=ga(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=xa(e.kernelRegularizer),this.recurrentRegularizer=xa(e.recurrentRegularizer),this.biasRegularizer=xa(e.biasRegularizer),this.kernelConstraint=Sr(e.kernelConstraint),this.recurrentConstraint=Sr(e.recurrentConstraint),this.biasConstraint=Sr(e.biasConstraint),this.dropout=Jf([1,nc([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Jf([1,nc([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=En(e);let n=e[e.length-1];this.kernel=this.addWeight("kernel",[n,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let a;if(this.useBias){if(this.unitForgetBias){let r=this.biasInitializer,s=this.units;a=new(t=class extends ao{apply(i,o){let l=r.apply([s]),d=new m2().apply([s]),c=r.apply([s*2]);return s$(s$(l,d),c)}},t.className="CustomInit",t)}else a=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,a,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return ue(()=>{let n=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new ce(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let a=e[1],r=e[2];e=e[0],0<this.dropout&&this.dropout<1&&this.dropoutMask==null&&(this.dropoutMask=sc({ones:()=>oi(e),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&this.recurrentDropoutMask==null&&(this.recurrentDropoutMask=sc({ones:()=>oi(a),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));let s=this.dropoutMask,i=this.recurrentDropoutMask,o,l,d,c;0<this.dropout&&this.dropout<1&&(e=ie(e,s[0]));let f=al(e,this.kernel.read());0<this.recurrentDropout&&this.recurrentDropout<1&&(a=ie(a,i[0])),f=ke(f,al(a,this.recurrentKernel.read())),this.useBias&&(f=Mo(f,this.bias.read()));let[m,x,y,b]=Bs(f,4,f.rank-1);o=this.recurrentActivation.apply(m),l=this.recurrentActivation.apply(x),d=ke(ie(l,r),ie(o,this.activation.apply(y))),c=this.recurrentActivation.apply(b);let w=ie(c,this.activation.apply(d));return[w,w,d]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:ac(this.activation),recurrentActivation:ac(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Sa(this.kernelInitializer),recurrentInitializer:Sa(this.recurrentInitializer),biasInitializer:Sa(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:ra(this.kernelRegularizer),recurrentRegularizer:ra(this.recurrentRegularizer),biasRegularizer:ra(this.biasRegularizer),activityRegularizer:ra(this.activityRegularizer),kernelConstraint:wr(this.kernelConstraint),recurrentConstraint:wr(this.recurrentConstraint),biasConstraint:wr(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign(Object.assign({},e),t)}};Jb.className="LSTMCell";De.registerClass(Jb);var r_=class extends Ql{constructor(e){e.implementation===0&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new Jb(e),super(e)}call(e,t){return ue(()=>{this.cell.dropoutMask!=null&&(Kt(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Kt(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};r_.className="LSTM";De.registerClass(r_);var j2=class extends Yb{constructor(e){super(e),this.cells=e.cells}get stateSize(){let e=[];for(let t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return ue(()=>{e=e;let n=e.slice(1),a=[];for(let i of this.cells.slice().reverse())Array.isArray(i.stateSize)?a.push(n.splice(0,i.stateSize.length)):a.push(n.splice(0,1));a.reverse();let r=[],s;for(let i=0;i<this.cells.length;++i){let o=this.cells[i];n=a[i],i===0?s=[e[0]].concat(n):s=[s[0]].concat(n),s=o.call(s,t),r.push(s.slice(1))}n=[];for(let i of r.slice().reverse())n.push(...i);return[s[0]].concat(n)})}build(e){sE(e)&&(e=e[0]),e=e;let t;this.cells.forEach((n,a)=>{wd(`RNNCell_${a}`,()=>{n.build(e),Array.isArray(n.stateSize)?t=n.stateSize[0]:t=n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){let e=super.getConfig(),t=a=>({className:a.getClassName(),config:a.getConfig()}),n={cells:this.cells.map(t)};return Object.assign(Object.assign({},e),n)}static fromConfig(e,t,n={}){let a=[];for(let r of t.cells)a.push(Eo(r,n));return new e({cells:a})}get trainableWeights(){if(!this.trainable)return[];let e=[];for(let t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.cells)t.push(...n.trainableWeights);return t.concat(e)}return e}getWeights(){let e=[];for(let t of this.cells)e.push(...t.weights);return iE(e)}setWeights(e){let t=[];for(let n of this.cells){let a=n.weights.length,r=e.splice(a);for(let s=0;s<n.weights.length;++s)t.push([n.weights[s],r[s]])}TA(t)}};j2.className="StackedRNNCells";De.registerClass(j2);function sc(e){let{ones:t,rate:n,training:a=!1,count:r=1,dropoutFunc:s}=e,i=()=>s!=null?s(t(),n):k6(t(),n),o=()=>qb(i,t,a);return!r||r<=1?xr(o().clone()):Array(r).fill(void 0).map(o).map(l=>xr(l.clone()))}var qge=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n},Sz=class extends Ql{constructor(e){if(e.unroll)throw new an("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new an("It is not possible at the moment to stack convolutional cells.");super(e),this.inputSpec=[new nr({ndim:5})]}call(e,t){return ue(()=>{if(this.cell.dropoutMask!=null&&(Kt(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Kt(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new ce("ConvRNN2D cell does not support constants");let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return ue(()=>{let{stateSize:t}=this.cell,n=e.shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)],s=va(r);return Array.isArray(t)?Array(t.length).fill(s):[s]})}resetStates(e,t=!1){ue(()=>{if(!this.stateful)throw new Ru("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)];if(n[0]==null)throw new ce("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>va(r)):this.states_=[va(r)];else if(e==null)Kt(this.states_),this.keptStates!=null&&(Kt(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>va(r)):this.states_[0]=va(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new ce(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):Kt(this.states_);for(let s=0;s<this.states_.length;++s){let i=e[s],o=r;if(!R.arraysEqual(i.shape,o))throw new ce(`State ${s} is incompatible with layer ${this.name}: expected shape=${o}, received shape=${i.shape}`);this.states_[s]=i}}this.states_=this.states_.map(s=>xr(s.clone()))})}computeSingleOutputShape(e){let{dataFormat:t,filters:n,kernelSize:a,padding:r,strides:s,dilationRate:i}=this.cell,o=t==="channelsFirst",l=e[o?3:2],d=e[o?4:3],c=Io(l,a[0],r,s[0],i[0]),f=Io(d,a[1],r,s[1],i[1]);return[...e.slice(0,2),...o?[n,c,f]:[c,f,n]]}};Sz.className="ConvRNN2D";var D2=class extends Jb{constructor(e){let{filters:t,kernelSize:n,strides:a,padding:r,dataFormat:s,dilationRate:i}=e;super(Object.assign(Object.assign({},e),{units:t})),this.filters=t,Rr(this.filters,"filters"),this.kernelSize=Bf(n,2,"kernelSize"),this.kernelSize.forEach(o=>Rr(o,"kernelSize")),this.strides=Bf(a||1,2,"strides"),this.strides.forEach(o=>Rr(o,"strides")),this.padding=r||"valid",$i(this.padding),this.dataFormat=s||"channelsLast",Va(this.dataFormat),this.dilationRate=Bf(i||1,2,"dilationRate"),this.dilationRate.forEach(o=>Rr(o,"dilationRate"))}build(e){var t;e=En(e);let n=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[n]==null)throw new ce(`The channel dimension of the input should be defined. Found ${e[n]}`);let a=e[n],r=4,s=this.kernelSize.concat([a,this.filters*r]);this.kernel=this.addWeight("kernel",s,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);let i=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let o;if(this.unitForgetBias){let l=this.biasInitializer,d=this.filters;o=new(t=class extends ao{apply(c,f){let m=l.apply([d]),x=$s([d]),y=l.apply([d*2]);return vA([m,x,y])}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,o,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return ue(()=>{if(e.length!==3)throw new ce(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training||!1,a=e[0],r=e[1],s=e[2],i=4;0<this.dropout&&this.dropout<1&&this.dropoutMask==null&&(this.dropoutMask=sc({ones:()=>oi(a),rate:this.dropout,training:n,count:i,dropoutFunc:this.dropoutFunc}));let o=this.dropoutMask,l=(H,B,Y)=>!B||!B[Y]?H:ie(B[Y],H),d=l(a,o,0),c=l(a,o,1),f=l(a,o,2),m=l(a,o,3);0<this.recurrentDropout&&this.recurrentDropout<1&&this.recurrentDropoutMask==null&&(this.recurrentDropoutMask=sc({ones:()=>oi(r),rate:this.recurrentDropout,training:n,count:i,dropoutFunc:this.dropoutFunc}));let x=this.recurrentDropoutMask,y=l(r,x,0),b=l(r,x,1),w=l(r,x,2),S=l(r,x,3),k=3,[C,E,T,_]=Bs(this.kernel.read(),i,k),[A,$,O,z]=this.useBias?Bs(this.bias.read(),i):[null,null,null,null];d=this.inputConv(d,C,A,this.padding),c=this.inputConv(c,E,$,this.padding),f=this.inputConv(f,T,O,this.padding),m=this.inputConv(m,_,z,this.padding);let[P,j,G,X]=Bs(this.recurrentKernel.read(),i,k);y=this.recurrentConv(y,P),b=this.recurrentConv(b,j),w=this.recurrentConv(w,G),S=this.recurrentConv(S,X);let J=this.recurrentActivation.apply(ke(d,y)),V=this.recurrentActivation.apply(ke(c,b)),Q=ke(ie(V,s),ie(J,this.activation.apply(ke(f,w)))),F=ie(this.recurrentActivation.apply(ke(m,S)),this.activation.apply(Q));return[F,F,Q]})}getConfig(){let e=super.getConfig(),{units:t}=e,n=qge(e,["units"]),a={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},n),a)}inputConv(e,t,n,a){let r=ws(e,t,this.strides,a||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return n?Mo(r,n,this.dataFormat):r}recurrentConv(e,t){return ws(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}};D2.className="ConvLSTM2DCell";De.registerClass(D2);var s_=class extends Sz{constructor(e){let t=new D2(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}};s_.className="ConvLSTM2D";De.registerClass(s_);var R2=class extends rn{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;let t=e.shape,n=[];for(let a=0;a<this.noiseShape.length;++a)n.push(this.noiseShape[a]==null?t[a]:this.noiseShape[a]);return n}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);if(0<this.rate&&this.rate<1){let a=t.training==null?!1:t.training,r=this.getNoiseShape(n);return qb(()=>k6(n,this.rate,r,this.seed),()=>n,a)}return e})}getConfig(){let e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}};R2.className="Dropout";De.registerClass(R2);var i_=class extends R2{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){let t=e.shape;return[t[0],1,t[2]]}};i_.className="SpatialDropout1D";De.registerClass(i_);var o_=class extends rn{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,Rr(this.units,"units"),this.activation=rc(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=ga(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=ga(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=Sr(e.kernelConstraint),this.biasConstraint=Sr(e.biasConstraint),this.kernelRegularizer=xa(e.kernelRegularizer),this.biasRegularizer=xa(e.biasRegularizer),this.activityRegularizer=xa(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=En(e);let t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=En(e);let t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e),a=g6(this.activation.getClassName()),r;return a!=null?r=al(n,this.kernel.read(),a,this.bias?this.bias.read():null):(r=al(n,this.kernel.read()),this.bias!=null&&(r=Mo(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){let e={units:this.units,activation:ac(this.activation),useBias:this.useBias,kernelInitializer:Sa(this.kernelInitializer),biasInitializer:Sa(this.biasInitializer),kernelRegularizer:ra(this.kernelRegularizer),biasRegularizer:ra(this.biasRegularizer),activityRegularizer:ra(this.activityRegularizer),kernelConstraint:wr(this.kernelConstraint),biasConstraint:wr(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}};o_.className="Dense";De.registerClass(o_);var l_=class extends rn{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=En(e);for(let t of e.slice(1))if(t==null)throw new ce(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Hu(e,1)]}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);if(this.dataFormat==="channelsFirst"&&n.rank>1){let a=[0];for(let r=2;r<n.rank;++r)a.push(r);a.push(1),n=Qt(n,a)}return sme(n)})}getConfig(){let e={};this.dataFormat!=null&&(e.dataFormat=this.dataFormat);let t=super.getConfig();return Object.assign(e,t),e}};l_.className="Flatten";De.registerClass(l_);var u_=class extends rn{constructor(e){super(e),this.supportsMasking=!0,this.activation=rc(e.activation)}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);return this.activation.apply(n)})}getConfig(){let e={activation:ac(this.activation)},t=super.getConfig();return Object.assign(e,t),e}};u_.className="Activation";De.registerClass(u_);var c_=class extends rn{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return ue(()=>(e=zt(e),ame(e,this.n)))}getConfig(){let e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}};c_.className="RepeatVector";De.registerClass(c_);var d_=class extends rn{constructor(e){super(e),this.targetShape=e.targetShape;for(let t=0;t<this.targetShape.length;++t)this.isUnknown(this.targetShape[t])&&(this.targetShape[t]=null)}isUnknown(e){return e<0||e==null}fixUnknownDimension(e,t){let n="Total size of new array must be unchanged.",a=t.slice(),r=1,s=null;for(let o=0;o<a.length;++o){let l=a[o];if(this.isUnknown(l))if(s===null)s=o;else throw new ce("Can only specifiy one unknown dimension.");else r*=l}let i=Hu(e);if(s!==null){if(r===0||i%r!==0)throw new ce(n);a[s]=i/r}else if(i!==r)throw new ce(n);return a}computeOutputShape(e){let t=!1;for(let n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e),a=n.shape,r=a.slice(0,1).concat(this.fixUnknownDimension(a.slice(1),this.targetShape));return le(n,r)})}getConfig(){let e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}};d_.className="Reshape";De.registerClass(d_);var h_=class extends rn{constructor(e){if(super(e),e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);let t=To(1,e.dims.length+1);if(!R.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new nr({ndim:this.dims.length+1})]}computeOutputShape(e){e=En(e);let t=e.slice();return this.dims.forEach((n,a)=>{t[a+1]=e[n]}),t}call(e,t){return Qt(zt(e),this.dimsIncludingBatch)}getConfig(){let e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}};h_.className="Permute";De.registerClass(h_);var p_=class extends rn{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){let n=zt(e);return $y(Md(n,this.maskValue),-1)}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e),a=$y(Md(n,this.maskValue),-1,!0);return ie(n,He(a,n.dtype))})}};p_.className="Masking";De.registerClass(p_);var f_=class extends rn{constructor(e){if(super(e),this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",e.batchInputShape==null&&e.inputShape==null){let t=null;e.batchSize!=null&&(t=e.batchSize),e.inputLength==null?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(Wn(e.inputLength))}this.inputDim=e.inputDim,Rr(this.inputDim,"inputDim"),this.outputDim=e.outputDim,Rr(this.outputDim,"outputDim"),this.embeddingsInitializer=ga(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=xa(e.embeddingsRegularizer),this.activityRegularizer=xa(e.activityRegularizer),this.embeddingsConstraint=Sr(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return ue(()=>this.maskZero?(e=zt(e),Md(e,pn(e))):null)}computeOutputShape(e){if(e=En(e),this.inputLength==null)return[...e,this.outputDim];let t=Wn(this.inputLength);if(t.length!==e.length-1)throw new ce(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let a=0;a<t.length;++a){let r=t[a],s=e[a+1];if(r!=null&&s!=null&&r!==s)throw new ce(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);r==null&&(t[n]=s),n++}}return[e[0],...t,this.outputDim]}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);n.dtype!=="int32"&&(n=Wl(n,"int32"));let a=S6(this.embeddings.read(),le(n,[n.size]));return le(a,En(this.computeOutputShape(n.shape)))})}getConfig(){let e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Sa(this.embeddingsInitializer),embeddingsRegularizer:ra(this.embeddingsRegularizer),activityRegularizer:ra(this.activityRegularizer),embeddingsConstraint:wr(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}};f_.className="Embedding";De.registerClass(f_);var gp=class extends rn{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new an}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(t.length===0)return e;let n=e.slice(0,e.length-t.length);for(let a=0;a<t.length;++a){let r=e[e.length-t.length+a],s=t[a];if(r==null||s==null||r<0||s<0)n.push(null);else if(r===1)n.push(s);else if(s===1)n.push(r);else{if(r!==s)throw new ce("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(r)}}return n}build(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[En(e)]),e=e,e.length<2)throw new ce(`A merge layer should be called on an Array of at least 2 inputs. Got ${e.length} input(s).`);let t=[];for(let r of e)r!=null&&r[0]!==null&&t.push(r[0]);if(t=Vu(t),t.length>1)throw new ce(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=e[0]==null?null:e[0].slice(1);for(let r=1;r<e.length;++r){let s=e[r]==null?null:e[r].slice(1);n=this.computeElementwiseOpOutputShape(n,s)}let a=e.map(r=>r.length);e.indexOf(null)===-1&&Vu(a).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return ue(()=>{if(e=e,this.reshapeRequired){let n=[],a=e.map(r=>r.rank);if(a.indexOf(null)===-1){let r=nc(a);for(let s of e){let i=s.rank;for(let o=0;o<r-i;++o)s=Hb(s,1);n.push(s)}return this.mergeFunction(n)}else{let r=!1;for(let o of e){let l=o.rank;if(l==null){let d=o.shape,c=d[0],f=d.slice(1).concat([c]),m=le(o,[c].concat(Hu(d.slice(1))));m=Qt(m,[1,0]),m=le(m,f),n.push(m),r=!0}else if(l>1){let d=To(1,l).concat([0]);n.push(Qt(o,d)),r=!0}else n.push(o)}let s=this.mergeFunction(n),i=s.rank;if(r){if(i==null){let o=s.shape,l=o.length,d=o[l-1],c=[d].concat(o.slice(0,o.length-1));s=le(Qt(le(s,[-1,d]),[1,0]),c)}else if(i>1){let o=[i-1].concat(To(0,i-1));s=Qt(s,o)}}return s}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let a=1;a<e.length;++a){let r=e[a]==null?null:e[a].slice(1);t=this.computeElementwiseOpOutputShape(t,r)}let n=[];for(let a of e)a!=null&&a[0]!==null&&n.push(a[0]);return n=Vu(n),n.length===1?t=n.concat(t):t=[null].concat(t),t}computeMask(e,t){return ue(()=>{if(t==null)return null;if(!Array.isArray(t))throw new ce("`mask` should be an Array");if(!Array.isArray(e))throw new ce("`inputs` should be an Array");if(t.length!==e.length)throw new ce(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(a=>a==null))return null;t=t.map(a=>a==null?a:Dr(a,0));let n=t[0];for(let a=1;a<t.length-1;++a)n=to(n,t[a]);return n})}},m_=class extends gp{constructor(e){super(e)}mergeFunction(e){return ue(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=ke(t,e[n]);return t})}};m_.className="Add";De.registerClass(m_);var g_=class extends gp{constructor(e){super(e)}mergeFunction(e){return ue(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=ie(t,e[n]);return t})}};g_.className="Multiply";De.registerClass(g_);var x_=class extends gp{constructor(e){super(e)}mergeFunction(e){return ue(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=ke(t,e[n]);return ie(1/e.length,t)})}};x_.className="Average";De.registerClass(x_);var y_=class extends gp{constructor(e){super(e)}mergeFunction(e){return ue(()=>{let t=e[0];for(let n=1;n<e.length;++n)t=ul(t,e[n]);return t})}};y_.className="Maximum";De.registerClass(y_);var b_=class extends gp{constructor(e){super(e)}mergeFunction(e){return ue(()=>{let t=e[0];for(let n=1;n<e.length;++n)t=ec(t,e[n]);return t})}};b_.className="Minimum";De.registerClass(b_);var v_=class extends gp{constructor(e){super(e),this.DEFAULT_AXIS=-1,e==null&&(e={}),this.axis=e.axis==null?this.DEFAULT_AXIS:e.axis,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){if(!(Array.isArray(e)&&Array.isArray(e[0]))||e.length===1)throw new ce("A `Concatenate` layer should be called on a list of at least 2 inputs");e=e;let t=!0;for(let a of e)if(a!=null){t=!1;break}if(t)return;let n=[];for(let a=0;a<e.length;++a){let r=e[a].slice();r.splice(this.axis,1);let s=!1;for(let i of n)if(R.arraysEqual(i,r)){s=!0;break}s||n.push(r)}if(n.length>1)throw new ce("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return ue(()=>vA(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new ce("A `Concatenate` layer should be called on a list of inputs.");let t=e,n=t[0].slice(),a=this.axis<0?n.length+this.axis:this.axis;for(let r of t.slice(1)){if(n[a]==null||r[a]==null){n[a]=null;break}n[a]+=r[a]}return n}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new ce("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new ce("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new ce(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return ue(()=>{let n=!0;if(t.forEach(s=>{if(s!=null){n=!1;return}}),n)return null;let a=[];for(let s=0;s<e.length;++s)t[s]==null?a.push(He(oi(e[s]),"bool")):t[s].rank<e[s].rank?a.push(Dr(t[s],-1)):a.push(t[s]);let r=Qn(a,this.axis);return $w(r,-1,!1)})}getConfig(){let e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}};v_.className="Concatenate";De.registerClass(v_);function $x(e,t){for(;e<0;)e+=t;return e}function Kge(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new an("batchDot is not implemented for tensors of 4D or higher rank yet");if(R.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),R.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),typeof n=="number"&&(n=[n,n]),e.dtype==="complex64"||t.dtype==="complex64")throw new an("batchDot is not implemented for complex64-type Tensors yet.");let a=e.shape.length,r=t.shape.length;n==null&&(n=[a-1,r-2]);let s=n;return ue(()=>{let i;if(a>r){i=a-r;let l=[];for(let d=0;d<i;++d)l.push(1);t=le(t,t.shape.concat(l))}else if(r>a){i=r-a;let l=[];for(let d=0;d<i;++d)l.push(1);e=le(e,e.shape.concat(l))}else i=0;let o;if(e.shape.length===2&&t.shape.length===2)s[0]===s[1]?o=yt(ie(e,t),s[0]):o=yt(ie(Qt(e,[1,0]),t),s[1]);else{let l=s[0]!==e.shape.length-1,d=s[1]===t.shape.length-1;o=Jt(e,t,l,d)}if(i>0){let l;a>r?l=a+r-3:l=a-1;let d=[];for(let c=l;c<l+i;++c)d.push(c);o=vc(o,d)}return o.shape.length===1&&(o=Dr(o,1)),o})}var w_=class extends gp{constructor(e){super(e),this.axes=e.axes,this.normalize=e.normalize==null?!1:e.normalize,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){R.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0],n=e[1];if(t.length>3||n.length>3)throw new an("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);if(t[a[0]]!==n[a[1]])throw new ce(`Dimension incompatibility: ${t[a[0]]} !== ${n[a[1]]}`)}mergeFunction(e){if(e.length!==2)throw new ce(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],n=e[1],a;return Array.isArray(this.axes)?a=this.axes.map((r,s)=>$x(r,e[s].shape.length)):a=[$x(this.axes,t.shape.length),$x(this.axes,n.shape.length)],this.normalize&&(t=$v(t,a[0]),n=$v(n,a[1])),Kge(t,n,a)}interpretAxes(e,t){let n;return Array.isArray(this.axes)?n=this.axes:n=[$x(this.axes,e.length),$x(this.axes,t.length)],n}computeOutputShape(e){R.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new an("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);t.splice(a[0],1),n.splice(a[1],1),n.splice(0,1);let r=t.concat(n);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){let e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}};w_.className="Dot";De.registerClass(w_);var S_=class extends rn{constructor(e){super(e),this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);return qb(()=>ke(f2(n.shape,0,this.stddev),n),()=>n,t.training||!1)})}};S_.className="GaussianNoise";De.registerClass(S_);var k_=class extends rn{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return ue(()=>{this.invokeCallHook(e,t);let n=zt(e);return this.rate>0&&this.rate<1?qb(()=>{let a=Math.sqrt(this.rate/(1-this.rate));return ie(n,f2(n.shape,1,a))},()=>n,t.training||!1):n})}};k_.className="GaussianDropout";De.registerClass(k_);var N_=class extends rn{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||zt(e).shape}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return ue(()=>{if(this.rate<1&&this.rate>0){let n=this._getNoiseShape(e);return qb(()=>{let a=zt(e),r=-1.6732632423543772*1.0507009873554805,s=Xl(yc(n),this.rate);s=Wl(s,"float32");let i=((1-this.rate)*(1+this.rate*r**2))**-.5,o=-i*r*this.rate,l=ke(ie(a,s),ie(ke(s,-1),r));return ke(ie(l,i),o)},()=>zt(e),t.training||!1)}return e})}};N_.className="AlphaDropout";De.registerClass(N_);function zy(e,t,n,a,r,s=.001){let i;if(e.rank===2)i=hT(e,t,n,a,r,s);else if(e.rank===3)i=pT(e,t,n,a,r,s);else if(e.rank===4)i=fT(e,t,n,a,r,s);else throw new an(`batchNormalization is not implemented for array of rank ${e.rank} yet`);return i}function Xge(e,t,n,a,r=.001){return ue(()=>{let s=Fb(e,a),i=s.mean,o=s.variance;return[zy(e,i,o,n,t,r),i,o]})}function Yge(e,t,n,a,r=.001){return ue(()=>{let s=Fb(e,a),i=s.mean,o=s.variance,l=[];for(let x of To(0,e.rank))a.indexOf(x)!==-1?l.push(1):l.push(e.shape[x]);let d=le(i,l),c=le(o,l),f=t==null?null:le(t,l),m=n==null?null:le(n,l);return[zy(e,d,c,m,f,r),i,o]})}function Jge(e,t,n,a,r=.001){return R.arraysEqual(a.slice().sort(),To(0,e.rank-1))?Xge(e,t,n,a,r):Yge(e,t,n,a,r)}var C_=class extends rn{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=ga(e.betaInitializer||"zeros"),this.gammaInitializer=ga(e.gammaInitializer||"ones"),this.movingMeanInitializer=ga(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=ga(e.movingVarianceInitializer||"ones"),this.betaConstraint=Sr(e.betaConstraint),this.gammaConstraint=Sr(e.gammaConstraint),this.betaRegularizer=xa(e.betaRegularizer),this.gammaRegularizer=xa(e.gammaRegularizer)}build(e){e=En(e);let t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(n==null)throw new ce(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new nr({ndim:e.length,axes:{[t]:n}})];let a=[n];this.scale&&(this.gamma=this.addWeight("gamma",a,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",a,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",a,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",a,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return ue(()=>{let n=t.training==null?!1:t.training,a=zt(e),r=a.shape,s=r.length,i=To(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);let l=Bd(1,s);l[o]=r[o];let d=i.slice();d.sort();let c=!R.arraysEqual(d,To(0,s).slice(0,s-1)),f=()=>{if(c){let w=le(this.movingMean.read(),l),S=le(this.movingVariance.read(),l),k=this.center?le(this.beta.read(),l):null,C=this.scale?le(this.gamma.read(),l):null;return zy(a,w,S,k,C,this.epsilon)}else return zy(a,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!n)return f();let[m,x,y]=Jge(a,this.gamma.read(),this.beta.read(),i,this.epsilon),b=(w,S,k)=>{ue(()=>{let C=1-k,E=w.read(),T=ie(st(E,S),C);w.write(st(E,T))})};return b(this.movingMean,x,this.momentum),b(this.movingVariance,y,this.momentum),m})}getConfig(){let e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Sa(this.betaInitializer),gammaInitializer:Sa(this.gammaInitializer),movingMeanInitializer:Sa(this.movingMeanInitializer),movingVarianceInitializer:Sa(this.movingVarianceInitializer),betaRegularizer:ra(this.betaRegularizer),gammaRegularizer:ra(this.gammaRegularizer),betaConstraint:wr(this.betaConstraint),gammaConstraint:wr(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}};C_.className="BatchNormalization";De.registerClass(C_);var E_=class extends rn{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(let t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=ga(e.betaInitializer||"zeros"),this.gammaInitializer=ga(e.gammaInitializer||"ones"),this.betaRegularizer=xa(e.betaRegularizer),this.gammaRegularizer=xa(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=En(e);let t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r<this.axis.length;++r)this.axis[r]<0&&(this.axis[r]+=t);for(let r of this.axis)if(r<0||r>=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Vu(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);let n=this.axis.map(r=>e[r]),a=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,a):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,a):this.beta=null,this.built=!0}call(e,t){let n=zt(e),a=n.shape,r=a.length;return ue(()=>{let{mean:s,variance:i}=Fb(n,this.axis,!0),o=Bd(1,r);for(let x of this.axis)o[x]=a[x];let l=x=>x!=null&&x.shape.length!==r?le(x,o):x,d=this.scale?l(this.gamma.read()):null,c=this.center?l(this.beta.read()):null,f=[],m=[];for(let x=0;x<r;++x)this.axis.indexOf(x)!==-1?(f.push(a[x]),m.push(1)):(f.push(1),m.push(a[x]));return s=ai(s,f),i=ai(i,f),d!=null&&(d=ai(d,m)),c!=null&&(c=ai(c,m)),zy(n,s,i,c,d,this.epsilon)})}getConfig(){let e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Sa(this.betaInitializer),gammaInitializer:Sa(this.gammaInitializer),betaRegularizer:ra(this.betaRegularizer),gammaRegularizer:ra(this.gammaRegularizer)},t=super.getConfig();return Object.assign(e,t),e}};E_.className="LayerNormalization";De.registerClass(E_);function Qge(e,t,n){return ue(()=>{if(e.rank!==4)throw new ce(`temporalPadding expects input tensor to be 4-D, but received a ${e.rank}-D tensor.`);if(t==null&&(t=[[1,1],[1,1]]),t.length!==2||t[0].length!==2||t[1].length!==2)throw new ce("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(n==null&&(n=Ao()),n!=="channelsLast"&&n!=="channelsFirst")throw new ce(`Unknown data format: ${n}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let a;return n==="channelsFirst"?a=[[0,0],[0,0],t[0],t[1]]:a=[[0,0],t[0],t[1],[0,0]],Ro(e,a)})}var I_=class extends rn{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?Ao():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new ce(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new ce(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new ce(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new nr({ndim:4})]}computeOutputShape(e){e=En(e);let t,n;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?n=e[3]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],e[1],t,n]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?n=e[2]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],t,n,e[3]])}call(e,t){return ue(()=>Qge(zt(e),this.padding,this.dataFormat))}getConfig(){let e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};I_.className="ZeroPadding2D";De.registerClass(I_);function M2(e,t,n,a,r,s){return ue(()=>{Va(r),y6(s),$i(a),n==null&&(n=[1,1]),a==null&&(a="valid"),r==null&&(r=Ao()),s==null&&(s="max"),e=KA(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=Ar(e,t,n,o):i=Kl(e,t,n,o),r==="channelsFirst"&&(i=Qt(i,[0,3,1,2])),i})}function kz(e,t,n,a,r,s){return ue(()=>{Va(r),y6(s),$i(a),n==null&&(n=[1,1,1]),a==null&&(a="valid"),r==null&&(r=Ao()),s==null&&(s="max"),e=dz(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=OT(e,t,n,o):i=dT(e,t,n,o),r==="channelsFirst"&&(i=Qt(i,[0,4,1,2,3])),i})}var Nz=class extends rn{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new ce(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(Rr(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new ce(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);Rr(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,$i(this.padding),this.inputSpec=[new nr({ndim:3})]}computeOutputShape(e){e=En(e);let t=Io(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return ue(()=>{this.invokeCallHook(e,t),e=Hb(zt(e),2);let n=this.poolingFunction(zt(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return vc(n,[2])})}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}},T_=class extends Nz{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),M2(e,t,n,a,r,"max")}};T_.className="MaxPooling1D";De.registerClass(T_);var A_=class extends Nz{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),M2(e,t,n,a,r,"avg")}};A_.className="AveragePooling1D";De.registerClass(A_);var Cz=class extends rn{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new ce(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];Rr(this.poolSize,"poolSize"),Rr(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Va(this.dataFormat),$i(this.padding),this.inputSpec=[new nr({ndim:4})]}computeOutputShape(e){e=En(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=Io(t,this.poolSize[0],this.padding,this.strides[0]),n=Io(n,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return ue(()=>(this.invokeCallHook(e,t),this.poolingFunction(zt(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},__=class extends Cz{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),M2(e,t,n,a,r,"max")}};__.className="MaxPooling2D";De.registerClass(__);var j_=class extends Cz{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),M2(e,t,n,a,r,"avg")}};j_.className="AveragePooling2D";De.registerClass(j_);var Ez=class extends rn{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new ce(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];Rr(this.poolSize,"poolSize"),Rr(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Va(this.dataFormat),$i(this.padding),this.inputSpec=[new nr({ndim:5})]}computeOutputShape(e){e=En(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=Io(t,this.poolSize[0],this.padding,this.strides[0]),n=Io(n,this.poolSize[1],this.padding,this.strides[1]),a=Io(a,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n,a]:[e[0],t,n,a,e[4]]}call(e,t){return ue(()=>(this.invokeCallHook(e,t),this.poolingFunction(zt(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},D_=class extends Ez{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),kz(e,t,n,a,r,"max")}};D_.className="MaxPooling3D";De.registerClass(D_);var R_=class extends Ez{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Va(r),$i(a),kz(e,t,n,a,r,"avg")}};R_.className="AveragePooling3D";De.registerClass(R_);var Iz=class extends rn{constructor(e){super(e),this.inputSpec=[new nr({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new an}},M_=class extends Iz{constructor(e){super(e||{})}call(e,t){return ue(()=>{let n=zt(e);return ba(n,1)})}};M_.className="GlobalAveragePooling1D";De.registerClass(M_);var $_=class extends Iz{constructor(e){super(e||{})}call(e,t){return ue(()=>{let n=zt(e);return ji(n,1)})}};$_.className="GlobalMaxPooling1D";De.registerClass($_);var Tz=class extends rn{constructor(e){super(e),this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Va(this.dataFormat),this.inputSpec=[new nr({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new an}getConfig(){let e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},B_=class extends Tz{call(e,t){return ue(()=>{let n=zt(e);return this.dataFormat==="channelsLast"?ba(n,[1,2]):ba(n,[2,3])})}};B_.className="GlobalAveragePooling2D";De.registerClass(B_);var F_=class extends Tz{call(e,t){return ue(()=>{let n=zt(e);return this.dataFormat==="channelsLast"?ji(n,[1,2]):ji(n,[2,3])})}};F_.className="GlobalMaxPooling2D";De.registerClass(F_);var Az=class extends rn{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){let e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){let a=t.layer,r=Eo(a,n);delete t.layer;let s={layer:r};return Object.assign(s,t),new e(s)}},O_=class extends Az{constructor(e){super(e),this.supportsMasking=!0}build(e){if(e=En(e),e.length<3)throw new ce(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];let t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=En(e);let t=[e[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),a=e[1];return[n[0],a].concat(n.slice(1))}call(e,t){return ue(()=>(e=zt(e),vz((n,a)=>[zt(this.layer.call(n,t)),[]],e,[],!1,null,null,!1,!0)[1]))}};O_.className="TimeDistributed";De.registerClass(O_);function Zge(e){fp(Qfe,"BidirectionalMergeMode",e)}var exe="concat",L_=class extends Az{constructor(e){super(e);let t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=Eo(n),t.goBackwards=t.goBackwards!==!0;let a={};if(a.className=e.layer.getClassName(),a.config=t,this.backwardLayer=Eo(a),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?exe:e.mergeMode,Zge(this.mergeMode),e.weights)throw new an("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){let t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let n,a,r;return this.returnState&&(r=t.slice(1)),n=t[0],n=n,this.mergeMode==="concat"?(n[n.length-1]*=2,a=[n]):this.mergeMode==null?a=[n,n.slice()]:a=[n],this.returnState?this.mergeMode==null?a.concat(r).concat(r.slice()):[n].concat(r).concat(r.slice()):Ds(a)}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=bz(e,n,a,this.numConstants);if(e=r.inputs,n=r.initialState,a=r.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(n==null||n.length===0)&&a==null)return super.apply(e,t);let s=[],i=[];if(n!=null){let l=n.length;if(l%2>0)throw new ce("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);let d=n.map(c=>new nr({shape:c.shape}));this.forwardLayer.stateSpec=d.slice(0,l/2),this.backwardLayer.stateSpec=d.slice(l/2),i.push(...d)}if(a!=null)throw new an("Support for constants in Bidirectional layers is not implemented yet.");let o=s[0]instanceof _o;for(let l of s)if(l instanceof _o!==o)throw new ce("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(o){let l=[e].concat(s),d=this.inputSpec.concat(i),c=this.inputSpec;this.inputSpec=d;let f=super.apply(l,t);return this.inputSpec=c,f}else return super.apply(e,t)}call(e,t){return ue(()=>{let n=t.initialState,a,r;if(n==null)a=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{let o=n.slice(0,n.length/2),l=n.slice(n.length/2);a=this.forwardLayer.call(e,Object.assign(t,{initialState:o})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:l}))}let s;this.returnState&&(Array.isArray(a)&&(s=a.slice(1).concat(r.slice(1))),a=a[0],r=r[0]),this.returnSequences&&(r=Mi(r,1));let i;return this.mergeMode==="concat"?i=vA([a,r]):this.mergeMode==="sum"?i=ke(a,r):this.mergeMode==="ave"?i=ie(.5,ke(a,r)):this.mergeMode==="mul"?i=ie(a,r):this.mergeMode==null&&(i=[a,r]),this.returnState?this.mergeMode==null?i.concat(s):[i].concat(s):i})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){wd(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),wd(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let n;if(this.returnSequences?this.mergeMode==null?n=[t,t]:n=t:this.mergeMode==null?n=[null,null]:n=null,this.returnState){let a=this.forwardLayer.states.map(r=>null);return Array.isArray(n)?n.concat(a).concat(a):[n].concat(a).concat(a)}else return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){let e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){let n=Eo(t.layer);if(delete t.layer,t.numConstants!=null)throw new an("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");let a=t;return a.layer=n,new e(a)}};L_.className="Bidirectional";De.registerClass(L_);var P_=class extends rn{constructor(e){super(e),this.scale=e.scale,e.offset?this.offset=e.offset:this.offset=0}getConfig(){let e={scale:this.scale,offset:this.offset},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return ue(()=>(e=zt(e),e.dtype!=="float32"&&(e=Wl(e,"float32")),ke(ie(e,this.scale),this.offset)))}};P_.className="Rescaling";De.registerClass(P_);var{resizeBilinear:txe,cropAndResize:nxe}=Ii,z_=class extends rn{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,n,a,r,s,i,o){return ue(()=>{let l,d=!1,c=t/s,f=n/i,m=(a+t)/s,x=(r+n)/i,y=[c,f,m,x],b=[];e.rank===3?(d=!0,l=rr([e])):l=e;for(let C=0;C<l.shape[0];C++)b.push(y);let w=bs(b,[b.length,4]),S=$d(0,b.length,1,"int32"),k=nxe(l,w,S,[a,r],"nearest");return Wl(d?zt($a(k)):k,o)})}upsize(e,t,n,a){return ue(()=>{let r=txe(e,[t,n]);return Wl(r,a)})}call(e,t){return ue(()=>{let n=zt(e),a=n.dtype,r=n.shape,s=r[r.length-3],i=r[r.length-2],o=0;s!==this.height&&(o=Math.floor((s-this.height)/2));let l=0;return i!==this.width&&(l=Math.floor((i-this.width)/2),l===0&&(l=1)),o>=0&&l>=0?this.centerCrop(n,o,l,this.height,this.width,s,i,a):this.upsize(e,this.height,this.width,a)})}getConfig(){let e={height:this.height,width:this.width},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){e=En(e);let t=e.length-3,n=e.length-2;return e[t]=this.height,e[n]=this.width,e}};z_.className="CenterCrop";De.registerClass(z_);function axe(e,t,n,a){let r=zt(e);if(r.dtype!=="int32"&&(r=Wl(r,"int32")),t==="int")return r;let s=r.shape;if(r.rank===0&&(r=Dr(r,-1)),t==="oneHot"&&r.shape[r.shape.length-1]!==1&&(r=Dr(r,-1)),r.rank>2)throw new ce(`When outputMode is not int, maximum output rank is 2 Received outputMode ${t} and input shape ${s} which would result in output rank ${r.rank}.`);let i=["multiHot","oneHot"].includes(t),o=r,l;if(typeof a<"u"&&t==="count"?l=Av(o,a,n,i):l=Av(o,[],n,i),t!=="tfIdf")return l;if(a)return ie(l,a);throw new ce("When outputMode is 'tfIdf', weights must be provided.")}var U_=class extends rn{constructor(e){super(e),this.numTokens=e.numTokens,e.outputMode?this.outputMode=e.outputMode:this.outputMode="multiHot"}getConfig(){let e={numTokens:this.numTokens,outputMode:this.outputMode},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){return e=En(e),e==null?[this.numTokens]:this.outputMode==="oneHot"&&e[e.length-1]!==1?(e.push(this.numTokens),e):(e[e.length-1]=this.numTokens,e)}call(e,t){return ue(()=>{e=zt(e),e.dtype!=="int32"&&(e=Wl(e,"int32"));let n;if(typeof t.countWeights<"u"){if(this.outputMode!=="count")throw new ce(`countWeights is not used when outputMode !== count.
93              Received countWeights=${t.countWeights}`);n=zt(t.countWeights)}let a=ji(e),r=Vf(e),s=Es(this.numTokens,a).bufferSync().get(0),i=Xl(r,0).bufferSync().get(0);if(!(s&&i))throw new ce(`Input values must be between 0 < values <= numTokens with numTokens=${this.numTokens}`);return axe(e,this.outputMode,this.numTokens,n)})}};U_.className="CategoryEncoding";De.registerClass(U_);var rxe=["bilinear","nearest"],S$=new Set(rxe),W_=class extends rn{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation)if(S$.has(e.interpolation))this.interpolation=e.interpolation;else throw new ce(`Invalid interpolation parameter: ${e.interpolation} is not implemented`);else this.interpolation="bilinear";this.cropToAspectRatio=!!e.cropToAspectRatio}computeOutputShape(e){e=En(e);let t=e[2];return[this.height,this.width,t]}getConfig(){let e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return ue(()=>{let n=[this.height,this.width];if(this.interpolation==="bilinear")return Ii.resizeBilinear(e,n,!this.cropToAspectRatio);if(this.interpolation==="nearest")return Ii.resizeNearestNeighbor(e,n,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[...S$]} are supported`)})}};W_.className="Resizing";De.registerClass(W_);var _z=class{constructor(e){this.seed=e}next(){if(this.seed!==void 0)return this.seed++}};_z.className="RandomSeed";var jz=class extends rn{constructor(e){super(e),this.randomGenerator=new _z(e.seed)}getConfig(){let e={seed:this.randomGenerator.seed},t=super.getConfig();return Object.assign(e,t),e}};jz.className="BaseRandomLayer";var sxe=["bilinear","nearest"],k$=new Set(sxe),V_=class extends jz{constructor(e){super(e);let{factor:t,interpolation:n="bilinear"}=e;if(this.factor=t,Array.isArray(this.factor)&&this.factor.length===2)this.widthLower=this.factor[0],this.widthUpper=this.factor[1];else if(!Array.isArray(this.factor)&&this.factor>0)this.widthLower=-this.factor,this.widthUpper=this.factor;else throw new ce(`Invalid factor: ${this.factor}. Must be positive number or tuple of 2 numbers`);if(this.widthLower<-1||this.widthUpper<-1)throw new ce(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper<this.widthLower)throw new ce(`factor cannot have upper bound less than lower bound.
94        Got upper bound: ${this.widthUpper}.
95        Got lower bound: ${this.widthLower}
96      `);if(n)if(k$.has(n))this.interpolation=n;else throw new ce(`Invalid interpolation parameter: ${n} is not implemented`)}getConfig(){let e={factor:this.factor,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){e=En(e);let t=e[2];return[this.imgHeight,-1,t]}call(e,t){return ue(()=>{let n=zt(e);this.imgHeight=n.shape[n.shape.length-3];let a=n.shape[n.shape.length-2];this.widthFactor=yc([1],1+this.widthLower,1+this.widthUpper,"float32",this.randomGenerator.next());let r=this.widthFactor.dataSync()[0]*a;r=Math.round(r);let s=[this.imgHeight,r];switch(this.interpolation){case"bilinear":return Ii.resizeBilinear(e,s);case"nearest":return Ii.resizeNearestNeighbor(e,s);default:throw new Error(`Interpolation is ${this.interpolation}
97          but only ${[...k$]} are supported`)}})}};V_.className="RandomWidth";De.registerClass(V_);function ixe(e){return new Sg(e)}function oxe(e){return new HA(e)}function lxe(e){return new UA(e)}function uxe(e){return new WA(e)}function cxe(e){return new VA(e)}function dxe(e){return new qA(e)}function hxe(e){return new GA(e)}function pxe(e){return new QA(e)}function fxe(e){return new I2(e)}function mxe(e){return new XA(e)}function gxe(e){return new T2(e)}function xxe(e){return new YA(e)}function yxe(e){return new JA(e)}function bxe(e){return new ZA(e)}function vxe(e){return new e_(e)}function wxe(e){return new t_(e)}function Sxe(e){return new u_(e)}function kxe(e){return new o_(e)}function Nxe(e){return new R2(e)}function Cxe(e){return new i_(e)}function Exe(e){return new l_(e)}function Ixe(e){return new c_(e)}function Txe(e){return new d_(e)}function Axe(e){return new h_(e)}function _xe(e){return new f_(e)}function jxe(e){return new m_(e)}function Dxe(e){return new x_(e)}function Rxe(e){return new v_(e)}function Mxe(e){return new y_(e)}function $xe(e){return new b_(e)}function Bxe(e){return new g_(e)}function Fxe(e){return new w_(e)}function Oxe(e){return new C_(e)}function Lxe(e){return new E_(e)}function Pxe(e){return new I_(e)}function H_(e){return new A_(e)}function zxe(e){return H_(e)}function Uxe(e){return H_(e)}function G_(e){return new j_(e)}function Wxe(e){return G_(e)}function Vxe(e){return G_(e)}function q_(e){return new R_(e)}function Hxe(e){return q_(e)}function Gxe(e){return q_(e)}function qxe(e){return new M_(e)}function Kxe(e){return new B_(e)}function Dz(e){return new $_(e)}function Rz(e){return new F_(e)}function Mz(e){return new T_(e)}function $z(e){return new __(e)}function Xxe(e){return new D_(e)}function Yxe(e){return new a_(e)}function Jxe(e){return new _2(e)}function Qxe(e){return new r_(e)}function Zxe(e){return new Jb(e)}function eye(e){return new n_(e)}function tye(e){return new A2(e)}function nye(e){return new s_(e)}function aye(e){return new D2(e)}function rye(e){return new Ql(e)}function sye(e){return new j2(e)}function iye(e){return new L_(e)}function oye(e){return new O_(e)}var lye=Dz,uye=Rz,cye=Mz,dye=$z;function hye(e){return new S_(e)}function pye(e){return new k_(e)}function fye(e){return new N_(e)}function mye(e){return new p_(e)}function gye(e){return new P_(e)}function xye(e){return new z_(e)}function yye(e){return new W_(e)}function bye(e){return new U_(e)}function vye(e){return new V_(e)}var Bz={};Xt(Bz,{MAPE:()=>jye,MSE:()=>Mye,binaryAccuracy:()=>wye,binaryCrossentropy:()=>Sye,categoricalAccuracy:()=>Nye,categoricalCrossentropy:()=>Cye,cosineProximity:()=>Tye,mape:()=>Dye,meanAbsoluteError:()=>Aye,meanAbsolutePercentageError:()=>_ye,meanSquaredError:()=>Rye,mse:()=>$ye,precision:()=>Eye,r2Score:()=>Bye,recall:()=>Iye,sparseCategoricalAccuracy:()=>kye});function wye(e,t){return BA(e,t)}function Sye(e,t){return L6(e,t)}function kye(e,t){return P6(e,t)}function Nye(e,t){return FA(e,t)}function Cye(e,t){return OA(e,t)}function Eye(e,t){return O6(e,t)}function Iye(e,t){return rge(e,t)}function Tye(e,t){return $A(e,t)}function Aye(e,t){return k2(e,t)}function _ye(e,t){return kg(e,t)}function jye(e,t){return kg(e,t)}function Dye(e,t){return kg(e,t)}function Rye(e,t){return mp(e,t)}function Mye(e,t){return mp(e,t)}function $ye(e,t){return mp(e,t)}function Bye(e,t){return sge(e,t)}var Fz={};Xt(Fz,{modelFromJSON:()=>$ge});var Oz={};Xt(Oz,{l1:()=>Oye,l1l2:()=>Fye,l2:()=>Lye});function Fye(e){return new Xb(e)}function Oye(e){return Uge(e)}function Lye(e){return Wge(e)}var Lz=class extends Qf{constructor(){super(...arguments),this.model=null}setModel(e){if(!(e instanceof Ol))throw new Error("model must be a LayersModel, not some other Container");this.model=e}};function $1(e,t){return e<t}function N$(e,t){return e>t}var Pz=class extends Lz{constructor(e){if(super(),e==null&&(e={}),e.restoreBestWeights)throw new an("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,["auto","min","max"].indexOf(this.mode)===-1&&(console.warn(`EarlyStopping mode '${this.mode}
97' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),this.mode==="min"?this.monitorFunc=$1:this.mode==="max"?this.monitorFunc=N$:this.monitor.indexOf("acc")!==-1?this.monitorFunc=N$:this.monitorFunc=$1,this.monitorFunc===$1&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===$1?1/0:-1/0}async onEpochEnd(e,t){await Au(t);let n=this.getMonitorValue(t);n!=null&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){e==null&&(e={});let t=e[this.monitor];return t==null&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}};function Pye(e){return new Pz(e)}var zye={earlyStopping:Pye},Uye=fe();Uye.registerFlag("KEEP_INTERMEDIATE_TENSORS",()=>!1,e=>{e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")});var Js;(function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"})(Js||(Js={}));var C$;(function(e){(function(t){t[t.LEGACY=0]="LEGACY",t[t.V1=1]="V1",t[t.V2=2]="V2"})(e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(C$||(C$={}));var K_={};function Wye(e,t){let n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};K_[e]=n}function zz(e){return K_[e]}function Vye(e){delete K_[e]}function M(e,t,n,a,r){let s=t.inputParams[e];if(s&&s.inputIndexStart!==void 0){let o=s.inputIndexStart,l=s.inputIndexEnd===0?void 0:s.inputIndexEnd===void 0?o+1:s.inputIndexEnd,d=o<0?t.inputNames.length+o:o;if(s.type==="tensor")return Wr(t.inputNames[d],n,a,r);if(s.type==="tensors"){let m=t.inputs.slice(o,l);return t.inputNames.slice(o,l).filter((x,y)=>{var b;return((b=m[y])===null||b===void 0?void 0:b.op)!=="NoOp"}).map(x=>Wr(x,n,a,r))}let c=Wr(t.inputNames[d],n,a,r),f=c.dataSync();return s.type==="number"?f[0]:R.toNestedArray(c.shape,f)}let i=t.attrParams[e];return i&&i.value}function Wr(e,t,n,a){let[r,s]=Zs(e,n);if(a!=null){let o=a.getHashTableHandleByName(r);if(o!=null)return o}let i=n.currentContextIds.find(o=>!!t[Pv(r,o)]);return i!==void 0?t[Pv(r,i)][s]:void 0}function E$(e,t,n){return t[Pv(e,n.currentContextId)]}function Rl(e,t){let[n,a,r]=Zs(e,t);return[Pv(n,t&&t.currentContextId),a,r]}function Pv(e,t){return t?`${e}-${t}`:e}function Zs(e,t){if(e==="")return["",0,void 0];let n=t!=null&&t.parseNodeNameCache!=null;if(n){let s=t.parseNodeNameCache.get(e);if(s!=null)return s}let a=e.split(":"),r;if(a.length===1)r=[e,0,void 0];else{let s=a[0],i=a.length===3?a[1]:void 0,o=Number(a[a.length-1]);r=[s,o,i]}return n&&t.parseNodeNameCache.set(e,r),r}function sv(e,t,n){let a=M("pad",e,t,n);if(a==="explicit"){a=M("explicitPaddings",e,t,n);let r=[[0,0],[0,0],[0,0],[0,0]];for(let s=0;s<4;s++)r[s][0]=a[s*2],r[s][1]=a[s*2+1];return r}return a}function Ml(e){return e.kept?e:tl(e)}var Uz={};Xt(Uz,{json:()=>Hye});var Hye=[{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}
97]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],Wz={};Xt(Wz,{json:()=>Gye});var Gye=
vendor: 6,808 bytes, line 97
97[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]
97,Vz={};Xt(Vz,{json:()=>qye});var qye
vendor: 7,590 bytes, line 97
97=[{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"}]}],
vendor: 13,556 bytes, line 97
97Hz={};Xt(Hz,{json:()=>Kye});var Kye=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],Gz={};Xt(Gz,{json:()=>Xye});var Xye=[{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"}]}],qz={};Xt(qz,{json:()=>Yye});var Yye=[{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}]}],Kz={};Xt(Kz,{json:()=>Jye});var Jye=[{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"}]}],Xz={};Xt(Xz,{json:()=>Qye});var Qye=[{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}
97,{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"}]}],Yz={};Xt(Yz,{json:()=>Zye});var Zye=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],Jz={};Xt(Jz,{json:()=>ebe});var ebe=[{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"}]}],Qz={};Xt(Qz,{json:()=>tbe});
97var tbe=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}],Zz={};Xt(Zz,{json:()=>nbe});var nbe=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}],e7={};Xt(e7,{json:()=>abe});var abe=[{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}
vendor: 15,839 bytes, line 97
97]},{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"}]}],t7={};Xt(t7,{json:()=>rbe});var rbe=[{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"}]}],n7={};Xt(n7,{json:()=>sbe});var sbe=[{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"}]}],a7={};Xt(a7,{json:()=>ibe});var ibe=[{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"}]}],r7={};Xt(r7,{json:()=>obe});var obe=[{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}]}],s7={};Xt(s7,{json:()=>lbe});var lbe=[{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"}]}],i7={};Xt(i7,{json:()=>ube});var ube=[{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:[]}],I$=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let e=[Uz,Wz,Vz,Hz,Gz,qz,Kz,Xz,Yz,Jz,Qz,Zz,e7,t7,n7,a7,r7,s7,i7],t=[].concat(...e.map(n=>n.json));this.opMappers=t.reduce((n,a)=>(n[a.tfOpName]=a,n),{})}transformGraph(e,t={}){let n=e.node,a=[],r=[],s=[],i=n.reduce((y,b)=>(y[b.name]=this.mapNode(b),b.op.startsWith("Placeholder")?a.push(y[b.name]):b.op==="Const"?r.push(y[b.name]):(b.input==null||b.input.length===0)&&s.push(y[b.name]),y),{}),o=[],l=[],d={},c={};t!=null&&(d=this.mapSignatureEntries(t.inputs),c=this.mapSignatureEntries(t.outputs));let f=Object.keys(i);f.forEach(y=>{let b=i[y];b.inputNames.forEach((w,S)=>{let[k,,C]=Rl(w),E=i[k];if(E.outputs!=null){let T=E.outputs.indexOf(C);if(T!==-1){let _=`${k}:${T}`;b.inputNames[S]=_}}b.inputs.push(E),E.children.push(b)})}),Object.keys(c).length===0?f.forEach(y=>{let b=i[y];b.children.length===0&&l.push(b)}):Object.keys(c).forEach(y=>{let[b]=Rl(y),w=i[b];w!=null&&(w.signatureKey=c[y],l.push(w))}),Object.keys(d).length>0?Object.keys(d).forEach(y=>{let[b]=Rl(y),w=i[b];w&&(w.signatureKey=d[y],o.push(w))}):o=a;let m={};e.library!=null&&e.library.function!=null&&(m=e.library.function.reduce((y,b)=>(y[b.signature.name]=this.mapFunction(b),y),{}));let x={nodes:i,inputs:o,outputs:l,weights:r,placeholders:a,signature:t,functions:m};return s.length>0&&(x.initNodes=s),x}mapSignatureEntries(e){return Object.keys(e||{}).reduce((t,n)=>(t[e[n].name]=n,t),{})}mapNode(e){let t=zz(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});let n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(a=>a.startsWith("^")?a.slice(1):a),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return t.inputs!=null&&(n.inputParams=t.inputs.reduce((a,r)=>(a[r.name]={type:r.type,inputIndexStart:r.start,inputIndexEnd:r.end},a),{})),t.attrs!=null&&(n.attrParams=t.attrs.reduce((a,r)=>{let s=r.type,i;switch(r.type){case"string":i=hE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=hE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"string[]":i=bE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=bE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number":i=fE(e.attr,r.tfName,r.defaultValue||0),i===void 0&&r.tfDeprecatedName&&(i=fE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number[]":i=yE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=yE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool":i=pE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=pE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool[]":i=wE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=wE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape":i=xE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=xE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape[]":i=vE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=vE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype":i=mE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=mE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype[]":i=gE(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=gE(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"func":i=T$(e.attr,r.tfName,r.defaultValue),i===void 0&&r.tfDeprecatedName&&(i=T$(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${r.type} for op: ${e.op}`)}return a[r.name]={value:i,type:s},a},{})),n}mapFunction(e){let t=e.nodeDef,n=[],a=[],r={};t!=null&&(r=t.reduce((d,c)=>(d[c.name]=this.mapNode(c),c.op==="Const"&&a.push(d[c.name]),d),{}));let s=[],i=[];e.signature.inputArg.forEach(d=>
vendor: 7,328 bytes, line 97
97{let[c]=Rl(d.name),f={name:c,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:X_(d.type),type:"dtype"}},children:[]};f.signatureKey=d.name,s.push(f),r[c]=f}),Object.keys(r).forEach(d=>{let c=r[d];c.inputNames.forEach((f,m)=>{let[x,,y]=Rl(f),b=r[x];if(b.outputs!=null){let w=b.outputs.indexOf(y);if(w!==-1){let S=`${x}:${w}`;c.inputNames[m]=S}}c.inputs.push(b),b.children.push(c)})});let o=e.ret;e.signature.outputArg.forEach(d=>{let[c,f]=Rl(o[d.name]),m=r[c];m!=null&&(m.defaultOutput=f,i.push(m))});let l=this.mapArgsToSignature(e);return{nodes:r,inputs:s,outputs:i,weights:a,placeholders:n,signature:l}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n),t),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return t!=null&&(n=t[n]),{name:n,dtype:e.type}}};function cbe(e){let t=fe().global;if(typeof t.atob<"u")return t.atob(e);if(typeof Buffer<"u")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function o7(e,t){let n=Array.isArray(e)?String.fromCharCode.apply(null,e):cbe(e);return t?n:n.toLowerCase()}function hE(e,t,n,a=!1){let r=e[t];return r!=null?o7(r.s,a):n}function pE(e,t,n){let a=e[t];return a?a.b:n}function fE(e,t,n){let a=e[t]||{},r=a.i!=null?a.i:a.f!=null?a.f:n;return typeof r=="number"?r:parseInt(r,10)}function X_(e){switch(typeof e=="string"&&(e=Js[e]),e){case Js.DT_FLOAT:case Js.DT_HALF:return"float32";case Js.DT_INT32:case Js.DT_INT64:case Js.DT_INT8:case Js.DT_UINT8:return"int32";case Js.DT_BOOL:return"bool";case Js.DT_DOUBLE:return"float32";case Js.DT_STRING:return"string";case Js.DT_COMPLEX64:case Js.DT_COMPLEX128:return"complex64";default:return null}}function T$(e,t,n){let a=e[t];return a&&a.func?a.func.name:n}function mE(e,t,n){let a=e[t];return a&&a.type?X_(a.type):n}function gE(e,t,n){let a=e[t];return a&&a.list&&a.list.type?a.list.type.map(r=>X_(r)):n}function l7(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function xE(e,t,n){let a=e[t];return a&&a.shape?l7(a.shape):n}function yE(e,t,n){let a=e[t];return a?((a.list.f&&a.list.f.length?a.list.f:a.list.i)||[]).map(r=>typeof r=="number"?r:parseInt(r,10)):n}function bE(e,t,n,a=!1){let r=e[t];return r&&r.list&&r.list.s?r.list.s.map(s=>o7(s,a)):n}function vE(e,t,n){let a=e[t];return a&&a.list&&a.list.shape?a.list.shape.map(r=>l7(r)):n}function wE(e,t,n){let a=e[t];return a&&a.list&&a.list.b?a.list.b:n}var dbe=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(a=>this.getInput(a)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((a,r)=>(a[r]=this.getAttr(r),a),{}))}getInput(e){return Wr(e,this.tensorMap,this.context)}getAttr(e,t){let n=this.node.rawAttrs[e];if(n.tensor!=null)return Wr(e,this.tensorMap,this.context);if(n.i!=null||n.f!=null)return fE(this.node.rawAttrs,e,t);if(n.s!=null)return hE(this.node.rawAttrs,e,t);if(n.b!=null)return pE(this.node.rawAttrs,e,t);if(n.shape!=null)return xE(this.node.rawAttrs,e,t);if(n.type!=null)return mE(this.node.rawAttrs,e,t);if(n.list!=null){if(n.list.i!=null||n.list.f!=null)return yE(this.node.rawAttrs,e,t);if(n.list.s!=null)return bE(this.node.rawAttrs,e,t);if(n.list.shape!=null)return vE(this.node.rawAttrs,e,t);if(n.list.b!=null)return wE(this.node.rawAttrs,e,t);if(n.list.type!=null)return gE(this.node.rawAttrs,e,t)}return t}},Fr={};Xt(Fr,{OP_SCOPE_SUFFIX:()=>JI,abs:()=>tr,acos:()=>nT,acosh:()=>aT,add:()=>ke,addN:()=>SL,all:()=>$w,any:()=>$y,argMax:()=>jd,argMin:()=>rT,asin:()=>sT,asinh:()=>iT,atan:()=>oT,atan2:()=>lT,atanh:()=>uT,avgPool:()=>Kl,avgPool3d:()=>dT,basicLSTMCell:()=>EL,batchNorm:()=>cp,batchNorm2d:()=>hT,batchNorm3d:()=>pT,batchNorm4d:()=>fT,batchToSpaceND:()=>_b,bincount:()=>mT,bitwiseAnd:()=>IL,booleanMaskAsync:()=>gP,broadcastArgs:()=>TL,broadcastTo:()=>vd,buffer:()=>Zt,cast:()=>He,ceil:()=>gT,clipByValue:()=>ns,clone:()=>tl,complex:()=>Ul,concat:()=>Qn,concat1d:()=>xT,concat2d:()=>yT,concat3d:()=>bT,concat4d:()=>vT,conv1d:()=>Bw,conv2d:()=>ws,conv2dTranspose:()=>Fw,conv3d:()=>ST,conv3dTranspose:()=>kT,cos:()=>jb,cosh:()=>Ow,cosineWindow:()=>o2,cumprod:()=>Oy,cumsum:()=>Lw,denseBincount:()=>Av,depthToSpace:()=>NT,depthwiseConv2d:()=>dp,diag:()=>_L,dilation2d:()=>CT,div:()=>ht,divNoNan:()=>ET,dot:()=>IT,dropout:()=>nA,einsum:()=>ud,elu:()=>mg,enclosingPowerOfTwo:()=>aA,ensureShape:()=>DL,equal:()=>si,erf:()=>Pw,euclideanNorm:()=>_T,exp:()=>as,expandDims:()=>Dr,expm1:()=>jT,eye:()=>zw,fft:()=>zb,fill:()=>ri,floor:()=>xg,floorDiv:()=>Mw,fused:()=>Yf,gather:()=>yg,gatherND:()=>vP,greater:()=>Es,greaterEqual:()=>Xl,ifft:()=>Xf,imag:()=>Db,image:()=>Ii,inTopKAsync:()=>wP,irfft:()=>e2,isFinite:()=>DT,isInf:()=>RT,isNaN:()=>MT,leakyRelu:()=>Rb,less:()=>Hf,lessEqual:()=>xc,linalg:()=>iA,linspace:()=>FL,localResponseNormalization:()=>$T,log:()=>ii,log1p:()=>Mb,logSigmoid:()=>BT,logSoftmax:()=>Ww,logSumExp:()=>$b,logicalAnd:()=>to,logicalNot:()=>Bb,logicalOr:()=>Vw,logicalXor:()=>FT,losses:()=>RP,lowerBound:()=>LL,matMul:()=>Jt,max:()=>ji,maxPool:()=>Ar,maxPool3d:()=>OT,maxPoolWithArgmax:()=>PL,maximum:()=>ul,mean:()=>ba,meshgrid:()=>zL,min:()=>Vf,minimum:()=>ec,mirrorPad:()=>LT,mod:()=>PT,moments:()=>Fb,movingAverage:()=>xP,mul:()=>ie,multiRNNCell:()=>UL,multinomial:()=>WL,neg:()=>ua,norm:()=>gg,notEqual:()=>Md,oneHot:()=>Gf,ones:()=>$s,onesLike:()=>oi,op:()=>re,outerProduct:()=>VL,pad:()=>Ro,pad1d:()=>HL,pad2d:()=>GL,pad3d:()=>qL,pad4d:()=>KL,pool:()=>zT,pow:()=>sl,prelu:()=>Lb,print:()=>tT,prod:()=>UT,raggedGather:()=>XL,raggedRange:()=>YL,raggedTensorToTensor:()=>JL,rand:()=>QL,randomGamma:()=>nP,randomNormal:()=>Gw,randomStandardNormal:()=>aP,randomUniform:()=>yc,randomUniformInt:()=>rP,range:()=>$d,real:()=>qf,reciprocal:()=>qT,relu:()=>Vn,relu6:()=>qw,reshape:()=>le,reverse:()=>Mi,reverse1d:()=>sP,reverse2d:()=>iP,reverse3d:()=>oP,reverse4d:()=>lP,rfft:()=>Ub,round:()=>Kw,rsqrt:()=>Xw,scalar:()=>Et,scatterND:()=>yP,searchSorted:()=>Hw,selu:()=>Yw,separableConv2d:()=>bg,setdiff1dAsync:()=>uP,sigmoid:()=>eo,sign:()=>KT,signal:()=>DP,sin:()=>Jw,sinh:()=>Qw,slice:()=>un,slice1d:()=>Pb,slice2d:()=>Zw,slice3d:()=>vg,slice4d:()=>Kf,softmax:()=>bc,softplus:()=>hp,spaceToBatchND:()=>Ob,sparse:()=>MP,sparseToDense:()=>bP,spectral:()=>jP,split:()=>Bs,sqrt:()=>$r,square:()=>Jn,squaredDifference:()=>t2,squeeze:()=>vc,stack:()=>rr,step:()=>pp,stridedSlice:()=>XT,string:()=>$P,sub:()=>st,sum:()=>yt,tan:()=>YT,tanh:()=>Zu,tensor:()=>bs,tensor1d:()=>Ln,tensor2d:()=>nl,tensor3d:()=>n2,tensor4d:()=>tc,tensor5d:()=>cP,tensor6d:()=>dP,tensorScatterUpdate:()=>pP,tile:()=>ai,topk:()=>QT,transpose:()=>Qt,truncatedNormal:()=>s2,unique:()=>ZT,unsortedSegmentSum:()=>i2,unstack:()=>$a,upperBound:()=>fP,variable:()=>eA,where:()=>Mr,whereAsync:()=>tA,zeros:()=>va,zerosLike:()=>pn});var hbe=(e,t,n,a=Fr)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[a.add(M("a",e,t,n),M("b",e,t,n))];case"AddN":return[a.addN(M("tensors",e,t,n))];case"FloorMod":case"Mod":return[a.mod(M("a",e,t,n),M("b",e,t,n))];case"Mul":return[a.mul(M("a",e,t,n),M("b",e,t,n))];
vendor: 5,960 bytes, lines 97-98
97case"RealDiv":case"Div":return[a.div(M("a",e,t,n),M("b",e,t,n))];case"DivNoNan":return[a.divNoNan(M("a",e,t,n),M("b",e,t,n))];case"FloorDiv":return[a.floorDiv(M("a",e,t,n),M("b",e,t,n))];case"Sub":return[a.sub(M("a",e,t,n),M("b",e,t,n))];case"Minimum":return[a.minimum(M("a",e,t,n),M("b",e,t,n))];case"Maximum":return[a.maximum(M("a",e,t,n),M("b",e,t,n))];case"Pow":return[a.pow(M("a",e,t,n),M("b",e,t,n))];case"SquaredDifference":return[a.squaredDifference(M("a",e,t,n),M("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},pbe=(e,t,n,a=Fr)=>{switch(e.op){case"Abs":case"ComplexAbs":return[a.abs(M("x",e,t,n))];case"Acos":return[a.acos(M("x",e,t,n))];case"Acosh":return[a.acosh(M("x",e,t,n))];case"Asin":return[a.asin(M("x",e,t,n))];case"Asinh":return[a.asinh(M("x",e,t,n))];case"Atan":return[a.atan(M("x",e,t,n))];case"Atan2":return[a.atan2(M("x",e,t,n),M("y",e,t,n))];case"Atanh":return[a.atanh(M("x",e,t,n))];case"Ceil":return[a.ceil(M("x",e,t,n))];case"Complex":return[a.complex(M("real",e,t,n),M("imag",e,t,n))];case"Cos":return[a.cos(M("x",e,t,n))];case"Cosh":return[a.cosh(M("x",e,t,n))];case"Elu":return[a.elu(M("x",e,t,n))];case"Erf":return[a.erf(M("x",e,t,n))];case"Exp":return[a.exp(M("x",e,t,n))];case"Expm1":return[a.expm1(M("x",e,t,n))];case"Floor":return[a.floor(M("x",e,t,n))];case"Log":return[a.log(M("x",e,t,n))];case"Log1p":return[a.log1p(M("x",e,t,n))];case"Imag":return[a.imag(M("x",e,t,n))];case"Neg":return[a.neg(M("x",e,t,n))];case"Reciprocal":return[a.reciprocal(M("x",e,t,n))];case"Real":return[a.real(M("x",e,t,n))];case"Relu":return[a.relu(M("x",e,t,n))];case"Round":return[a.round(M("x",e,t,n))];case"Selu":return[a.selu(M("x",e,t,n))];case"Sigmoid":return[a.sigmoid(M("x",e,t,n))];case"Sin":return[a.sin(M("x",e,t,n))];case"Sign":return[a.sign(M("x",e,t,n))];case"Sinh":return[a.sinh(M("x",e,t,n))];case"Softplus":return[a.softplus(M("x",e,t,n))];case"Sqrt":return[a.sqrt(M("x",e,t,n))];case"Square":return[a.square(M("x",e,t,n))];case"Tanh":return[a.tanh(M("x",e,t,n))];case"Tan":return[a.tan(M("x",e,t,n))];case"ClipByValue":return[a.clipByValue(M("x",e,t,n),M("clipValueMin",e,t,n),M("clipValueMax",e,t,n))];case"Relu6":return[a.relu6(M("x",e,t,n))];case"Rsqrt":return[a.rsqrt(Wr(e.inputNames[0],t,n))];case"LeakyRelu":return[a.leakyRelu(M("x",e,t,n),M("alpha",e,t,n))];case"Prelu":return[a.prelu(M("x",e,t,n),M("alpha",e,t,n))];case"IsNan":return[a.isNaN(Wr(e.inputNames[0],t,n))];case"IsInf":return[a.isInf(Wr(e.inputNames[0],t,n))];case"IsFinite":return[a.isFinite(Wr(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function Qi(e,t,n=""){if(!(typeof e=="number"||typeof t=="number")){R.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let a=0;a<e.length;a++){let r=e[a],s=t[a];R.assert(r<0||s<0||r===s,()=>n+` Shapes ${e} and ${t} must match`)}}}function A$(e){return!(typeof e=="number"||e.some(t=>t<0))}function Bx(e,t,n){let a=SE(e,n),r=!A$(a);if(r&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${a}`);if(r&&t.forEach(s=>{a=SE(s.shape,a)}),!A$(a))throw new Error(`Non-fully-defined elementShape: ${a}`);return a}function SE(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let n=[];for(let a=0;a<e.length;++a){let r=e[a],s=t[a];if(r>=0&&s>=0&&r!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[a]=r>=0?r:s}return n}var fbe=class{constructor(e,t,n,a,r,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=a,this.identicalElementShapes=r,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=Et(0),xr(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!e.has(t.tensor.id))&&t.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()}`);let t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map(t=>this.read(t))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);let n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e},
98          because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=t.shape),Qi(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,xr(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach((n,a)=>this.write(n,t[a]))}gather(e,t){if(t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let a=0;a<this.size();
vendor: 7,268 bytes, lines 98-102
98a++)e.push(a)}if(e.length===0)return bs([],[0].concat(this.elementShape));let n=this.readMany(e);return Qi(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),rr(n,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 bs([],[0].concat(this.elementShape));let t=[];for(let a=0;a<this.size();a++)t.push(a);let n=this.readMany(t);return Qi(this.elementShape,n[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${n[0].shape})`),Qn(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);if(e.length!==t.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${t.shape[0]}`);let n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error(`Max index must be < array size (${n}  vs. ${this.maxSize})`);this.writeMany(e,$a(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0,a=e.map(o=>(n+=o,n));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to
99          tensor.shape[0], but sum of lengths is
100        ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);let r=n===0?0:t.size/n,s=[];ue(()=>{t=le(t,[1,n,r]);for(let o=0;o<e.length;++o){let l=[0,o===0?0:a[o-1],0],d=[1,e[o],r];s[o]=le(un(t,l,d),this.elementShape)}return s});let i=[];for(let o=0;o<e.length;o++)i[o]=o;this.writeMany(i,s)}},$2=class kE{get id(){return this.idTensor.id}constructor(t,n,a,r=-1){this.tensors=t,this.elementShape=n,this.elementDtype=a,t?.forEach(s=>{if(a!==s.dtype)throw new Error(`Invalid data types; op elements ${a}, but list elements ${s.dtype}`);Qi(n,s.shape,"TensorList shape mismatch: "),xr(s)}),this.idTensor=Et(0),this.maxNumElements=r,xr(this.idTensor)}copy(){return new kE([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(t){this.tensors.forEach(n=>{(t==null||!t.has(n.id))&&n.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(t,n,a=-1){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(a!==-1&&this.tensors.length!==a)throw new Error(`Operation expected a list with ${a} elements but got a list with ${this.tensors.length} elements.`);Qi(t,this.elementShape,"TensorList shape mismatch: ");let r=Bx(this.elementShape,this.tensors,t);return ue(()=>{let s=this.tensors.map(i=>le(i,r));return rr(s,0)})}popBack(t,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.");let a=Bx(this.elementShape,this.tensors,t),r=this.tensors.pop();return r.kept=!1,Qi(r.shape,t,"TensorList shape mismatch: "),le(r,a)}pushBack(t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(Qi(t.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");xr(t),this.tensors.push(t)}resize(t){if(t<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${t}`);if(this.maxNumElements!==-1&&t>this.maxNumElements)throw new Error(`TensorListResize input size ${t} is greater maxNumElement ${this.maxNumElements}.`);let n=new kE([],this.elementShape,this.elementDtype,this.maxNumElements);n.tensors.length=t;for(let a=0;a<Math.min(this.tensors.length,t);++a)n.tensors[a]=this.tensors[a];return n}getItem(t,n,a){if(a!==this.elementDtype)throw new Error(`Invalid data types; op elements ${a}, but list elements ${this.elementDtype}`);if(t<0||t>this.tensors.length)throw new Error(`Trying to access element ${t} in a list with ${this.tensors.length} elements.`);if(this.tensors[t]==null)throw new Error(`element at index ${t} is null.`);Qi(this.tensors[t].shape,n,"TensorList shape mismatch: ");let r=Bx(this.elementShape,this.tensors,n);return le(this.tensors[t],r)}setItem(t,n){if(n.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n.dtype}, but list elements ${this.elementDtype}`);if(t<0||this.maxNumElements!==-1&&t>=this.maxNumElements)throw new Error(`Trying to set element ${t} in a list with max ${this.maxNumElements} elements.`);Qi(this.elementShape,n.shape,"TensorList shape mismatch: "),xr(n),this.tensors[t]!=null&&(this.tensors[t].kept=!1),this.tensors[t]=n}gather(t,n,a){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);Qi(this.elementShape,a,"TensorList shape mismatch: "),t=t.slice(0,this.size());let r=Bx(this.elementShape,this.tensors,a);return t.length===0?bs([],[0].concat(r)):ue(()=>{let s=t.map(i=>le(this.tensors[i],r));return rr(s,0)})}concat(t,n){if(t&&t!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${t}`);Qi(this.elementShape,n,"TensorList shape mismatch: ");let a=Bx(this.elementShape,this.tensors,n);return this.size()===0?bs([],[0].concat(a)):ue(()=>{let r=this.tensors.map(s=>le(s,a));return Qn(r,0)})}};function mbe(e,t,n){let a=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);let r=e.shape.slice(1);Qi(r,t,"TensorList shape mismatch: ");let s=$a(e);return new $2(s,t,a)}function gbe(e,t,n,a){return new $2([],e,t,a)}function xbe(e,t,n,a){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let r=Math.max(...t);if(a!=null&&a!==-1&&r>=a)throw new Error(`Max index must be < array size (${r}  vs. ${a})`);let s=new $2([],n,e.dtype,a),i=$a(e,0);return t.forEach((o,l)=>{s.setItem(o,i[l])}),s}function ybe(e,t,n){let a=0,r=t.map(c=>(a+=c,a));if(a!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to
101          tensor.shape[0], but sum of lengths is
102        ${a}, and tensor's shape is: ${e.shape}`);let s=e.shape.slice(1),i=SE(s,n),o=a===0?0:e.size/a,l=ue(()=>{let c=[];e=le(e,[1,a,o]);for(let f=0;f<t.length;++f){let m=[0,f===0?0:r[f-1],0],x=[1,t[f],o];c[f]=le(un(e,m,x),i)}return e.dispose(),c}),d=new $2([],n,e.dtype,t.length);for(let c=0;c<l.length;c++)d.setItem(c,l[c]);return d}var bbe=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{let a=M("thenBranch",e,t,n),r=M("elseBranch",e,t,n),s=M("cond",e,t,n),i=M("args",e,t,n);return(await s.data())[0]?n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let a=M("body",e,t,n),r=M("cond",e,t,n),s=M("args",e,t,n),i=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map(c=>c.id),l=await i[0].data();
vendor: 23,949 bytes, line 102
102i.forEach(c=>{!c.kept&&o.indexOf(c.id)===-1&&c.dispose()});let d=s;for(;l[0];){let c=d;d=await n.functionMap[a].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);let f=d.map(x=>x.id);c.forEach(x=>{!x.kept&&o.indexOf(x.id)===-1&&f.indexOf(x.id)===-1&&x.dispose()});let m=await n.functionMap[r].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);l=await m[0].data(),m.forEach(x=>{!x.kept&&o.indexOf(x.id)===-1&&f.indexOf(x.id)===-1&&x.dispose()})}return d}case"LoopCond":{let a=M("pred",e,t,n);return[Ml(a)]}case"Switch":{let a=M("pred",e,t,n),r=M("data",e,t,n);return r.kept||(r=Ml(r)),(await a.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{let a=e.inputNames.find(r=>Wr(r,t,n)!==void 0);if(a){let r=Wr(a,t,n);return[Ml(r)]}return}case"Enter":{let a=M("frameName",e,t,n),r=M("tensor",e,t,n);return n.enterFrame(a),[Ml(r)]}case"Exit":{let a=M("tensor",e,t,n);return n.exitFrame(),[Ml(a)]}case"NextIteration":{let a=M("tensor",e,t,n);return n.nextIteration(),[Ml(a)]}case"TensorArrayV3":{let a=M("size",e,t,n),r=M("dtype",e,t,n),s=M("elementShape",e,t,n),i=M("dynamicSize",e,t,n),o=M("clearAfterRead",e,t,n),l=M("identicalElementShapes",e,t,n),d=M("name",e,t,n),c=new fbe(d,r,a,s,l,i,o);return n.addTensorArray(c),[c.idTensor,Et(1)]}case"TensorArrayWriteV3":{let a=M("tensorArrayId",e,t,n),r=M("index",e,t,n),s=M("tensor",e,t,n),i=n.getTensorArray(a.id);return i.write(r,s),[i.idTensor]}case"TensorArrayReadV3":{let a=M("tensorArrayId",e,t,n),r=M("index",e,t,n);return[n.getTensorArray(a.id).read(r)]}case"TensorArrayGatherV3":{let a=M("tensorArrayId",e,t,n),r=M("indices",e,t,n),s=M("dtype",e,t,n);return[n.getTensorArray(a.id).gather(r,s)]}case"TensorArrayScatterV3":{let a=M("tensorArrayId",e,t,n),r=M("indices",e,t,n),s=M("tensor",e,t,n),i=n.getTensorArray(a.id);return i.scatter(r,s),[i.idTensor]}case"TensorArrayConcatV3":{let a=M("tensorArrayId",e,t,n),r=n.getTensorArray(a.id),s=M("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{let a=M("tensorArrayId",e,t,n),r=M("tensor",e,t,n),s=M("lengths",e,t,n),i=n.getTensorArray(a.id);return i.split(s,r),[i.idTensor]}case"TensorArraySizeV3":{let a=M("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return[Et(r.size(),"int32")]}case"TensorArrayCloseV3":{let a=M("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{let a=M("tensorListId",e,t,n),r=M("index",e,t,n),s=M("tensor",e,t,n),i=n.getTensorList(a.id);return i.setItem(r,s),[i.idTensor]}case"TensorListGetItem":{let a=M("tensorListId",e,t,n),r=M("index",e,t,n),s=M("elementShape",e,t,n),i=M("elementDType",e,t,n);return[n.getTensorList(a.id).getItem(r,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let a=M("indices",e,t,n),r=M("tensor",e,t,n),s=M("elementShape",e,t,n),i=M("numElements",e,t,n),o=xbe(r,a,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let a=M("elementShape",e,t,n),r=M("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=M(s,e,t,n),o=e.op==="TensorListReserve"?-1:i,l=gbe(a,r,i,o);return n.addTensorList(l),[l.idTensor]}case"TensorListGather":{let a=M("tensorListId",e,t,n),r=M("indices",e,t,n),s=M("elementShape",e,t,n),i=M("elementDType",e,t,n);return[n.getTensorList(a.id).gather(r,i,s)]}case"TensorListStack":{let a=M("tensorListId",e,t,n),r=M("elementShape",e,t,n),s=M("elementDType",e,t,n),i=M("numElements",e,t,n);return[n.getTensorList(a.id).stack(r,s,i)]}case"TensorListFromTensor":{let a=M("tensor",e,t,n),r=M("elementShape",e,t,n),s=M("elementDType",e,t,n),i=mbe(a,r,s);return n.addTensorList(i),[i.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{let a=M("tensorListId",e,t,n),r=n.getTensorList(a.id),s=M("dtype",e,t,n),i=M("elementShape",e,t,n);return[r.concat(s,i)]}case"TensorListPushBack":{let a=M("tensorListId",e,t,n),r=M("tensor",e,t,n),s=n.getTensorList(a.id);return s.pushBack(r),[s.idTensor]}case"TensorListPopBack":{let a=M("tensorListId",e,t,n),r=M("elementShape",e,t,n),s=M("elementDType",e,t,n);return[n.getTensorList(a.id).popBack(r,s)]}case"TensorListSplit":{let a=M("tensor",e,t,n),r=M("elementShape",e,t,n),s=M("lengths",e,t,n),i=ybe(a,s,r);return n.addTensorList(i),[i.idTensor]}case"TensorListLength":{let a=M("tensorListId",e,t,n),r=n.getTensorList(a.id);return[Et(r.size(),"int32")]}case"TensorListResize":{let a=M("tensorListId",e,t,n),r=M("size",e,t,n),s=n.getTensorList(a.id).resize(r);return n.addTensorList(s),[s.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function _$(e,t,n){let[a,r]=M("fusedOps",e,t,n),s=a==="biasadd",i=!s,o=r==="prelu",l=a==="fusedbatchnorm",d=M("numArgs",e,t,n);if(s){if(o&&d!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&s&&d!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let c=M("strides",e,t,n),f=sv(e,t,n),m=M("dataFormat",e,t,n).toUpperCase(),x=M("dilations",e,t,n),[y,b]=M("args",e,t,n);i&&(b=y,y=void 0);let w=M("leakyreluAlpha",e,t,n);return{stride:c,pad:f,dataFormat:m,dilations:x,biasArg:y,preluArg:b,activationFunc:r,leakyreluAlpha:w}}var vbe=(e,t,n,a=Fr)=>{switch(e.op){case"Conv1D":{let r=M("stride",e,t,n),s=M("pad",e,t,n),i=M("dataFormat",e,t,n).toUpperCase(),o=M("dilation",e,t,n);return[a.conv1d(M("x",e,t,n),M("filter",e,t,n),r,s,i,o)]}case"Conv2D":{let r=M("strides",e,t,n),s=sv(e,t,n),i=M("dataFormat",e,t,n).toUpperCase(),o=M("dilations",e,t,n);return[a.conv2d(M("x",e,t,n),M("filter",e,t,n),[r[1],r[2]],s,i,[o[1],o[2]])]}case"_FusedConv2D":{let{stride:r,pad:s,dataFormat:i,dilations:o,biasArg:l,preluArg:d,activationFunc:c,leakyreluAlpha:f}=_$(e,t,n);return[a.fused.conv2d({x:M("x",e,t,n),filter:M("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:i,dilations:[o[1],o[2]],bias:l,activation:c,preluActivationWeights:d,leakyreluAlpha:f})]}case"FusedDepthwiseConv2dNative":{let{stride:r,pad:s,dataFormat:i,dilations:o,biasArg:l,preluArg:d,activationFunc:c,leakyreluAlpha:f}=_$(e,t,n);return[a.fused.depthwiseConv2d({x:M("x",e,t,n),filter:M("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:i,dilations:[o[1],o[2]],bias:l,activation:c,preluActivationWeights:d,leakyreluAlpha:f})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let r=M("outputShape",e,t,n),s=M("strides",e,t,n),i=sv(e,t,n);return[a.conv2dTranspose(M("x",e,t,n),M("filter",e,t,n),r,[s[1],s[2]],i)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let r=M("strides",e,t,n),s=sv(e,t,n),i=M("dilations",e,t,n),o=M("dataFormat",e,t,n).toUpperCase();return[a.depthwiseConv2d(M("input",e,t,n),M("filter",e,t,n),[r[1],r[2]],s,o,[i[1],i[2]])]}case"Conv3D":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("dataFormat",e,t,n).toUpperCase(),o=M("dilations",e,t,n);return[a.conv3d(M("x",e,t,n),M("filter",e,t,n),[r[1],r[2],r[3]],s,i,[o[1],o[2],o[3]])]}case"AvgPool":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("kernelSize",e,t,n);return[a.avgPool(M("x",e,t,n),[i[1],i[2]],[r[1],r[2]],s)]}case"MaxPool":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("kernelSize",e,t,n);return[a.maxPool(M("x",e,t,n),[i[1],i[2]],[r[1],r[2]],s)]}case"MaxPoolWithArgmax":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("kernelSize",e,t,n),o=M("includeBatchInIndex",e,t,n),{result:l,indexes:d}=a.maxPoolWithArgmax(M("x",e,t,n),[i[1],i[2]],[r[1],r[2]],s,o);return[l,d]}case"AvgPool3D":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("kernelSize",e,t,n);return[a.avgPool3d(M("x",e,t,n),[i[1],i[2],i[3]],[r[1],r[2],r[3]],s)]}case"MaxPool3D":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("kernelSize",e,t,n);return[a.maxPool3d(M("x",e,t,n),[i[1],i[2],i[3]],[r[1],r[2],r[3]],s)]}case"Dilation2D":{let r=M("strides",e,t,n),s=M("pad",e,t,n),i=M("dilations",e,t,n),o=r[1],l=r[2],d=i[1],c=i[2];return[a.dilation2d(M("x",e,t,n),M("filter",e,t,n),[o,l],s,[d,c],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},wbe=(e,t,n,a=Fr)=>{switch(e.op){case"Fill":{let r=M("shape",e,t,n),s=M("dtype",e,t,n),i=M("value",e,t,n);return[a.fill(r,i,s)]}case"LinSpace":{let r=M("start",e,t,n),s=M("stop",e,t,n),i=M("num",e,t,n);return[a.linspace(r,s,i)]}case"Multinomial":{let r=M("logits",e,t,n),s=M("numSamples",e,t,n),i=M("seed",e,t,n);return[a.multinomial(r,s,i)]}case"OneHot":{let r=M("indices",e,t,n),s=M("depth",e,t,n),i=M("onValue",e,t,n),o=M("offValue",e,t,n),l=M("dtype",e,t,n);return[a.oneHot(r,s,i,o,l)]}case"Ones":return[a.ones(M("shape",e,t,n),M("dtype",e,t,n))];case"OnesLike":return[a.onesLike(M("x",e,t,n))];case"RandomStandardNormal":return[a.randomStandardNormal(M("shape",e,t,n),M("dtype",e,t,n),M("seed",e,t,n))];case"RandomUniform":return[a.randomUniform(M("shape",e,t,n),M("minval",e,t,n),M("maxval",e,t,n),M("dtype",e,t,n))];case"RandomUniformInt":return[a.randomUniformInt(M("shape",e,t,n),M("minval",e,t,n),M("maxval",e,t,n),M("seed",e,t,n))];case"Range":{let r=M("start",e,t,n),s=M("stop",e,t,n),i=M("step",e,t,n);return[a.range(r,s,i,M("dtype",e,t,n))]}case"TruncatedNormal":{let r=M("shape",e,t,n),s=M("mean",e,t,n),i=M("stdDev",e,t,n),o=M("seed",e,t,n);return[a.truncatedNormal(r,s,i,M("dtype",e,t,n),o)]}case"Zeros":return[a.zeros(M("shape",e,t,n),M("dtype",e,t,n))];case"ZerosLike":return[a.zerosLike(M("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function MN(e,t,n){let a=M("boxes",e,t,n),r=M("scores",e,t,n),s=M("maxOutputSize",e,t,n),i=M("iouThreshold",e,t,n),o=M("scoreThreshold",e,t,n),l=M("softNmsSigma",e,t,n);return{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}}var Sbe=async(e,t,n,a,r=Fr)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:s,scores:i,maxOutputSize:o,iouThreshold:l,scoreThreshold:d,softNmsSigma:c}=MN(e,t,n),f=await r.image.nonMaxSuppressionWithScoreAsync(s,i,o,l,d,c);return[f.selectedIndices,f.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:s,scores:i,maxOutputSize:o,iouThreshold:l,scoreThreshold:d}=MN(e,t,n),c=M("padToMaxOutputSize",e,t,n),f=await r.image.nonMaxSuppressionPaddedAsync(s,i,o,l,d,c);return[f.selectedIndices,f.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:s,scores:i,maxOutputSize:o,iouThreshold:l,scoreThreshold:d}=MN(e,t,n);return[await r.image.nonMaxSuppressionAsync(s,i,o,l,d)]}case"Where":{let s=r.cast(M("condition",e,t,n),"bool"),i=[await r.whereAsync(s)];return s.dispose(),i}case"ListDiff":return r.setdiff1dAsync(M("x",e,t,n),M("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}},kbe=(e,t,n,a=Fr)=>{switch(e.op){case"LowerBound":{let r=M("sortedSequence",e,t,n),s=M("values",e,t,n);return[a.lowerBound(r,s)]}case"TopKV2":{let r=M("x",e,t,n),s=M("k",e,t,n),i=M("sorted",e,t,n),o=a.topk(r,s,i);return[o.values,o.indices]}case"UpperBound":{let r=M("sortedSequence",e,t,n),s=M("values",e,t,n);return[a.upperBound(r,s)]}case"Unique":{let r=M("x",e,t,n),s=a.unique(r);return[s.values,s.indices]}case"UniqueV2":{let r=M("x",e,t,n),s=M("axis",e,t,n),i=a.unique(r,s);return[i.values,i.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Nbe=(e,t,n,a=Fr)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let r=M("default",e,t,n);return[Wr(e.name,t,n)||r];case"Placeholder":return[Wr(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let c=M("x",e,t,n);return[Ml(c)]}case"IdentityN":return M("x",e,t,n).map(c=>Ml(c));case"Snapshot":let s=M("x",e,t,n);return[Ml(s)];case"Shape":return[a.tensor1d(M("x",e,t,n).shape,"int32")];case"ShapeN":return M("x",e,t,n).map(c=>a.tensor1d(c.shape));case"Size":return[a.scalar(M("x",e,t,n).size,"int32")];case"Rank":return[a.scalar(M("x",e,t,n).rank,"int32")];case"NoOp":return[a.scalar(1)];case"Print":let i=M("x",e,t,n),o=M("data",e,t,n),l=M("message",e,t,n),d=M("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(l);for(let c=0;c<o.length;c++)console.log(Array.prototype.slice.call(o[c].dataSync()).slice(0,d));return[i];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Cbe=class{get id(){return this.handle.id}constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=Et(0),this.tensorMap=new Map,xr(this.handle)}clearAndClose(){this.tensorMap.forEach(e=>e.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Et(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return this.tensorMap.forEach(a=>a.dispose()),this.tensorMap.clear(),ue(()=>{let a=$a(t),r=n.length,s=a.length;R.assert(r===s,()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${s} elements.`);for(let i=0;i<r;i++){let o=n[i],l=a[i];xr(l),this.tensorMap.set(o,l)}return this.handle})}async find(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return ue(()=>{let a=[];for(let r=0;r<n.length;r++){let s=n[r],i=this.findWithDefault(s,t);a.push(i)}return rr(a)})}findWithDefault(e,t){let n=this.tensorMap.get(e);return n??t}checkKeyAndValueTensor(e,t){if(e.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${e.dtype}`);if(t.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${t.dtype}`)}},Ebe=async(e,t,n,a)=>{switch(e.op){case"HashTable":case"HashTableV2":{let r=a.getHashTableHandleByName(e.name);if(r!=null)return[r];{let s=M("keyDType",e,t,n),i=M("valueDType",e,t,n),o=new Cbe(s,i);return a.addHashTable(e.name,o),[o.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{let r=M("tableHandle",e,t,n,a),s=M("keys",e,t,n),i=M("values",e,t,n);return[await a.getHashTableById(r.id).import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{let r=M("tableHandle",e,t,n,a),s=M("keys",e,t,n),i=M("defaultValue",e,t,n);return[await a.getHashTableById(r.id).find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{let r=M("tableHandle",e,t,n,a);return[a.getHashTableById(r.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ibe=(e,t,n,a=Fr)=>{switch(e.op){case"ResizeBilinear":{let r=M("images",e,t,n),s=M("size",e,t,n),i=M("alignCorners",e,t,n),o=M("halfPixelCenters",e,t,n);return[a.image.resizeBilinear(r,[s[0],s[1]],i,o)]}case"ResizeNearestNeighbor":{let r=M("images",e,t,n),s=M("size",e,t,n),i=M("alignCorners",e,t,n),o=M("halfPixelCenters",e,t,n);return[a.image.resizeNearestNeighbor(r,[s[0],s[1]],i,o)]}case"CropAndResize":{let r=M("image",e,t,n),s=M("boxes",e,t,n),i=M("boxInd",e,t,n),o=M("cropSize",e,t,n),l=M("method",e,t,n),d=M("extrapolationValue",e,t,n);return[a.image.cropAndResize(r,s,i,o,l,d)]}case"ImageProjectiveTransformV3":{let r=M("images",e,t,n),s=M("transforms",e,t,n),i=M("outputShape",e,t,n),o=M("fillValue",e,t,n),l=M("interpolation",e,t,n),d=M("fillMode",e,t,n);return[a.image.transform(r,s,l.toLowerCase(),d.toLowerCase(),o,i)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Tbe=(e,t,n,a=Fr)=>{switch(e.op){case"Equal":return[a.equal(M("a",e,t,n),M("b",e,t,n))];case"NotEqual":return[a.notEqual(M("a",e,t,n),M("b",e,t,n))];case"Greater":return[a.greater(M("a",e,t,n),M("b",e,t,n))];case"GreaterEqual":return[a.greaterEqual(M("a",e,t,n),M("b",e,t,n))];case"Less":return[a.less(M("a",e,t,n),M("b",e,t,n))];case"LessEqual":return[a.lessEqual(M("a",e,t,n),M("b",e,t,n))];case"LogicalAnd":return[a.logicalAnd(M("a",e,t,n),M("b",e,t,n))];case"LogicalNot":return[a.logicalNot(M("a",e,t,n))];case"LogicalOr":return[a.logicalOr(M("a",e,t,n),M("b",e,t,n))];case"Select":case"SelectV2":return[a.where(M("condition",e,t,n),M("a",e,t,n),M("b",e,t,n))];case"BitwiseAnd":return[a.bitwiseAnd(M("a",e,t,n),M("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Abe=(e,t,n,a=Fr)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[a.matMul(M("a",e,t,n),M("b",e,t,n),M("transposeA",e,t,n),M("transposeB",e,t,n))];case"Einsum":return[a.einsum(M("equation",e,t,n),...M("tensors",e,t,n))];case"Transpose":return[a.transpose(M("x",e,t,n),M("perm",e,t,n))];case"_FusedMatMul":let[r,s]=M("fusedOps",e,t,n),i=r==="biasadd",o=s==="prelu",l=M("numArgs",e,t,n),d=M("leakyreluAlpha",e,t,n);if(i){if(o&&l!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&l!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[c,f]=M("args",e,t,n);return[a.fused.matMul({a:M("a",e,t,n),b:M("b",e,t,n),transposeA:M("transposeA",e,t,n),transposeB:M("transposeB",e,t,n),bias:c,activation:s,preluActivationWeights:f,leakyreluAlpha:d})];case"MatrixBandPart":return[a.linalg.bandPart(M("a",e,t,n),M("numLower",e,t,n),M("numUpper",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},_be=(e,t,n,a=Fr)=>{switch(e.op){case"EuclideanNorm":return[a.euclideanNorm(M("x",e,t,n),M("axis",e,t,n),M("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":return[a.batchNorm(M("x",e,t,n),M("mean",e,t,n),M("variance",e,t,n),M("offset",e,t,n),M("scale",e,t,n),M("epsilon",e,t,n))];case"FusedBatchNormV3":return[a.batchNorm(M("x",e,t,n),M("mean",e,t,n),M("variance",e,t,n),M("offset",e,t,n),M("scale",e,t,n),M("epsilon",e,t,n))];case"LRN":return[a.localResponseNormalization(M("x",e,t,n),M("radius",e,t,n),M("bias",e,t,n),M("alpha",e,t,n),M("beta",e,t,n))];case"Softmax":return[a.softmax(M("x",e,t,n))];case"LogSoftmax":return[a.logSoftmax(M("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},jbe=(e,t,n,a=Fr)=>{switch(e.op){case"RaggedGather":{let{outputNestedSplits:r,outputDenseValues:s}=a.raggedGather(M("paramsNestedSplits",e,t,n),M("paramsDenseValues",e,t,n),M("indices",e,t,n),M("outputRaggedRank",e,t,n));return r.concat(s)}case"RaggedRange":{let{rtNestedSplits:r,rtDenseValues:s}=a.raggedRange(M("starts",e,t,n),M("limits",e,t,n),M("splits",e,t,n));return[r,s]}case"RaggedTensorToTensor":return[a.raggedTensorToTensor(M("shape",e,t,n),M("values",e,t,n),M("defaultValue",e,t,n),M("rowPartitionTensors",e,t,n),M("rowPartitionTypes",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Dbe=(e,t,n,a=Fr)=>{switch(e.op){case"Max":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.max(M("x",e,t,n),o,l)]}case"Mean":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.mean(M("x",e,t,n),o,l)]}case"Min":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.min(M("x",e,t,n),o,l)]}case"Sum":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.sum(M("x",e,t,n),o,l)]}case"All":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.all(M("x",e,t,n),o,l)]}case"Any":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.any(M("x",e,t,n),o,l)]}case"ArgMax":{let o=M("axis",e,t,n);return[a.argMax(M("x",e,t,n),o)]}case"ArgMin":{let o=M("axis",e,t,n);return[a.argMin(M("x",e,t,n),o)]}case"Prod":{let o=M("axis",e,t,n),l=M("keepDims",e,t,n);return[a.prod(M("x",e,t,n),o,l)]}case"Cumprod":{let o=M("axis",e,t,n),l=M("exclusive",e,t,n),d=M("reverse",e,t,n);return[a.cumprod(M("x",e,t,n),o,l,d)]}case"Cumsum":{let o=M("axis",e,t,n),l=M("exclusive",e,t,n),d=M("reverse",e,t,n);return[a.cumsum(M("x",e,t,n),o,l,d)]}case"Bincount":let r=M("x",e,t,n),s=M("weights",e,t,n),i=M("size",e,t,n);return[a.bincount(r,s,i)];case"DenseBincount":{let o=M("x",e,t,n),l=M("weights",e,t,n),d=M("size",e,t,n),c=M("binaryOutput",e,t,n);return[a.denseBincount(o,l,d,c)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Rbe=(e,t,n,a=Fr)=>{switch(e.op){case"ConcatV2":case"Concat":{let r=M("n",e,t,n),s=M("axis",e,t,n),i=M("tensors",e,t,n);return i=i.slice(0,r),[a.concat(i,s)]}case"Gather":{let r=M("x",e,t,n),s=M("indices",e,t,n);return[a.gather(r,a.cast(s,"int32"),0)]}case"GatherV2":{let r=M("axis",e,t,n),s=M("batchDims",e,t,n),i=M("x",e,t,n),o=M("indices",e,t,n);return[a.gather(i,a.cast(o,"int32"),r,s)]}case"Reverse":{let r=M("dims",e,t,n),s=[];for(let o=0;o<r.length;o++)r[o]&&s.push(o);let i=M("x",e,t,n);return[a.reverse(i,s)]}case"ReverseV2":{let r=M("axis",e,t,n),s=M("x",e,t,n);return[a.reverse(s,r)]}case"Slice":{let r=M("begin",e,t,n),s=M("size",e,t,n);return[a.slice(M("x",e,t,n),r,s)]}case"StridedSlice":{let r=M("begin",e,t,n),s=M("end",e,t,n),i=M("strides",e,t,n),o=M("beginMask",e,t,n),l=M("endMask",e,t,n),d=M("ellipsisMask",e,t,n),c=M("newAxisMask",e,t,n),f=M("shrinkAxisMask",e,t,n),m=M("x",e,t,n);return[a.stridedSlice(m,r,s,i,o,l,d,c,f)]}case"Pack":return ue(()=>{let r=M("axis",e,t,n),s=M("tensors",e,t,n),i=s[0].shape,o=a.squeeze(s[0]).shape,l=s.map(d=>{let c=R.arraysEqual(d.shape,i);if(!c&&!R.arraysEqual(a.squeeze(d).shape,o))throw new Error("the input tensors shape does not match");return c?d:a.reshape(d,i)});return[a.stack(l,r)]});case"Unpack":{let r=M("axis",e,t,n),s=M("tensor",e,t,n);return a.unstack(s,r)}case"Tile":{let r=M("reps",e,t,n);return[a.tile(M("x",e,t,n),r)]}case"Split":case"SplitV":{let r=M("axis",e,t,n),s=M("numOrSizeSplits",e,t,n),i=M("x",e,t,n);return a.split(i,s,r)}case"ScatterNd":{let r=M("indices",e,t,n),s=M("values",e,t,n),i=M("shape",e,t,n);return[a.scatterND(r,s,i)]}case"GatherNd":{let r=M("x",e,t,n),s=M("indices",e,t,n);return[a.gatherND(r,s)]}case"SparseToDense":{let r=M("sparseIndices",e,t,n),s=M("outputShape",e,t,n),i=M("sparseValues",e,t,n),o=M("defaultValue",e,t,n);return[a.sparseToDense(r,i,s,i.dtype===o.dtype?o:a.cast(o,i.dtype))]}case"TensorScatterUpdate":{let r=M("indices",e,t,n),s=M("values",e,t,n),i=M("tensor",e,t,n);return[a.tensorScatterUpdate(i,r,s)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Mbe=(e,t,n,a=Fr)=>{switch(e.op){case"SparseFillEmptyRows":{let{outputIndices:r,outputValues:s,emptyRowIndicator:i,reverseIndexMap:o}=a.sparse.sparseFillEmptyRows(M("indices",e,t,n),M("values",e,t,n),M("denseShape",e,t,n),M("defaultValue",e,t,n));return[r,s,i,o]}case"SparseReshape":{let{outputIndices:r,outputShape:s}=a.sparse.sparseReshape(M("inputIndices",e,t,n),M("inputShape",e,t,n),M("newShape",e,t,n));return[r,s]}case"SparseSegmentMean":return[a.sparse.sparseSegmentMean(M("data",e,t,n),M("indices",e,t,n),M("segmentIds",e,t,n))];case"SparseSegmentSum":return[a.sparse.sparseSegmentSum(M("data",e,t,n),M("indices",e,t,n),M("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},$be=(e,t,n,a=Fr)=>{switch(e.op){case"FFT":return[a.fft(M("x",e,t,n))];case"IFFT":return[a.ifft(M("x",e,t,n))];case"RFFT":return[a.rfft(M("x",e,t,n))];case"IRFFT":return[a.irfft(M("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Bbe=(e,t,n,a=Fr)=>{switch(e.op){case"StaticRegexReplace":return[a.string.staticRegexReplace(M("input",e,t,n),M("pattern",e,t,n),M("rewrite",e,t,n),M("replaceGlobal",e,t,n))];case"StringNGrams":{let{nGrams:r,nGramsSplits:s}=a.string.stringNGrams(M("data",e,t,n),M("dataSplits",e,t,n),M("separator",e,t,n),M("nGramWidths",e,t,n),M("leftPad",e,t,n),M("rightPad",e,t,n),M("padWidth",e,t,n),M("preserveShortSequences",e,t,n));return[r,s]}case"StringSplit":{let{indices:r,values:s,shape:i}=a.string.stringSplit(M("input",e,t,n),M("delimiter",e,t,n),M("skipEmpty",e,t,n));return[r,s,i]}case"StringToHashBucketFast":return[a.string.stringToHashBucketFast(M("input",e,t,n),M("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Fbe=(e,t,n,a=Fr)=>{switch(e.op){case"Cast":return[a.cast(M("x",e,t,n),M("dtype",e,t,n))];case"ExpandDims":{let r=M("axis",e,t,n);return[a.expandDims(M("x",e,t,n),r)]}case"Squeeze":{let r=M("axis",e,t,n);return[a.squeeze(M("x",e,t,n),r)]}case"Reshape":return[a.reshape(M("x",e,t,n),M("shape",e,t,n))];case"EnsureShape":return[a.ensureShape(M("x",e,t,n),M("shape",e,t,n))];case"MirrorPad":return[a.mirrorPad(M("x",e,t,n),M("padding",e,t,n),M("mode",e,t,n))];case"PadV2":case"Pad":return[a.pad(M("x",e,t,n),M("padding",e,t,n),M("c
102onstantValue",e,t,n))];case"SpaceToBatchND":{let r=M("blockShape",e,t,n),s=M("paddings",e,t,n);return[a.spaceToBatchND(M("x",e,t,n),r,s)]}case"BatchToSpaceND":{let r=M("blockShape",e,t,n),s=M("crops",e,t,n);return[a.batchToSpaceND(M("x",e,t,n),r,s)]}case"DepthToSpace":{let r=M("blockSize",e,t,n),s=M("dataFormat",e,t,n).toUpperCase();return[a.depthToSpace(M("x",e,t,n),r,s)]}case"BroadcastTo":return[a.broadcastTo(M("x",e,t,n),M("shape",e,t,n))];case"BroadcastArgs":return[a.broadcastArgs(M("s0",e,t,n),M("s1",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function j$(e,t,n,a,r=ue){let s=((i,o,l)=>{switch(i.category){case"arithmetic":return r(()=>hbe(i,o,l));case"basic_math":return r(()=>pbe(i,o,l));case"control":return bbe(i,o,l);case"convolution":return r(()=>vbe(i,o,l));case"creation":return r(()=>wbe(i,o,l));case"dynamic":return Sbe(i,o,l);case"evaluation":return r(()=>kbe(i,o,l));case"image":return r(()=>Ibe(i,o,l));case"graph":return r(()=>Nbe(i,o,l));case"logical":return r(()=>Tbe(i,o,l));case"matrices":return r(()=>Abe(i,o,l));case"normalization":return r(()=>_be(i,o,l));case"ragged":return r(()=>jbe(i,o,l));case"reduction":return r(()=>Dbe(i,o,l));case"slice_join":return r(()=>Rbe(i,o,l));case"sparse":return r(()=>Mbe(i,o,l));case"spectral":return r(()=>$be(i,o,l));case"string":return r(()=>Bbe(i,o,l));case"transformation":return r(()=>Fbe(i,o,l));case"hash_table":return Ebe(i,o,l,a);case"custom":let d=zz(i.op);if(d&&d.customExecutor)return d.customExecutor(new dbe(i,o,l));throw TypeError(`Custom op ${i.op} is not registered.`);default:throw TypeError(`Unknown op '${i.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return R.isPromise(s)?s.then(i=>[].concat(i)):[].concat(s)}var D$=class{constructor(e={},t={},n={},a={},r){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=a,this.parseNodeNameCache=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,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(){let e=[];for(let t=0;t<this.contexts.length-1;t++){let n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map(t=>t.id===0&&t.iterationId===0?"":`${t.frameName}-${t.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++;let 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(let t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(let t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}};function R$(e,t,n,a){let r=new Set,s=[],i=null,o=null,l=new Set,d=new Set(Object.keys(e).map(m=>Zs(m)[0]));a=a||[];let c=new Set(a.map(m=>Zs(m.name)[0])),f=[...t];for(;f.length>0;){let m=f.pop();if((dd(m)||Hbe(m)||Gbe(m))&&i==null&&(i=m,o=i.children.map(x=>x.name).filter(x=>r.has(x))),r.add(m.name),n[m.name]==null&&!d.has(m.name)&&!c.has(m.name)){if(m.input
vendor: 4,226 bytes, line 102
102s.length===0){s.push(m.name);continue}m.inputs.forEach(x=>{l.has(x.name)||(l.add(x.name),f.push(x))})}}return{inputs:e,outputs:t,usedNodes:r,missingInputs:s,dynamicNode:i,syncInputs:o}}function Obe(e,t){let{usedNodes:n,inputs:a}=t,r=Object.keys(a).map(w=>Zs(w)[0]).map(w=>e.nodes[w]),s=e.initNodes||[],i=w=>n.has(typeof w=="string"?w:w.name);function o(w){return[...new Map(w.map(S=>[S.name,S])).values()]}let l=o([...r,...e.weights,...s]).filter(i),d=o([...l,...Object.values(e.nodes)]).filter(i),c=new Map(d.map(w=>[w.name,w])),f={};for(let w of d){f[w.name]=f[w.name]||0;for(let S of w.children)i(S)||(f[S.name]=Number.POSITIVE_INFINITY),f[S.name]=(f[S.name]||0)+1}let m=Object.entries(f).filter(([,w])=>w===0).map(([w])=>w),x=[...m];for(;m.length>0;){let w=m.pop(),S=c.get(w);for(let k of S.children.filter(i))--f[k.name]===0&&(x.push(k.name),m.push(k.name))}let y=x.map(w=>c.get(w)),b=Lbe(y,l);return Pbe(b,l),b}function Lbe(e,t){let n=new Map(e.map(s=>[s.name,s])),a=t.map(s=>s.name),r=new Set(a);for(;a.length>0;){let s=a.pop(),i=n.get(s);for(let o of i.children)!n.has(o.name)||r.has(o.name)||(r.add(o.name),a.push(o.name))}return e.filter(s=>r.has(s.name))}var B1=class extends Error{constructor(e){super(`NodesExecutionOrderError: ${e}`)}};function Pbe(e,t){let n=new Map(e.map((o,l)=>[o.name,l])),a=new Set(t.map(o=>o.name)),r=o=>a.has(typeof o=="string"?o:o.name),s=new Set(e.map(o=>o.name)),i=o=>s.has(typeof o=="string"?o:o.name);for(let o of e){for(let l of o.children.filter(i)){if(!n.has(l.name))throw new B1(`Child ${l.name} of node ${o.name} is unreachable.`);if(n.get(o.name)>n.get(l.name))throw new B1(`Node ${o.name} is scheduled to run after its child ${l.name}.`)}if(!r(o))for(let l of o.inputs){if(!n.has(l.name))throw new B1(`Input ${l.name} of node ${o.name} is unreachable.`);if(n.get(l.name)>n.get(o.name))throw new B1(`Node ${o.name} is scheduled to run before its input ${l.name}.`)}}}function zbe(e){let t=new Map(e.map((o,l)=>[o.name,l])),n=Number.MAX_SAFE_INTEGER,a=e.map((o,l)=>dd(o)?n:l),r=o=>{let l=a[t.get(o.name)];return l??-1},s=e.map((o,l)=>o.children.map(r).reduce((d,c)=>Math.max(d,c),a[l])),i=new Map;for(let o=0;o<e.length;++o){let l=s[o];if(l===n)continue;let d=e[o],c=e[l];i.has(c.name)||i.set(c.name,[]),i.get(c.name).push(d)}return i}var Ube=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),Wbe=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),Vbe=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function dd(e){return Ube.has(e.op)}function Hbe(e){return Wbe.has(e.op)}function Gbe(e){return Vbe.has(e.op)}var M$=class u7{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(t){let n=Object.keys(t).map(a=>t[a].map(r=>r.id));this._weightIds=[].concat(...n),this._weightMap=t}set resourceManager(t){this._resourceManager=t}get inputs(){return this._inputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(t=>t.signatureKey||t.name)}get outputNodes(){return this._outputs.map(t=>{let n=t.signatureKey||t.name;return t.defaultOutput?`${n}:${t.defaultOutput}`:n})}get functions(){return Object.keys(this._functions).reduce((t,n)=>(t[n]=this._functions[n].signature,t),{})}constructor(t,n){this.graph=t,this.parent=n,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=t.outputs,this._inputs=t.inputs,this._initNodes=t.initNodes,this._signature=t.signature,this._functions=t.functions,t.functions!=null&&Object.keys(t.functions).forEac
vendor: 40,132 bytes, lines 102-104
102h(a=>{this._functionExecutorMap[a]=new u7(t.functions[a],this)})}getCompilationKey(t,n){let a=t.map(s=>s.name).sort(),r=n.map(s=>s.name).sort();return a.join(this.SEPARATOR)+"--"+r.join(this.SEPARATOR)}compile(t,n){let a=R$(t,n,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:s,syncInputs:i}=a;if(s!=null)throw new Error(`This execution contains the node '${s.name}', which has the dynamic op '${s.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${i}]`);if(r.length>0){let d=n.map(f=>f.name),c=Object.keys(t);throw new Error(`Cannot compute the outputs [${d}] from the provided inputs [${c}]. Missing the following inputs: [${r}]`)}let o=Obe(this.graph,a),l=zbe(o);return{orderedNodes:o,nodeLiveUntilMap:l}}cloneAndKeepTensor(t){if(t==null)return null;let n=t.clone();return xr(n),n}cloneTensorList(t){return t?t.map(n=>this.cloneAndKeepTensor(n)):null}cloneTensorMap(t){return Object.fromEntries(Object.entries(t).map(([n,a])=>[n,this.cloneTensorList(a)]))}execute(t,n){this.disposeIntermediateTensors(),t=this.mapInputs(t);let a=Object.keys(t).sort();this.checkInputs(t),this.checkInputShapeAndType(t),n=this.mapOutputs(n),this.checkOutputs(n);let r=a.map(m=>this.graph.nodes[Zs(m)[0]]),s=n.map(m=>Zs(m)[0]),i=new Set(s),o=s.map(m=>this.graph.nodes[m]);o.length===0&&(o=this._outputs);let l=this.getCompilationKey(r,o),d=this.compiledMap.get(l);d==null&&(d=this.compile(t,o),this.compiledMap.set(l,d));try{this.keepIntermediateTensors=fe().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(m){this.keepIntermediateTensors=!1,console.warn(m.message)}let c={},f={};return ue(()=>{let m=new D$(this.weightMap,c,f,this.functionExecutorMap,this.parseNodeNameCache),x=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(t).forEach(S=>{let[k,C]=Zs(S,m),E=[];E[C]=t[S],x[k]=E,this.keepIntermediateTensors&&(this.clonedTensorsMap[k]=this.cloneTensorList(E))});let y=this.getFrozenTensorIds(x),{orderedNodes:b,nodeLiveUntilMap:w}=d;for(let S of b){if(x[S.name])continue;let k=j$(S,x,m,this._resourceManager);if(R.isPromise(k))throw new Error(`The execution of the op '${S.op}' returned a promise. Please use model.executeAsync() instead.`);x[S.name]=k,this.keepIntermediateTensors&&(this.clonedTensorsMap[S.name]=this.cloneTensorList(k)),this.checkTensorForDisposalWithNodeLiveUntilInfo(S,x,m,y,i,w.get(S.name))}return this.parent==null&&m.dispose(y),n.map(S=>Wr(S,x,m))})}getFrozenTensorIds(t){let n=[].concat.apply([],Object.keys(t).map(a=>t[a]).map(a=>a.map(r=>r.id)));return new Set(n)}checkTensorForDisposal(t,n,a,r,s,i,o){if(!(dd(n)||i.has(t))){for(let l of a[t])l!=null&&(o[l.id]=(o[l.id]||0)+n.children.length);for(let l of n.inputs){if(dd(l))continue;let d=E$(l.name,a,r);if(d!=null)for(let c of d){if(!c||c.kept||s.has(c.id))continue;let f=o[c.id];f===1?(c.dispose(),delete o[c.id]):f!=null&&o[c.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(t,n,a,r,s,i){function o(l){return dd(l)||s.has(l.name)}if(!(dd(t)||i==null))for(let l of i){if(o(l))continue;let d=E$(l.name,n,a);for(let c of d)!c||c.kept||r.has(c.id)||c.dispose()}}async executeAsync(t,n){return this._executeAsync(t,n)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach(t=>{for(let n of t)n&&!n.isDisposed&&n.dispose()}),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(t,n,a=!1,r={},s={}){this.disposeIntermediateTensors(),a||(t=this.mapInputs(t),this.checkInputs(t),this.checkInputShapeAndType(t),n=this.mapOutputs(n),this.checkOutputs(n));try{this.keepIntermediateTensors=fe().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(m){this.keepIntermediateTensors=!1,console.warn(m.message)}let i=new D$(this.weightMap,r,s,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));let o=await this.executeWithControlFlow(t,i,n,a),l=n.map(m=>Wr(m,o,i)),d=l.map(m=>m.id),c=Object.keys(t).map(m=>t[m].id),f=new Set([...d,...c,...this.weightIds]);return Object.values(o).forEach(m=>{m.forEach(x=>{x&&!x.isDisposed&&!f.has(x.id)&&x.dispose()})}),this.parent==null&&i.dispose(f),l}async executeFunctionAsync(t,n,a){let r=t.reduce((s,i,o)=>(s[this.inputs[o].name]=i,s),{});return this._executeAsync(r,this.outputNodes,!0,n,a)}async executeWithControlFlow(t,n,a,r){let s=Object.keys(t),i=s.map(E=>this.graph.nodes[Zs(E)[0]]),o=a.map(E=>Zs(E)[0]),l=new Set(o),d=o.map(E=>this.graph.nodes[E]);d.length===0&&(d=this._outputs);let{usedNodes:c,missingInputs:f,dynamicNode:m,syncInputs:x}=R$(t,d,this.weightMap,this._initNodes),y=[...i,...this.graph.weights,...this._initNodes||[]].map(E=>({node:E,contexts:n.currentContext})),b=Object.assign({},this.weightMap);Object.keys(t).forEach(E=>{let[T,_]=Zs(E),A=[];A[_]=t[E],b[T]=A});let w={},S=this.getFrozenTensorIds(b),k={};for(;y.length>0;){let E=this.processStack(i,y,n,b,k,S,l,w,c);await Promise.all(E)}m==null&&!r&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let C=d.filter(E=>!dd(E)&&!Wr(E.name,b,n)).map(E=>E.name);if(C.length>0){let E="";throw m!=null&&(E=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${x}]`),new Error(`Cannot compute the outputs [${C}] from the provided inputs [${s}]. Consider providing the following inputs: [${f}]. ${E}`)}return b}processStack(t,n,a,r,s,i,o,l,d){let c=[];for(;n.length>0;){let f=n.pop();a.currentContext=f.contexts;let m="";if(f.node.op==="Enter"&&M("isConstant",f.node,r,a)&&([m]=Rl(f.node.name,a)),r[f.node.name]==null){let x=j$(f.node,r,a,this._resourceManager);m||([m]=Rl(f.node.name,a));let y=a.currentContext;R.isPromise(x)?c.push(x.then(b=>(r[m]=b,this.keepIntermediateTensors&&(this.clonedTensorsMap[m]=this.cloneTensorList(b)),a.currentContext=y,this.checkTensorForDisposal(m,f.node,r,a,i,o,l),this.processChildNodes(f.node,n,a,r,s,d),b))):(r[m]=x,this.keepIntermediateTensors&&(this.clonedTensorsMap[m]=this.cloneTensorList(x)),this.checkTensorForDisposal(m,f.node,r,a,i,o,l),this.processChildNodes(f.node,n,a,r,s,d))}else this.processChildNodes(f.node,n,a,r,s,d)}return c}processChildNodes(t,n,a,r,s,i){t.children.forEach(o=>{let[l]=Rl(o.name,a);s[l]||!i.has(o.name)||(o.op==="Merge"?o.inputNames.some(d=>!!Wr(d,r,a))&&(s[l]=!0,n.push({contexts:a.currentContext,node:o})):o.inputNames.every(d=>!!Wr(d,r,a))&&(s[l]=!0,n.push({contexts:a.currentContext,node:o})))})}dispose(){Object.keys(this.weightMap).forEach(t=>this.weightMap[t].forEach(n=>n.dispose()))}checkInputShapeAndType(t){Object.keys(t).forEach(n=>{let a=t[n],[r]=Zs(n),s=this.graph.nodes[r];if(s.attrParams.shape&&s.attrParams.shape.value){let i=s.attrParams.shape.value,o=i.length===a.shape.length&&a.shape.every((l,d)=>i[d]===-1||i[d]===l);R.assert(o,()=>`The shape of dict['${s.name}'] provided in model.execute(dict) must be [${i}], but was [${a.shape}]`)}s.attrParams.dtype&&s.attrParams.dtype.value&&R.assert(a.dtype===s.attrParams.dtype.value,()=>`The dtype of dict['${s.name}'] provided in model.execute(dict) must be ${s.attrParams.dtype.value}, but was ${a.dtype}`)})}mapInputs(t){var n,a;let r={};for(let s in t){let i=(a=(n=this._signature)===null||n===void 0?void 0:n.inputs)===null||a===void 0?void 0:a[s];i!=null?r[i.name]=t[s]:r[s]=t[s]}return r}checkInputs(t){let n=Object.keys(t).filter(a=>{let[r]=Zs(a);return this.graph.nodes[r]==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(t){return t.map(n=>{var a,r;let s=(r=(a=this._signature)===null||a===void 0?void 0:a.outputs)===null||r===void 0?void 0:r[n];return s!=null?s.name:n},{})}checkOutputs(t){t.forEach(n=>{let[a]=Zs(n);if(!this.graph.nodes[a])throw new Error(`The output '${n}' is not found in the graph`)})}},qbe=class{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(let e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(let e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}},Kbe="?tfjs-format=file",Xbe="model.json",Y_=class{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,t={},n=Hr){this.modelUrl=e,this.loadOptions=t,this.version="n/a",this.io=n,t==null&&(this.loadOptions={}),this.resourceManager=new qbe}findIOHandler(){let e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{let t=this.io.getLoadHandlers(e,this.loadOptions);if(t.length===0)t.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[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.");let e=this.handler.load();return R.isPromise(e)?e.then(t=>t.getWeightStream==null?this.loadSync(t):this.loadStreaming(t)):this.loadSync(e)}loadSync(e){let t=this.io.decodeWeights(e.weightData,e.weightSpecs);return this.loadWithWeightMap(e,t)}async loadStreaming(e){if(e.getWeightStream==null)throw new Error("Model artifacts missing streamWeights function");let t=await hL(e.getWeightStream(),e.weightSpecs);return this.loadWithWeightMap(e,t)}loadWithWeightMap(e,t){this.artifacts=e;let n=this.artifacts.modelTopology,a=this.artifacts.signature;if(this.artifacts.userDefinedMetadata!=null){let r=this.artifacts.userDefinedMetadata;r.signature!=null&&(a=r.signature),r.structuredOutputKeys!=null&&(this.structuredOutputKeys=r.structuredOutputKeys)}if(this.signature=a,this.version=`${n.versions.producer}.${n.versions.minConsumer}`,this.executor=new M$(I$.Instance.transformGraph(n,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(t),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){let r=I$.Instance.transformGraph(e.modelInitializer);this.initializer=new M$(r),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}async save(e,t){if(typeof e=="string"){let n=this.io.getSaveHandlers(e);if(n.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(n.length>1)throw new Error(`Found more than one (${n.length}) save handlers for URL '${e}'`);e=n[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){let t=e instanceof en?[e]:e,n={};return t.forEach((a,r)=>n[this.structuredOutputKeys[r]]=a),n}return e}predict(e,t){let n=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(n)}async predictAsync(e,t){let n=await this.executeAsync(e,this.outputNodes);return this.addStructuredOutputNames(n)}normalizeInputs(e){var t;if(!(e instanceof en)&&!Array.isArray(e)){let r=(t=this.signature)===null||t===void 0?void 0:t.inputs;if(r!=null)for(let s in r){let i=r[s];i.resourceId!=null&&(e[s]=this.resourceIdToCapturedInput[i.resourceId])}return e}e=Array.isArray(e)?e:[e];let n=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+n!==this.inputNodes.length)throw new Error(`Input tensor count mismatch, the graph model has ${this.inputNodes.length-n} non-resource placeholders, while there are ${e.length} input tensors provided.`);let a=0;return this.inputNodes.reduce((r,s)=>{var i,o,l;let d=(l=(o=(i=this.signature)===null||i===void 0?void 0:i.inputs)===null||o===void 0?void 0:o[s])===null||l===void 0?void 0:l.resourceId;return d!=null?r[s]=this.resourceIdToCapturedInput[d]:r[s]=e[a++],r},{})}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){let t=this.initializerSignature.outputs,n=Object.keys(t);for(let a=0;a<n.length;a++){let r=n[a],s=t[r];this.resourceIdToCapturedInput[s.resourceId]=e[a]}}}execute(e,t){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((t,n)=>(t[n]=[e[n]],t),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&Kt(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}};async function Ybe(e,t={},n=Hr){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&typeof e=="string"&&(e=Qbe(e));let a=new Y_(e,t,n);return await a.load(),a}function Jbe(e){if(e==null)throw new Error("modelUrl in loadGraphModelSync() cannot be null. Please provide model artifacts or an IOHandler that loads the model");let t;if(e instanceof Array){let[a,r]=e;if(!a)throw new Error("modelJSON must be the first element of the array");if(!r||!(r instanceof ArrayBuffer))throw new Error("An ArrayBuffer of weights must be the second element of the array");if(!("modelTopology"in a))throw new Error("Model JSON is missing 'modelTopology'");if(!("weightsManifest"in a))throw new Error("Model JSON is missing 'weightsManifest'");let s=Hr.getWeightSpecs(a.weightsManifest),i=Hr.getModelArtifactsForJSONSync(a,s,r);t=Hr.fromMemorySync(i)}else if("load"in e)t=e;else if("modelTopology"in e&&"weightSpecs"in e&&"weightData"in e)t=Hr.fromMemorySync(e);else throw new Error("Unknown model format");let n=new Y_(t);return n.load(),n}function Qbe(e){return e.endsWith("/")||(e=e+"/"),`${e}${Xbe}${Kbe}`}var Zbe="4.22.0",c7={};Xt(c7,{CSVDataset:()=>w7,Dataset:()=>Ng,FileDataSource:()=>T7,TextLineDataset:()=>v7,URLDataSource:()=>A7,array:()=>S0e,csv:()=>$0e,func:()=>B0e,generator:()=>F0e,microphone:()=>L0e,version_data:()=>P0e,webcam:()=>O0e,zip:()=>k0e});var e0e=dc(fw()),t0e=dc(fw());function n0e(e,t){return zv(e,t)}function zv(e,t,n=new Map,a=new Set){if(e==null)return null;if(typeof Blob=="function"&&e instanceof Blob)return e.slice();if(a.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(r.recurse)if(Zf(e)){let s=Array.isArray(e)?[]:{};a.add(e);for(let i in e){let o=e[i],l=zv(o,t,n,a);s[i]=l}return a.delete(e),e.__proto__&&(s.__proto__=e.__proto__),s}else throw new Error(`Can't recurse into non-iterable type: ${e}`);else return n.set(e,r.value),r.value}function a0e(e,t=h7){return d7(e,t)}function d7(e,t,n=new Set){let a=e[0];if(n.has(a))throw new Error("Circular references are not supported.");let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(r.recurse)if(Zf(a)){let s=Array.isArray(a)?[]:{};n.add(a);for(let i in a){let o=e.map(d=>d[i]),l=d7(o,t,n);s[i]=l}return n.delete(a),s}else throw new Error(`Can't recurse into non-iterable type: ${a}`);else return r.value}function h7(e){return e===null?null:Zf(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function p7(e,t){let n=new Map;zv(e,t,n);for(let a of Array.from(n.keys())){let r=n.get(a);if(R.isPromise(r)){let s=await r;n.set(a,s)}}return zv(e,t,n)}function Zf(e){let t=!1;if(fe().get("IS_BROWSER"))t=e instanceof TextDecoder;else{let{StringDecoder:n}=D8();t=e instanceof n}return e!=null&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||typeof e=="object"&&!(e instanceof en)&&!(e instanceof Promise)&&!t)}function r0e(e){return e==null||s0e(e)||Array.isArray(e)||typeof e=="object"&&e instanceof en||R.isTypedArray(e)}function s0e(e){return e===null||typeof e!="object"&&typeof e!="function"}function i0e(e){return n0e(e,o0e)}function o0e(e){return e instanceof en?{value:e.clone(),recurse:!1}:Zf(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var f7=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return this.length()===0}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(let t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);let e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}},m7=class g7 extends f7{constructor(){super(g7.INITIAL_CAPACITY)}isFull(){return!1}push(t){super.isFull()&&this.expand(),super.push(t)}unshift(t){super.isFull()&&this.expand(),super.unshift(t)}expand(){let t=this.capacity*2,n=new Array(t),a=this.length();for(let r=0;r<a;r++)n[r]=this.get(this.wrap(this.begin+r));this.data=n,this.capacity=t,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=a}};m7.INITIAL_CAPACITY=32;function x7(e){return new c0e(e)}function J_(e){return new d0e(e)}function l0e(e,t){return new y7(e,t)}function u0e(e,t=Pu.FAIL){return new v0e(e,t)}var Br=class{async toArray(){let e=[],t=await this.next();for(;!t.done;)e.push(t.value),t=await this.next();return e}async toArrayForTest(){let e=this.prefetch(100),t=[],n=await e.next();for(;!n.done;)t.push(n.value),n=await e.next();return t}async resolveFully(){let e=await this.next();for(;!e.done;)e=await this.next()}async resolveWhile(e){let t=await this.next(),n=e(t.value);for(;!t.done&&n;)t=await this.next(),n=e(t.value)}handleErrors(e){return new y0e(this,e)}filter(e){return new g0e(this,e)}map(e){return new x0e(this,e)}mapAsync(e){return new $$(this,e)}serialMapAsync(e){return new $$(this,e).serial()}flatmap(e){return new b0e(this,e)}async forEachAsync(e){return this.map(e).resolveFully()}async serialForEach(e){return this.serialMapAsync(e).resolveWhile(t=>t===!0)}rowMajorBatch(e,t=!0){return new m0e(this,e,t)}columnMajorBatch(e,t=!0,n=h7){return this.rowMajorBatch(e,t).map(a=>a0e(a,n))}concatenate(e,t){return new y7(x7([this,e]),t)}take(e){return e<0||e==null?this:new f0e(this,e)}skip(e){return e<0||e==null?this:new p0e(this,e)}prefetch(e){return new b7(this,e)}shuffle(e,t){return new w0e(this,e,t)}serial(){return new h0e(this)}},c0e=class extends Br{constructor(e){super(),this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};let e=this.items[this.trav];return this.trav++,{value:i0e(e),done:!1}}},d0e=class extends Br{constructor(e){super(),this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}},h0e=class extends Br{constructor(e){super(),this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}},p0e=class extends Br{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++<this.maxCount;){let e=await this.upstream.next();if(e.done)return e;Kt(e.value)}return this.upstream.next()}},f0e=class extends Br{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0}summary(){return`${this.upstream.summary()} -> Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}},m0e=class extends Br{constructor(e,t,n=!0){super(),this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){let e=[];for(;e.length<this.batchSize;){let t=await this.upstream.next();if(t.done)return this.enableSmallLastBatch&&e.length>0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}},g0e=class extends Br{constructor(e,t){super(),this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){let e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;Kt(e.value)}}},x0e=class extends Br{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Co.getTensorsInContainer(e.value),n=this.transform(e.value),a=Co.getTensorsInContainer(n);for(let r of t)Co.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},y0e=class extends Br{constructor(e,t){super(),this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}},$$=class extends Br{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=Co.getTensorsInContainer(e.value),n=await this.transform(e.value),a=Co.getTensorsInContainer(n);for(let r of t)Co.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},Q_=class extends Br{constructor(){super(),this.outputQueue=new m7,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.outputQueue.length()===0;)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}},b0e=class extends Q_{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){let e=await this.upstream.next();if(e.done)return!1;let t=Co.getTensorsInContainer(e.value),n=this.transform(e.value),a=Co.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(let r of t)Co.isTensorInList(r,a)||r.dispose();return!0}},y7=class extends Br{constructor(e,t){super(),this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,this.iterator==null){let n=await this.moreIterators.next();if(n.done)return{value:null,done:!0};this.iterator=n.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}let t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}},Pu;(function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"})(Pu||(Pu={}));var v0e=class extends Br{constructor(e,t=Pu.FAIL){super(),this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;function a(s){return s instanceof Br?{value:s.next().then(i=>(t++,i.done&&n++,i.value)),recurse:!1}:{value:null,recurse:!0}}let r=await p7(this.iterators,a);if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case Pu.FAIL:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case Pu.SHORTEST:return{value:null,done:!0};case Pu.LONGEST:}return this.count++,{value:r,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}},b7=class extends Br{constructor(e,t){super(),this.upstream=e,this.bufferSize=t,this.buffer=new f7(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){let e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}},w0e=class extends b7{constructor(e,t,n){super(e,t),this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=t0e.alea(n||R.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){let e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(t.done)this.upstreamExhausted=!0;else return this.refill(),t}return{value:null,done:!0}}},Ng=class{constructor(){this.size=null}batch(e,t=!0){let n=this;R.assert(e>0,()=>`batchSize needs to be positive, but it is
103      ${e}`);let a;return this.size===1/0||this.size==null?a=this.size:t?a=Math.ceil(this.size/e):a=Math.floor(this.size/e),Qs(async()=>(await n.iterator()).columnMajorBatch(e,t,N0e),a)}concatenate(e){let t=this,n;return this.size===1/0||e.size===1/0?n=1/0:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,Qs(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===1/0?n=1/0:n=null,Qs(async()=>(await t.iterator()).filter(a=>ue(()=>e(a))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return Qs(async()=>(await t.iterator()).map(n=>ue(()=>e(n))),this.size)}mapAsync(e){let t=this;return Qs(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");let t=this;return Qs(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=1/0:n=null,Qs(async()=>{let a=J_(async()=>({value:await t.iterator(),done:!1}));return l0e(a.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size<e||e===void 0||e<0)?n=0:n=null,Qs(async()=>(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified.  If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);let a=this,r=e0e.alea(t||R.now().toString());return Qs(async()=>{let s=r.int32();return n&&(s+=r.int32()),(await a.iterator()).shuffle(e,s.toString())},this.size)}take(e){let t=this,n;return this.size!=null&&this.size>e?n=e:this.size!=null&&this.size<=e?n=this.size:n=null,Qs(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}};Ng.MAX_BUFFER_SIZE=1e4;function Qs(e,t=null){return new class extends Ng{constructor(){super(...arguments),this.size=t}async iterator(){return e()}}}function S0e(e){return Qs(async()=>x7(e),e.length)}function k0e(e){if(!Zf(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n<e.length;n++)t=t==null?e[n].size:Math.min(t,e[n].size);else if(e instanceof Object)for(let n in e)t=t==null?e[n].size:Math.min(t,e[n].size);return Qs(async()=>{let n=await p7(e,a=>{if(a instanceof Ng)return{value:a.iterator(),recurse:!1};if(Zf(a))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")});return u0e(n,Pu.SHORTEST)},t)}function N0e(e){if(e===null)return null;let t=e[0];return r0e(t)?{value:C0e(e),recurse:!1}:{value:null,recurse:!0}}function C0e(e){if(e.length===0)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof en?rr(e):bs(e)}var v7=class extends Ng{constructor(e){super(),this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split(`
104`).map(e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e))}},F1='"',Fx=Symbol("out"),B$=Symbol("field"),O1=Symbol("quote"),$N=Symbol("quoteafterquote"),F$=Symbol("quoteinquote"),w7=class extends Ng{async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&R.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((a,r)=>(a[r]=a[r]+1||1,a),{}),n=Object.keys(t).filter(a=>t[a]>1);if(R.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let a of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(a)===-1)throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let e=await(await this.base.iterator()).next();if(e.done)throw new Error("No data was found for CSV parsing.");let t=e.value;return this.parseRow(t,!1)}else return null}constructor(e,t){super(),this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new v7(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(R.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},a={};for(let r=0;r<this.fullColumnNames.length;r++){let s=this.fullColumnNames[r],i=this.columnConfigs?this.columnConfigs[s]:null;if(!(this.configuredColumnsOnly&&!i)){let o=t[r],l=null;if(o==="")if(i&&i.default!==void 0)l=i.default;else{if(i&&(i.required||i.isLabel))throw new Error(`Required column ${s} is empty in this line: ${e}`);l=void 0}else{let d=Number(o);if(isNaN(d))i&&i.dtype==="bool"?l=this.getBoolean(o):l=o;else if(!i||!i.dtype)l=d;else switch(i.dtype){case"float32":l=d;break;case"int32":l=Math.floor(d);break;case"bool":l=this.getBoolean(o);break;default:l=d}}i&&i.isLabel?a[s]=l:n[s]=l}}return Object.keys(a).length===0?n:{xs:n,ys:a}}getBoolean(e){return e==="1"||e.toLowerCase()==="true"?1:0}parseRow(e,t=!0){let n=[],a=0,r=e.length,s=Fx;for(let i=0;i<r;i++)switch(s){case Fx:switch(e.charAt(i)){case F1:a=i+1,s=O1;break;case this.delimiter:if(a=i+1,this.delimiter===" "&&this.delimWhitespace)break;n.push(""),s=Fx;break;default:s=B$,a=i;break}break;case B$:e.charAt(i)===this.delimiter&&(n.push(e.substring(a,i)),s=Fx,a=i+1);break;case O1:e.charAt(i)===F1&&(s=$N);break;case $N:switch(e.charAt(i)){case this.delimiter:n.push(e.substring(a,i-1)),s=Fx,a=i+1;break;case F1:s=O1;break;default:s=F$;break}break;case F$:e.charAt(i)===F1&&(s=O1);break}if(s===$N?n.push(e.substring(a,r-1)):n.push(e.substring(a)),t&&n.length!==this.fullColumnNames.length)throw new Error(`Invalid row in csv file. Should have ${this.fullColumnNames.length} elements in a row, but got ${n}`);return n}},E0e=class S7 extends Br{constructor(t){super(),this.microphoneConfig=t,this.isClosed=!1,this.fftSize=t.fftSize||1024;let n=Math.log2(this.fftSize);if(this.fftSize<0||n<4||n>14||!Number.isInteger(n))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=t.numFramesPerSpectrogram||43,this.sampleRateHz=t.sampleRateHz,this.columnTruncateLength=t.columnTruncateLength||this.fftSize,this.audioTrackConstraints=t.audioTrackConstraints,this.smoothingTimeConstant=t.smoothingTimeConstant||0,this.includeSpectrogram=t.includeSpectrogram!==!1,this.includeWaveform=t.includeWaveform===!0,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(t={}){if(!fe().get("IS_BROWSER"))throw new Error("microphone API is only supported in browser environment.");let n=new S7(t);return await n.start(),n}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null?!0:this.audioTrackConstraints,video:!1})}catch(a){throw new Error(`Error thrown while initializing video stream: ${a.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");let t=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new t,!this.sampleRateHz)this.sampleRateHz=this.audioContext.sampleRate;else if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`);let n=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=this.fftSize*2,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,n.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let t,n,a=await this.getAudioData();if(this.includeSpectrogram){let r=this.flattenQueue(a.freqDataQueue);t=this.getTensorFromAudioDataArray(r,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){let r=this.flattenQueue(a.timeDataQueue);n=this.getTensorFromAudioDataArray(r,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:t,waveform:n},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){let t=[],n=[],a=0;return new Promise(r=>{let s=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0&&r({freqDataQueue:t,timeDataQueue:n}),t.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),n.push(this.timeData.slice())),++a===this.numFrames&&(clearInterval(s),r({freqDataQueue:t,timeDataQueue:n}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(t){let n=t[0].length,a=new Float32Array(t.length*n);return t.forEach((r,s)=>a.set(r,s*n)),a}getTensorFromAudioDataArray(t,n){let a=new Float32Array(R.sizeFromShape(n));return a.set(t,a.length-t.length),bs(a,n)}},I0e=class k7 extends Br{constructor(t,n){if(super(),this.webcamVideoElement=t,this.webcamConfig=n,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=Ln([0],"int32"),this.webcamConfig.centerCrop){let a=this.webcamConfig.resizeWidth*1/this.webcamVideoElement.width,r=this.webcamConfig.resizeHeight*1/this.webcamVideoElement.height,s=(1-a)/2,i=(1-r)/2,o=s+a,l=r+i;this.cropBox=nl([i,s,l,o],[1,4])}else this.cropBox=nl([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(t,n={}){if(!fe().get("IS_BROWSER"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!t){if(t=document.createElement("video"),!n.resizeWidth||!n.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");t.width=n.resizeWidth,t.height=n.resizeHeight}let a=new k7(t,n);return await a.start(),a}async start(){this.webcamConfig.facingMode&&R.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(t){throw t.message=`Error thrown while initializing video stream
104: ${t.message}`,t}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(t){console.log(t),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(t=>{this.webcamVideoElement.onloadedmetadata=()=>{t()}})}async next(){if(this.isClosed)return{value:null,done:!0};let t;try{t=Wb.fromPixels(this.webcamVideoElement)}catch(n){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(n)}`)}if(this.resize)try{return{value:this.cropAndResizeFrame(t),done:!1}}catch(n){throw new Error(`Error thrown cropping the video: ${n.message}`)}finally{t.dispose()}else return{value:t,done:!1}}needToResize(){return!!(this.webcamConfig.resizeWidth&&this.webcamConfig.resizeHeight&&(this.webcamVideoElement.width!==this.webcamConfig.resizeWidth||this.webcamVideoElement.height!==this.webcamConfig.resizeHeight))}cropAndResizeFrame(t){return ue(()=>{let n=Dr(He(t,"float32"),0),a;a=Ii.cropAndResize(n,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");let r=a.shape;return le(a,r.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(t=>t.stop());try{this.webcamVideoElement.srcObject=null}catch(t){console.log(t),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}},N7=class{},C7=class extends Br{split(e){return new T0e(this,e)}},T0e=class extends C7{constructor(e,t){super(),this.upstream=e,this.impl=new A0e(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},A0e=class extends Q_{constructor(e,t){super(),this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){let e=await this.upstream.next();if(e.done)return this.carryover===""?!1:(this.outputQueue.push(this.carryover),this.carryover="",!0);let t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(let n of t.slice(0,-1))this.outputQueue.push(n);return this.carryover=t[t.length-1],!0}},_0e=class extends Br{decodeUTF8(){return new j0e(this)}},j0e=class extends C7{constructor(e){super(),this.upstream=e,this.impl=new D0e(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},D0e=class extends Q_{constructor(e){if(super(),this.upstream=e,fe().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{let{StringDecoder:t}=D8();this.decoder=new t("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){let e=await this.upstream.next(),t;if(e.done)return!1;t=e.value;let n;return fe().get("IS_BROWSER")?n=this.decoder.decode(t,{stream:!0}):n=this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0}},E7=class extends _0e{constructor(e,t={}){super(),this.file=e,this.options=t,R.assert(e instanceof Uint8Array||(fe().get("IS_BROWSER")?e instanceof File||e instanceof Blob:!1),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1024*1024}summary(){return`FileChunks ${this.file}`}async next(){return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?{value:null,done:!0}:{value:await new Promise((e,t)=>{let n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{let a=new FileReader;a.onload=s=>{let i=a.result;if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),!(i instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(i)},a.onabort=s=>t(new Error("Aborted")),a.onerror=s=>t(new Error(s.type));let r=this.file.slice(this.offset,n);a.readAsArrayBuffer(r)}this.offset=n}),done:!1}}};async function R0e(e,t={},n){let a,r;typeof e=="string"?a=e:(a=e.url,r=M0e(e));let s=await(0,R.fetch)(a,r);if(s.ok){let i=new Uint8Array(await s.arrayBuffer());return new E7(i,t)}else throw new Error(s.statusText)}var M0e=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});function I7(e){return typeof e=="string"&&e.slice(0,7)==="file://"}var T7=class extends N7{constructor(e,t={}){super(),this.input=e,this.options=t}async iterator(){if(I7(this.input)&&fe().get("IS_NODE")){let e=WI();this.input=e.readFileSync(this.input.slice(7))}return new E7(this.input,this.options)}},A7=class extends N7{constructor(e,t={}){super(),this.url=e,this.fileOptions=t}async iterator(){return I7(this.url)?new T7(this.url,this.fileOptions).iterator():R0e(this.url,this.fileOptions)}};function $0e(e,t={}){return new w7(new A7(e),t)}function B0e(e){let t=J_(e);return Qs(async()=>t)}
vendor: 68,211 bytes, lines 104-107
104function F0e(e){return Qs(async()=>{let t=await e();return J_(()=>t.next())})}async function O0e(e,t){return I0e.create(e,t)}async function L0e(e){return E0e.create(e)}var P0e="4.22.0";function bt(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&R.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}var z0e=cl.whereImpl,Z_=class _7 extends tb{nextDataId(){return _7.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new mw(this,Ji())}write(t,n,a){this.firstUse&&(this.firstUse=!1,fe().get("IS_NODE")&&W.warn(`
105============================
106Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details. 
107============================`));let r={id:this.nextDataId()};return this.data.set(r,{values:t,dtype:a,refCount:1}),r}makeTensorInfo(t,n,a){let r;if(n==="string"&&a!=null&&a.length>0&&R.isString(a[0])){let s=a.map(i=>R.encodeString(i));r=this.write(s,t,n)}else r=this.write(a,t,n);return{dataId:r,shape:t,dtype:n}}refCount(t){return this.data.has(t)?this.data.get(t).refCount:0}incRef(t){let n=this.data.get(t);n.refCount++}decRef(t){if(this.data.has(t)){let n=this.data.get(t);n.refCount--}}move(t,n,a,r,s){this.data.set(t,{values:n,dtype:r,refCount:s})}numDataIds(){return this.data.numDataIds()}async read(t){return this.readSync(t)}readSync(t){let{dtype:n,complexTensorInfos:a}=this.data.get(t);if(n==="complex64"){let r=this.readSync(a.real.dataId),s=this.readSync(a.imag.dataId);return W.mergeRealAndImagArrays(r,s)}return R.convertBackendValuesAndArrayBuffer(this.data.get(t).values,n)}bufferSync(t){let n=this.readSync(t.dataId);if(t.dtype==="string")try{let a=n.map(r=>R.decodeString(r));return Zt(t.shape,t.dtype,a)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return Zt(t.shape,t.dtype,n)}makeOutput(t,n,a){return Ji().makeTensorFromTensorInfo(this.makeTensorInfo(n,a,t),this)}disposeData(t,n=!1){if(this.data.has(t)){if(this.data.get(t).refCount--,!n&&this.data.get(t).refCount>0)return!1;let{complexTensorInfos:a}=this.data.get(t);a!=null&&(this.disposeData(a.real.dataId,!0),this.disposeData(a.imag.dataId,!0)),this.data.delete(t)}return!0}disposeIntermediateTensorInfo(t){this.disposeData(t.dataId)}async time(t){let n=R.now();return t(),{kernelMs:R.now()-n}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(t){bt([t],"where");let n=this.readSync(t.dataId);return z0e(t.shape,n)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};Z_.nextDataId=0;var e4={};Xt(e4,{addImpl:()=>R7,bincountImpl:()=>n4,bincountReduceImpl:()=>M7,bitwiseAndImpl:()=>$7,castImpl:()=>D7,ceilImpl:()=>B7,concatImpl:()=>a4,equalImpl:()=>F7,expImpl:()=>L7,expm1Impl:()=>z7,floorDivImpl:()=>W7,floorImpl:()=>U7,gatherNdImpl:()=>V7,gatherV2Impl:()=>H7,greaterEqualImpl:()=>q7,greaterImpl:()=>G7,lessEqualImpl:()=>X7,lessImpl:()=>K7,linSpaceImpl:()=>Y7,logImpl:()=>J7,maxImpl:()=>Q7,maximumImpl:()=>Z7,minimumImpl:()=>eU,multiplyImpl:()=>r4,negImpl:()=>tU,notEqualImpl:()=>nU,prodImpl:()=>aU,raggedGatherImpl:()=>rU,raggedRangeImpl:()=>sU,raggedTensorToTensorImpl:()=>iU,rangeImpl:()=>i4,rsqrtImpl:()=>oU,scatterImpl:()=>xd,sigmoidImpl:()=>P1e,simpleAbsImpl:()=>j7,sliceImpl:()=>Wv,sparseFillEmptyRowsImpl:()=>uU,sparseReshapeImpl:()=>cU,sparseSegmentReductionImpl:()=>o4,sqrtImpl:()=>W1e,squaredDifferenceImpl:()=>dU,staticRegexReplaceImpl:()=>hU,stridedSliceImpl:()=>pU,stringNGramsImpl:()=>l4,stringSplitImpl:()=>u4,stringToHashBucketFastImpl:()=>c4,subImpl:()=>fU,tileImpl:()=>mU,topKImpl:()=>xU,transposeImpl:()=>s4,uniqueImpl:()=>h4});function j7(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}var U0e=e=>{let{x:t}=e.inputs,n=e.backend;bt(t,"abs");let a=new Float32Array(R.sizeFromShape(t.shape)),r=n.data.get(t.dataId).values;return a=j7(r),n.makeOutput(a,t.shape,t.dtype)},W0e={kernelName:hm,backendName:"cpu",kernelFunc:U0e};function Ha(e){return(t,n,a,r,s)=>{let i=W.assertAndGetBroadcastShape(t,n),o=i.length,l=R.computeStrides(i),d=R.sizeFromShape(i),c=R.getTypedArrayFromDType(s,d),f=t.length,m=n.length,x=R.computeStrides(t),y=R.computeStrides(n),b=W.getBroadcastDims(t,i),w=W.getBroadcastDims(n,i);if(b.length+w.length===0)for(let S=0;S<c.length;++S)c[S]=e(a[S%a.length],r[S%r.length]);else for(let S=0;S<c.length;++S){let k=R.indexToLoc(S,o,l),C=k.slice(-f);b.forEach(A=>C[A]=0);let E=R.locToIndex(C,f,x),T=k.slice(-m);w.forEach(A=>T[A]=0);let _=R.locToIndex(T,m,y);c[S]=e(a[E],r[_])}return[c,i]}}function ei(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}var V0e={kernelName:yw,backendName:"cpu",kernelFunc:ei};function Uv(e,t,n="float32"){if(n==="complex64"){let r=Uv(e,t,"float32"),s=Uv(e,t,"float32");return ei({inputs:{real:r,imag:s},backend:e})}let a=R.makeZerosTypedArray(R.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function ol(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var H0e={kernelName:wh,backendName:"cpu",kernelFunc:ol};function Fd(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}var G0e={kernelName:_w,backendName:"cpu",kernelFunc:Fd};function D7(e,t,n,a){if(a==="int32"){let r=Int32Array.from(e);return[t,"int32",r]}if(a==="bool"){let r=R.toTypedArray([0],n),[s,i]=Ha((o,l)=>o!==l?1:0)(t,[],e,r,"bool");return[i,"bool",s]}throw new Error(`Error in Cast: failed to cast ${n} to ${a}`)}function ic(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return ol({inputs:{x:r},backend:n});let c=Uv(n,r.shape,r.dtype),f=ic({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),m=ei({inputs:{real:f,imag:c},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(f),m}if(r.dtype==="complex64"){let c=Fd({inputs:{input:r},backend:n}),f=ic({inputs:{x:c},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(c),f}if(!R.hasEncodingLoss(r.dtype,s)){let c=ol({inputs:{x:r},backend:n});return{dataId:c.dataId,shape:c.shape,dtype:s}}let i=n.data.get(r.dataId).values,[o,l,d]=D7(i,r.shape,r.dtype,s);return n.makeTensorInfo(o,l,d)}var q0e={kernelName:nh,backendName:"cpu",kernelFunc:ic};function kr(e,t,n,a){return n==null?({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;bt([i,o],e);let d=l.data.get(i.dataId).values,c=l.data.get(o.dataId).values,f=i.dtype==="string"?W.fromUint8ToStringArray(d):d,m=i.dtype==="string"?W.fromUint8ToStringArray(c):c,x=a||i.dtype,[y,b]=t(i.shape,o.shape,f,m,x);return l.makeTensorInfo(b,x,y)}:({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;if(i.dtype==="complex64"||o.dtype==="complex64"){let d=ic({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),c=l.data.get(d.dataId),f=c.complexTensorInfos.real,m=c.complexTensorInfos.imag,x=l.data.get(f.dataId).values,y=l.data.get(m.dataId).values,b=ic({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),w=l.data.get(b.dataId),S=w.complexTensorInfos.real,k=w.complexTensorInfos.imag,C=l.data.get(S.dataId).values,E=l.data.get(k.dataId).values,[T,_,A]=n(i.shape,o.shape,x,y,C,E),$=l.makeTensorInfo(A,"float32",T),O=l.makeTensorInfo(A,"float32",_),z=ei({inputs:{real:$,imag:O},backend:l});return l.disposeIntermediateTensorInfo(d),l.disposeIntermediateTensorInfo(b),l.disposeIntermediateTensorInfo($),l.disposeIntermediateTensorInfo(O),z}else{let d=l.data.get(i.dataId).values,c=l.data.get(o.dataId).values,f=a||i.dtype,[m,x]=t(i.shape,o.shape,d,c,f);return l.makeTensorInfo(x,f,m)}}}function t4(e){return(t,n,a,r,s,i)=>{let o=W.assertAndGetBroadcastShape(t,n),l=R.sizeFromShape(o),d=o.length,c=R.computeStrides(o),f=R.getTypedArrayFromDType("float32",l),m=R.getTypedArrayFromDType("float32",l),x=W.getBroadcastDims(t,o),y=W.getBroadcastDims(n,o),b=W.mergeRealAndImagArrays(a,r),w=W.mergeRealAndImagArrays(s,i),S=t.length,k=R.computeStrides(t),C=n.length,E=R.computeStrides(n);if(x.length+y.length===0)for(let T=0;T<f.length;T++){let _=T%b.length,A=T%w.length,$=e(b[_*2],b[_*2+1],w[A*2],w[A*2+1]);f[T]=$.real,m[T]=$.imag}else for(let T=0;T<f.length;T++){let _=R.indexToLoc(T,d,c),A=_.slice(-S);x.forEach(j=>A[j]=0);let $=R.locToIndex(A,S,k),O=_.slice(-C);y.forEach(j=>O[j]=0);let z=R.locToIndex(O,C,E),P=e(b[$*2],b[$*2+1],w[z*2],w[z*2+1]);f[T]=P.real,m[T]=P.imag}return[f,m,o]}}var R7=Ha((e,t)=>e+t),K0e=t4((e,t,n,a)=>({real:e+n,imag:t+a})),em=kr(hc,R7,K0e),X0e={kernelName:hc,backendName:"cpu",kernelFunc:em};function n4(e,t,n,a,r){let s=R.sizeFromShape(a),i=R.makeZerosTypedArray(r,n);for(let o=0;o<e.length;o++){let l=e[o];if(l<0)throw new Error("Input x must be non-negative!");l>=r||(s>0?i[l]+=t[o]:i[l]+=1)}return i}function M7(e,t,n,a=!1){let r=e.shape[0],s=e.shape[1],i=Zt([r,n],t.dtype);for(let o=0;o<r;o++)for(let l=0;l<s;l++){let d=e.get(o,l);if(d<0)throw new Error("Input x must be non-negative!");d>=n||(a?i.set(1,o,d):t.size>0?i.set(i.get(o,d)+t.get(o,l),o,d):i.set(i.get(o,d)+1,o,d))}return i}var $7=Ha((e,t)=>e&t),Y0e=kr(vm,$7),J0e={kernelName:vm,backendName:"cpu",kernelFunc:Y0e};function dl(e){return(t,n,a)=>{let r=R.getArrayFromDType(n,t.length);for(let s=0;s<t.length;++s)r[s]=e(t[s],a);return r}}function Gn(e,t,n){let a=dl(t);return wc(e,a,n)}function wc(e,t,n){return({inputs:a,attrs:r,backend:s})=>{let{x:i}=a;bt(i,e);let o=s,l=o.data.get(i.dataId).values,d;if(i.dtype==="string"){if(!Array.isArray(l))throw new Error("String tensor's value was not an instance of Array");d=W.fromUint8ToStringArray(l)}else d=l;let c=n||i.dtype,f=t(d,c,r);return o.makeTensorInfo(i.shape,c,f)}}var B7=dl(e=>Math.ceil(e)),Q0e=wc(ah,B7),Z0e={kernelName:ah,backendName:"cpu",kernelFunc:Q0e};function a4(e,t,n,a){let r=R.getArrayFromDType(n,R.sizeFromShape(t));if(a&&n!=="string"){let s=0;e.forEach(i=>{let o=R.sizeFromShape(i.shape);r.set(i.vals,s),s+=o})}else{let s=0;e.forEach(i=>{let o=n==="string"?W.fromUint8ToStringArray(i.vals):i.vals,l=0;for(let d=0;d<i.shape[0];++d){let c=d*t[1]+s;for(let f=0;f<i.shape[1];++f)r[c+f]=o[l++]}s+=i.shape[1]})}return r}var F7=Ha((e,t)=>e===t?1:0),O7=kr(Tm,F7,null,"bool"),e1e={kernelName:Tm,backendName:"cpu",kernelFunc:O7},L7=dl(e=>Math.exp(e)),P7=wc(mh,L7,"float32"),t1e={kernelName:mh,backendName:"cpu",kernelFunc:P7},z7=dl(e=>Math.expm1(e)),n1e=wc(gh,z7),a1e={kernelName:gh,backendName:"cpu",kernelFunc:n1e},U7=dl(e=>Math.floor(e)),r1e=wc(xh,U7),s1e={kernelName:xh,backendName:"cpu",kernelFunc:r1e},W7=Ha((e,t)=>Math.floor(e/t)),i1e=kr(yh,W7,null,"int32"),o1e={kernelName:yh,backendName:"cpu",kernelFunc:i1e};function V7(e,t,n,a,r,s,i,o,l){let d=Zt([a,s],n);for(let c=0;c<a;c++){let f=[],m=0;for(let x=0;x<r;x++){let y=e[c*r+x];m+=y*i[x],f.push(y)}if(m<0||m>=l/s)throw new Error(`Invalid indices: ${f} does not index into ${o}`);for(let x=0;x<s;x++)d.values[c*s+x]=t.get(...t.indexToLoc(m*s+x))}return d}function H7(e,t,n){let a=Zt(n,e.dtype);for(let r=0;r<a.size;++r){let s=a.indexToLoc(r).slice(),i=s[0],o=s[2],l=t.locToIndex([i,o]);s[2]=t.values[l];let d=e.locToIndex(s);0<=d&&d<e.values.length&&(a.values[r]=e.values[d])}return a}var G7=Ha((e,t)=>e>t?1:0),l1e=kr(Rm,G7,null,"bool"),u1e={kernelName:Rm,backendName:"cpu",kernelFunc:l1e},q7=Ha((e,t)=>e>=t?1:0),c1e=kr(vh,q7,null,"bool"),d1e={kernelName:vh,backendName:"cpu",kernelFunc:c1e},K7=Ha((e,t)=>e<t?1:0),h1e=kr(Mm,K7,null,"bool"),p1e={kernelName:Mm,backendName:"cpu",kernelFunc:h1e},X7=Ha((e,t)=>e<=t?1:0),f1e=kr($m,X7,null,"bool"),m1e={kernelName:$m,backendName:"cpu",kernelFunc:f1e};function Y7(e,t,n){let a=(t-e)/(n-1),r=R.makeZerosTypedArray(n,"float32");r[0]=e;for(let s=1;s<r.length;s++)r[s]=r[s-1]+a;return r}var J7=dl(e=>Math.log(e)),g1e=wc(Eh,J7),x1e={kernelName:Eh,backendName:"cpu",kernelFunc:g1e};function Q7(e,t,n,a){let r=R.getTypedArrayFromDType(a,R.sizeFromShape(n));for(let s=0;s<r.length;++s){let i=s*t,o=e[i];for(let l=0;l<t;++l){let d=e[i+l];(Number.isNaN(d)||d>o)&&(o=d)}r[s]=o}return r}var Z7=Ha((e,t)=>Math.max(e,t)),y1e=kr(_h,Z7),b1e={kernelName:_h,backendName:"cpu",kernelFunc:y1e},eU=Ha((e,t)=>Math.min(e,t)),v1e=kr(Mh,eU),w1e={kernelName:Mh,backendName:"cpu",kernelFunc:v1e},r4=Ha((e,t)=>e*t),S1e=t4((e,t,n,a)=>({real:e*n-t*a,imag:e*a+t*n})),B2=kr(Fh,r4,S1e),k1e={kernelName:Fh,backendName:"cpu",kernelFunc:B2};function tU(e,t,n){let a=R.createScalarValue(-1,n);return r4([],t,a,e,n)}function N1e(e){let{inputs:t,backend:n}=e,{x:a}=t;bt(a,"neg");let r=n.data.get(a.dataId).values,[s,i]=tU(r,a.shape,a.dtype);return n.makeTensorInfo(i,a.dtype,s)}var C1e={kernelName:Wm,backendName:"cpu",kernelFunc:N1e},nU=Ha((e,t)=>e!==t?1:0),E1e=kr(Vm,nU,null,"bool"),I1e={kernelName:Vm,backendName:"cpu",kernelFunc:E1e};function s4(e,t,n,a,r){let s=t.length,i=R.sizeFromShape(t),o=R.computeStrides(t),l=R.computeStrides(r),d=R.getTypedArrayFromDType(n,R.sizeFromShape(r));for(let c=0;c<i;++c){let f=R.indexToLoc(c,s,o),m=new Array(f.length);for(let y=0;y<m.length;y++)m[y]=f[a[y]];let x=R.locToIndex(m,s,l);d[x]=e[c]}return d}function Ps(e){let{inputs:t,attrs:n,backend:a}=e,{x:r}=t,{perm:s}=n;bt(r,"transpose");let i=r.shape.length,o=new Array(i);for(let c=0;c<o.length;c++)o[c]=r.shape[s[c]];let l=a.data.get(r.dataId).values,d=s4(l,r.shape,r.dtype,s,o);return{dataId:a.write(d,o,r.dtype),shape:o,dtype:r.dtype}}var T1e={kernelName:Fl,backendName:"cpu",kernelFunc:Ps};function aU(e,t,n,a){let[r,s]=W.computeOutAndReduceShapes(e,a),i=Di(t,"int32"),o=R.makeZerosTypedArray(R.sizeFromShape(r),i),l=R.sizeFromShape(s);for(let d=0;d<o.length;++d){let c=d*l,f=1;for(let m=0;m<l;++m)f*=n[c+m];o[d]=f}return{outVals:o,outShape:r,outDtype:i}}function A1e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;bt(r,"prod");let o=r.shape.length,l=R.parseAxisParam(s,r.shape),d=W.getAxesPermutation(l,o),c=l,f=r,m=[];d!=null&&(f=Ps({inputs:{x:r},backend:n,attrs:{perm:d}}),m.push(f),c=W.getInnerMostAxes(c.length,o));let x=n.data.get(f.dataId).values,{outVals:y,outShape:b,outDtype:w}=aU(f.shape,f.dtype,x,c),S=b;return i&&(S=W.expandShapeToKeepDim(b,l)),m.forEach(k=>n.disposeIntermediateTensorInfo(k)),n.makeTensorInfo(S,w,y)}var _1e={kernelName:Uh,backendName:"cpu",kernelFunc:A1e};function j1e(e,t,n){e.forEach((a,r)=>{if(a<0||a>=n){let s=R.indexToLoc(r,t.length,R.computeStrides(t)).join(",");throw new Error(`indices[${s}] = ${a} is not in [0, ${n})`)}})}function D1e(e,t){for(let n=0;n<e.length;++n){let a=e[n],r=n===e.length-1?t:e[n+1].length;if(a.length===0)throw new Error("Ragged splits may not be empty");if(a[0]<0)throw new Error("Ragged splits must be non-negative");if(a[a.length-1]>r)throw new Error("Ragged splits must not point past values");for(let s=1;s<a.length;++s)if(a[s-1]>a[s])throw new Error("Ragged splits must be sorted in ascending order")}}function R1e(e,t,n,a){let r=[],s=0,i=t.length-1+n.length,o=new Array(i).fill(null).map(()=>[0]);D1e(n,a);let l=1;for(let d=0;d<t.length-1;++d){l*=t[d];let c=t[d+1];for(let f=1;f<l+1;++f)o[d].push(f*c)}for(let d=0;d<e.length;++d){let c=e[d],f=e[d]+1;for(let m=0;m<n.length;++m){let x=n[m],y=m+t.length-1;if(y>=0){let b=o[y],w=b[b.length-1]-x[c];for(let S=c;S<f;++S)o[y].push(x[S+1]+w)}c=x[c],f=x[f]}f!==c&&(r.push([c,f]),s+=f-c)}return{outSplits:o,valueSlices:r,numValues:s}}function M1e(e){let t=[];for(let n=0;n<e.length;++n){let a=e[n].length,r=R.getArrayFromDType("int32",a);t.push(r),e[n].forEach((s,i)=>r[i]=s)}return t}function O$(e,t){let n=e.slice(0,t);for(;n.length<t;)n.push(1);for(let a=t;a<e.length;a++)n[t-1]*=e[a];return n}function $1e(e,t,n,a,r,s){let i=O$(t,2)[1],o=O$(s,2)[1],l=0;for(let d of n)for(let c=d[0];c<d[1];++c){for(let f=0;f<a;++f)r[l*o+f]=e[c*i+f];++l}}function B1e(e,t,n,a,r){let s=t.slice();s[0]=r;let i=R.getArrayFromDType(n,R.sizeFromShape(s)),o=e.length,l=o===0?0:o/t[0];return $1e(e,t,a,l,i,s),[i,s]}function rU(e,t,n,a,r,s,i,o){if(e.length===0)throw new Error("paramsNestedSplits must be non empty");if(t[0].length===0)throw new Error("Split tensors must not be scalars");let l=t[0][0]-1;if(j1e(s,i,l),a.length===0)throw new Error("params.rank must be nonzero");let d=a[0],{outSplits:c,valueSlices:f,numValues:m}=R1e(s,i,e,d),x=M1e(c),y=B1e(n,a,r,f,m);return[x,y[0],y[1]]}var L$=2147483647;function sU(e,t,n,a,r,s,i){if(t.length>1)throw new Error("starts must be a scalar or vector");if(r.length>1)throw new Error("limits must be a scalar or vector");if(i.length>1)throw new Error("deltas must be a scalar or vector");let o=t.length===0,l=r.length===0,d=i.length===0,c=[];o||c.push(t[0]),l||c.push(r[0]),d||c.push(i[0]);for(let w=1;w<c.length;++w)if(c[w]!==c[w-1])throw new Error("starts, limits, and deltas must have the same shape");let f=c.length===0?1:c[0],m=R.getArrayFromDType("int32",f+1);m[0]=0;for(let w=0;w<f;++w){let S=o?e[0]:e[w],k=l?a[0]:a[w],C=d?s[0]:s[w];if(C===0)throw new Error("Requires delta != 0");let E;if(C>0&&k<S||C<0&&k>S)E=0;else if(E=Math.ceil(Math.abs((k-S)/C)),E>L$)throw new Error(`Requires ((limit - start) / delta) <= ${L$}`);m[w+1]=m[w]+E}let x=m[f],y=R.getArrayFromDType(n,x),b=0;for(let w=0;w<f;++w){let S=m[w+1]-m[w],k=o?e[0]:e[w],C=d?s[0]:s[w];for(let E=0;E<S;++E)y[b++]=k,k+=C}return[m,y]}var Xi=W.RowPartitionType,F1e=class NE{constructor(t,n,a,r,s,i,o,l,d,c){this.shape=t,this.shapeShape=n,this.values=a,this.valuesShape=r,this.valuesDType=s,this.defaultValue=i,this.defaultValueShape=o,this.rowPartitionValues=l,this.rowPartitionValuesShapes=d,this.rowPartitionTypes=W.getRowPartitionTypesHelper(c),this.raggedRank=W.getRaggedRank(this.rowPartitionTypes)}getRowPartitionTypeByDimension(t){return this.rowPartitionTypes[0]===Xi.FIRST_DIM_SIZE?this.rowPartitionTypes[t+1]:this.rowPartitionTypes[t]}getRowPartitionTensor(t){return this.rowPartitionTypes[0]===Xi.FIRST_DIM_SIZE?this.rowPartitionValues[t+1]:this.rowPartitionValues[t]}getMaxWidth(t){let n=this.getRowPartitionTensor(t-1);switch(this.getRowPartitionTypeByDimension(t-1)){case Xi.VALUE_ROWIDS:return NE.getMaxWidthValueRowID(n);case Xi.ROW_SPLITS:return NE.getMaxWidthRowSplit(n);default:throw new Error(`Cannot handle partition type ${Xi[this.getRowPartitionTypeByDimension(t-1)]}`)}}static getMaxWidthRowSplit(t){let n=t.length;if(n===0||n===1)return 0;let a=0;for(let r=0;r<n-1;++r){let s=t[r+1]-t[r];s>a&&(a=s)}return a}static getMaxWidthValueRowID(t){let n=t.length;if(n===0)return 0;let a=0,r=t[0],s=0;for(let i=1;i<n;++i){let o=t[i];o!==r&&(r=o,s=Math.max(i-a,s),a=i)}return Math.max(n-a,s)}tensorShapeFromTensor(t,n,a=!0){if(n.length===0){if(t[0]===-1)return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return z$(t,a)}calculateOutputSize(t){let n=this.valuesShape,a=this.defaultValueShape;W.validateDefaultValueShape(a,n);let r=this.tensorShapeFromTensor(this.shape,this.shapeShape),s=W.combineRaggedTensorToTensorShapes(this.raggedRank,r,n);s[0]<0&&(s[0]=t);for(let i=1;i<=this.raggedRank;++i)s[i]<0&&(s[i]=this.getMaxWidth(i));return s}calculateFirstParentOutputIndex(t,n,a){let r=Math.min(t,a),s=[],i=0;for(let o=0;o<r;++o,i+=n)s.push(i);for(let o=r;o<t;++o)s.push(-1);return R.assert(s.length===t,()=>"Final length of result must be equal to firstDimension."),s}calculateOutputIndexRowSplit(t,n,a,r){let s=t.length,i=[];for(let o=0;o<s-1;++o){let l=t[o+1]-t[o],d=Math.min(r,l),c=n[o];c===-1&&(d=0);for(let f=0;f<d;++f)i.push(c),c+=a;for(let f=0;f<l-d;++f)i.push(-1)}if(s>0&&i.length!==t[s-1])throw new Error("Invalid row split size.");return i}calculateOutputIndexValueRowID(t,n,a,r){let s=t.length,i=[];if(s===0)return[];let o=0,l=t[0];if(l>=n.length)throw new Error(`Got currentValueRowId=${l}, which is not less than ${n.length}`);let d=n[l];i.push(d);for(let c=1;c<s;++c){let f=t[c];if(f===l)d>=0&&(++o,o<r?d+=a:d=-1);else{if(o=0,l=f,f>=n.length)throw new Error(`Got nextValueRowId=${f} which is not less than ${n.length}`);d=n[f]}i.push(d)}if(i.length!==t.length)throw new Error("Invalid row ids.");return i}calculateOutputIndex(t,n,a,r){let s=this.getRowPartitionTensor(t),i=this.getRowPartitionTypeByDimension(t);switch(i){case Xi.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(s,n,a,r);case Xi.ROW_SPLITS:if(s.length-1>n.length)throw new Error(`Row partition size is greater than output size: ${s.length-1} > ${n.length}`);return this.calculateOutputIndexRowSplit(s,n,a,r);default:throw new Error(`Unsupported partition type: ${Xi[i]}`)}}getFirstDimensionSize(){let t=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");let n=this.rowPartitionTypes[0];switch(n){case Xi.FIRST_DIM_SIZE:return t[0];case Xi.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case Xi.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${Xi[n]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");let t=this.getFirstDimensionSize(),n=this.calculateOutputSize(t),a=new Array(this.raggedRank+1);a[a.length-1]=1;for(let i=a.length-2;i>=0;--i)a[i]=a[i+1]*n[i+1];let r=z$(n,!1),s=R.getArrayFromDType(this.valuesDType,R.sizeFromShape(r));if(a[0]*n[0]>0){let i=this.calculateFirstParentOutputIndex(t,a[0],n[0]);for(let o=1;o<=this.raggedRank;++o)i=this.calculateOutputIndex(o-1,i,a[o],n[o]);this.setOutput(this.raggedRank,i,s,r)}return[r,s]}setOutput(t,n,a,r){if(a.length===0)return;let s=this.values,i=a,o=r.slice();o=o.slice(t+1);let l=R.sizeFromShape(o),d=n.length,c=this.defaultValue;if(c.length!==l&&c.length!==1){let y=this.defaultValueShape;ue(()=>{let b=le(c,y);c=vd(b,o).dataSync()})}let f=0,m=0,x=0;for(let y=0;y<=d;++y){let b=y<d?n[y]:-1;if(b===x){++x;continue}if(m<x){let w=s.subarray(f*l),S=i.subarray(m*l),k=(x-m)*l;P$(S,w,k)}if(y>=d){let w=a.length;b=Math.floor(w/l)}if(b>x)if(this.defaultValue.length===1)i.subarray(x*l,b*l).fill(this.defaultValue[0]),x=b;else for(;b>x;){let w=i.slice(x*l);P$(w,c,l),++x}b<0?(f=y+1,m=x):(f=y,m=x,x=m+1)}}};function P$(e,t,n){for(let a=0;a<n;a++)e[a]=t[a]}function z$(e,t){let n=[];for(let a of e){if(a<0){if(!t)throw new Error(`Dimension ${a} must be >= 0`);if(a<-1)throw new Error(`Dimension ${a} must be >= -1`);a=-1}n.push(a)}return n}function iU(e,t,n,a,r,s,i,o,l,d){return new F1e(e,t,n,a,r,s,i,o,l,d).compute()}function i4(e,t,n,a){let r=e===t,s=e<t&&n<0,i=t<e&&n>1;if(r||s||i)return R.makeZerosTypedArray(0,a);let o=Math.abs(Math.ceil((t-e)/n)),l=R.makeZerosTypedArray(o,a);t<e&&n===1&&(n=-1),l[0]=e;for(let d=1;d<l.length;d++)l[d]=l[d-1]+n;return l}var oU=dl(e=>1/Math.sqrt(e)),O1e=wc(Yh,oU),L1e={kernelName:Yh,backendName:"cpu",kernelFunc:O1e};function xd(e,t,n,a,r,s,i,o,l,d){let c=[a/r,r],f=e.values,m=t.values;if(a===0)return Zt(n,t.dtype);let x=l instanceof ar?l:Zt(c,t.dtype);typeof l=="string"||typeof l=="number"?x.values.fill(l):typeof l=="boolean"&&x.values.fill(+l);for(let y=0;y<s;y++){let b=[],w=0;for(let S=0;S<i;S++){let k=f[y*i+S];b.push(k),w+=k*o[S]}if(w<0||w>=a/r)throw new Error(`Invalid indices: ${b} does not index into ${n}`);for(let S=0;S<r;S++)d?x.values[w*r+S]+=m[y*r+S]:x.values[w*r+S]=t.rank===0?m[0]:m[y*r+S]}return x}var P1e=dl(e=>1/(1+Math.exp(-e))),lU=Gn(tp,e=>1/(1+Math.exp(-e))),z1e={kernelName:tp,backendName:"cpu",kernelFunc:lU};function Wv(e,t,n,a,r){let s=vr.isSliceContinous(a,t,n),i=R.sizeFromShape(n),o=R.computeStrides(a);if(s){let f=vr.computeFlatOffset(t,o);return r==="string"?e.slice(f,f+i):e.subarray(f,f+i)}let l=r==="string"?W.fromUint8ToStringArray(e):e,d=Zt(a,r,l),c=Zt(n,r);for(let f=0;f<c.size;++f){let m=c.indexToLoc(f),x=m.map((y,b)=>y+t[b]);c.set(d.get(...x),...m)}return r==="string"?W.fromStringArrayToUint8(c.values):c.values}function Od(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a;bt(r,"slice");let[o,l]=vr.parseSliceParams(r,s,i);vr.assertParamsValid(r,o,l);let d=n.data.get(r.dataId).values,c=Wv(d,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,c)}var U1e={kernelName:ag,backendName:"cpu",kernelFunc:Od};function uU(e,t,n,a,r,s,i){let o=t[0],l=s[0],d=new Array(l),c=new Array(o),f=t[1];if(l===0){if(o!==0)throw new Error(W.getSparseFillEmptyRowsIndicesDenseShapeMismatch(o));let w=R.getArrayFromDType(n,0),S=R.getArrayFromDType(r,0);return[w,[0,f],S,d,c]}let m=!0,x=0,y=new Array(l).fill(0);for(let w=0;w<o;++w){let S=e[w*f];if(S<0)throw new Error(W.getSparseFillEmptyRowsNegativeIndexErrorMessage(w,S));if(S>=l)throw new Error(W.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(w,S,l));++y[S],m=m&&S>=x,x=S}let b=!0;for(let w=0;w<l;++w){let S=y[w]===0;d[w]=S,b=b&&!S,y[w]=Math.max(y[w],1),w>0&&(y[w]+=y[w-1])}if(b&&m){let w=e,S=a;for(let k=0;k<o;++k)c[k]=k;return[w,[o,f],S,d,c]}else{let w=y[l-1],S=R.getArrayFromDType(n,w*f),k=R.getArrayFromDType(r,w),C=new Array(l).fill(0);for(let E=0;E<o;++E){let T=e[E*f],_=C[T],A=(T===0?0:y[T-1])+_;C[T]++;for(let $=0;$<f;++$)S[A*f+$]=e[E*f+$];k[A]=a[E],c[E]=A}for(let E=0;E<l;++E)if(C[E]===0){let T=E===0?0:y[E-1];S[T*f+0]=E;for(let _=1;_<f;++_)S[T*f+_]=0;k[T]=i}return[S,[w,f],k,d,c]}}function cU(e,t,n,a,r){let s=R.sizeFromShape(a),i=t[0],o=r.length,l=[],d=1,c=-1;for(let b=0;b<o;++b){let w=r[b];if(w===-1){if(c!==-1)throw new Error(W.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(c,b));c=b,l.push(1)}else{if(w<0)throw new Error(W.getSparseReshapeNegativeOutputDimErrorMessage(b,w));d*=w,l.push(w)}}if(c!==-1){if(d<=0)throw new Error(W.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());let b=Math.trunc(s/d);if(d*b!==s)throw new Error(W.getSparseReshapeInputOutputMultipleErrorMessage(a,l));l[c]=b}if(R.sizeFromShape(l)!==s)throw new Error(W.getSparseReshapeInputOutputMismatchErrorMessage(a,l));let f=a.length,m=[];if(f>0){m[f-1]=1;for(let b=f-2;b>=0;--b)m[b]=m[b+1]*a[b+1]}let x=[];if(o>0){x[o-1]=1;for(let b=o-2;b>=0;--b)x[b]=x[b+1]*l[b+1]}let y=R.getArrayFromDType(n,i*o);for(let b=0;b<i;++b){let w=0;for(let S=0;S<f;++S)w+=e[b*f+S]*m[S];for(let S=0;S<o;++S)y[b*o+S]=Math.trunc(w/x[S]),w%=x[S]}return[y,[i,o],l]}function o4(e,t,n,a,r,s=!1,i=0){let o=a.length,l=[t[0],e.length/t[0]],d=l[1],c=o>0?r[o-1]+1:0;if(c<0)throw new Error(W.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let f=t.slice();f[0]=c;let m=f.reduce((k,C)=>k*C,1),x=R.getArrayFromDType(n,m);if(o===0)return c>0&&x.fill(i),[x,f];if(c<=0)throw new Error(W.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let y=0,b=1,w=0,S=r[y];for(;;){let k=0;if(b<o){if(k=r[b],S===k){++b;continue}if(S>=k)throw new Error(W.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage())}if(S<0||S>=c)throw new Error(W.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(S,c));S>w&&x.fill(i,w*d,S*d);for(let C=y;C<b;++C){let E=a[C];if(E<0||E>=l[0])throw new Error(W.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(C,a[C],l[0]));for(let T=0;T<d;T++)x[S*d+T]+=e[E*d+T]}if(s)for(let C=0;C<d;C++)x[S*d+C]/=b-y;if(y=b,++b,w=S+1,S=k,b>o)break}return w<c&&x.fill(i,w*d,c*d),[x,f]}var W1e=dl(e=>Math.sqrt(e)),V1e=Gn(ap,e=>Math.sqrt(e)),H1e={kernelName:ap,backendName:"cpu",kernelFunc:V1e},dU=Ha((e,t)=>{let n=e-t;return n*n}),G1e=kr(ip,dU),q1e={kernelName:ip,backendName:"cpu",kernelFunc:G1e},hU=dl((e,t)=>{let{pattern:n,replaceGlobal:a,rewrite:r}=t;return e.replace(new RegExp(n,a?"g":""),r)}),K1e=wc(yb,hU),X1e={kernelName:yb,backendName:"cpu",kernelFunc:K1e};function pU(e,t,n,a){let r=Zt(e,t.dtype);for(let s=0;s<r.size;s++){let i=r.indexToLoc(s),o=new Array(i.length);for(let l=0;l<o.length;l++)o[l]=i[l]*n[l]+a[l];r.set(t.get(...o),...i)}return r}var Y1e=class{constructor(e,t,n,a,r,s){this.separator=R.encodeString(e),this.nGramWidths=t,this.leftPad=R.encodeString(n),this.rightPad=R.encodeString(a),this.padWidth=r,this.preserveShort=s}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){let n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}createNGrams(e,t,n,a,r,s){for(let i=0;i<r;++i){let o=this.getPadWidth(s),l=Math.max(0,o-i),d=Math.max(0,o-(r-(i+1))),c=s-(l+d),f=t+(l>0?0:i-o),m=0;m+=l*this.leftPad.length;for(let S=0;S<c;++S)m+=e[f+S].length;m+=d*this.rightPad.length;let x=l+d+c-1;m+=x*this.separator.length,n[a+i]=new Uint8Array(m);let y=n[a+i],b=0,w=S=>S.forEach(k=>y[b++]=k);for(let S=0;S<l;++S)w(this.leftPad),w(this.separator);for(let S=0;S<c-1;++S)w(e[f+S]),w(this.separator);if(c>0){w(e[f+c-1]);for(let S=0;S<d;++S)w(this.separator),w(this.rightPad)}else{for(let S=0;S<d-1;++S)w(this.rightPad),w(this.separator);w(this.rightPad)}}}compute(e,t){let n=e.length,a=t.length;if(a>0){let o=t[0];if(o!==0)throw new Error(`First split value must be 0, got ${o}`);for(let l=1;l<a;++l){let d=t[l]>=o;if(d=d&&t[l]<=n,!d)throw new Error(`Invalid split value ${t[l]}, must be in [${o}, ${n}]`);o=t[l]}if(o!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${o}`)}let r=a-1,s=R.getArrayFromDType("int32",a);if(n===0||a===0){let o=new Array(n);for(let l=0;l<=r;++l)s[l]=0;return[o,s]}s[0]=0;for(let o=1;o<=r;++o){let l=t[o]-t[o-1],d=0;this.nGramWidths.forEach(c=>{d+=this.getNumNGrams(l,c)}),this.preserveShort&&l>0&&d===0&&(d=1),s[o]=s[o-1]+d}let i=new Array(s[r]);for(let o=0;o<r;++o){let l=t[o],d=s[o];if(this.nGramWidths.forEach(c=>{let f=t[o+1]-t[o],m=this.getNumNGrams(f,c);this.createNGrams(e,l,i,d,m,c),d+=m}),this.preserveShort&&d===s[o]){let c=t[o+1]-t[o];if(c===0)continue;let f=c+2*this.padWidth;this.createNGrams(e,l,i,d,1,f)}}return[i,s]}};function l4(e,t,n,a,r,s,i,o){return new Y1e(n,a,r,s,i,o).compute(e,t)}function J1e(e,t,n,a){if(!e.length)return;if(t.length===0){for(let s=0;s<e.length;++s)a.push(e.subarray(s,s+1));return}if(t.length===1){let s=t[0],i=e.indexOf(s);for(;i!==-1;){let o=e.subarray(0,i);(!n||o.length!==0)&&a.push(o),e=e.subarray(i+1),i=e.indexOf(s)}(!n||e.length!==0)&&a.push(e);return}let r=0;for(let s=0;s<e.length+1;s++)if(s===e.length||t.indexOf(e[s])!==-1){let i=e.subarray(r,s);(!n||i.length!==0)&&a.push(i),r=s+1}}function u4(e,t,n){let a=e.length,r=[],s=0,i=0,o=new Array(a);for(let m=0;m<a;++m){let x=r.length;J1e(e[m],t,n,r);let y=r.length-x;o[m]=y,s+=y,i=Math.max(i,y)}let l=R.getArrayFromDType("int32",s*2),d=new Array(s),c=[a,i],f=0;for(let m=0;m<a;++m)for(let x=0;x<o[m];++x)l[f*2]=m,l[f*2+1]=x,d[f]=r[f],++f;return[l,d,c]}function c4(e,t){let n=R.getArrayFromDType("int32",e.length);for(let a=0;a<e.length;++a)n[a]=R.fingerPrint64(e[a]).modulo(t).getLowBitsUnsigned();return n}var fU=Ha((e,t)=>e-t),Q1e=t4((e,t,n,a)=>({real:e-n,imag:t-a})),d4=kr(op,fU,Q1e),Z1e={kernelName:op,backendName:"cpu",kernelFunc:d4};function mU(e,t){let n=new Array(e.rank);for(let r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];let a=Zt(n,e.dtype);for(let r=0;r<a.values.length;++r){let s=a.indexToLoc(r),i=new Array(e.rank);for(let l=0;l<i.length;l++)i[l]=s[l]%e.shape[l];let o=e.locToIndex(i);a.values[r]=e.values[o]}return a}var Hx=(e,t)=>{let n=t.value-e.value;return n===0?e.index-t.index:n};function gU(e,t,n=0,a=e.length-1){for(;a>n;){if(a-n>600){let o=a-n+1,l=t-n+1,d=Math.log(o),c=.5*Math.exp(2*d/3),f=.5*Math.sqrt(d*c*(o-c)/o)*Math.sign(l-o/2),m=Math.max(n,Math.floor(t-l*c/o+f)),x=Math.min(a,Math.floor(t+(o-l)*c/o+f));gU(e,t,m,x)}let r=e[t],s=n,i=a;for(R.swap(e,n,t),Hx(e[a],r)>0&&R.swap(e,n,a);s<i;){for(R.swap(e,s,i),s++,i--;Hx(e[s],r)<0;)s=s+1;for(;Hx(e[i],r)>0;)i=i-1}Hx(e[n],r)===0?R.swap(e,n,i):(i=i+1,R.swap(e,i,a)),i<=t&&(n=i+1),t<=i&&(a=i-1)}}function xU(e,t,n,a,r){let s=t[t.length-1],[i,o]=[e.length/s,s],l=R.getTypedArrayFromDType(n,i*a),d=R.getTypedArrayFromDType("int32",i*a);for(let f=0;f<i;f++){let m=f*o,x=e.subarray(m,m+o),y=new Array(x.length);x.forEach((k,C)=>y[C]={value:k,index:C}),a<y.length&&(gU(y,a),y=y.slice(0,a)),r&&y.sort(Hx);let b=f*a,w=l.subarray(b,b+a),S=d.subarray(b,b+a);for(let k=0;k<a;k++)w[k]=y[k].value,S[k]=y[k].index}let c=t.slice();return c[c.length-1]=a,[Zt(c,n,l),Zt(c,"int32",d)]}function h4(e,t,n,a){let r=R.parseAxisParam(t,n)[0],s=[1,n[0],1];for(let y=0;y<r;y++)s[0]*=n[y];s[1]=n[r];for(let y=r+1;y<n.length;y++)s[2]*=n[y];let i=new Map,o=new Int32Array(n[r]),l=new ar(s,a,e),d=[],c=s[0]===1&&s[2]===1;for(let y=0;y<n[r];y++){let b;if(c)b=e[y].toString();else{let S=[];for(let k=0;k<s[0];k++)for(let C=0;C<s[2];C++)S.push(l.get(k,y,C));b=S.join(",")}let w=i.get(b);if(w!=null)o[y]=w;else{let S=i.size;i.set(b,S),o[y]=S,d.push(y)}}let f=s.slice();f[1]=i.size;let m=new ar(f,a);d.forEach((y,b)=>{for(let w=0;w<s[0];w++)for(let S=0;S<s[2];S++)m.set(l.get(w,y,S),w,b,S)});let x=n.slice();return x[r]=f[1],{outputValues:m.values,outputShape:x,indices:o}}var eve="4.22.0";Rw("cpu",()=>new Z_,1);var yU=Gn(ph,e=>e>=0?e:Math.exp(e)-1),tve={kernelName:ph,backendName:"cpu",kernelFunc:yU};function bU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a;bt([r],"leakyRelu");let i=R.sizeFromShape(r.shape),o=n.data.get(r.dataId).values,l=R.getTypedArrayFromDType("float32",i);for(let d=0;d<o.length;d++)l[d]=o[d]<0?s*o[d]:o[d];return n.makeTensorInfo(r.shape,"float32",l)}var nve={kernelName:Ch,backendName:"cpu",kernelFunc:bU},ave=Ha((e,t)=>e<0?t*e:e);function vU(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t;bt([a,r],"prelu");let s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,[o,l]=ave(a.shape,r.shape,s,i,"float32");return n.makeTensorInfo(l,"float32",o)}var rve={kernelName:zh,backendName:"cpu",kernelFunc:vU},wU=Gn(Vh,e=>Math.max(0,e)),sve={kernelName:Vh,backendName:"cpu",kernelFunc:wU},SU=Gn(qh,e=>Math.min(Math.max(0,e),6)),ive={kernelName:qh,backendName:"cpu",kernelFunc:SU};function Vv(e,t,n,a,r){if(n==="linear")return ol({inputs:{x:t},backend:e});if(n==="relu")return wU({inputs:{x:t},backend:e});if(n==="elu")return yU({inputs:{x:t},backend:e});if(n==="relu6")return SU({inputs:{x:t},backend:e});if(n==="prelu")return vU({inputs:{x:t,alpha:a},backend:e});if(n==="leakyrelu")return bU({inputs:{x:t},backend:e,attrs:{alpha:r}});if(n==="sigmoid")return lU({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}function ca(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=R.sizeFromShape(r.shape),o=R.inferFromImplicitShape(s,i),l=R.sizeFromShape(o);R.assert(i===l,()=>`The new shape (${o}) has ${l} elements and the old shape (${r.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),n.incRef(r.dataId);let d=n.data.get(r.dataId);if(d.complexTensorInfos!=null){let c=d.complexTensorInfos.real,f=d.complexTensorInfos.imag;c.shape=o,f.shape=o}return{dataId:r.dataId,shape:o,dtype:r.dtype}}var ove={kernelName:Ym,backendName:"cpu",kernelFunc:ca};function kU(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;bt([r,s],"matMul");let l=r.shape.length,d=s.shape.length,c=i?r.shape[l-2]:r.shape[l-1],f=o?s.shape[d-1]:s.shape[d-2],m=i?r.shape[l-1]:r.shape[l-2],x=o?s.shape[d-2]:s.shape[d-1],y=r.shape.slice(0,-2),b=s.shape.slice(0,-2),w=R.sizeFromShape(y),S=R.sizeFromShape(b),k=fg.assertAndGetBroadcastShape(r.shape.slice(0,-2),s.shape.slice(0,-2)).concat([m,x]);R.assert(c===f,()=>`Error in matMul: inner shapes (${c}) and (${f}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let C=i?[w,c,m]:[w,m,c],E=o?[S,x,f]:[S,f,x],T=ca({inputs:{x:r},backend:n,attrs:{shape:C}}),_=ca({inputs:{x:s},backend:n,attrs:{shape:E}}),A=i?T.shape[1]:T.shape[2],$=i?T.shape[2]:T.shape[1],O=o?_.shape[1]:_.shape[2],z=Math.max(w,S),P=n.data.get(T.dataId).values,j=n.data.get(_.dataId).values,G=R.computeStrides(T.shape),X=R.computeStrides(_.shape),[J,V,Q]=i?[G[0],1,G[1]]:[G[0],G[1],1],[F,H,B]=o?[1,X[1],X[0]]:[X[1],1,X[0]],Y=$*O,ne=Zt([z,$,O],T.dtype),ee=ne.values,U=n.blockSize;for(let oe=0;oe<z;oe++){let pe=oe%w,he=oe%S;for(let xe=0;xe<$;xe+=U){let Ie=Math.min(xe+U,$);for(let _e=0;_e<O;_e+=U){let Oe=Math.min(_e+U,O);for(let Ye=0;Ye<A;Ye+=U){let ft=Math.min(Ye+U,A);for(let ze=xe;ze<Ie;ze++)for(let ct=_e;ct<Oe;ct++){let ot=0;for(let tt=Ye;tt<ft;tt++){let Tt=P[pe*J+ze*V+tt*Q],bn=j[tt*F+ct*H+he*B];ot+=Tt*bn}ee[oe*Y+(ze*O+ct)]+=ot}}}}}return n.disposeIntermediateTensorInfo(T),n.disposeIntermediateTensorInfo(_),n.makeTensorInfo(k,ne.dtype,ne.values)}var lve={kernelName:th,backendName:"cpu",kernelFunc:kU};function uve(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:d,activation:c,leakyreluAlpha:f}=a,m,x,y,b=[];m=kU({inputs:{a:r,b:s},attrs:{transposeA:l,transposeB:d},backend:n}),i&&(x=em({inputs:{a:m,b:i},backend:n}),b.push(m),m=x),c&&(y=Vv(n,m,c,o,f),b.push(m),m=y);for(let w of b)n.disposeIntermediateTensorInfo(w);return m}var cve={kernelName:Nd,backendName:"cpu",kernelFunc:uve},dve=Gn(Gd,e=>Math.acos(e)),hve={kernelName:Gd,backendName:"cpu",kernelFunc:dve},pve=Gn(qd,e=>Math.acosh(e)),fve={kernelName:qd,backendName:"cpu",kernelFunc:pve};function mve(e){let{inputs:t,backend:n}=e,a=t;bt(t,"addN");let r=a.map(o=>n.data.get(o.dataId).values),s=Zt(a[0].shape,a[0].dtype),i=s.values;for(let o=0;o<a.length;o++){let l=r[o];for(let d=0;d<i.length;d++)i[d]+=l[d]}return n.makeTensorInfo(s.shape,s.dtype,s.values)}var gve={kernelName:Kd,backendName:"cpu",kernelFunc:mve};function xve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;bt(r,"all");let o=R.parseAxisParam(s,r.shape),l=o,d=W.getAxesPermutation(l,r.shape.length),c=r;d!=null&&(c=Ps({inputs:{x:r},backend:n,attrs:{perm:d}}),l=W.getInnerMostAxes(l.length,r.shape.length)),W.assertAxesAreInnerMostDims("all",l,c.shape.length);let[f,m]=W.computeOutAndReduceShapes(c.shape,l),x=R.sizeFromShape(m),y=R.makeZerosTypedArray(R.sizeFromShape(f),c.dtype),b=n.data.get(c.dataId).values;for(let S=0;S<y.length;++S){let k=S*x,C=b[k];for(let E=0;E<x;++E){let T=b[k+E];C=C&&T}y[S]=C}d!=null&&n.disposeIntermediateTensorInfo(c);let w=n.makeTensorInfo(f,c.dtype,y);if(i){let S=W.expandShapeToKeepDim(f,o),k=ca({inputs:{x:w},backend:n,attrs:{shape:S}});return n.disposeIntermediateTensorInfo(w),k}return w}var yve={kernelName:pm,backendName:"cpu",kernelFunc:xve};function bve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;bt(r,"any");let o=R.parseAxisParam(s,r.shape),l=o,d=W.getAxesPermutation(l,r.shape.length),c=r;d!=null&&(c=Ps({inputs:{x:r},backend:n,attrs:{perm:d}}),l=W.getInnerMostAxes(l.length,r.shape.length)),W.assertAxesAreInnerMostDims("any",l,c.shape.length);let[f,m]=W.computeOutAndReduceShapes(c.shape,l),x=R.sizeFromShape(m),y=R.makeZerosTypedArray(R.sizeFromShape(f),c.dtype),b=n.data.get(c.dataId).values;for(let S=0;S<y.length;++S){let k=S*x,C=b[k];for(let E=0;E<x;++E){let T=b[k+E];C=C||T}y[S]=C}d!=null&&n.disposeIntermediateTensorInfo(c);let w=n.makeTensorInfo(f,c.dtype,y);if(i){let S=W.expandShapeToKeepDim(f,o),k=ca({inputs:{x:w},backend:n,attrs:{shape:S}});return n.disposeIntermediateTensorInfo(w),k}return w}var vve={kernelName:fm,backendName:"cpu",kernelFunc:bve};function wve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a;bt(r,"argMax");let i=R.parseAxisParam(s,r.shape),o=W.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Ps({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=W.getInnerMostAxes(i.length,l.shape.length)),i=[i[0]],W.assertAxesAreInnerMostDims("argMax",i,l.shape.length);let[c,f]=W.computeOutAndReduceShapes(l.shape,i),m=R.sizeFromShape(c),x=R.makeZerosTypedArray(m,"int32"),y=R.sizeFromShape(f),b=n.data.get(l.dataId).values;for(let w=0;w<x.length;++w){let S=w*y,k=b[S],C=0;for(let E=0;E<y;++E){let T=b[S+E];T>k&&(k=T,C=E)}x[w]=C}return d.forEach(w=>n.disposeIntermediateTensorInfo(w)),n.makeTensorInfo(c,"int32",x)}var Sve={kernelName:mm,backendName:"cpu",kernelFunc:wve};function kve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a;bt(r,"argMin");let i=R.parseAxisParam(s,r.shape),o=W.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Ps({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=W.getInnerMostAxes(i.length,l.shape.length)),i=[i[0]],W.assertAxesAreInnerMostDims("argMin",i,l.shape.length);let[c,f]=W.computeOutAndReduceShapes(l.shape,i),m=R.sizeFromShape(c),x=R.makeZerosTypedArray(m,"int32"),y=R.sizeFromShape(f),b=n.data.get(l.dataId).values;for(let w=0;w<x.length;++w){let S=w*y,k=b[S],C=0;for(let E=0;E<y;++E){let T=b[S+E];T<k&&(k=T,C=E)}x[w]=C}return d.forEach(w=>n.disposeIntermediateTensorInfo(w)),n.makeTensorInfo(c,"int32",x)}var Nve={kernelName:gm,backendName:"cpu",kernelFunc:kve},Cve=Gn(Xd,e=>Math.asin(e)),Eve={kernelName:Xd,backendName:"cpu",kernelFunc:Cve},Ive=Gn(Yd,e=>Math.asinh(e)),Tve={kernelName:Yd,backendName:"cpu",kernelFunc:Ive},Ave=Gn(Jd,e=>Math.atan(e)),_ve={kernelName:Jd,backendName:"cpu",kernelFunc:Ave},jve=Ha((e,t)=>Math.atan2(e,t)),Dve=kr(Zd,jve),Rve={kernelName:Zd,backendName:"cpu",kernelFunc:Dve},Mve=Gn(Qd,e=>Math.atanh(e)),$ve={kernelName:Qd,backendName:"cpu",kernelFunc:Mve};function p4(e,t,n,a,r,s){let i=r.strideHeight,o=r.strideWidth,l=r.dilationHeight,d=r.dilationWidth,c=r.effectiveFilterHeight,f=r.effectiveFilterWidth,m=r.padInfo.top,x=r.padInfo.left,y=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,b=Zt(r.outShape,n),w=b.values,S=r.outShape[1]*r.outShape[2]*r.outShape[3],k=r.outShape[2]*r.outShape[3],C=r.outShape[3];for(let E=0;E<r.batchSize;++E){let T=E*S,_=E*a[0];for(let A=0;A<r.inChannels;++A)for(let $=0;$<r.outHeight;++$){let O=$*i-m,z=Math.max(0,O),P=Math.min(r.inHeight,c+O),j=T+$*k;for(let G=0;G<r.outWidth;++G){let X=G*o-x,J=Math.max(0,X),V=Math.min(r.inWidth,f+X),Q=y,F=0,H=0;for(let Y=z;Y<P;Y+=l){let ne=_+Y*a[1];for(let ee=J;ee<V;ee+=d){let U=ne+ee*a[2],oe=e[U+A];s==="max"&&oe>Q?Q=oe:s==="avg"&&(F+=oe,H++)}if(isNaN(Q))break}let B=j+G*C+A;w[B]=s==="avg"?F/H:Q}}}return b}function NU(e,t,n,a,r=!1,s=!1){let i=Zt(a.outShape,"int32"),o=a.strideHeight,l=a.strideWidth,d=a.dilationHeight,c=a.dilationWidth,f=a.effectiveFilterHeight,m=a.effectiveFilterWidth,x=a.padInfo.top,y=a.padInfo.left,b=Zt(t,n,e);for(let w=0;w<a.batchSize;++w)for(let S=0;S<a.inChannels;++S)for(let k=0;k<a.outHeight;++k){let C=k*o-x,E=C;for(;E<0;)E+=d;let T=Math.min(a.inHeight,f+C);for(let _=0;_<a.outWidth;++_){let A=_*l-y,$=A;for(;$<0;)$+=c;let O=Math.min(a.inWidth,m+A),z=Number.NEGATIVE_INFINITY,P=-1;for(let j=E;j<T;j+=d){let G=j-C;for(let X=$;X<O;X+=c){let J=X-A,V=b.get(w,j,X,S);V>z&&(z=V,r?P=s?((w*a.inHeight+j)*a.inWidth+X)*a.inChannels+S:(j*a.inWidth+X)*a.inChannels+S:P=G*m+J)}}i.set(P,w,k,_,S)}}return i}function CU(e,t,n,a,r,s){let i=r.strideDepth,o=r.strideHeight,l=r.strideWidth,d=r.dilationDepth,c=r.dilationHeight,f=r.dilationWidth,m=r.effectiveFilterDepth,x=r.effectiveFilterHeight,y=r.effectiveFilterWidth,b=r.padInfo.front,w=r.padInfo.top,S=r.padInfo.left,k=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,C=Zt(r.outShape,n),E=C.values,T=r.outShape[1]*r.outShape[2]*r.outShape[3]*r.outShape[4],_=r.outShape[2]*r.outShape[3]*r.outShape[4],A=r.outShape[3]*r.outShape[4],$=r.outShape[4];for(let O=0;O<r.batchSize;++O){let z=O*T,P=O*a[0];for(let j=0;j<r.inChannels;++j)for(let G=0;G<r.outDepth;++G){let X=G*i-b,J=X;for(;J<0;)J+=d;let V=Math.min(r.inDepth,m+X),Q=z+G*_;for(let F=0;F<r.outHeight;++F){let H=F*o-w,B=H;for(;B<0;)B+=c;let Y=Math.min(r.inHeight,x+H),ne=Q+F*A;for(let ee=0;ee<r.outWidth;++ee){let U=ee*l-S,oe=U;for(;oe<0;)oe+=f;let pe=Math.min(r.inWidth,y+U),he=ne+ee*$,xe=k,Ie=0,_e=0;for(let Ye=J;Ye<V;Ye+=d){let ft=P+Ye*a[1];for(let ze=B;ze<Y;ze+=c){let ct=ft+ze*a[2];for(let ot=oe;ot<pe;ot+=f){let tt=ct+ot*a[3],Tt=e[tt+j];if(s==="max"&&Tt>xe?xe=Tt:s==="avg"&&(Ie+=Tt,_e++),isNaN(xe))break}if(isNaN(xe))break}if(isNaN(xe))break}let Oe=he+j;E[Oe]=s==="avg"?Ie/Math.max(_e,1):xe}}}}return C}function Bve(e,t){let n=Zt(t.outShape,"int32"),a=t.strideDepth,r=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,l=t.dilationWidth,d=t.effectiveFilterDepth,c=t.effectiveFilterHeight,f=t.effectiveFilterWidth,m=t.padInfo.front,x=t.padInfo.top,y=t.padInfo.left;for(let b=0;b<t.batchSize;++b)for(let w=0;w<t.inChannels;++w)for(let S=0;S<t.outDepth;++S){let k=S*a-m,C=k;for(;C<0;)C+=i;let E=Math.min(t.inDepth,d+k);for(let T=0;T<t.outHeight;++T){let _=T*r-x,A=_;for(;A<0;)A+=o;let $=Math.min(t.inHeight,c+_);for(let O=0;O<t.outWidth;++O){let z=O*s-y,P=z;for(;P<0;)P+=l;let j=Math.min(t.inWidth,f+z),G=Number.NEGATIVE_INFINITY,X=-1;for(let J=C;J<E;J+=i){let V=J-k;for(let Q=A;Q<$;Q+=o){let F=Q-_;for(let H=P;H<j;H+=l){let B=H-z,Y=e.get(b,J,Q,H,w);Y>=G&&(G=Y,X=V*c*f+F*c+B)}}}n.set(X,b,S,T,O,w)}}}return n}function Fve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;bt(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;R.assert(W.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let c=W.computePool2DInfo(r.shape,s,i,d,o,l),f;if(c.filterWidth===1&&c.filterHeight===1&&R.arraysEqual(c.inShape,c.outShape))f=ol({inputs:{x:r},backend:n});else{let m=n.data.get(r.dataId).values,x=R.computeStrides(r.shape),y=p4(m,r.shape,r.dtype,x,c,"avg");f=n.makeTensorInfo(c.outShape,r.dtype,y.values)}return f}var Ove={kernelName:eh,backendName:"cpu",kernelFunc:Fve};function Lve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;bt(r,"avgPool3d");let c=W.computePool3DInfo(r.shape,s,i,1,o,l,d),f=n.data.get(r.dataId).values,m=CU(f,r.shape,r.dtype,R.computeStrides(r.shape),c,"avg");return n.makeTensorInfo(m.shape,"float32",m.values)}var Pve={kernelName:xm,backendName:"cpu",kernelFunc:Lve};function zve(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;bt([r,s],"avgPool3DGrad");let c=W.computePool3DInfo(s.shape,i,o,1,l,d),f=c.strideDepth,m=c.strideHeight,x=c.strideWidth,y=c.filterDepth,b=c.filterHeight,w=c.filterWidth,S=c.dilationDepth,k=c.dilationHeight,C=c.dilationWidth,E=c.effectiveFilterDepth,T=c.effectiveFilterHeight,_=c.effectiveFilterWidth,A=E-1-c.padInfo.front,$=_-1-c.padInfo.left,O=T-1-c.padInfo.top,z=Zt(s.shape,"float32"),P=1/(y*b*w),j=n.bufferSync(r);for(let G=0;G<c.batchSize;++G)for(let X=0;X<c.inChannels;++X)for(let J=0;J<c.inDepth;++J)for(let V=0;V<c.inHeight;++V)for(let Q=0;Q<c.inWidth;++Q){let F=J-A,H=V-O,B=Q-$,Y=0;for(let ne=0;ne<E;ne+=S){let ee=(F+ne)/f;if(!(ee<0||ee>=c.outDepth||Math.floor(ee)!==ee))for(let U=0;U<T;U+=k){let oe=(H+U)/m;if(!(oe<0||oe>=c.outHeight||Math.floor(oe)!==oe))for(let pe=0;pe<_;pe+=C){let he=(B+pe)/x;if(he<0||he>=c.outWidth||Math.floor(he)!==he)continue;let xe=j.get(G,ee,oe,he,X);Y+=xe}}}z.set(Y*P,G,J,V,Q,X)}return n.makeTensorInfo(z.shape,z.dtype,z.values)}var Uve={kernelName:rb,backendName:"cpu",kernelFunc:zve};function Wve(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;bt([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,c=W.computePool2DInfo(i.shape,o,l,1,d),f=c.strideHeight,m=c.strideWidth,x=c.filterHeight,y=c.filterWidth,b=c.dilationHeight,w=c.dilationWidth,S=c.effectiveFilterHeight,k=c.effectiveFilterWidth,C=k-1-c.padInfo.left,E=S-1-c.padInfo.top,T=Zt(i.shape,"float32"),_=1/(x*y),A=n.data.get(r.dataId).values,$=Zt(r.shape,"float32",A);for(let O=0;O<c.batchSize;++O)for(let z=0;z<c.inChannels;++z)for(let P=0;P<c.inHeight;++P)for(let j=0;j<c.inWidth;++j){let G=P-E,X=j-C,J=0;for(let V=0;V<S;V+=b){let Q=(G+V)/f;if(!(Q<0||Q>=c.outHeight||Math.floor(Q)!==Q))for(let F=0;F<k;F+=w){let H=(X+F)/m;if(H<0||H>=c.outWidth||Math.floor(H)!==H)continue;let B=$.get(O,Q,H,z);J+=B}}T.set(J*_,O,P,j,z)}return n.makeTensorInfo(T.shape,T.dtype,T.values)}var Vve={kernelName:ab,backendName:"cpu",kernelFunc:Wve};function Hve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,scale:s,offset:i,mean:o,variance:l}=t;R.assert(o.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),R.assert(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),R.assert(s==null||o.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),bt([r,o,l,s,i],"batchNorm");let{varianceEpsilon:d}=a;d==null&&(d=.001);let c=n.data.get(r.dataId).values,f=n.data.get(o.dataId).values,m=n.data.get(l.dataId).values,x=s?n.data.get(s.dataId).values:new Float32Array([1]),y=i?n.data.get(i.dataId).values:new Float32Array([0]),b=new Float32Array(c.length),w=y.length,S=x.length,k=m.length,C=f.length,E=0,T=0,_=0,A=0;for(let $=0;$<c.length;++$)b[$]=y[E++]+(c[$]-f[T++])*x[_++]/Math.sqrt(m[A++]+d),E>=w&&(E=0),T>=C&&(T=0),_>=S&&(_=0),A>=k&&(A=0);return n.makeTensorInfo(r.shape,r.dtype,b)}var Gve={kernelName:bh,backendName:"cpu",kernelFunc:Hve};function qve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;bt([r],"batchToSpaceND");let o=s.reduce((S,k)=>S*k),l=W.getReshaped(r.shape,s,o),d=W.getPermuted(l.length,s.length),c=W.getReshapedPermuted(r.shape,s,o),f=W.getSliceBeginCoords(i,s.length),m=W.getSliceSize(c,i,s.length),x=ca({inputs:{x:r},backend:n,attrs:{shape:l}}),y=Ps({inputs:{x},backend:n,attrs:{perm:d}}),b=ca({inputs:{x:y},backend:n,attrs:{shape:c}}),w=Od({inputs:{x:b},backend:n,attrs:{begin:f,size:m}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),w}var Kve={kernelName:ym,backendName:"cpu",kernelFunc:qve};function Xve(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,d=n4(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var Yve={kernelName:bm,backendName:"cpu",kernelFunc:Xve};function Jve(e){let{inputs:t,backend:n}=e,{s0:a,s1:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=W.assertAndGetBroadcastShape(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}var Qve={kernelName:sb,backendName:"cpu",kernelFunc:Jve},Zve=Gn(pc,(e,t)=>{let n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e}),ewe={kernelName:pc,backendName:"cpu",kernelFunc:Zve},twe=e=>{let{x:t}=e.inputs,n=e.backend,a=new Float32Array(R.sizeFromShape(t.shape)),r=n.data.get(t.dataId),s=r.complexTensorInfos.real,i=r.complexTensorInfos.imag,o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let d=0;d<o.length;d++){let c=o[d],f=l[d];a[d]=Math.hypot(c,f)}return n.makeOutput(a,t.shape,"float32")},nwe={kernelName:ib,backendName:"cpu",kernelFunc:twe};function tm(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.imag,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}var awe={kernelName:Ew,backendName:"cpu",kernelFunc:tm};function nm(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=R.parseAxisParam(r,t[0].shape)[0],i=t.map(b=>b.shape);W.assertParamsConsistent(i,s);let o=W.computeOutShape(t.map(b=>b.shape),s);if(R.sizeFromShape(o)===0)return n.makeTensorInfo(o,t[0].dtype,[]);let l=t.filter(b=>R.sizeFromShape(b.shape)>0);if(l.length===1)return ol({inputs:{x:l[0]},backend:n});if(l[0].dtype==="complex64"){let b=l.map(E=>Fd({inputs:{input:E},backend:n})),w=l.map(E=>tm({inputs:{input:E},backend:n})),S=nm({inputs:b,backend:n,attrs:{axis:s}}),k=nm({inputs:w,backend:n,attrs:{axis:s}}),C=ei({inputs:{real:S,imag:k},backend:n});return b.forEach(E=>n.disposeIntermediateTensorInfo(E)),w.forEach(E=>n.disposeIntermediateTensorInfo(E)),n.disposeIntermediateTensorInfo(S),n.disposeIntermediateTensorInfo(k),C}let d=l.map(b=>{let w=[-1,R.sizeFromShape(b.shape.slice(s))];return ca({inputs:{x:b},backend:n,attrs:{shape:w}})}),c=d.map(b=>({vals:n.data.get(b.dataId).values,shape:b.shape}));o=W.computeOutShape(d.map(b=>b.shape),1);let f=d[0].shape[0]===1,m=a4(c,o,t[0].dtype,f),x=W.computeOutShape(l.map(b=>b.shape),s),y=n.makeTensorInfo(x,t[0].dtype,m);return d.forEach(b=>n.disposeIntermediateTensorInfo(b)),y}var rwe={kernelName:wm,backendName:"cpu",kernelFunc:nm};function EU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:c}=a;bt([r,s],"conv2d");let f=W.convertConv2DDataFormat(l),m=W.computeConv2DInfo(r.shape,s.shape,i,d,o,c,!1,f),x=m.filterHeight,y=m.filterWidth,b=m.dilationHeight,w=m.dilationWidth,S=m.padInfo.left,k=m.padInfo.top,C=m.dataFormat==="channelsLast",E=new ar(m.outShape,r.dtype),T=R.computeStrides(r.shape),_=R.computeStrides(s.shape),A=T[0],$=C?T[1]:T[2],O=C?T[2]:1,z=C?1:T[1],P=E.strides[0],j=C?E.strides[1]:E.strides[2],G=C?E.strides[2]:1,X=C?1:E.strides[1],J=n.data.get(r.dataId).values,V=n.data.get(s.dataId).values,Q=E.values;for(let F=0;F<m.batchSize;++F){let H=F*A,B=F*P;for(let Y=0;Y<m.outHeight;++Y){let ne=B+Y*j,ee=Y*m.strideHeight-k;for(let U=0;U<x;++U){let oe=ee+U*b;if(oe<0||oe>=m.inHeight)continue;let pe=U*_[0],he=H+oe*$;for(let xe=0;xe<m.outWidth;++xe){let Ie=ne+xe*G,_e=xe*m.strideWidth-S;for(let Oe=0;Oe<y;++Oe){let Ye=_e+Oe*w;if(Ye<0||Ye>=m.inWidth)continue;let ft=pe+Oe*_[1],ze=he+Ye*O,ct=ft;for(let ot=0;ot<m.inChannels;++ot){let tt=J[ze+ot*z];for(let Tt=0;Tt<m.outChannels;++Tt)Q[Ie+Tt*X]+=tt*V[ct+Tt];ct+=m.outChannels}}}}}}return n.makeTensorInfo(E.shape,E.dtype,Q)}var swe={kernelName:rh,backendName:"cpu",kernelFunc:EU};function iwe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,filterShape:c}=a;bt([r,s],"conv2dBackpropFilter");let f=W.convertConv2DDataFormat(l),m=W.computeConv2DInfo(r.shape,c,i,1,o,d,!1,f),{strideHeight:x,strideWidth:y,filterHeight:b,filterWidth:w}=m,S=m.dataFormat==="channelsLast",k=new ar(m.filterShape,"float32"),C=m.padInfo.left,E=m.padInfo.top,T=n.data.get(r.dataId).values,_=n.data.get(s.dataId).values,A=new ar(r.shape,r.dtype,T),$=new ar(s.shape,s.dtype,_);for(let O=0;O<b;++O){let z=Math.max(0,Math.ceil((E-O)/x)),P=Math.min(m.outHeight,(m.inHeight+E-O)/x);for(let j=0;j<w;++j){let G=Math.max(0,Math.ceil((C-j)/y)),X=Math.min(m.outWidth,(m.inWidth+C-j)/y);for(let J=0;J<m.inChannels;++J)for(let V=0;V<m.outChannels;++V){let Q=0;for(let F=0;F<m.batchSize;++F)for(let H=z;H<P;++H){let B=O+H*x-E;for(let Y=G;Y<X;++Y){let ne=j+Y*y-C;S?Q+=A.get(F,B,ne,J)*$.get(F,H,Y,V):Q+=A.get(F,J,B,ne)*$.get(F,V,H,Y)}}k.set(Q,O,j,J,V)}}}return n.makeTensorInfo(k.shape,k.dtype,k.values)}var owe={kernelName:bw,backendName:"cpu",kernelFunc:iwe};function lwe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:d,dimRoundingMode:c}=a;bt([r,s],"conv2dBackpropInput");let f=R.computeStrides(s.shape),m=R.computeStrides(r.shape),x=W.convertConv2DDataFormat(d),y=W.computeConv2DInfo(i,s.shape,o,1,l,c,!1,x),b=new ar(y.inShape,"float32"),w=b.values,S=n.data.get(r.dataId).values,k=n.data.get(s.dataId).values,[C,E,T]=f,{batchSize:_,filterHeight:A,filterWidth:$,inChannels:O,inHeight:z,inWidth:P,outChannels:j,outHeight:G,outWidth:X,strideHeight:J,strideWidth:V}=y;x=y.dataFormat;let Q=A-1-y.padInfo.top,F=$-1-y.padInfo.left,H=x==="channelsLast",B=b.strides[0],Y=H?b.strides[1]:b.strides[2],ne=H?b.strides[2]:1,ee=H?1:b.strides[1],U=m[0],oe=H?m[1]:m[2],pe=H?m[2]:1,he=H?1:m[1];for(let xe=0;xe<_;++xe)for(let Ie=0;Ie<O;++Ie)for(let _e=0;_e<z;++_e){let Oe=_e-Q,Ye=Math.max(0,Math.ceil(Oe/J)),ft=Math.min(G,(A+Oe)/J);for(let ze=0;ze<P;++ze){let ct=ze-F,ot=Math.max(0,Math.ceil(ct/V)),tt=Math.min(X,($+ct)/V),Tt=0;for(let Ut=Ye;Ut<ft;++Ut){let Tn=Ut*J-Oe;for(let Nn=ot;Nn<tt;++Nn){let Pn=Nn*V-ct,sa=U*xe+oe*Ut+pe*Nn,pa=C*(A-1-Tn)+E*($-1-Pn)+T*Ie;for(let Be=0;Be<j;++Be){let lt=S[sa+he*Be],$e=k[pa+Be];Tt+=lt*$e}}}let bn=B*xe+Y*_e+ne*ze+ee*Ie;w[bn]=Tt}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}var uwe={kernelName:sh,backendName:"cpu",kernelFunc:lwe};function cwe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a;bt([r,s],"conv3d");let d=W.computeConv3DInfo(r.shape,s.shape,i,l,o),{filterDepth:c,filterHeight:f,filterWidth:m,dilationDepth:x,dilationHeight:y,dilationWidth:b,padInfo:w}=d,S=w.front,k=w.left,C=w.top,E=new ar(d.outShape,r.dtype),T=n.data.get(r.dataId).values,_=n.data.get(s.dataId).values,A=E.values,$=R.computeStrides(r.shape),O=R.computeStrides(s.shape);for(let z=0;z<d.batchSize;++z){let P=z*$[0],j=z*E.strides[0];for(let G=0;G<d.outDepth;++G){let X=j+G*E.strides[1],J=G*d.strideDepth-S;for(let V=0;V<c;++V){let Q=J+V*x;if(Q<0||Q>=d.inDepth)continue;let F=V*O[0],H=P+Q*$[1];for(let B=0;B<d.outHeight;++B){let Y=X+B*E.strides[2],ne=B*d.strideHeight-C;for(let ee=0;ee<f;++ee){let U=ne+ee*y;if(U<0||U>=d.inHeight)continue;let oe=F+ee*O[1],pe=H+U*$[2];for(let he=0;he<d.outWidth;++he){let xe=Y+he*d.outChannels,Ie=he*d.strideWidth-k;for(let _e=0;_e<m;++_e){let Oe=Ie+_e*b;if(Oe<0||Oe>=d.inWidth)continue;let Ye=oe+_e*O[2],ft=pe+Oe*d.inChannels,ze=Ye;for(let ct=0;ct<d.inChannels;++ct){let ot=T[ft+ct];for(let tt=0;tt<d.outChannels;++tt)A[xe+tt]+=ot*_[ze+tt];ze+=d.outChannels}}}}}}}}return n.makeTensorInfo(E.shape,E.dtype,E.values)}var dwe={kernelName:ih,backendName:"cpu",kernelFunc:cwe};function hwe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a;bt([r,s],"conv3dBackpropFilterV2");let d=R.computeStrides(r.shape),c=R.computeStrides(s.shape),f=W.computeConv3DInfo(r.shape,l,i,1,o),m=f.strideDepth,x=f.strideHeight,y=f.strideWidth,b=f.filterDepth,w=f.filterHeight,S=f.filterWidth,k=new ar(f.filterShape,"float32"),C=k.values,[E,T,_,A]=k.strides,$=n.data.get(s.dataId).values,[O,z,P,j]=c,G=n.data.get(r.dataId).values,[X,J,V,Q]=d,F=f.padInfo.front,H=f.padInfo.left,B=f.padInfo.top;for(let Y=0;Y<b;++Y){let ne=Math.max(0,Math.ceil((F-Y)/m)),ee=Math.min(f.outDepth,(f.inDepth+F-Y)/m),U=Y*E;for(let oe=0;oe<w;++oe){let pe=Math.max(0,Math.ceil((B-oe)/x)),he=Math.min(f.outHeight,(f.inHeight+B-oe)/x),xe=oe*T+U;for(let Ie=0;Ie<S;++Ie){let _e=Math.max(0,Math.ceil((H-Ie)/y)),Oe=Math.min(f.outWidth,(f.inWidth+H-Ie)/y),Ye=Ie*_+xe;for(let ft=0;ft<f.inChannels;++ft){let ze=ft*A+Ye;for(let ct=0;ct<f.outChannels;++ct){let ot=0;for(let tt=0;tt<f.batchSize;++tt){let Tt=tt*X,bn=tt*O;for(let Ut=ne;Ut<ee;++Ut){let Tn=(Y+Ut*m-F)*J+Tt,Nn=Ut*z+bn;for(let Pn=pe;Pn<he;++Pn){let sa=(oe+Pn*x-B)*V+Tn,pa=Pn*P+Nn;for(let Be=_e;Be<Oe;++Be){let lt=(Ie+Be*y-H)*Q+sa,$e=Be*j+pa;ot+=G[lt+ft]*$[$e+ct]}}}}C[ze+ct]=ot}}}}}return n.makeTensorInfo(k.shape,k.dtype,k.values)}var pwe={kernelName:Sm,backendName:"cpu",kernelFunc:hwe};function fwe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a;bt([r],"conv3dBackpropInputV2");let d=R.computeStrides(r.shape),c=R.computeStrides(s.shape),f=W.computeConv3DInfo(l,s.shape,o,1,i),m=new ar(f.inShape,"float32"),x=m.values,[y,b,w,S]=m.strides,k=n.data.get(r.dataId).values,[C,E,T,_]=d,A=n.data.get(s.dataId).values,[$,O,z,P]=c,{batchSize:j,filterDepth:G,filterHeight:X,filterWidth:J,inChannels:V,inDepth:Q,inHeight:F,inWidth:H,outChannels:B,outDepth:Y,outHeight:ne,outWidth:ee,strideDepth:U,strideHeight:oe,strideWidth:pe}=f,he=G-1-f.padInfo.front,xe=X-1-f.padInfo.top,Ie=J-1-f.padInfo.left;for(let _e=0;_e<j;++_e)for(let Oe=0;Oe<V;++Oe)for(let Ye=0;Ye<Q;++Ye){let ft=Ye-he,ze=Math.max(0,Math.ceil(ft/U)),ct=Math.min(Y,(G+ft)/U);for(let ot=0;ot<F;++ot){let tt=ot-xe,Tt=Math.max(0,Math.ceil(tt/oe)),bn=Math.min(ne,(X+tt)/oe);for(let Ut=0;Ut<H;++Ut){let Tn=Ut-Ie,Nn=Math.max(0,Math.ceil(Tn/pe)),Pn=Math.min(ee,(J+Tn)/pe),sa=0;for(let pa=ze;pa<ct;++pa){let Be=pa*U-ft;for(let lt=Tt;lt<bn;++lt){let $e=lt*oe-tt;for(let Ue=Nn;Ue<Pn;++Ue){let dt=Ue*pe-Tn,Qe=C*_e+E*pa+T*lt+_*Ue,An=$*(G-1-Be)+O*(X-1-$e)+z*(J-1-dt)+P*Oe;for(let Bn=0;Bn<B;++Bn){let Ga=k[Qe+Bn],_n=A[An+Bn];sa+=Ga*_n}}}}x[y*_e+b*Ye+w*ot+S*Ut+Oe]=sa}}}return n.makeTensorInfo(m.shape,m.dtype,m.values)}var mwe={kernelName:km,backendName:"cpu",kernelFunc:fwe},gwe=Gn(oh,e=>Math.cos(e)),xwe={kernelName:oh,backendName:"cpu",kernelFunc:gwe},ywe=Gn(lh,e=>Math.cosh(e)),bwe={kernelName:lh,backendName:"cpu",kernelFunc:ywe};function vwe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,[c,f,m,x]=r.shape,y=s.shape[0],[b,w]=o,S=Zt([y,b,w,x],"float32"),k=n.data.get(s.dataId).values,C=n.data.get(i.dataId).values,E=n.data.get(r.dataId).values,T=R.computeStrides(r.shape),_=R.computeStrides(S.shape);for(let A=0;A<y;A++){let $=A*4,O=k[$],z=k[$+1],P=k[$+2],j=k[$+3],G=C[A];if(G>=c)continue;let X=b>1?(P-O)*(f-1)/(b-1):0,J=w>1?(j-z)*(m-1)/(w-1):0;for(let V=0;V<b;V++){let Q=b>1?O*(f-1)+V*X:.5*(O+P)*(f-1);if(Q<0||Q>f-1){for(let F=0;F<w;F++)for(let H=0;H<x;H++){let B=H+F*_[2]+V*_[1]+A*_[0];S.values[B]=d}continue}if(l==="bilinear"){let F=Math.floor(Q),H=Math.ceil(Q),B=Q-F;for(let Y=0;Y<w;Y++){let ne=w>1?z*(m-1)+Y*J:.5*(z+j)*(m-1);if(ne<0||ne>m-1){for(let pe=0;pe<x;pe++){let he=pe+Y*_[2]+V*_[1]+A*_[0];S.values[he]=d}continue}let ee=Math.floor(ne),U=Math.ceil(ne),oe=ne-ee;for(let pe=0;pe<x;pe++){let he=pe+ee*T[2]+F*T[1]+G*T[0],xe=E[he];he=pe+U*T[2]+F*T[1]+G*T[0];let Ie=E[he];he=pe+ee*T[2]+H*T[1]+G*T[0];let _e=E[he];he=pe+U*T[2]+H*T[1]+G*T[0];let Oe=E[he],Ye=xe+(Ie-xe)*oe,ft=_e+(Oe-_e)*oe;he=pe+Y*_[2]+V*_[1]+A*_[0],S.values[he]=Ye+(ft-Ye)*B}}}else for(let F=0;F<w;++F){let H=w>1?z*(m-1)+F*J:.5*(z+j)*(m-1);if(H<0||H>m-1){for(let ne=0;ne<x;ne++){let ee=ne+F*_[2]+V*_[1]+A*_[0];S.values[ee]=d}continue}let B=Math.round(H),Y=Math.round(Q);for(let ne=0;ne<x;ne++){let ee=ne+B*T[2]+Y*T[1]+G*T[0],U=ne+F*_[2]+V*_[1]+A*_[0];S.values[U]=E[ee]}}}}return n.makeTensorInfo(S.shape,S.dtype,S.values)}var wwe={kernelName:Cm,backendName:"cpu",kernelFunc:vwe};function Swe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a;bt(r,"cumprod");let l=W.getAxesPermutation([s],r.shape.length),d=r;l!=null&&(d=Ps({inputs:{x:r},backend:n,attrs:{perm:l}}));let c=W.getInnerMostAxes(1,r.shape.length)[0];if(c!==d.shape.length-1)throw new Error(`backend.cumprod in CPU expects an inner-most axis=${d.shape.length-1} but got axis=${c}`);let f=Di(d.dtype,"int32"),m=R.makeOnesTypedArray(R.sizeFromShape(d.shape),f),x=n.data.get(d.dataId).values,y=d.shape[d.shape.length-1],b=o?(S,k)=>S+y-k-1:(S,k)=>S+k;for(let S=0;S<x.length;S+=y)for(let k=0;k<y;k++){let C=b(S,k);if(k===0)m[C]=i?1:x[C];else{let E=b(S,k-1);m[C]=i?x[E]*m[E]:x[C]*m[E]}}let w=n.makeTensorInfo(d.shape,f,m);if(l!=null){let S=W.getUndoAxesPermutation(l),k=Ps({inputs:{x:w},backend:n,attrs:{perm:S}});return n.disposeIntermediateTensorInfo(w),n.disposeIntermediateTensorInfo(d),k}return w}var kwe={kernelName:Nm,backendName:"cpu",kernelFunc:Swe};function Nwe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a;bt(r,"cumsum");let l=W.getAxesPermutation([s],r.shape.length),d=r;l!=null&&(d=Ps({inputs:{x:r},backend:n,attrs:{perm:l}}));let c=W.getInnerMostAxes(1,r.shape.length)[0];if(c!==d.shape.length-1)throw new Error(`backend.cumsum in CPU expects an inner-most axis=${d.shape.length-1} but got axis=${c}`);let f=Di(d.dtype,"int32"),m=R.makeZerosTypedArray(R.sizeFromShape(d.shape),f),x=n.data.get(d.dataId).values,y=d.shape[d.shape.length-1],b=o?(S,k)=>S+y-k-1:(S,k)=>S+k;for(let S=0;S<x.length;S+=y)for(let k=0;k<y;k++){let C=b(S,k);if(k===0)m[C]=i?0:x[C];else{let E=b(S,k-1);m[C]=i?x[E]+m[E]:x[C]+m[E]}}let w=n.makeTensorInfo(d.shape,f,m);if(l!=null){let S=W.getUndoAxesPermutation(l),k=Ps({inputs:{x:w},backend:n,attrs:{perm:S}});return n.disposeIntermediateTensorInfo(w),n.disposeIntermediateTensorInfo(d),k}return w}var Cwe={kernelName:uh,backendName:"cpu",kernelFunc:Nwe};function Ewe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,c=n4(l,d,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,c)}else if(r.shape.length===2){let l=n.bufferSync(r),d=n.bufferSync(s),c=M7(l,d,i,o);return n.makeTensorInfo(c.shape,s.dtype,c.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}var Iwe={kernelName:ob,backendName:"cpu",kernelFunc:Ewe};function Twe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a;R.assert(i==="NHWC",()=>`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`);let o=r.shape[0],l=r.shape[1],d=r.shape[2],c=r.shape[3],f=l*s,m=d*s,x=c/(s*s),y=n.data.get(r.dataId).values,b=new Float32Array(o*f*m*x),w=0;for(let S=0;S<o;++S)for(let k=0;k<f;++k){let C=Math.floor(k/s),E=k%s;for(let T=0;T<m;++T){let _=Math.floor(T/s),A=T%s,$=(E*s+A)*x;for(let O=0;O<x;++O){let z=O+$+c*(_+d*(C+l*S));b[w++]=y[z]}}}return n.makeTensorInfo([o,f,m,x],r.dtype,b)}var Awe={kernelName:Em,backendName:"cpu",kernelFunc:Twe};function IU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:d}=a;bt([r,s],"depthwiseConv2DNative");let c=R.computeStrides(r.shape),f=R.computeStrides(s.shape),m=l;m==null&&(m=[1,1]),R.assert(W.eitherStridesOrDilationsAreOne(i,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${m}'`);let x=W.computeConv2DInfo(r.shape,s.shape,i,m,o,d,!0),{filterHeight:y,filterWidth:b,dilationHeight:w,dilationWidth:S,padInfo:k}=x,C=k.left,E=k.top,T=x.outChannels/x.inChannels,_=new ar(x.outShape,r.dtype),A=n.data.get(r.dataId).values,$=n.data.get(s.dataId).values,O=_.values;for(let z=0;z<x.batchSize;++z){let P=z*c[0],j=z*_.strides[0];for(let G=0;G<x.outHeight;++G){let X=j+G*_.strides[1],J=G*x.strideHeight-E;for(let V=0;V<y;++V){let Q=J+V*w;if(Q<0||Q>=x.inHeight)continue;let F=V*f[0],H=P+Q*c[1];for(let B=0;B<x.outWidth;++B){let Y=X+B*_.strides[2],ne=B*x.strideWidth-C;for(let ee=0;ee<b;++ee){let U=ne+ee*S;if(U<0||U>=x.inWidth)continue;let oe=F+ee*f[1],pe=H+U*x.inChannels,he=Y,xe=oe;for(let Ie=0;Ie<x.inChannels;++Ie){let _e=A[pe+Ie];for(let Oe=0;Oe<T;++Oe)O[he+Oe]+=_e*$[xe+Oe];he+=T,xe+=T}}}}}}return n.makeTensorInfo(_.shape,_.dtype,_.values)}var _we={kernelName:ch,backendName:"cpu",kernelFunc:IU};function jwe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,filterShape:c}=a;bt([r,s],"depthwiseConv2dNativeBackpropFilter");let f=W.computeConv2DInfo(r.shape,c,i,o,l,d,!0),{strideHeight:m,strideWidth:x,filterHeight:y,filterWidth:b}=f,w=new ar(f.filterShape,"float32"),S=f.padInfo.left,k=f.padInfo.top,C=f.outChannels/f.inChannels,E=n.data.get(r.dataId).values,T=new ar(r.shape,r.dtype,E),_=n.data.get(s.dataId).values,A=new ar(s.shape,s.dtype,_);for(let $=0;$<y;++$){let O=Math.max(0,Math.ceil((k-$)/m)),z=Math.min(f.outHeight,(f.inHeight+k-$)/m);for(let P=0;P<b;++P){let j=Math.max(0,Math.ceil((S-P)/x)),G=Math.min(f.outWidth,(f.inWidth+S-P)/x);for(let X=0;X<f.outChannels;++X){let J=Math.trunc(X/C),V=X%C,Q=0;for(let F=0;F<f.batchSize;++F)for(let H=O;H<z;++H){let B=$+H*m-k;for(let Y=j;Y<G;++Y){let ne=P+Y*x-S;Q+=T.get(F,B,ne,J)*A.get(F,H,Y,X)}}w.set(Q,$,P,J,V)}}}return n.makeTensorInfo(w.shape,w.dtype,w.values)}var Dwe={kernelName:vw,backendName:"cpu",kernelFunc:jwe};function Rwe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,inputShape:c}=a;bt([r,s],"depthwiseConv2DNativeBackpropInput");let f=R.computeStrides(r.shape),m=R.computeStrides(s.shape),x=W.computeConv2DInfo(c,s.shape,i,o,l,d,!0),y=new ar(x.inShape,"float32"),b=y.values,[w,S,k]=y.strides,C=n.data.get(r.dataId).values,[E,T,_]=f,A=n.data.get(s.dataId).values,[$,O,z]=m,{batchSize:P,filterHeight:j,filterWidth:G,inChannels:X,inHeight:J,inWidth:V,outChannels:Q,outHeight:F,outWidth:H,strideHeight:B,strideWidth:Y}=x,ne=j-1-x.padInfo.top,ee=G-1-x.padInfo.left,U=Q/X;for(let oe=0;oe<P;++oe)for(let pe=0;pe<X;++pe)for(let he=0;he<J;++he){let xe=he-ne,Ie=Math.max(0,Math.ceil(xe/B)),_e=Math.min(F,(j+xe)/B);for(let Oe=0;Oe<V;++Oe){let Ye=Oe-ee,ft=Math.max(0,Math.ceil(Ye/Y)),ze=Math.min(H,(G+Ye)/Y),ct=0;for(let ot=Ie;ot<_e;++ot){let tt=ot*B-xe;for(let Tt=ft;Tt<ze;++Tt){let bn=Tt*Y-Ye,Ut=E*oe+T*ot+_*Tt,Tn=$*(j-1-tt)+O*(G-1-bn)+z*pe;for(let Nn=0;Nn<U;++Nn){let Pn=pe*U+Nn,sa=C[Ut+Pn],pa=A[Tn+Nn];ct+=sa*pa}}}b[w*oe+S*he+k*Oe+pe]=ct}}return n.makeTensorInfo(y.shape,y.dtype,y.values)}var Mwe={kernelName:ww,backendName:"cpu",kernelFunc:Rwe};function $we(e){let{inputs:t,backend:n}=e,{x:a}=t,r=R.sizeFromShape(a.shape),s=n.data.get(a.dataId).values,i=Zt([r,r],a.dtype),o=i.values;for(let d=0;d<s.length;d++)o[d*r+d]=s[d];let l=[...a.shape,...a.shape];return n.makeTensorInfo(l,i.dtype,i.values)}var Bwe={kernelName:lb,backendName:"cpu",kernelFunc:$we}
vendor: 4,652 bytes, line 107
107,Fwe={kernelName:dh,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r}=e,{strides:s,pad:i,dilations:o}=n,l=t,d=l.data.get(a.dataId).values,c=a.shape.length,f=l.data.get(r.dataId).values,m=r.shape.length,{batchSize:x,inHeight:y,inWidth:b,inChannels:w,outHeight:S,outWidth:k,padInfo:C,strideHeight:E,strideWidth:T,filterHeight:_,filterWidth:A,dilationHeight:$,dilationWidth:O,outShape:z}=W.computeDilation2DInfo(a.shape,r.shape,s,i,"NHWC",o),P=R.sizeFromShape(z),j=z.length,G=R.getArrayFromDType(a.dtype,P);for(let X=0;X<x;++X)for(let J=0;J<S;++J){let V=J*E-C.top;for(let Q=0;Q<k;++Q){let F=Q*T-C.left;for(let H=0;H<w;++H){let B=Number.MIN_SAFE_INTEGER;for(let ne=0;ne<_;++ne){let ee=V+ne*$;if(ee>=0&&ee<y)for(let U=0;U<A;++U){let oe=F+U*O;if(oe>=0&&oe<b){let pe=R.locToIndex([X,ee,oe,H],c,R.computeStrides(a.shape)),he=R.locToIndex([ne,U,H],m,R.computeStrides(r.shape)),xe=d[pe]+f[he];xe>B&&(B=xe)}}}let Y=R.locToIndex([X,J,Q,H],j,R.computeStrides(z));G[Y]=B}}}return{dataId:l.write(R.toTypedArray(G,a.dtype),z,a.dtype),shape:z,dtype:a.dtype}}},Owe={kernelName:Uf,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,c=R.toNestedArray(a.shape,d.data.get(a.dataId).values),f=R.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:m,inHeight:x,inWidth:y,inChannels:b,outHeight:w,outWidth:S,padInfo:k,strideHeight:C,strideWidth:E,filterHeight:T,filterWidth:_,dilationHeight:A,dilationWidth:$,outShape:O}=W.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);R.assert(s.rank===O.length,()=>`Error in ${Uf}, dy must have the same rank as output ${O.length}, but got ${s.rank}`);let z=R.toNestedArray(O,d.data.get(s.dataId).values),P=R.makeZerosNestedTypedArray(r.shape,r.dtype);for(let j=0;j<m;++j)for(let G=0;G<w;++G){let X=G*C-k.top;for(let J=0;J<S;++J){let V=J*E-k.left;for(let Q=0;Q<b;++Q){let F=Number.MIN_SAFE_INTEGER,H=0,B=0;for(let Y=0;Y<T;++Y){let ne=X+Y*A;if(ne>=0&&ne<x)for(let ee=0;ee<_;++ee){let U=V+ee*$;if(U>=0&&U<y){let oe=c[j][ne][U][Q]+f[Y][ee][Q];oe>F&&(F=oe,H=Y,B=ee)}}}P[H][B][Q]+=z[j][G][J][Q]}}}return{dataId:d.write(R.toTypedArray(P,a.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},Lwe={kernelName:zf,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,c=R.toNestedArray(a.shape,d.data.get(a.dataId).values),f=R.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:m,inHeight:x,inWidth:y,inChannels:b,outHeight:w,outWidth:S,padInfo:k,strideHeight:C,strideWidth:E,filterHeight:T,filterWidth:_,dilationHeight:A,dilationWidth:$,outShape:O}=W.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);R.assert(s.rank===O.length,()=>`Error in ${zf}, dy must have the same rank as output ${O.length}, but got ${s.rank}`);let z=R.toNestedArray(O,d.data.get(s.dataId).values),P=R.makeZerosNestedTypedArray(a.shape,a.dtype);for(let j=0;j<m;++j)for(let G=0;G<w;++G){let X=G*C-k.top;for(let J=0;J<S;++J){let V=J*E-k.left;for(let Q=0;Q<b;++Q){let F=Number.MIN_SAFE_INTEGER,H=X<0?0:X,B=V<0?0:V;for(let Y=0;Y<T;++Y){let ne=X+Y*A;if(ne>=0&&ne<x)for(let ee=0;ee<_;++ee){let U=V+ee*$;if(U>=0&&U<y){let oe=c[j][ne][U][Q]+f[Y][ee][Q];oe>F&&(F=oe,H=ne,B=U)}}}P[j][H][B][Q]+=z[j][G][J][Q]}}}return{dataId:d.write(R.toTypedArray(P,a.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};function Pwe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r}=t,{canvas:s,options:i}=a,{contextOptions:o,imageOptions:l}=i||{},d=l?.alpha||1,c=o?.contextType||"2d";if(c!=="2d")throw new Error(`Context type ${o.contextType} is not supported by the CPU backend.`);let f=s.getContext(c,o?.contextAttributes||{});if(f==null)throw new Error(`Could not get the context with ${c} type.`);let[m,x]=r.shape.slice(0,2),y=r.shape.length===2?1:r.shape[2],b=n.data.get(r.dataId).values,w=r.dtype==="float32"?255:1,S=new Uint8ClampedArray(x*m*4);for(let C=0;C<m*x;++C){let E=[0,0,0,255*d];for(let _=0;_<y;_++){let A=b[C*y+_];if(r.dtype==="float32"){if(A<0||A>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${A}.`)}else if(r.dtype==="int32"&&(A<0||A>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${A}.`);y===1?(E[0]=A*w,E[1]=A*w,E[2]=A*w):E[_]=A*w}let T=C*4;S[T+0]=Math.round(E[0]),S[T+1]=Math.round(E[1]),S[T+2]=Math.round(E[2]),S[T+3]=Math.round(E[3])}s.width=x,s.height=m;let k=new ImageData(S,x,m);return f.putImageData(k,0,0),r}var zwe={kernelName:Sw,backendName:"cpu",kernelFunc:Pwe};function Qb(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;bt(r,"sum");let o;
vendor: 47,571 bytes, lines 107-117
107r.dtype==="bool"?o=ic({inputs:{x:r},backend:n,attrs:{dtype:"int32"}}):o=ol({inputs:{x:r},backend:n});let l=o.shape.length,d=R.parseAxisParam(s,o.shape),c=W.getAxesPermutation(d,l),f=d,m=o;c!=null&&(m=Ps({inputs:{x:o},backend:n,attrs:{perm:c}}),f=W.getInnerMostAxes(f.length,l)),W.assertAxesAreInnerMostDims("sum",f,m.shape.length);let[x,y]=W.computeOutAndReduceShapes(m.shape,f),b=W.upcastType(m.dtype,"int32"),w=Uv(n,x,b),S=R.sizeFromShape(y),k=n.data.get(w.dataId).values,C=n.data.get(m.dataId).values;for(let E=0;E<k.length;++E){let T=E*S,_=0;for(let A=0;A<S;++A)_+=C[T+A];k[E]=_}if(i){let E=W.expandShapeToKeepDim(w.shape,d),T=w;w=ca({inputs:{x:w},backend:n,attrs:{shape:E}}),n.disposeIntermediateTensorInfo(T)}return n.disposeIntermediateTensorInfo(o),c!=null&&n.disposeIntermediateTensorInfo(m),w}var Uwe={kernelName:rp,backendName:"cpu",kernelFunc:Qb};function Wwe(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=W.decodeEinsumEquation(r,s.length);W.checkEinsumDimSizes(i.length,l,s);let{path:d,steps:c}=W.getEinsumComputePath(o,l),f=c.length,m=null,x=i.length,y=[];for(let b=0;b<f;++b){for(let w of c[b]){let{permutationIndices:S,expandDims:k}=W.getEinsumPermutation(x,l[w]),C;W.isIdentityPermutation(S)?C=s[w]:(C=Ps({inputs:{x:s[w]},backend:n,attrs:{perm:S}}),y.push(C));let E=C.shape.slice();for(let T=0;T<k.length;++T)E.splice(k[T],0,1);R.arraysEqual(C.shape,E)||(C=ca({inputs:{x:C},backend:n,attrs:{shape:E}}),y.push(C)),m===null?m=C:(m=B2({inputs:{a:C,b:m},backend:n}),y.push(m))}b<f-1&&(d[b]>=0&&(m=Qb({inputs:{x:m},backend:n,attrs:{axis:d[b]-(i.length-x),keepDims:!1}}),y.push(m)),x--)}for(let b of y)b!==m&&n.disposeIntermediateTensorInfo(b);return m}var Vwe={kernelName:kw,backendName:"cpu",kernelFunc:Wwe};function Hwe(e){let{inputs:t,backend:n}=e,{dy:a,y:r}=t;bt([a,r],"eluGrad");let s=new Float32Array(R.sizeFromShape(r.shape)),i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values;for(let l=0;l<i.length;++l){let d=i[l];d>=0?s[l]=o[l]:s[l]=o[l]*(d+1)}return n.makeTensorInfo(r.shape,"float32",s)}var Gwe={kernelName:Im,backendName:"cpu",kernelFunc:Hwe},qwe=W.ERF_P,Kwe=W.ERF_A1,Xwe=W.ERF_A2,Ywe=W.ERF_A3,Jwe=W.ERF_A4,Qwe=W.ERF_A5,Zwe=Gn(fh,e=>{let t=Math.sign(e),n=Math.abs(e),a=1/(1+qwe*n);return t*(1-((((Qwe*a+Jwe)*a+Ywe)*a+Xwe)*a+Kwe)*a*Math.exp(-n*n))}),e2e={kernelName:fh,backendName:"cpu",kernelFunc:Zwe};function Hv(e){let{inputs:t,backend:n,attrs:a}=e,{input:r}=t,{dim:s}=a,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(R.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),ca({inputs:{x:r},backend:n,attrs:{shape:o}})}var t2e={kernelName:Am,backendName:"cpu",kernelFunc:Hv},n2e=Ha((e,t)=>e/t),f4=kr(hh,n2e),CE={kernelName:hh,backendName:"cpu",kernelFunc:f4};function TU(e,t,n){let a=e.shape,r=a[0],s=a[1],i=n.data.get(e.dataId),o=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,d=[r,s],c=R.sizeFromShape(d),f=R.getTypedArrayFromDType("float32",c),m=R.getTypedArrayFromDType("float32",c);for(let w=0;w<r;w++){let S=Od({inputs:{x:o},backend:n,attrs:{begin:[w,0],size:[1,s]}}),k=Od({inputs:{x:l},backend:n,attrs:{begin:[w,0],size:[1,s]}}),C=ei({inputs:{real:S,imag:k},backend:n}),{real:E,imag:T}=a2e(C,t,n),_=W.mergeRealAndImagArrays(E,T);for(let A=0;A<s;A++){let $=W.getComplexWithIndex(_,A);f[w*s+A]=$.real,m[w*s+A]=$.imag}n.disposeIntermediateTensorInfo(S),n.disposeIntermediateTensorInfo(k),n.disposeIntermediateTensorInfo(C)}let x=n.makeTensorInfo(d,"float32",f),y=n.makeTensorInfo(d,"float32",m),b=ei({inputs:{real:x,imag:y},backend:n});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),b}function a2e(e,t,n){let a=R.sizeFromShape(e.shape),r=n.data.get(e.dataId),s=n.data.get(r.complexTensorInfos.real.dataId).values,i=n.data.get(r.complexTensorInfos.imag.dataId).values;if(r2e(a)){let o=EE(s,i,a,t,n),l=[e.shape[0],e.shape[1]];if(t){let d=n.makeTensorInfo(l,"float32",o.real),c=n.makeTensorInfo(l,"float32",o.imag),f=n.makeTensorInfo([],"float32",R.createScalarValue(a,"float32")),m=ol({inputs:{x:f},backend:n}),x=CE.kernelFunc({inputs:{a:d,b:f},backend:n}),y=CE.kernelFunc({inputs:{a:c,b:m},backend:n}),b=n.data.get(x.dataId).values,w=n.data.get(y.dataId).values;return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),{real:b,imag:w}}return o}else{let o=W.mergeRealAndImagArrays(s,i),l=s2e(o,a,t);return W.splitRealAndImagArrays(l)}}function r2e(e){return(e&e-1)===0}function EE(e,t,n,a,r){if(n===1)return{real:e,imag:t};let s=W.mergeRealAndImagArrays(e,t),i=n/2,o=W.complexWithEvenIndex(s),l=o.real,d=o.imag,c=[l.length],f=r.makeTensorInfo(c,"float32",l),m=r.makeTensorInfo(c,"float32",d),x=ei({inputs:{real:f,imag:m},backend:r}),y=W.complexWithOddIndex(s),b=y.real,w=y.imag,S=[b.length],k=r.makeTensorInfo(S,"float32",b),C=r.makeTensorInfo(S,"float32",w),E=ei({inputs:{real:k,imag:C},backend:r}),T=EE(l,d,i,a,r),_=T.real,A=T.imag,$=[_.length],O=r.makeTensorInfo($,"float32",_),z=r.makeTensorInfo($,"float32",A),P=ei({inputs:{real:O,imag:z},backend:r}),j=EE(b,w,i,a,r),G=j.real,X=j.imag,J=[G.length],V=r.makeTensorInfo(J,"float32",G),Q=r.makeTensorInfo(J,"float32",X),F=ei({inputs:{real:V,imag:Q},backend:r}),H=W.exponents(n,a),B=[H.real.length],Y=r.makeTensorInfo(B,"float32",H.real),ne=r.makeTensorInfo(B,"float32",H.imag),ee=ei({inputs:{real:Y,imag:ne},backend:r}),U=B2({inputs:{a:ee,b:F},backend:r}),oe=em({inputs:{a:P,b:U},backend:r}),pe=d4({inputs:{a:P,b:U},backend:r}),he=Fd({inputs:{input:oe},backend:r}),xe=Fd({inputs:{input:pe},backend:r}),Ie=tm({inputs:{input:oe},backend:r}),_e=tm({inputs:{input:pe},backend:r}),Oe=nm({inputs:[he,xe],backend:r,attrs:{axis:0}}),Ye=nm({inputs:[Ie,_e],backend:r,attrs:{axis:0}}),ft=r.data.get(Oe.dataId).values,ze=r.data.get(Ye.dataId).values;return r.disposeIntermediateTensorInfo(f),r.disposeIntermediateTensorInfo(m),r.disposeIntermediateTensorInfo(x),r.disposeIntermediateTensorInfo(k),r.disposeIntermediateTensorInfo(C),r.disposeIntermediateTensorInfo(E),r.disposeIntermediateTensorInfo(O),r.disposeIntermediateTensorInfo(z),r.disposeIntermediateTensorInfo(P),r.disposeIntermediateTensorInfo(V),r.disposeIntermediateTensorInfo(Q),r.disposeIntermediateTensorInfo(F),r.disposeIntermediateTensorInfo(Y),r.disposeIntermediateTensorInfo(ne),r.disposeIntermediateTensorInfo(ee),r.disposeIntermediateTensorInfo(U),r.disposeIntermediateTensorInfo(oe),r.disposeIntermediateTensorInfo(pe),r.disposeIntermediateTensorInfo(he),r.disposeIntermediateTensorInfo(Ie),r.disposeIntermediateTensorInfo(xe),r.disposeIntermediateTensorInfo(_e),r.disposeIntermediateTensorInfo(Oe),r.disposeIntermediateTensorInfo(Ye),{real:ft,imag:ze}}function s2e(e,t,n){let a=new Float32Array(t*2);for(let r=0;r<t;r++){let s=0,i=0;for(let o=0;o<t;o++){let l=W.exponent(r*o,t,n),d=W.getComplexWithIndex(e,o);s+=d.real*l.real-d.imag*l.imag,i+=d.real*l.imag+d.imag*l.real}n&&(s/=t,i/=t),W.assignToTypedArray(a,s,i,r)}return a}function i2e(e){let{inputs:t,backend:n}=e,{input:a}=t,r=R.sizeFromShape(a.shape),s=a.shape[a.shape.length-1],i=r/s,o=ca({inputs:{x:a},backend:n,attrs:{shape:[i,s]}}),l=TU(o,!1,n),d=ca({inputs:{x:l},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),d}var o2e={kernelName:Nw,backendName:"cpu",kernelFunc:i2e};function m4(e){let{backend:t,attrs:n}=e,{shape:a,value:r,dtype:s}=n,i=s||R.inferDtype(r),o=R.getArrayFromDType(i,R.sizeFromShape(a));return u2e(o,r),t.makeTensorInfo(a,i,o)}var l2e={kernelName:ub,backendName:"cpu",kernelFunc:m4};function u2e(e,t,n){e.fill(t)}var c2e={kernelName:_m,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,r=n,s=R.getTypedArrayFromDType(a.dtype,R.sizeFromShape(a.shape)),[i,o,l,d]=a.shape,c=r.data.get(a.dataId).values;for(let f=0;f<i;f++){let m=f*l*o*d;for(let x=0;x<o;x++){let y=x*(l*d);for(let b=0;b<l;b++){let w=b*d;for(let S=0;S<d;S++){let k=Math.round(l-b-1),C=m+y+w+S,E=c[C];if(k>=0&&k<l){let T=k*d,_=m+y+T+S;E=c[_]}s[C]=E}}}}return{dataId:r.write(s,a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};function d2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:c,dilations:f,dimRoundingMode:m,activation:x,leakyreluAlpha:y}=a,b=EU({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:c,dilations:f,dimRoundingMode:m}});if(i){let w=b;if(c==="NCHW"&&i.shape.length===1&&i.shape[0]!==1){let S=ca({inputs:{x:i},backend:n,attrs:{shape:[i.shape[0],1,1]}});b=em({inputs:{a:b,b:S},backend:n}),n.disposeIntermediateTensorInfo(S)}else b=em({inputs:{a:b,b:i},backend:n});n.disposeIntermediateTensorInfo(w)}if(x){let w=b;if(c==="NCHW"&&x==="prelu"&&o.shape.length===1&&o.shape[0]!==1){let S=ca({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});b=Vv(n,b,x,S,y),n.disposeIntermediateTensorInfo(S)}else b=Vv(n,b,x,o,y);n.disposeIntermediateTensorInfo(w)}return b}var h2e={kernelName:Cd,backendName:"cpu",kernelFunc:d2e};function p2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:c,dilations:f,dimRoundingMode:m,activation:x,leakyreluAlpha:y}=a,b=IU({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:c,dilations:f,dimRoundingMode:m}});if(i){let w=b;b=em({inputs:{a:b,b:i},backend:n}),n.disposeIntermediateTensorInfo(w)}if(x){let w=b;b=Vv(n,b,x,o,y),n.disposeIntermediateTensorInfo(w)}return b}var f2e={kernelName:Ed,backendName:"cpu",kernelFunc:p2e};function m2e(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=R.sizeFromShape(a.shape),i=r.shape,o=i[i.length-1],[l,d,c,f]=W.prepareAndValidate(a,r);if(d===0)return n.makeTensorInfo(l,a.dtype,[]);let m=n.data.get(r.dataId).values,x=n.bufferSync(a),y=V7(m,x,a.dtype,d,o,c,f,a.shape,s);return n.makeTensorInfo(l,a.dtype,y.values)}var g2e={kernelName:Dm,backendName:"cpu",kernelFunc:m2e};function x2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,indices:s}=t,{axis:i,batchDims:o}=a;bt([r,s],"gatherV2");let l=R.parseAxisParam(i,r.shape)[0],d=n.data.get(s.dataId).values,c=r.shape[l];for(let E=0;E<d.length;++E){let T=d[E];R.assert(T<=c-1&&T>=0,()=>`GatherV2: the index value ${T} is not in [0, ${c-1}]`)}let f=o;o==null&&(f=0);let m=R.sizeFromShape(s.shape),x=W.segment_util.collectGatherOpShapeInfo(r,s,l,f),y=ca({inputs:{x:r},backend:n,attrs:{shape:[x.batchSize,x.outerSize,x.dimSize,x.sliceSize]}}),b=ca({inputs:{x:s},backend:n,attrs:{shape:[x.batchSize,m/x.batchSize]}}),w=[x.batchSize,x.outerSize,m/x.batchSize,x.sliceSize],S=n.bufferSync(b),k=n.bufferSync(y),C=H7(k,S,w);return n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),n.makeTensorInfo(x.outputShape,C.dtype,C.values)}var y2e={kernelName:jm,backendName:"cpu",kernelFunc:x2e};function b2e(e){let{inputs:t,backend:n}=e,{input:a}=t,r=R.sizeFromShape(a.shape),s=a.shape[a.shape.length-1],i=r/s,o=ca({inputs:{x:a},backend:n,attrs:{shape:[i,s]}}),l=TU(o,!0,n),d=ca({inputs:{x:l},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),d}var v2e={kernelName:Cw,backendName:"cpu",kernelFunc:b2e},w2e=Gn(Sh,e=>Number.isFinite(e)?1:0,"bool"),S2e={kernelName:Sh,backendName:"cpu",kernelFunc:w2e},k2e=Gn(kh,e=>Math.abs(e)===1/0?1:0,"bool"),N2e={kernelName:kh,backendName:"cpu",kernelFunc:k2e},C2e=Gn(Nh,e=>Number.isNaN(e)?1:0,"bool"),E2e={kernelName:Nh,backendName:"cpu",kernelFunc:C2e};function I2e(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=Y7(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var T2e={kernelName:Bm,backendName:"cpu",kernelFunc:I2e},A2e=Gn(Ih,e=>Math.log1p(e)),_2e={kernelName:Ih,backendName:"cpu",kernelFunc:A2e},j2e=Ha((e,t)=>e&&t),D2e=kr(Fm,j2e,null,"bool"),R2e={kernelName:Fm,backendName:"cpu",kernelFunc:D2e},M2e=Gn(Om,e=>e?0:1,"bool"),$2e={kernelName:Om,backendName:"cpu",kernelFunc:M2e},B2e=Ha((e,t)=>e||t),F2e=kr(Lm,B2e,null,"bool"),O2e={kernelName:Lm,backendName:"cpu",kernelFunc:F2e};function L2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a;bt(r,"LRN");let d=r.shape[3],c=d-1,f=n.data.get(r.dataId).values,m=R.sizeFromShape(r.shape),x=new Float32Array(m);function y(b){let w=b%d,S=b-w+Math.max(0,w-s),k=b-w+Math.min(w+s,c),C=0;for(;S<=k;S++){let E=f[S];C+=E*E}return C}for(let b=0;b<m;b++){let w=y(b),S=f[b]*Math.pow(i+o*w,-l);x[b]=S}return n.makeTensorInfo(r.shape,r.dtype,x)}var P2e={kernelName:Th,backendName:"cpu",kernelFunc:L2e};function z2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:c}=a;bt(i,"LRNGrad");let f=R.sizeFromShape(i.shape),m=i.shape[3],x=n.data.get(i.dataId).values,y=n.data.get(r.dataId).values,b=n.data.get(s.dataId).values,w=new Float32Array(f),S=f;for(let k=0;k<S;k++){let C=k%m,E=k-C+Math.max(0,C-o),T=k-C+Math.min(m,C+o+1),_=0;for(let A=E;A<T;A++)_+=Math.pow(y[A],2);_=d*_+l;for(let A=E;A<T;A++){let $=-2*d*c*y[A]*b[k]/_;k===A&&($+=Math.pow(_,-c)),$*=x[k],w[A]+=$}}return n.makeTensorInfo(i.shape,r.dtype,w)}var U2e={kernelName:Pm,backendName:"cpu",kernelFunc:z2e};function AU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=n,l=r.shape,d=l.length,c=R.parseAxisParam(s,l),f=c,m=W.getAxesPermutation(f,d),x=o.data.get(r.dataId).values;if(m!=null){let E=new Array(d);for(let T=0;T<E.length;T++)E[T]=l[m[T]];x=s4(x,l,r.dtype,m,E),f=W.getInnerMostAxes(f.length,d),l=E}bt(r,"max"),W.assertAxesAreInnerMostDims("max",f,d);let[y,b]=W.computeOutAndReduceShapes(l,f),w=R.sizeFromShape(b),S=Q7(x,w,y,r.dtype),k=o.write(S,y,r.dtype),C=y;return i&&(C=W.expandShapeToKeepDim(y,c)),{dataId:k,shape:C,dtype:r.dtype}}var W2e={kernelName:Ah,backendName:"cpu",kernelFunc:AU};function V2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;bt(r,"maxPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;R.assert(W.eitherStridesOrDilationsAreOne(i,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let c=W.computePool2DInfo(r.shape,s,i,d,o,l),f;if(c.filterWidth===1&&c.filterHeight===1&&R.arraysEqual(c.inShape,c.outShape))f=ol({inputs:{x:r},backend:n});else{let m=n.data.get(r.dataId).values,x=R.computeStrides(r.shape),y=p4(m,r.shape,r.dtype,x,c,"max");f=n.makeTensorInfo(c.outShape,r.dtype,y.values)}return f}var H2e={kernelName:jh,backendName:"cpu",kernelFunc:V2e};function G2e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;bt(r,"maxPool3d");let c=W.computePool3DInfo(r.shape,s,i,1,o,l,d),f=n.data.get(r.dataId).values,m=CU(f,r.shape,r.dtype,R.computeStrides(r.shape),c,"max");return n.makeTensorInfo(m.shape,"float32",m.values)}var q2e={kernelName:zm,backendName:"cpu",kernelFunc:G2e};function K2e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;bt([r,s],"maxPool3DGrad");let c=W.computePool3DInfo(s.shape,i,o,1,l,d),f=n.bufferSync(s),m=Bve(f,c),x=c.strideDepth,y=c.strideHeight,b=c.strideWidth,w=c.dilationDepth,S=c.dilationHeight,k=c.dilationWidth,C=c.effectiveFilterDepth,E=c.effectiveFilterHeight,T=c.effectiveFilterWidth,_=C-1-c.padInfo.front,A=T-1-c.padInfo.left,$=E-1-c.padInfo.top,O=Zt(s.shape,"float32"),z=n.bufferSync(r);for(let P=0;P<c.batchSize;++P)for(let j=0;j<c.inChannels;++j)for(let G=0;G<c.inDepth;++G)for(let X=0;X<c.inHeight;++X)for(let J=0;J<c.inWidth;++J){let V=G-_,Q=X-$,F=J-A,H=0;for(let B=0;B<C;B+=w){let Y=(V+B)/x;if(!(Y<0||Y>=c.outDepth||Math.floor(Y)!==Y))for(let ne=0;ne<E;ne+=S){let ee=(Q+ne)/y;if(!(ee<0||ee>=c.outHeight||Math.floor(ee)!==ee))for(let U=0;U<T;U+=k){let oe=(F+U)/b;if(oe<0||oe>=c.outWidth||Math.floor(oe)!==oe)continue;let pe=C*E*T-1-m.get(P,Y,ee,oe,j),he=B*E*T+ne*T+U,xe=pe===he?1:0;if(xe===0)continue;let Ie=z.get(P,Y,ee,oe,j);H+=Ie*xe}}}O.set(H,P,G,X,J,j)}return n.makeTensorInfo(O.shape,O.dtype,O.values)}var X2e={kernelName:db,backendName:"cpu",kernelFunc:K2e};function Y2e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;bt([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:c,dimRoundingMode:f}=a,m=W.computePool2DInfo(o.shape,l,d,1,c,f),x=n.data.get(o.dataId).values,y=Zt(m.outShape,o.dtype,NU(x,o.shape,o.dtype,m).values),b=m.strideHeight,w=m.strideWidth,S=m.dilationHeight,k=m.dilationWidth,C=m.effectiveFilterHeight,E=m.effectiveFilterWidth,T=E-1-m.padInfo.left,_=C-1-m.padInfo.top,A=Zt(o.shape,"float32"),$=n.data.get(r.dataId).values,O=Zt(r.shape,"float32",$);for(let z=0;z<m.batchSize;++z)for(let P=0;P<m.inChannels;++P)for(let j=0;j<m.inHeight;++j)for(let G=0;G<m.inWidth;++G){let X=j-_,J=G-T,V=0;for(let Q=0;Q<C;Q+=S){let F=(X+Q)/b;if(!(F<0||F>=m.outHeight||Math.floor(F)!==F))for(let H=0;H<E;H+=k){let B=(J+H)/w;if(B<0||B>=m.outWidth||Math.floor(B)!==B)continue;let Y=C*E-1-y.get(z,F,B,P),ne=Q*E+H,ee=Y===ne?1:0;if(ee===0)continue;let U=O.get(z,F,B,P);V+=U*ee}}A.set(V,z,j,G,P)}return n.makeTensorInfo(A.shape,A.dtype,A.values)}var J2e={kernelName:cb,backendName:"cpu",kernelFunc:Y2e};function Q2e(e,t,n,a,r){let s=R.computeStrides(t),i=p4(e,t,n,s,r,"max"),o=NU(e,t,n,r,!0,a);return[i.values,o.values]}var Z2e={kernelName:hb,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;bt(a,"MaxPoolWithArgmax");let d=l.data.get(a.dataId).values,c=W.computePool2DInfo(a.shape,r,s,[1,1],i),[f,m]=Q2e(d,a.shape,a.dtype,o,c),x=l.write(f,c.outShape,a.dtype),y=l.write(m,c.outShape,a.dtype);return[{dataId:x,shape:c.outShape,dtype:a.dtype},{dataId:y,shape:c.outShape,dtype:"int32"}]}};function eSe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=R.parseAxisParam(s,r.shape),l=W.computeOutAndReduceShapes(r.shape,o)[1],d=R.sizeFromShape(l),c=[],f=n.makeTensorInfo([],"float32",new Float32Array([d]));c.push(f);let m=ic({inputs:{x:r},backend:n,attrs:{dtype:"float32"}});c.push(m);let x=f4({inputs:{a:m,b:f},backend:n});c.push(x);let y=Qb({inputs:{x},backend:n,attrs:{axis:s,keepDims:i}});return c.forEach(b=>n.disposeIntermediateTensorInfo(b)),y}var tSe={kernelName:Dh,backendName:"cpu",kernelFunc:eSe};function nSe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;bt(r,"min");let o=R.parseAxisParam(s,r.shape),l=o,d=W.getAxesPermutation(l,r.shape.length),c=r;d!=null&&(c=Ps({inputs:{x:r},backend:n,attrs:{perm:d}}),l=W.getInnerMostAxes(l.length,r.shape.length)),W.assertAxesAreInnerMostDims("min",l,c.shape.length);let[f,m]=W.computeOutAndReduceShapes(c.shape,l),x=R.sizeFromShape(m),y=R.makeZerosTypedArray(R.sizeFromShape(f),c.dtype),b=n.data.get(c.dataId).values;for(let S=0;S<y.length;++S){let k=S*x,C=b[k];for(let E=0;E<x;++E){let T=b[k+E];(Number.isNaN(T)||T<C)&&(C=T)}y[S]=C}d!=null&&n.disposeIntermediateTensorInfo(c);let w=n.makeTensorInfo(f,c.dtype,y);if(i){let S=W.expandShapeToKeepDim(f,o),k=ca({inputs:{x:w},backend:n,attrs:{shape:S}});return n.disposeIntermediateTensorInfo(w),k}return w}var aSe={kernelName:Rh,backendName:"cpu",kernelFunc:nSe};function rSe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,mode:i}=a;bt(r,"mirrorPad");let o=s.map((k,C)=>k[0]+r.shape[C]+k[1]),l=s.map(k=>k[0]),d=s.map((k,C)=>k[0]+r.shape[C]),c=i==="reflect"?0:1,f=n.data.get(r.dataId).values,m=r.shape.length,x=R.computeStrides(r.shape),y=R.sizeFromShape(o),b=o.length,w=R.computeStrides(o),S=R.getTypedArrayFromDType(r.dtype,y);for(let k=0;k<y;k++){let C=R.indexToLoc(k,b,w);for(let T=0;T<b;T++)C[T]<l[T]?C[T]=l[T]*2-C[T]-c:C[T]>=d[T]&&(C[T]=(d[T]-1)*2-C[T]+c);C=C.map((T,_)=>T-l[_]);let E=R.locToIndex(C,m,x);S[k]=f[E]}return{dataId:n.write(S,o,r.dtype),shape:o,dtype:r.dtype}}var sSe={kernelName:$h,backendName:"cpu",kernelFunc:rSe},iSe=Ha((e,t)=>{let n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),oSe=kr(Bh,iSe),lSe={kernelName:Bh,backendName:"cpu",kernelFunc:oSe},uSe=dc(fw());function _U(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=r.shape.length,o=s;if(o===-1&&(o=i-1),o!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${o}`);let l=R.parseAxisParam([o],r.shape),d=AU({inputs:{x:r},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=W.expandShapeToKeepDim(d.shape,l),f=ca({inputs:{x:d},backend:n,attrs:{shape:c}}),m=d4({inputs:{a:r,b:f},backend:n}),x=P7({inputs:{x:m},backend:n}),y=Qb({inputs:{x},backend:n,attrs:{axis:l,keepDims:!1}}),b=ca({inputs:{x:y},backend:n,attrs:{shape:c}}),w=f4({inputs:{a:x,b},backend:n});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),w}var cSe={kernelName:sp,backendName:"cpu",kernelFunc:_U};function dSe(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a;bt(r,"multinomial");let l=o?r:_U({inputs:{logits:r},backend:n,attrs:{dim:-1}}),d=l.shape[0],c=l.shape[1],f=n.data.get(l.dataId).values,m=[d,s],x=R.makeZerosTypedArray(R.sizeFromShape(m),"int32");for(let y=0;y<d;++y){let b=y*c,w=new Float32Array(c-1);w[0]=f[b];for(let C=1;C<w.length;++C)w[C]=w[C-1]+f[b+C];let S=uSe.alea(i.toString()),k=y*s;for(let C=0;C<s;++C){let E=S();x[k+C]=w.length;for(let T=0;T<w.length;T++)if(E<w[T]){x[k+C]=T;break}}}return o||n.disposeIntermediateTensorInfo(l),n.makeTensorInfo(m,"int32",x)}var hSe={kernelName:Um,backendName:"cpu",kernelFunc:dSe},pSe=cl.nonMaxSuppressionV3Impl;function fSe(e){let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a;bt(r,"NonMaxSuppression");let d=n.data.get(r.dataId).values,c=n.data.get(s.dataId).values,{selectedIndices:f}=pSe(d,c,i,o,l);return n.makeTensorInfo([f.length],"int32",new Int32Array(f))}var mSe={kernelName:Hm,backendName:"cpu",kernelFunc:fSe},gSe=cl.nonMaxSuppressionV4Impl;function xSe(e){let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:d}=a;bt(r,"NonMaxSuppressionPadded");let c=n.data.get(r.dataId).values,f=n.data.get(s.dataId).values,{selectedIndices:m,validOutputs:x}=gSe(c,f,i,o,l,d);return[n.makeTensorInfo([m.length],"int32",new Int32Array(m)),n.makeTensorInfo([],"int32",new Int32Array([x]))]}var ySe={kernelName:Gm,backendName:"cpu",kernelFunc:xSe},bSe=cl.nonMaxSuppressionV5Impl;function vSe(e){let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:d}=a;bt(r,"NonMaxSuppressionWithScore");let c=n.data.get(r.dataId).values,f=n.data.get(s.dataId).values,m=i,x=o,y=l,b=d,{selectedIndices:w,selectedScores:S}=bSe(c,f,m,x,y,b);return[n.makeTensorInfo([w.length],"int32",new Int32Array(w)),n.makeTensorInfo([S.length],"float32",new Float32Array(S))]}var wSe={kernelName:qm,backendName:"cpu",kernelFunc:vSe};function SSe(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{dtype:s,depth:i,onValue:o,offValue:l}=a;bt(r,"oneHot");let d=R.sizeFromShape(r.shape),c=new Float32Array(d*i);c.fill(l);let f=n.data.get(r.dataId).values;for(let m=0;m<d;++m)f[m]>=0&&f[m]<i&&(c[m*i+f[m]]=o);return n.makeTensorInfo([...r.shape,i],s,c)}var kSe={kernelName:Oh,backendName:"cpu",kernelFunc:SSe};function Gv(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("zerosLike is not supported for string tensors");if(a.dtype==="complex64"){let r=Fd({inputs:{input:a},backend:n}),s=Gv({inputs:{x:r},backend:n}),i=tm({inputs:{input:a},backend:n}),o=Gv({inputs:{x:i},backend:n}),l=ei({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return m4({backend:n,attrs:{shape:a.shape,value:0,dtype:a.dtype}})}var NSe={kernelName:hg,backendName:"cpu",kernelFunc:Gv};function jU(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported for string tensors");if(a.dtype==="complex64"){let r=Fd({inputs:{input:a},backend:n}),s=jU({inputs:{x:r},backend:n}),i=tm({inputs:{input:a},backend:n}),o=Gv({inputs:{x:i},backend:n}),l=ei({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return m4({backend:n,attrs:{shape:a.shape,value:1,dtype:a.dtype}})}var CSe={kernelName:Km,backendName:"cpu",kernelFunc:jU};function DU(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return Hv({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(c=>{R.assertShapesMatch(s,c.shape,"All tensors passed to stack must have matching shapes"),R.assert(i===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(c=>{let f=Hv({inputs:{input:c},backend:n,attrs:{dim:r}});return o.push(f),f}),d=nm({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(c=>n.disposeIntermediateTensorInfo(c)),d}var ESe={kernelName:Xm,backendName:"cpu",kernelFunc:DU};function ISe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a;bt(r,"pad");let o=s.map((S,k)=>S[0]+r.shape[k]+S[1]),l=s.map(S=>S[0]),d=n.data.get(r.dataId).values,c=R.sizeFromShape(r.shape),f=r.shape.length,m=R.computeStrides(r.shape),x=R.sizeFromShape(o),y=o.length,b=R.computeStrides(o),w=R.getTypedArrayFromDType(r.dtype,x);i!==0&&w.fill(i);for(let S=0;S<c;S++){let k=R.indexToLoc(S,f,m).map((E,T)=>E+l[T]),C=R.locToIndex(k,y,b);w[C]=d[S]}return{dataId:n.write(w,o,r.dtype),shape:o,dtype:r.dtype}}var RU={kernelName:Lh,backendName:"cpu",kernelFunc:ISe},TSe=Ha((e,t)=>Math.pow(e,t)),ASe=kr(Ph,TSe),_Se={kernelName:Ph,backendName:"cpu",kernelFunc:ASe};function jSe(e){let{inputs:t,backend:n,attrs:a}=e,{paramsNestedSplits:r,paramsDenseValues:s,indices:i}=t,{outputRaggedRank:o}=a,l=r.map(S=>n.data.get(S.dataId).values),d=r.map(S=>S.shape),c=n.data.get(s.dataId).values,f=n.data.get(i.dataId).values,[m,x,y]=rU(l,d,c,s.shape,s.dtype,f,i.shape),b=m.map(S=>n.makeTensorInfo([S.length],"int32",S)),w=n.makeTensorInfo(y,s.dtype,x);return b.concat([w])}var DSe={kernelName:Iw,backendName:"cpu",kernelFunc:jSe};function RSe(e){let{inputs:t,backend:n}=e,{starts:a,limits:r,deltas:s}=t,i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[d,c]=sU(i,a.shape,a.dtype,o,r.shape,l,s.shape),f=n.makeTensorInfo([d.length],"int32",d),m=n.makeTensorInfo([c.length],a.dtype,c);return[f,m]}var MSe={kernelName:Tw,backendName:"cpu",kernelFunc:RSe};function $Se(e){let{inputs:t,backend:n,attrs:a}=e,{shape:r,values:s,defaultValue:i,rowPartitionTensors:o}=t,{rowPartitionTypes:l}=a,d=n.data.get(r.dataId).values,c=n.data.get(s.dataId).values,f=n.data.get(i.dataId).values,m=o.map(w=>n.data.get(w.dataId).values),x=o.map(w=>w.shape),[y,b]=iU(d,r.shape,c,s.shape,s.dtype,f,i.shape,m,x,l);return n.makeTensorInfo(y,s.dtype,b)}var BSe={kernelName:Aw,backendName:"cpu",kernelFunc:$Se};function FSe(e){let{backend:t,attrs:n}=e,{start:a,stop:r,dtype:s,step:i}=n,o=i4(a,r,i,s);return t.makeTensorInfo([o.length],s,o)}var OSe={kernelName:pb,backendName:"cpu",kernelFunc:FSe},LSe=Gn(Wh,e=>1/e),PSe={kernelName:Wh,backendName:"cpu",kernelFunc:LSe};function zSe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a;bt(r,"resizeBilinear");let l=R.computeStrides(r.shape),[d,c]=o,[f,m,x,y]=r.shape,b=n.data.get(r.dataId).values,w=new Float32Array(R.sizeFromShape([f,d,c,y])),S=[s&&d>1?m-1:m,s&&c>1?x-1:x],k=[s&&d>1?d-1:d,s&&c>1?c-1:c],C=0,E=S[0]/k[0],T=S[1]/k[1];for(let _=0;_<f;_++)for(let A=0;A<d;A++){let $;i?$=E*(A+.5)-.5:$=E*A;let O=Math.max(0,Math.floor($)),z=$-O,P=Math.min(m-1,Math.ceil($)),j=_*l[0]+O*l[1],G=_*l[0]+P*l[1];for(let X=0;X<c;X++){let J;i?J=T*(X+.5)-.5:J=T*X;let V=Math.max(0,Math.floor(J)),Q=J-V,F=Math.min(x-1,Math.ceil(J)),H=j+V*l[2],B=G+V*l[2],Y=j+F*l[2],ne=G+F*l[2];for(let ee=0;ee<y;ee++){let U=b[H+ee],oe=b[B+ee],pe=b[Y+ee],he=b[ne+ee],xe=U+(pe-U)*Q,Ie=oe+(he-oe)*Q,_e=xe+(Ie-xe)*z;w[C++]=_e}}}return n.makeTensorInfo([f,d,c,y],"float32",w)}var USe={kernelName:Gh,backendName:"cpu",kernelFunc:zSe};function WSe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a;bt([s,r],"resizeBilinearGrad");let o=R.computeStrides(r.shape),[l,d,c,f]=r.shape,[,m,x]=s.shape,y=new Float32Array(l*d*c*f),b=[i&&m>1?d-1:d,i&&x>1?c-1:c],w=[i&&m>1?m-1:m,i&&x>1?x-1:x],S=b[0]/w[0],k=b[1]/w[1],C=n.data.get(s.dataId).values,E=0;for(let T=0;T<l;T++){let _=T*o[0];for(let A=0;A<m;A++){let $=A*S,O=Math.floor($),z=Math.min(Math.ceil($),d-1),P=_+O*o[1],j=_+z*o[1],G=$-O,X=1-G;for(let J=0;J<x;J++){let V=J*k,Q=Math.floor(V),F=Math.min(Math.ceil(V),c-1),H=V-Q,B=1-H,Y=P+Q*o[2],ne=P+F*o[2],ee=j+Q*o[2],U=j+F*o[2],oe=X*B,pe=X*H,he=G*B,xe=G*H;for(let Ie=0;Ie<f;Ie++){let _e=C[E++];y[Y+Ie]+=_e*oe,y[ne+Ie]+=_e*pe,y[ee+Ie]+=_e*he,y[U+Ie]+=_e*xe}}}}return n.makeTensorInfo([l,c,d,f],"float32",y)}var VSe={kernelName:Qm,backendName:"cpu",kernelFunc:WSe};function HSe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a;bt(r,"resizeNearestNeighbor");let l=R.computeStrides(r.shape),[d,c]=o,[f,m,x,y]=r.shape,b=n.data.get(r.dataId).values,w=new Float32Array(f*d*c*y),S=[s&&d>1?m-1:m,s&&c>1?x-1:x],k=[s&&d>1?d-1:d,s&&c>1?c-1:c],C=S[0]/k[0],E=S[1]/k[1],T=0;for(let _=0;_<f;_++){let A=_*l[0];for(let $=0;$<d;$++){let O=i?C*($+.5):C*$,z=Math.min(m-1,s?Math.round(O):Math.floor(O));i&&(z=Math.max(0,z));let P=A+z*l[1];for(let j=0;j<c;j++){let G=i?E*(j+.5):E*j,X=Math.min(x-1,s?Math.round(G):Math.floor(G));i&&(X=Math.max(0,X));let J=P+X*l[2];for(let V=0;V<y;V++){let Q=b[J+V];w[T++]=Q}}}}return n.makeTensorInfo([f,d,c,y],r.dtype,w)}var GSe={kernelName:Hh,backendName:"cpu",kernelFunc:HSe};function qSe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a;bt([s,r],"resizeNearestNeighborGrad");let o=R.computeStrides(r.shape),l=R.computeStrides(s.shape),[d,c,f,m]=r.shape,[,x,y]=s.shape,b=new Float32Array(d*c*f*m),w=n.data.get(s.dataId).values,S=[i&&x>1?c-1:c,i&&y>1?f-1:f],k=[i&&x>1?x-1:x,i&&y>1?y-1:y],C=S[0]/k[0],E=S[1]/k[1],T=1/C,_=1/E,A=Math.ceil(T)*2+2,$=Math.ceil(_)*2+2;for(let O=0;O<d;O++){let z=O*o[0];for(let P=0;P<c;P++){let j=z+P*o[1],G=Math.floor(P*T),X=Math.floor(G-A/2);for(let J=0;J<f;J++){let V=j+J*o[2],Q=Math.floor(J*_),F=Math.floor(Q-$/2);for(let H=0;H<m;H++){let B=0;for(let Y=0;Y<A;Y++){let ne=Y+X;if(ne<0||ne>=x)continue;let ee=z+ne*l[1],U=ne*C,oe=Math.min(c-1,i?Math.round(U):Math.floor(U));if(P===oe)for(let pe=0;pe<$;pe++){let he=pe+F;if(he<0||he>=y)continue;let xe=ee+he*l[2],Ie=he*E,_e=Math.min(f-1,i?Math.round(Ie):Math.floor(Ie));J===_e&&(B+=w[xe+H])}}b[V+H]=B}}}}return n.makeTensorInfo(r.shape,r.dtype,b)}var KSe={kernelName:Jm,backendName:"cpu",kernelFunc:qSe};function XSe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a;bt(r,"reverse");let i=r.shape.length,o=R.parseAxisParam(s,r.shape);if(i===0)return ol({inputs:{x:r},backend:n});let l=new ar(r.shape,r.dtype),d=n.bufferSync(r);for(let c=0;c<l.size;c++){let f=l.indexToLoc(c),m=f.slice();o.forEach(x=>m[x]=r.shape[x]-1-m[x]),l.set(d.get(...m),...f)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}var YSe={kernelName:Kh,backendName:"cpu",kernelFunc:XSe},JSe={kernelName:pg,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=R.getTypedArrayFromDType(a.dtype,R.sizeFromShape(a.shape)),[d,c,f,m]=a.shape,[x,y]=W.getImageCenter(i,c,f),b=255,w=Math.sin(r),S=Math.cos(r),k=o.data.get(a.dataId).values;for(let C=0;C<d;C++){let E=C*f*c*m;for(let T=0;T<c;T++){let _=T*(f*m);for(let A=0;A<f;A++){let $=A*m;for(let O=0;O<m;O++){let z=[d,T,A,O],P=z[2],j=z[1],G=(P-x)*S-(j-y)*w,X=(P-x)*w+(j-y)*S;G=Math.round(G+x),X=Math.round(X+y);let J=s;if(typeof s!="number"&&(O===3?J=b:J=s[O]),G>=0&&G<f&&X>=0&&X<c){let Q=X*(f*m),F=G*m,H=E+Q+F+O;J=k[H]}let V=E+_+$+O;l[V]=J}}}}return{dataId:o.write(l,a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}},QSe=Gn(Xh,e=>{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2===0?t:t+1}),ZSe={kernelName:Xh,backendName:"cpu",kernelFunc:QSe};function eke(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r,updates:s}=t,{shape:i}=a,{sliceRank:o,numUpdates:l,sliceSize:d,strides:c,outputSize:f}=W.calculateShapes(s,r,i),m=!0,x=n.bufferSync(r),y=n.bufferSync(s),b=xd(x,y,i,f,d,l,o,c,0,m);return n.makeTensorInfo(i,b.dtype,b.values)}var tke={kernelName:Zm,backendName:"cpu",kernelFunc:eke};function nke(e,t){let n=0,a=e.length,r=0;for(;n<a;)r=Math.floor((n+a)/2),e[r]<t?n=r+1:a=r;return a}function ake(e,t){let n=0,a=e.length,r=0;for(;n<a;)r=Math.floor((n+a)/2),e[r]<=t?n=r+1:a=r;return a}function rke(e,t,n,a,r,s){let i=R.getArrayFromDType("int32",n*r);for(let o=0;o<n;++o){let l=e.slice(o*a,(o+1)*a),d=o*r;for(let c=0;c<r;++c)i[d+c]=s==="left"?nke(l,t[c+d]):ake(l,t[c+d])}return i}function ske(e){let{inputs:t,backend:n,attrs:a}=e,{sortedSequence:r,values:s}=t,{side:i}=a,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,d=rke(o,l,r.shape[0],r.shape[1],s.shape[1],i);return n.makeTensorInfo(s.shape,"int32",d)}var ike={kernelName:tg,backendName:"cpu",kernelFunc:ske};function oke(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t;bt([a,r,s],"select");let i=a.shape.length,o=n.data.get(a.dataId).values,l=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,c=Di(r.dtype,s.dtype),f=R.makeZerosTypedArray(R.sizeFromShape(r.shape),c),m=0,x=i===0||i>1||r.shape.length===1?1:R.sizeFromShape(r.shape.slice(1));for(let y=0;y<o.length;y++)for(let b=0;b<x;b++)o[y]===1?f[m++]=l[y]:f[m++]=d[y];return n.makeTensorInfo(r.shape,c,f)}var lke={kernelName:ng,backendName:"cpu",kernelFunc:oke},uke=W.SELU_SCALEALPHA,cke=W.SELU_SCALE,dke=Gn(Jh,e=>e>=0?cke*e:uke*(Math.exp(e)-1)),hke={kernelName:Jh,backendName:"cpu",kernelFunc:dke},pke=Gn(ep,e=>e<0?-1:e>0?1:0),fke={kernelName:ep,backendName:"cpu",kernelFunc:pke},mke=Gn(Qh,e=>Math.sin(e)),gke={kernelName:Qh,backendName:"cpu",kernelFunc:mke},xke=Gn(Zh,e=>Math.sinh(e)),yke={kernelName:Zh,backendName:"cpu",kernelFunc:xke},bke=11920928955078125e-23,U$=Math.log(bke)+2,vke=Gn(np,e=>{let t=e>-U$,n=e<U$,a=Math.exp(e),r;return n?r=a:t?r=e:r=Math.log(1+a),r}),wke={kernelName:np,backendName:"cpu",kernelFunc:vke};function Ske(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;bt([r],"spaceToBatchND");let o=R.sizeFromShape(s),l=[[0,0]];l.push(...i);for(let w=1+s.length;w<r.shape.length;++w)l.push([0,0]);let d=RU.kernelFunc({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),c=W.getReshaped(d.shape,s,o,!1),f=W.getPermuted(c.length,s.length,!1),m=W.getReshapedPermuted(d.shape,s,o,!1),x=ca({inputs:{x:d},backend:n,attrs:{shape:c}}),y=Ps({inputs:{x},backend:n,attrs:{perm:f}}),b=ca({inputs:{x:y},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),b}var kke={kernelName:rg,backendName:"cpu",kernelFunc:Ske};function Nke(e){let{inputs:t,backend:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=t;if(s.shape.length!==1)throw new Error(`Dense shape must be a vector, saw:
108        ${s.shape}`);if(a.shape.length!==2)throw new Error(`Indices must be a matrix, saw:
109        ${a.shape}`);if(r.shape.length!==1)throw new Error(`Values must be a vector, saw:
110        ${r.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw:
111        ${i.shape}`);let o=n.data.get(a.dataId).values,l=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,c=n.data.get(i.dataId).values[0],[f,m,x,y,b]=uU(o,a.shape,a.dtype,l,r.dtype,d,c);return[n.makeTensorInfo(m,a.dtype,f),n.makeTensorInfo([m[0]],r.dtype,x),n.makeTensorInfo([y.length],"bool",new Uint8Array(y.map(w=>Number(w)))),n.makeTensorInfo([b.length],a.dtype,new Int32Array(b))]}var Cke={kernelName:fb,backendName:"cpu",kernelFunc:Nke};function Eke(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape
112        ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape
113        ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.data.get(r.dataId).values),o=n.data.get(a.dataId).values,l=Array.from(n.data.get(s.dataId).values),[d,c,f]=cU(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(c,a.dtype,d),n.makeTensorInfo([f.length],s.dtype,new Int32Array(f))]}var Ike={kernelName:ig,backendName:"cpu",kernelFunc:Eke};function Tke(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape
114          ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
115          ${s.shape}`);if(r.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");let i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[d,c]=o4(i,a.shape,a.dtype,o,l,!0);return n.makeTensorInfo(c,a.dtype,d)}var Ake={kernelName:mb,backendName:"cpu",kernelFunc:Tke};function _ke(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape
116         ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
117         ${s.shape}`);if(r.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");let i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[d,c]=o4(i,a.shape,a.dtype,o,l);return n.makeTensorInfo(c,a.dtype,d)}var jke={kernelName:gb,backendName:"cpu",kernelFunc:_ke};function Dke(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,sliceSize:c,strides:f,outputSize:m}=W.calculateShapes(s,r,o),x=!1,y=n.bufferSync(r),b;switch(s.dtype){case"bool":{let w=n.bufferSync(s),S=!!n.data.get(i.dataId).values[0];b=xd(y,w,o,m,c,d,l,f,S,x);break}case"float32":{let w=n.bufferSync(s),S=n.data.get(i.dataId).values[0];b=xd(y,w,o,m,c,d,l,f,S,x);break}case"int32":{let w=n.bufferSync(s),S=n.data.get(i.dataId).values[0];b=xd(y,w,o,m,c,d,l,f,S,x);break}case"string":{let w=n.bufferSync(s),S=R.decodeString(n.data.get(i.dataId).values[0]);b=xd(y,w,o,m,c,d,l,f,S,x);break}default:throw new Error(`Unsupported type ${s.dtype}`)}return n.makeTensorInfo(o,b.dtype,b.values)}var Rke={kernelName:og,backendName:"cpu",kernelFunc:Dke};function Mke(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=R.parseAxisParam(i,r.shape)[0],l=W.prepareSplitSize(r,s,o),d=new Array(r.shape.length).fill(0),c=r.shape.slice();return l.map(f=>{let m=[...c];m[o]=f;let x=Od({inputs:{x:r},backend:n,attrs:{begin:d,size:m}});return d[o]+=f,x})}var $ke={kernelName:sg,backendName:"cpu",kernelFunc:Mke},Bke={kernelName:xb,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,a=t;bt(n,"square");let r=a.data.get(n.dataId).values,s=new Float32Array(r.length);for(let i=0;i<r.length;++i){let o=r[i];s[i]=o*o}return{dataId:a.write(s,n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}},Fke=Gn(mc,(e,t)=>{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),Oke={kernelName:mc,backendName:"cpu",kernelFunc:Fke};function Lke(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:c,newAxisMask:f,shrinkAxisMask:m}=a;bt(r,"stridedSlice");let{finalShapeSparse:x,finalShape:y,isIdentity:b,sliceDim0:w,isSimpleSlice:S,begin:k,end:C,strides:E}=vr.sliceInfo(r.shape,s,i,o,l,d,c,f,m),T;if(b)T=ca({inputs:{x:r},backend:n,attrs:{shape:y}});else if(w||S){R.assert(r.shape.length>=1,()=>`Input must have rank at least 1, got: ${r.shape.length}`);let _=vr.computeOutShape(k,C,E),A=Od({inputs:{x:r},backend:n,attrs:{begin:k,size:_}});T=ca({inputs:{x:A},backend:n,attrs:{shape:y}}),n.disposeIntermediateTensorInfo(A)}else{let _=n.bufferSync(r),A=pU(x,_,E,k);T=n.makeTensorInfo(y,A.dtype,A.values)}return T}var Pke={kernelName:lg,backendName:"cpu",kernelFunc:Lke};function zke(e){let{inputs:t,backend:n,attrs:a}=e,{separator:r,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:d}=a,{data:c,dataSplits:f}=t,m=n.data.get(c.dataId).values,x=n.data.get(f.dataId).values,[y,b]=l4(m,x,r,s,i,o,l,d);return[n.makeTensorInfo([y.length],"string",y),n.makeTensorInfo(f.shape,"int32",b)]}var Uke={kernelName:bb,backendName:"cpu",kernelFunc:zke};function Wke(e){let{inputs:t,backend:n,attrs:a}=e,{skipEmpty:r}=a,{input:s,delimiter:i}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(s.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);let o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values[0],[d,c,f]=u4(o,l,r),m=c.length;return[n.makeTensorInfo([m,2],"int32",d),n.makeTensorInfo([m],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(f))]}var Vke={kernelName:vb,backendName:"cpu",kernelFunc:Wke};function Hke(e){let{inputs:t,backend:n,attrs:a}=e,{numBuckets:r}=a,{input:s}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");let i=n.data.get(s.dataId).values,o=c4(i,r);return n.makeTensorInfo(s.shape,"int32",o)}var Gke={kernelName:wb,backendName:"cpu",kernelFunc:Hke},qke=Gn(lp,e=>Math.tan(e)),Kke={kernelName:lp,backendName:"cpu",kernelFunc:qke},Xke=Gn(up,e=>Math.tanh(e)),Yke={kernelName:up,backendName:"cpu",kernelFunc:Xke};function Jke(e){let{inputs:t,backend:n}=e,{tensor:a,indices:r,updates:s}=t,{sliceRank:i,numUpdates:o,sliceSize:l,strides:d,outputSize:c}=W.calculateShapes(s,r,a.shape),f=!1,m=n.bufferSync(r),x=n.bufferSync(s),y=n.bufferSync(a),b=xd(m,x,a.shape,c,l,o,i,d,y,f);return n.makeTensorInfo(a.shape,b.dtype,b.values)}var Qke={kernelName:eg,backendName:"cpu",kernelFunc:Jke};function Zke(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;bt(r,"tile");let i=mU(n.bufferSync(r),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}var eNe={kernelName:fc,backendName:"cpu",kernelFunc:Zke};function tNe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a;bt(r,"topk");let o=n.data.get(r.dataId).values,[l,d]=xU(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var nNe={kernelName:ug,backendName:"cpu",kernelFunc:tNe};function aNe(e){let{inputs:t,attrs:n,backend:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=n,[c,f,m,x]=r.shape,[y,b]=d??[f,m],w=[c,y,b,x],S=R.computeStrides(r.shape),k=S[0],C=S[1],E=S[2],T=R.computeStrides(w),_=T[0],A=T[1],$=T[2],O=R.getTypedArrayFromDType(r.dtype,R.sizeFromShape(w));O.fill(l);let z=a.data.get(r.dataId).values,P=a.data.get(s.dataId).values;for(let j=0;j<c;++j){let G=s.shape[0]===1?P:P.subarray(j*8,j*8+8);for(let X=0;X<y;++X)for(let J=0;J<b;++J)for(let V=0;V<x;++V){let Q,F=G[6]*J+G[7]*X+1;if(F===0)continue;let H=(G[0]*J+G[1]*X+G[2])/F,B=(G[3]*J+G[4]*X+G[5])/F,Y=W$(H,m,o),ne=W$(B,f,o);switch(i){case"nearest":Q=uNe(z,f,m,k,C,E,j,ne,Y,V,l);break;case"bilinear":Q=cNe(z,f,m,k,C,E,j,ne,Y,V,l);break;default:throw new Error(`Error in Transform: Expect 'nearest' or 'bilinear', but got ${i}`)}let ee=j*_+X*A+J*$+V;O[ee]=Q}return a.makeTensorInfo(w,r.dtype,O)}return{dataId:a.write(O,w,r.dtype),shape:r.shape,dtype:r.dtype}}var rNe={kernelName:cg,backendName:"cpu",kernelFunc:aNe};function W$(e,t,n){switch(n){case"reflect":return sNe(e,t);case"wrap":return iNe(e,t);case"nearest":return lNe(e,t);default:return oNe(e)}}function sNe(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let a=2*t;n<a&&(n=a*Math.trunc(-n/a)+n),n=n<-t?n+a:-n-1}else if(n>t-1)if(t<=1)n=0;else{let a=2*t;n-=a*Math.trunc(n/a),n>=t&&(n=a-n-1)}return R.clamp(0,n,t-1)}function iNe(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let a=t-1;n+=t*(Math.trunc(-n/a)+1)}else if(n>t-1)if(t<=1)n=0;else{let a=t-1;n-=t*Math.trunc(n/a)}return R.clamp(0,n,t-1)}function oNe(e,t){return e}function lNe(e,t){return R.clamp(0,e,t-1)}function Gx(e,t,n,a,r,s,i,o,l,d,c){let f=i*a+o*r+l*s+d;return 0<=o&&o<t&&0<=l&&l<n?e[f]:c}function uNe(e,t,n,a,r,s,i,o,l,d,c){let f=Math.round(o),m=Math.round(l);return Gx(e,t,n,a,r,s,i,f,m,d,c)}function cNe(e,t,n,a,r,s,i,o,l,d,c){let f=Math.floor(o),m=Math.floor(l),x=f+1,y=m+1,b=(y-l)*Gx(e,t,n,a,r,s,i,f,m,d,c)+(l-m)*Gx(e,t,n,a,r,s,i,f,y,d,c),w=(y-l)*Gx(e,t,n,a,r,s,i,x,m,d,c)+(l-m)*Gx(e,t,n,a,r,s,i,x,y,d,c);return(x-o)*b+(o-f)*w}function dNe(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;bt(s,"unique");let i=a.data.get(s.dataId).values,{outputValues:o,outputShape:l,indices:d}=h4(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([d.length],"int32",d)]}var hNe={kernelName:Sb,backendName:"cpu",kernelFunc:dNe};function pNe(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r.shape.length,o=r.shape[s],l=new Array(i-1),d=0;for(let x=0;x<i;x++)x!==s&&(l[d++]=r.shape[x]);let c=new Array(i).fill(0),f=r.shape.slice();f[s]=1;let m=new Array(o);for(let x=0;x<m.length;x++){c[s]=x;let y=Od({inputs:{x:r},backend:n,attrs:{begin:c,size:f}});m[x]=ca({inputs:{x:y},backend:n,attrs:{shape:l}}),n.disposeIntermediateTensorInfo(y)}return m}var fNe={kernelName:dg,backendName:"cpu",kernelFunc:pNe};function mNe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a;bt(r,"unsortedSegmentSum");let o=r.shape.length,l=s.shape.length,d=[],c=[],f=o-l,m=s;for(let y=0;y<f;++y){let b=Hv({inputs:{input:m},backend:n,attrs:{dim:y+1}});m=b,c.push(b)}for(let y=0;y<i;++y){let b=R.createScalarValue(y,"int32"),w=n.makeTensorInfo([],"int32",b),S=O7({inputs:{a:w,b:m},backend:n}),k=ic({inputs:{x:S},backend:n,attrs:{dtype:"float32"}}),C=B2({inputs:{a:k,b:r},backend:n}),E=Qb({inputs:{x:C},backend:n,attrs:{axis:0,keepDims:!1}});d.push(E),c.push(w),c.push(S),c.push(k),c.push(C),c.push(E)}let x=DU({inputs:d,backend:n,attrs:{axis:0}});return c.forEach(y=>n.disposeIntermediateTensorInfo(y)),x}var gNe={kernelName:kb,backendName:"cpu",kernelFunc:mNe},xNe=[cve,W0e,hve,fve,X0e,gve,yve,vve,Sve,Nve,Eve,Tve,_ve,Rve,$ve,Ove,Pve,Uve,Vve,lve,Gve,Kve,Yve,J0e,Qve,q0e,Z0e,ewe,V0e,nwe,rwe,swe,owe,uwe,dwe,pwe,mwe,xwe,bwe,wwe,kwe,Cwe,Iwe,Awe,_we,Dwe,Mwe,Bwe,Fwe,Owe,Lwe,zwe,Vwe,tve,Gwe,e1e,e2e,t1e,t2e,a1e,o2e,l2e,c2e,s1e,o1e,h2e,f2e,g2e,y2e,u1e,d1e,H0e,v2e,awe,S2e,N2e,E2e,nve,p1e,m1e,T2e,x1e,_2e,R2e,$2e,O2e,P2e,U2e,W2e,b1e,H2e,q2e,X2e,J2e,Z2e,tSe,aSe,w1e,sSe,lSe,hSe,k1e,C1e,mSe,ySe,wSe,I1e,kSe,CSe,ESe,RU,_Se,rve,_1e,DSe,MSe,BSe,OSe,G0e,CE,PSe,sve,ive,ove,USe,VSe,GSe,KSe,YSe,JSe,ZSe,L1e,tke,ike,lke,hke,z1e,fke,gke,yke,U1e,cSe,wke,kke,Cke,Ike,Ake,jke,Rke,$ke,H1e,Bke,q1e,X1e,Oke,Pke,Uke,Vke,Gke,Z1e,Uwe,Kke,Yke,Qke,eNe,nNe,rNe,T1e,hNe,fNe,gNe,NSe];for(let e of xNe)Nb(e);var MU={};Xt(MU,{assertNotComplex:()=>Eg,bindCanvasToFramebuffer:()=>TNe,bindColorTextureToFramebuffer:()=>ov,bindTextureToProgramUniformSampler:()=>YU,bindTextureUnit:()=>qU,bindVertexBufferToProgramAttribute:()=>IE,callAndCheck:()=>at,canBeRepresented:()=>BU,createFragmentShader:()=>LU,createFramebuffer:()=>GU,createProgram:()=>PU,createStaticIndexBuffer:()=>WU,createStaticVertexBuffer:()=>UU,createTexture:()=>VU,createVertexShader:()=>
vendor: 6,502 bytes, lines 117-121
117OU,getBatchDim:()=>Ld,getExtensionOrThrow:()=>qx,getFramebufferErrorMessage:()=>JU,getMaxTexturesInShader:()=>t9,getNumChannels:()=>ENe,getProgramUniformLocation:()=>XU,getProgramUniformLocationOrThrow:()=>KU,getRowsCols:()=>Pd,getShapeAs3D:()=>Xx,getTextureShapeFromLogicalShape:()=>ZU,getWebGLDisjointQueryTimerVersion:()=>n9,getWebGLErrorMessage:()=>FU,getWebGLMaxTextureSize:()=>e9,hasExtension:()=>Ai,isCapableOfRenderingToFloatTexture:()=>a9,isDownloadFloatTextureEnabled:()=>r9,isReshapeFree:()=>Wy,isWebGLFenceEnabled:()=>s9,isWebGLVersionEnabled:()=>AE,linkProgram:()=>zU,logShaderSourceAndInfoLog:()=>x4,resetMaxTextureSize:()=>ANe,resetMaxTexturesInShader:()=>_Ne,unbindColorTextureFromFramebuffer:()=>TE,unbindTextureUnit:()=>INe,validateFramebuffer:()=>Kx,validateProgram:()=>iv,validateTextureSize:()=>HU});var hd={},L1={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function $U(e,t){hd[e]=t}function jo(e,t){if(!(e in hd)||t!=null){let a=bNe(e,t);if(a!==null)hd[e]=a;else return console.log("Could not get context for WebGL version",e),null}let n=hd[e];return n==null||n.isContextLost()?(delete hd[e],jo(e)):(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),hd[e])}function yNe(e){if(!fe().getBool("IS_SAFARI")&&typeof OffscreenCanvas<"u"&&e===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 bNe(e,t){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");let n=t??yNe(e);return n.addEventListener("webglcontextlost",a=>{a.preventDefault(),delete hd[e]},!1),fe().getBool("SOFTWARE_WEBGL_ENABLED")&&(L1.failIfMajorPerformanceCaveat=!1),e===1?n.getContext("webgl",L1)||n.getContext("experimental-webgl",L1):n.getContext("webgl2",L1)}var Uy;(function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"})(Uy||(Uy={}));var Ti;(function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"})(Ti||(Ti={}));var Vr;(function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(Vr||(Vr={}));function Zb(e,t){return[t,e]}function vNe(e,t){return e*t}function P1(e){let t=R.sizeFromShape(e),n=Math.ceil(t/4);return R.sizeToSquarishShape(n)}function Cg(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function wNe(e,t){let[n,a]=Cg(e,t);return n*a*4}function g4(e,t){let n=e,a,r,s,i,o,l,d,c,f,m;return fe().getNumber("WEBGL_VERSION")===2?(a=n.R32F,r=n.R16F,s=n.RGBA16F,i=n.RGBA32F,o=n.RED,d=4,c=1,f=n.HALF_FLOAT,m=n.FLOAT,l=n.RGBA8):(a=e.RGBA,r=e.RGBA,s=e.RGBA,i=n.RGBA,o=e.RGBA,d=4,c=4,f=t!=null?t.HALF_FLOAT_OES:null,m=e.FLOAT,l=e.RGBA),{internalFormatFloat:a,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:l,downloadUnpackNumChannels:d,defaultNumChannels:c,textureTypeHalfFloat:f,textureTypeFloat:m}}function at(e,t){let n=t();return fe().getBool("DEBUG")&&SNe(e),n}function SNe(e){let t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+FU(e,t))}var kNe=596e-10,NNe=65504;function BU(e){return!!(fe().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||e===0||kNe<Math.abs(e)&&Math.abs(e)<NNe)}function FU(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return`Unknown error code ${t}`}}function qx(e,t){return Zl(e,()=>e.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function OU(e,t){let n=Zl(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(at(e,()=>e.shaderSource(n,t)),at(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function LU(e,t){let n=Zl(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(at(e,()=>e.shaderSource(n,t)),at(e,()=>e.compileShader(n)),fe().get("ENGINE_COMPILE_ONLY"))return n;if(e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw x4(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var CNe=/ERROR: [0-9]+:([0-9]+):/g;function x4(e,t){let n=CNe.exec(t);if(n==null){console.log(`Couldn't parse line number in error: ${t}`),console.log(e);return}let a=+n[1],r=e.split(`
118`),s=r.length.toString().length+2,i=r.map((f,m)=>R.rightPad((m+1).toString(),s)+f),o=0;for(let f=0;f<i.length;f++)o=Math.max(i[f].length,o);let l=i.slice(0,a-1),d=i.slice(a-1,a),c=i.slice(a);console.log(l.join(`
119`)),console.log(t.split(`
120`)[0]),console.log(`%c ${R.rightPad(d[0],o)}`,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(c.join(`
121`))}function PU(e){return Zl(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function zU(e,t){if(at(e,()=>e.linkProgram(t)),!fe().get("ENGINE_COMPILE_ONLY")&&e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function iv(e,t){if(at(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function UU(e,t){let n=Zl(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return at(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),at(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function WU(e,t){let n=Zl(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return at(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),at(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function ENe(){return fe().getNumber("WEBGL_VERSION")===2?1:4}function VU(e){return Zl(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function HU(e,t){let n=fe().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let a=`[${e}x${t}]`;
vendor: 18,996 bytes, lines 121-338
121throw new Error("Requested texture size "+a+" is invalid.")}if(e>n||t>n){let a=`[${e}x${t}]`,r=`[${n}x${n}]`;throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+r+".")}}function GU(e){return Zl(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function IE(e,t,n,a,r,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(at(e,()=>e.bindBuffer(e.ARRAY_BUFFER,a)),at(e,()=>e.vertexAttribPointer(o,r,e.FLOAT,!1,s,i)),at(e,()=>e.enableVertexAttribArray(o)),!0)}function qU(e,t,n){QU(e,n),at(e,()=>e.activeTexture(e.TEXTURE0+n)),at(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function INe(e,t){QU(e,t),at(e,()=>e.activeTexture(e.TEXTURE0+t)),at(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function KU(e,t,n){return Zl(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function XU(e,t,n){return e.getUniformLocation(t,n)}function YU(e,t,n,a){at(e,()=>qU(e,t,a)),at(e,()=>e.uniform1i(n,a))}function TNe(e){at(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),at(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),at(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function ov(e,t,n){at(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),at(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function TE(e,t){at(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),at(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function Kx(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+JU(e,t))}function JU(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}function Zl(e,t,n){let a=at(e,()=>t());if(a==null)throw new Error(n);return a}function QU(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,a=t+e.TEXTURE0;if(a<e.TEXTURE0||a>n){let r=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${r}.`)}}function Ld(e,t=2){return R.sizeFromShape(e.slice(0,e.length-t))}function Pd(e){if(e.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function Xx(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[Ld(e),...Pd(e)]),t}function ZU(e,t=!1){let n=fe().getNumber("WEBGL_MAX_TEXTURE_SIZE"),a=fe().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");a===1/0&&fe().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(a=n/2),t&&(n=n*2,a=a*2,e=e.map((o,l)=>l>=e.length-2?R.nearestLargerEven(e[l]):e[l]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=R.squeezeShape(e).newShape);let r=R.sizeFromShape(e),s=null;e.length<=1&&r<=n?s=[1,r]:e.length===2&&e[0]<=n&&e[1]<=n?s=e:e.length===3&&e[0]*e[1]<=n&&e[2]<=n?s=[e[0]*e[1],e[2]]:e.length===3&&e[0]<=n&&e[1]*e[2]<=n?s=[e[0],e[1]*e[2]]:e.length===4&&e[0]*e[1]*e[2]<=n&&e[3]<=n?s=[e[0]*e[1]*e[2],e[3]]:e.length===4&&e[0]<=n&&e[1]*e[2]*e[3]<=n&&(s=[e[0],e[1]*e[2]*e[3]]);let i=s!=null&&Math.max(...s)>a&&Math.min(...s)<=(t?2:1)&&Math.min(...s)>0;if(s==null||i)if(t){let o=Ld(e),l=2,d=2;e.length&&([l,d]=Pd(e)),r=o*(l/2)*(d/2),s=R.sizeToSquarishShape(r).map(c=>c*2)}else s=R.sizeToSquarishShape(r);return s}function z1(e){return e%2===0}function Wy(e,t){if(e=e.slice(-2),t=t.slice(-2),R.arraysEqual(e,t)||!e.length||!t.length||e[0]===0||e[1]===0||t[0]===0||t[1]===0)return!0;if(e.length!==t.length){let n=e[e.length-1],a=t[t.length-1];if(n===a||z1(n)&&z1(a)&&(e[0]===1||t[0]===1))return!0}return e[1]===t[1]&&z1(e[0])&&z1(t[0])}var lv,uv;function e9(e){if(lv==null){let t=jo(e);lv=t.getParameter(t.MAX_TEXTURE_SIZE)}return lv}function ANe(){lv=null}function _Ne(){uv=null}function t9(e){if(uv==null){let t=jo(e);uv=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,uv)}function n9(e){if(e===0)return 0;let t,n=jo(e);return Ai(n,"EXT_disjoint_timer_query_webgl2")&&e===2?t=2:Ai(n,"EXT_disjoint_timer_query")?t=1:t=0,t}function Ai(e,t){return e.getExtension(t)!=null}function AE(e){try{if(jo(e)!=null)return!0}catch(t){return console.log("Error when getting WebGL context: ",t),!1}return!1}function a9(e){if(e===0)return!1;let t=jo(e);if(e===1){if(!Ai(t,"OES_texture_float"))return!1}else if(!Ai(t,"EXT_color_buffer_float"))return!1;return _E(t)}function r9(e){if(e===0)return!1;let t=jo(e);if(e===1){if(!Ai(t,"OES_texture_float")||!Ai(t,"WEBGL_color_buffer_float"))return!1}else{if(Ai(t,"EXT_color_buffer_float"))return _E(t);let n="EXT_color_buffer_half_float";if(Ai(t,n)){let a=t.getExtension(n);return jNe(t,a)}return!1}return _E(t)}function _E(e){let t=g4(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);let a=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,a),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let r=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(a),r}function jNe(e,t){let n=g4(e,t),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,1,1,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let s=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(a),e.deleteFramebuffer(r),s}function s9(e){return e!==2?!1:jo(e).fenceSync!=null}function Eg(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&R.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}var Nt=fe();Nt.registerFlag("HAS_WEBGL",()=>Nt.getNumber("WEBGL_VERSION")>0);Nt.registerFlag("WEBGL_VERSION",()=>AE(2)?2:AE(1)?1:0);Nt.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);Nt.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>Nt.get("WEBGL_VERSION")===2);Nt.registerFlag("WEBGL_CPU_FORWARD",()=>!0);Nt.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);Nt.registerFlag("WEBGL_PACK",()=>Nt.getBool("HAS_WEBGL"));Nt.registerFlag("WEBGL_PACK_NORMALIZATION",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_CLIP",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_REDUCE",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_LAZILY_UNPACK",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_CONV_IM2COL",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",()=>Nt.getBool("WEBGL_PACK"));Nt.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>e9(Nt.getNumber("WEBGL_VERSION")));Nt.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>t9(Nt.getNumber("WEBGL_VERSION")));Nt.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{let e=Nt.getNumber("WEBGL_VERSION");return e===0?0:n9(e)});Nt.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>Nt.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Ib.isMobile());Nt.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>a9(Nt.getNumber("WEBGL_VERSION")));Nt.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>Nt.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:Nt.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));Nt.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>r9(Nt.getNumber("WEBGL_VERSION")));Nt.registerFlag("WEBGL_FENCE_API_ENABLED",()=>s9(Nt.getNumber("WEBGL_VERSION")));Nt.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>Nt.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);Nt.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if(typeof e!="number")throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${e}.`);if(e<0&&e!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)});Nt.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>Ib.isMobile()?1:-1,e=>{if(typeof e!="number")throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${e}.`);if(e<0&&e!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)});Nt.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128);Nt.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",()=>!1);Nt.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",()=>1e5);Nt.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",()=>128);Nt.registerFlag("WEBGL_EXP_CONV",()=>!1);Nt.registerFlag("SOFTWARE_WEBGL_ENABLED",()=>Nt.getBool("IS_TEST"));Nt.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",()=>1/0);Nt.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",()=>!1);Nt.registerFlag("WEBGL2_ISNAN_CUSTOM",()=>!1);Nt.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);function Is(){let e,t,n,a,r,s,i,o,l,d;return fe().getNumber("WEBGL_VERSION")===2?(e="#version 300 es",t="in",n="out",a="in",r="texture",s="outputColor",i="out vec4 outputColor;",o=fe().getBool("WEBGL2_ISNAN_CUSTOM")?`
122      bool isnan_custom(float val) {
123        uint floatToUint = floatBitsToUint(val);
124        return (floatToUint & 0x7fffffffu) > 0x7f800000u;
125      }
126
127      bvec4 isnan_custom(vec4 val) {
128        return bvec4(isnan_custom(val.x),
129          isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));
130      }
131
132      #define isnan(value) isnan_custom(value)
133    `:"",l="",d=`
134      #define round(value) newRound(value)
135      int newRound(float value) {
136        return int(floor(value + 0.5));
137      }
138
139      ivec4 newRound(vec4 value) {
140        return ivec4(floor(value + vec4(0.5)));
141      }
142    `):(e="",t="attribute",n="varying",a="varying",r="texture2D",s="gl_FragColor",i="",o=`
143      #define isnan(value) isnan_custom(value)
144      bool isnan_custom(float val) {
145        return (val > 0. || val < 1. || val == 0.) ? false : true;
146      }
147      bvec4 isnan_custom(vec4 val) {
148        return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));
149      }
150    `,l=`
151      uniform float INFINITY;
152
153      bool isinf(float val) {
154        return abs(val) == INFINITY;
155      }
156      bvec4 isinf(vec4 val) {
157        return equal(abs(val), vec4(INFINITY));
158      }
159    `,d=`
160      int round(float value) {
161        return int(floor(value + 0.5));
162      }
163
164      ivec4 round(vec4 value) {
165        return ivec4(floor(value + vec4(0.5)));
166      }
167    `),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:r,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:d}}function xp(e,t,n="index"){let a=R.computeStrides(t);return a.map((r,s)=>{let i=`int ${e[s]} = ${n} / ${r}`,o=s===a.length-1?`int ${e[s+1]} = ${n} - ${e[s]} * ${r}`:`index -= ${e[s]} * ${r}`;return`${i}; ${o};`}).join("")}function F2(e,t,n="index"){let a=R.computeStrides(t);return a.map((r,s)=>{let i=`int ${e[s]} = ${n} / outShapeStrides[${s}]`,o=s===a.length-1?`int ${e[s+1]} = ${n} - ${e[s]} * outShapeStrides[${s}]`:`index -= ${e[s]} * outShapeStrides[${s}]`;return`${i}; ${o};`}).join("")}function DNe(e,t){let n=e.length,a=e.map(s=>`${t}[${s}]`),r=new Array(n-1);r[n-2]=a[n-1];for(let s=n-3;s>=0;--s)r[s]=`(${r[s+1]} * ${a[s+1]})`;return r}function RNe(e,t,n="index"){let a=e.map((s,i)=>i),r=DNe(a,t);return r.map((s,i)=>{let o=`int ${e[i]} = ${n} / ${r[i]}`,l=i===r.length-1?`int ${e[i+1]} = ${n} - ${e[i]} * ${r[i]}`:`index -= ${e[i]} * ${r[i]}`;return`${o}; ${l};`}).join("")}function y4(e){let t=R.computeStrides(e).map(n=>n.toString());return`
168  int getFlatIndex(ivec3 coords) {
169    return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z;
170  }
171`}function b4(){return`
172  int getFlatIndex(ivec3 coords) {
173    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;
174  }
175`}var i9=`
176  const float FLOAT_MAX = 1.70141184e38;
177  const float FLOAT_MIN = 1.17549435e-38;
178
179  lowp vec4 encode_float(highp float v) {
180    if (isnan(v)) {
181      return vec4(255, 255, 255, 255);
182    }
183
184    highp float av = abs(v);
185
186    if(av < FLOAT_MIN) {
187      return vec4(0.0, 0.0, 0.0, 0.0);
188    } else if(v > FLOAT_MAX) {
189      return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
190    } else if(v < -FLOAT_MAX) {
191      return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;
192    }
193
194    highp vec4 c = vec4(0,0,0,0);
195
196    highp float e = floor(log2(av));
197    highp float m = exp2(fract(log2(av))) - 1.0;
198
199    c[2] = floor(128.0 * m);
200    m -= c[2] / 128.0;
201    c[1] = floor(32768.0 * m);
202    m -= c[1] / 32768.0;
203    c[0] = floor(8388608.0 * m);
204
205    highp float ebias = e + 127.0;
206    c[3] = floor(ebias / 2.0);
207    ebias -= c[3] * 2.0;
208    c[2] += floor(ebias) * 128.0;
209
210    c[3] += 128.0 * step(0.0, -v);
211
212    return c / 255.0;
213  }
214`,{getBroadcastDims:o9}=W;function MNe(e,t,n){let a=[];if(e.forEach(m=>{let x=R.sizeFromShape(m.shapeInfo.logicalShape);if(m.shapeInfo.isUniform?a.push(`uniform float ${m.name}${x>1?`[${x}]`:""};`):(a.push(`uniform sampler2D ${m.name};`),a.push(`uniform int offset${m.name};`)),n.enableShapeUniforms){let{uniformShape:y}=v4(n.packedInputs,m.shapeInfo.logicalShape,m.shapeInfo.texShape);switch(y.length){case 1:a.push(`uniform int ${m.name}Shape;`);break;case 2:a.push(`uniform ivec2 ${m.name}Shape;`);break;case 3:a.push(`uniform ivec3 ${m.name}Shape;`);break;case 4:a.push(`uniform ivec4 ${m.name}Shape;`);break}a.push(`uniform ivec2 ${m.name}TexShape;`)}}),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:a.push("uniform int outShape;");break;case 2:a.push("uniform ivec2 outShape;"),a.push("uniform int outShapeStrides;");break;case 3:a.push("uniform ivec3 outShape;"),a.push("uniform ivec2 outShapeStrides;");break;case 4:a.push("uniform ivec4 outShape;"),a.push("uniform ivec3 outShapeStrides;");break}a.push("uniform ivec2 outTexShape;")}n.customUniforms&&n.customUniforms.forEach(m=>{a.push(`uniform ${m.type} ${m.name}${m.arrayIndex?`[${m.arrayIndex}]`:""};`)});let r=a.join(`
215`),s=e.map(m=>$Ne(m,t,n.packedInputs,n.enableShapeUniforms)).join(`
216`),i=t.texShape,o=Is(),l=ONe(o),d,c,f=zNe(o);return t.isPacked?(d=BNe(t.logicalShape,i,n.enableShapeUniforms),c=PNe(o)):(d=FNe(t.logicalShape,i,n.enableShapeUniforms),c=LNe(o)),n.packedInputs&&(f+=HNe),[f,l,c,r,d,s,n.userCode].join(`
217`)}function Ig(e,t=!1){let n=e.shapeInfo.logicalShape;switch(n.length){case 0:return aCe(e,t);case 1:return sCe(e,t);case 2:return oCe(e,t);case 3:return uCe(e,t);case 4:return dCe(e,t);case 5:return hCe(e);case 6:return pCe(e);default:throw new Error(`${n.length}-D input sampling is not yet supported`)}}function l9(e,t){switch(e.shapeInfo.logicalShape.length){case 0:return nCe(e);case 1:return rCe(e,t);case 2:return iCe(e,t);case 3:return lCe(e,t);default:return cCe(e,t)}}function $Ne(e,t,n=!1,a){let r="";n?r+=l9(e,a):r+=Ig(e,a);let s=e.shapeInfo.logicalShape,i=t.logicalShape;return s.length<=i.length&&(n?r+=fCe(e,t):r+=mCe(e,t)),r}function BNe(e,t,n){switch(e.length){case 0:return u9();case 1:return GNe(e,t,n);case 2:return eCe(e,t,n);case 3:return KNe(e,t,n);default:return YNe(e,t,n)}}function FNe(e,t,n){switch(e.length){case 0:return u9();case 1:return qNe(e,t,n);case 2:return tCe(e,t,n);case 3:return XNe(e,t,n);case 4:return JNe(e,t,n);case 5:return QNe(e,t);case 6:return ZNe(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}function ONe(e){return`
218    float sampleTexture(sampler2D textureSampler, vec2 uv) {
219      return ${e.texture2D}(textureSampler, uv).r;
220    }
221  `}function LNe(e){return`
222    void setOutput(float val) {
223      ${e.output} = vec4(val, 0, 0, 0);
224    }
225  `}function PNe(e){return`
226    void setOutput(vec4 val) {
227      ${e.output} = val;
228    }
229  `}function zNe(e){return`${e.version}
230    precision highp float;
231    precision highp int;
232    precision highp sampler2D;
233    ${e.varyingFs} vec2 resultUV;
234    ${e.defineOutput}
235    const vec2 halfCR = vec2(0.5, 0.5);
236
237    struct ivec5
238    {
239      int x;
240      int y;
241      int z;
242      int w;
243      int u;
244    };
245
246    struct ivec6
247    {
248      int x;
249      int y;
250      int z;
251      int w;
252      int u;
253      int v;
254    };
255
256    uniform float NAN;
257    ${e.defineSpecialNaN}
258    ${e.defineSpecialInf}
259    ${e.defineRound}
260
261    int imod(int x, int y) {
262      return x - y * (x / y);
263    }
264
265    int idiv(int a, int b, float sign) {
266      int res = a / b;
267      int mod = imod(a, b);
268      if (sign < 0. && mod != 0) {
269        res -= 1;
270      }
271      return res;
272    }
273
274    //Based on the work of Dave Hoskins
275    //https://www.shadertoy.com/view/4djSRW
276    #define HASHSCALE1 443.8975
277    float random(float seed){
278      vec2 p = resultUV * seed;
279      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);
280      p3 += dot(p3, p3.yzx + 19.19);
281      return fract((p3.x + p3.y) * p3.z);
282    }
283
284    ${UNe}
285    ${WNe}
286    ${VNe}
287  `}var UNe=`
288vec2 uvFromFlat(int texNumR, int texNumC, int index) {
289  int texR = index / texNumC;
290  int texC = index - texR * texNumC;
291  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
292}
293vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
294  int texelIndex = index / 2;
295  int texR = texelIndex / texNumC;
296  int texC = texelIndex - texR * texNumC;
297  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
298}
299`,WNe=`
300vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,
301  int texNumC, int row, int col) {
302  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
303  int texR = texelIndex / texNumC;
304  int texC = texelIndex - texR * texNumC;
305  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
306}
307`,VNe=`
308vec2 packedUVfrom3D(int texNumR, int texNumC,
309    int texelsInBatch, int texelsInLogicalRow, int b,
310    int row, int col) {
311  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
312  int texR = index / texNumC;
313  int texC = index - texR * texNumC;
314  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
315}
316`,HNe=`
317  float getChannel(vec4 frag, vec2 innerDims) {
318    vec2 modCoord = mod(innerDims, 2.);
319    return modCoord.x == 0. ?
320      (modCoord.y == 0. ? frag.r : frag.g) :
321      (modCoord.y == 0. ? frag.b : frag.a);
322  }
323  float getChannel(vec4 frag, int dim) {
324    float modCoord = mod(float(dim), 2.);
325    return modCoord == 0. ? frag.r : frag.g;
326  }
327`;function u9(){return`
328    int getOutputCoords() {
329      return 0;
330    }
331  `}function GNe(e,t,n){let a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return a[0]===1?n?`
332      int getOutputCoords() {
333        return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));
334      }
335    `:`
336      int getOutputCoords() {
337        return 2 * int(resultUV.x * ${a[1]}.0);
338      }
339    `:a[1]===1?n?`
340      int getOutputCoords() {
341        return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));
342      }
343    `:`
344      int getOutputCoords() {
345        return 2 * int(resultUV.y * ${a[0]}.0);
346      }
347    `:n?`
348    int getOutputCoords() {
349      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
350      ivec2 resTexRC = ivec2(resultUV.yx *
351                             vec2(packedTexShape[0], packedTexShape[1]));
352      return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);
353    }
354  `:`
355    int getOutputCoords() {
356      ivec2 resTexRC = ivec2(resultUV.yx *
357                             vec2(${a[0]}, ${a[1]}));
358      return 2 * (resTexRC.x * ${a[1]} + resTexRC.y);
359    }
360  `}function qNe(e,t,n){return t[0]===1?n?`
361      int getOutputCoords() {
362        return int(resultUV.x * float(outTexShape[1]));
363      }
364    `:`
365      int getOutputCoords() {
366        return int(resultUV.x * ${t[1]}.0);
367      }
368    `:t[1]===1?n?`
369      int getOutputCoords() {
370        return int(resultUV.y * float(outTexShape[0]));
371      }
372    `:`
373      int getOutputCoords() {
374        return int(resultUV.y * ${t[0]}.0);
375      }
376    `:n?`
377    int getOutputCoords() {
378      ivec2 resTexRC = ivec2(resultUV.yx *
379                             vec2(outTexShape[0], outTexShape[1]));
380      return resTexRC.x * outTexShape[1] + resTexRC.y;
381    }
382  `:`
383    int getOutputCoords() {
384      ivec2 resTexRC = ivec2(resultUV.yx *
385                             vec2(${t[0]}, ${t[1]}));
386      return resTexRC.x * ${t[1]} + resTexRC.y;
387    }
388  `}function KNe(e,t,n){if(n)return`
389    ivec3 getOutputCoords() {
390      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
391      int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));
392      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));
393      ivec2 resTexRC = ivec2(resultUV.yx *
394                             vec2(packedTexShape[0], packedTexShape[1]));
395      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
396
397      int b = index / texelsInBatch;
398      index -= b * texelsInBatch;
399
400      int r = 2 * (index / texelsInLogicalRow);
401      int c = imod(index, texelsInLogicalRow) * 2;
402
403      return ivec3(b, r, c);
404    }
405  `;let a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[2]/2),s=r*Math.ceil(e[1]/2);return`
406    ivec3 getOutputCoords() {
407      ivec2 resTexRC = ivec2(resultUV.yx *
408                             vec2(${a[0]}, ${a[1]}));
409      int index = resTexRC.x * ${a[1]} + resTexRC.y;
410
411      int b = index / ${s};
412      index -= b * ${s};
413
414      int r = 2 * (index / ${r});
415      int c = imod(index, ${r}) * 2;
416
417      return ivec3(b, r, c);
418    }
419  `}function XNe(e,t,n){if(n)return`
420  ivec3 getOutputCoords() {
421    ivec2 resTexRC = ivec2(resultUV.yx *
422                           vec2(outTexShape[0], outTexShape[1]));
423    int index = resTexRC.x * outTexShape[1] + resTexRC.y;
424    ${F2(["r","c","d"],e)}
425    return ivec3(r, c, d);
426  }
427`;let a=xp(["r","c","d"],e);return`
428    ivec3 getOutputCoords() {
429      ivec2 resTexRC = ivec2(resultUV.yx *
430                             vec2(${t[0]}, ${t[1]}));
431      int index = resTexRC.x * ${t[1]} + resTexRC.y;
432      ${a}
433      return ivec3(r, c, d);
434    }
435  `}function YNe(e,t,n){if(n)return`
436    ivec4 getOutputCoords() {
437      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
438      ivec2 resTexRC = ivec2(resultUV.yx *
439                             vec2(packedTexShape[0], packedTexShape[1]));
440      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
441
442      int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));
443      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));
444      int texelsInBatchN = texelsInBatch * outShape[1];
445
446      int b2 = index / texelsInBatchN;
447      index -= b2 * texelsInBatchN;
448
449      int b = index / texelsInBatch;
450      index -= b * texelsInBatch;
451
452      int r = 2 * (index / texelsInLogicalRow);
453      int c = imod(index, texelsInLogicalRow) * 2;
454
455      return ivec4(b2, b, r, c);
456    }
457  `;let a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[e.length-1]/2),s=r*Math.ceil(e[e.length-2]/2),i=s,o="",l="b, r, c";for(let d=2;d<e.length-1;d++)i*=e[e.length-d-1],o=`
458      int b${d} = index / ${i};
459      index -= b${d} * ${i};
460    `+o,l=`b${d}, `+l;return`
461    ivec${e.length} getOutputCoords() {
462      ivec2 resTexRC = ivec2(resultUV.yx *
463                             vec2(${a[0]}, ${a[1]}));
464      int index = resTexRC.x * ${a[1]} + resTexRC.y;
465
466      ${o}
467
468      int b = index / ${s};
469      index -= b * ${s};
470
471      int r = 2 * (index / ${r});
472      int c = imod(index, ${r}) * 2;
473
474      return ivec${e.length}(${l});
475    }
476  `}function JNe(e,t,n){if(n)return`
477    ivec4 getOutputCoords() {
478      ivec2 resTexRC = ivec2(resultUV.yx *
479        vec2(outTexShape[0], outTexShape[1]));
480      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
481      ${F2(["r","c","d","d2"],e)}
482      return ivec4(r, c, d, d2);
483    }
484  `;let a=xp(["r","c","d","d2"],e);return`
485    ivec4 getOutputCoords() {
486      ivec2 resTexRC = ivec2(resultUV.yx *
487        vec2(${t[0]}, ${t[1]}));
488      int index = resTexRC.x * ${t[1]} + resTexRC.y;
489      ${a}
490      return ivec4(r, c, d, d2);
491    }
492  `}function QNe(e,t){let n=xp(["r","c","d","d2","d3"],e);return`
493    ivec5 getOutputCoords() {
494      ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]},
495                             ${t[1]}));
496
497      int index = resTexRC.x * ${t[1]} + resTexRC.y;
498
499      ${n}
500
501      ivec5 outShape = ivec5(r, c, d, d2, d3);
502      return outShape;
503    }
504  `}function ZNe(e,t){let n=xp(["r","c","d","d2","d3","d4"],e);return`
505    ivec6 getOutputCoords() {
506      ivec2 resTexRC = ivec2(resultUV.yx *
507        vec2(${t[0]}, ${t[1]}));
508      int index = resTexRC.x * ${t[1]} + resTexRC.y;
509
510      ${n}
511
512      ivec6 result = ivec6(r, c, d, d2, d3, d4);
513      return result;
514    }
515  `}function eCe(e,t,n){let a=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(R.arraysEqual(e,t))return n?`
516      ivec2 getOutputCoords() {
517        ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
518        return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));
519      }
520    `:`
521      ivec2 getOutputCoords() {
522        return 2 * ivec2(resultUV.yx * vec2(${a[0]}, ${a[1]}));
523      }
524    `;let r=Math.ceil(e[1]/2);return n?`
525    ivec2 getOutputCoords() {
526      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
527      int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));
528      ivec2 resTexRC = ivec2(resultUV.yx *
529                             vec2(packedTexShape[0], packedTexShape[1]));
530
531      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
532      int r = 2 * (index / texelsInLogicalRow);
533      int c = imod(index, texelsInLogicalRow) * 2;
534
535      return ivec2(r, c);
536    }
537  `:`
538    ivec2 getOutputCoords() {
539      ivec2 resTexRC = ivec2(resultUV.yx *
540                             vec2(${a[0]}, ${a[1]}));
541
542      int index = resTexRC.x * ${a[1]} + resTexRC.y;
543      int r = 2 * (index / ${r});
544      int c = imod(index, ${r}) * 2;
545
546      return ivec2(r, c);
547    }
548  `}function tCe(e,t,n){return R.arraysEqual(e,t)?n?`
549      ivec2 getOutputCoords() {
550        return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));
551      }
552    `:`
553      ivec2 getOutputCoords() {
554        return ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]}));
555      }
556    `:e[1]===1?n?`
557      ivec2 getOutputCoords() {
558        ivec2 resTexRC = ivec2(resultUV.yx *
559                               vec2(outTexShape[0], outTexShape[1]));
560        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
561        return ivec2(index, 0);
562      }
563    `:`
564      ivec2 getOutputCoords() {
565        ivec2 resTexRC = ivec2(resultUV.yx *
566                               vec2(${t[0]}, ${t[1]}));
567        int index = resTexRC.x * ${t[1]} + resTexRC.y;
568        return ivec2(index, 0);
569      }
570    `:e[0]===1?n?`
571      ivec2 getOutputCoords() {
572        ivec2 resTexRC = ivec2(resultUV.yx *
573                               vec2(outTexShape[0], outTexShape[1]));
574        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
575        return ivec2(0, index);
576      }
577    `:`
578      ivec2 getOutputCoords() {
579        ivec2 resTexRC = ivec2(resultUV.yx *
580                               vec2(${t[0]}, ${t[1]}));
581        int index = resTexRC.x * ${t[1]} + resTexRC.y;
582        return ivec2(0, index);
583      }
584    `:n?`
585    ivec2 getOutputCoords() {
586      ivec2 resTexRC = ivec2(resultUV.yx *
587                             vec2(outTexShape[0], outTexShape[1]));
588      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
589      int r = index / outShape[1];
590      int c = index - r * outShape[1];
591      return ivec2(r, c);
592    }
593  `:`
594    ivec2 getOutputCoords() {
595      ivec2 resTexRC = ivec2(resultUV.yx *
596                             vec2(${t[0]}, ${t[1]}));
597      int index = resTexRC.x * ${t[1]} + resTexRC.y;
598      int r = index / ${e[1]};
599      int c = index - r * ${e[1]};
600      return ivec2(r, c);
601    }
602  `}function yp(e){return`offset${e}`}function nCe(e){let t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),a=Is();return`
603    vec4 ${n}() {
604      return ${a.texture2D}(${t}, halfCR);
605    }
606  `}function aCe(e,t){let n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`float ${a}() {return ${n};}`;let[r,s]=e.shapeInfo.texShape;if(r===1&&s===1)return`
607      float ${a}() {
608        return sampleTexture(${n}, halfCR);
609      }
610    `;let i=yp(n);if(t)return`
611    float ${a}() {
612      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], ${i});
613      return sampleTexture(${n}, uv);
614    }
615  `;let[o,l]=e.shapeInfo.texShape;return`
616    float ${a}() {
617      vec2 uv = uvFromFlat(${o}, ${l}, ${i});
618      return sampleTexture(${n}, uv);
619    }
620  `}function rCe(e,t){let n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=e.shapeInfo.texShape,s=Is();if(t)return`
621    vec4 ${a}(int index) {
622      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));
623      vec2 uv = packedUVfrom1D(
624        packedTexShape[0], packedTexShape[1], index);
625      return ${s.texture2D}(${n}, uv);
626    }
627  `;let i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)];return`
628    vec4 ${a}(int index) {
629      vec2 uv = packedUVfrom1D(
630        ${i[0]}, ${i[1]}, index);
631      return ${s.texture2D}(${n}, uv);
632    }
633  `}function sCe(e,t){let n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`
634      float ${a}(int index) {
635        ${Tg(e)}
636      }
637    `;let r=e.shapeInfo.texShape,s=r[0],i=r[1];if(i===1&&s===1)return`
638      float ${a}(int index) {
639        return sampleTexture(${n}, halfCR);
640      }
641    `;let o=yp(n);return i===1?t?`
642      float ${a}(int index) {
643        vec2 uv = vec2(0.5, (float(index + ${o}) + 0.5) / float(${n}TexShape[0]));
644        return sampleTexture(${n}, uv);
645      }
646    `:`
647      float ${a}(int index) {
648        vec2 uv = vec2(0.5, (float(index + ${o}) + 0.5) / ${s}.0);
649        return sampleTexture(${n}, uv);
650      }
651    `:s===1?t?`
652      float ${a}(int index) {
653        vec2 uv = vec2((float(index + ${o}) + 0.5) / float(${n}TexShape[1]), 0.5);
654        return sampleTexture(${n}, uv);
655      }
656    `:`
657      float ${a}(int index) {
658        vec2 uv = vec2((float(index + ${o}) + 0.5) / ${i}.0, 0.5);
659        return sampleTexture(${n}, uv);
660      }
661    `:t?`
662    float ${a}(int index) {
663      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], index + ${o});
664      return sampleTexture(${n}, uv);
665    }
666  `:`
667    float ${a}(int index) {
668      vec2 uv = uvFromFlat(${s}, ${i}, index + ${o});
669      return sampleTexture(${n}, uv);
670    }
671  `}function iCe(e,t){let n=e.shapeInfo.logicalShape,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=e.shapeInfo.texShape,i=s[0],o=s[1],l=Is();if(s!=null&&R.arraysEqual(n,s))return t?`
672      vec4 ${r}(int row, int col) {
673        vec2 uv = (vec2(col, row) + halfCR) / vec2(${a}TexShape[1], ${a}TexShape[0]);
674
675        return ${l.texture2D}(${a}, uv);
676      }
677    `:`
678      vec4 ${r}(int row, int col) {
679        vec2 uv = (vec2(col, row) + halfCR) / vec2(${o}.0, ${i}.0);
680
681        return ${l.texture2D}(${a}, uv);
682      }
683    `;if(t)return`
684    vec4 ${r}(int row, int col) {
685      ivec2 packedTexShape = ivec2(ceil(float(${a}TexShape[0]) / 2.0), ceil(float(${a}TexShape[1]) / 2.0));
686      int valuesPerRow = int(ceil(float(${a}Shape[1]) / 2.0));
687      vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);
688      return ${l.texture2D}(${a}, uv);
689    }
690  `;let d=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],c=Math.ceil(n[1]/2);return`
691    vec4 ${r}(int row, int col) {
692      vec2 uv = packedUVfrom2D(${c}, ${d[0]}, ${d[1]}
692, row, col);
693      return ${l.texture2D}(${a}, uv);
694    }
695  `}function oCe(e,t){let n=e.shapeInfo.logicalShape,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=e.shapeInfo.texShape;if(s!=null&&R.arraysEqual(n,s)){if(t)return`
696      float ${r}(int row, int col) {
697        vec2 uv = (vec2(col, row) + halfCR) / vec2(${a}TexShape[1], ${a}TexShape[0]);
698        return sampleTexture(${a}, uv);
699      }
700    `;let m=s[0],x=s[1];return`
701    float ${r}(int row, int col) {
702      vec2 uv = (vec2(col, row) + halfCR) / vec2(${x}.0, ${m}.0);
703      return sampleTexture(${a}, uv);
704    }
705  `}let{newShape:i,keptDims:o}=R.squeezeShape(n),l=i;if(l.length<n.length){let m=Ag(e,l),x=["row","col"];return`
706      ${Ig(m,t)}
707      float ${r}(int row, int col) {
708        return ${r}(${_g(x,o)});
709      }
710    `}if(e.shapeInfo.isUniform)return`
711      float ${r}(int row, int col) {
712        int index = round(dot(vec2(row, col), vec2(${n[1]}, 1)));
713        ${Tg(e)}
714      }
715    `;let d=s[0],c=s[1],f=yp(a);return c===1?t?`
716      float ${r}(int row, int col) {
717        float index = dot(vec3(row, col, ${f}), vec3(${a}Shape[1], 1, 1));
718        vec2 uv = vec2(0.5, (index + 0.5) / float(${a}TexShape[0]));
719        return sampleTexture(${a}, uv);
720      }
721    `:`
722    float ${r}(int row, int col) {
723      float index = dot(vec3(row, col, ${f}), vec3(${n[1]}, 1, 1));
724      vec2 uv = vec2(0.5, (index + 0.5) / ${d}.0);
725      return sampleTexture(${a}, uv);
726    }
727  `:d===1?t?`
728      float ${r}(int row, int col) {
729        float index = dot(vec3(row, col, ${f}), vec3(${a}Shape[1], 1, 1));
730        vec2 uv = vec2((index + 0.5) / float(${a}TexShape[1]), 0.5);
731        return sampleTexture(${a}, uv);
732      }
733    `:`
734    float ${r}(int row, int col) {
735      float index = dot(vec3(row, col, ${f}), vec3(${n[1]}, 1, 1));
736      vec2 uv = vec2((index + 0.5) / ${c}.0, 0.5);
737      return sampleTexture(${a}, uv);
738    }
739  `:t?`
740      float ${r}(int row, int col) {
741        // Explicitly use integer operations as dot() only works on floats.
742        int index = row * ${a}Shape[1] + col + ${f};
743        vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index);
744        return sampleTexture(${a}, uv);
745      }
746    `:`
747  float ${r}(int row, int col) {
748    // Explicitly use integer operations as dot() only works on floats.
749    int index = row * ${n[1]} + col + ${f};
750    vec2 uv = uvFromFlat(${d}, ${c}, index);
751    return sampleTexture(${a}, uv);
752  }
753`}function lCe(e,t){let n=e.shapeInfo.logicalShape,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=e.shapeInfo.texShape,i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];if(n[0]===1){let m=n.slice(1),x=[1,2],y=Ag(e,m),b=["b","row","col"];return`
754        ${l9(y,t)}
755        vec4 ${r}(int b, int row, int col) {
756          return ${r}(${_g(b,x)});
757        }
758      `}let o=Is();if(t)return`
759    vec4 ${r}(int b, int row, int col) {
760      ivec2 packedTexShape = ivec2(ceil(float(${a}TexShape[0]) / 2.0), ceil(float(${a}TexShape[1]) / 2.0));
761      int valuesPerRow = int(ceil(float(${a}Shape[2]) / 2.0));
762      int texelsInBatch = valuesPerRow * int(ceil(float(${a}Shape[1]) / 2.0));
763      vec2 uv = packedUVfrom3D(
764        packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);
765      return ${o.texture2D}(${a}, uv);
766    }
767  `;let l=i[0],d=i[1],c=Math.ceil(n[2]/2),f=c*Math.ceil(n[1]/2);return`
768    vec4 ${r}(int b, int row, int col) {
769      vec2 uv = packedUVfrom3D(
770        ${l}, ${d}, ${f}, ${c}, b, row, col);
771      return ${o.texture2D}(${a}, uv);
772    }
773  `}function uCe(e,t){let n=e.shapeInfo.logicalShape,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=n[1]*n[2],i=n[2],{newShape:o,keptDims:l}=R.squeezeShape(n),d=o;if(d.length<n.length){let b=Ag(e,d),w=["row","col","depth"];return`
774        ${Ig(b,t)}
775        float ${r}(int row, int col, int depth) {
776          return ${r}(${_g(w,l)});
777        }
778      `}if(e.shapeInfo.isUniform)return`
779      float ${r}(int row, int col, int depth) {
780        int index = round(dot(vec3(row, col, depth),
781                          vec3(${s}, ${i}, 1)));
782        ${Tg(e)}
783      }
784    `;let c=e.shapeInfo.texShape,f=c[0],m=c[1],x=e.shapeInfo.flatOffset;if(m===s&&x==null)return t?`
785      float ${r}(int row, int col, int depth) {
786        int stride1 = ${a}Shape[2];
787        float texR = float(row);
788        float texC = dot(vec2(col, depth), vec2(stride1, 1));
789        vec2 uv = (vec2(texC, texR) + halfCR) /
790                   vec2(${a}TexShape[1], ${a}TexShape[0]);
791        return sampleTexture(${a}, uv);
792      }
793    `:`
794        float ${r}(int row, int col, int depth) {
795          float texR = float(row);
796          float texC = dot(vec2(col, depth), vec2(${i}, 1));
797          vec2 uv = (vec2(texC, texR) + halfCR) /
798                     vec2(${m}.0, ${f}.0);
799          return sampleTexture(${a}, uv);
800        }
801      `;if(m===i&&x==null)return t?`
802      float ${r}(int row, int col, int depth) {
803        float texR = dot(vec2(row, col), vec2(${a}Shape[1], 1));
804        float texC = float(depth);
805        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${a}TexShape[1], ${a}TexShape[0]);
806        return sampleTexture(${a}, uv);
807      }
808    `:`
809    float ${r}(int row, int col, int depth) {
810      float texR = dot(vec2(row, col), vec2(${n[1]}, 1));
811      float texC = float(depth);
812      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${m}.0, ${f}.0);
813      return sampleTexture(${a}, uv);
814    }
815  `;let y=yp(a);return t?`
816    float ${r}(int row, int col, int depth) {
817      // Explicitly use integer operations as dot() only works on floats.
818      int stride0 = ${a}Shape[1] * ${a}Shape[2];
819      int stride1 = ${a}Shape[2];
820      int index = row * stride0 + col * stride1 + depth + ${y};
821      vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index);
822      return sampleTexture(${a}, uv);
823    }
824    `:`
825      float ${r}(int row, int col, int depth) {
826        // Explicitly use integer operations as dot() only works on floats.
827        int index = row * ${s} + col * ${i} + depth + ${y};
828        vec2 uv = uvFromFlat(${f}, ${m}, index);
829        return sampleTexture(${a}, uv);
830      }
831  `}function cCe(e,t){let n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=Is();if(t)return`
832    vec4 ${a}(int b2, int b, int row, int col) {
833      int valuesPerRow = int(ceil(float(${n}Shape[3]) / 2.0));
834      int texelsInBatch = valuesPerRow * int(ceil(float(${n}Shape[2]) / 2.0));
835      int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);
836      texelsInBatch *= ${n}Shape[1];
837      index = b2 * texelsInBatch + index;
838      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));
839      int texR = index / packedTexShape[1];
840      int texC = index - texR * packedTexShape[1];
841      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${r.texture2D}(${n}, uv);
842    }
843  `;let s=e.shapeInfo.logicalShape,i=s.length,o=e.shapeInfo.texShape,l=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)],d=l[0],c=l[1],f=Math.ceil(s[i-1]/2),m=f*Math.ceil(s[i-2]/2),x="int b, int row, int col",y=`b * ${m} + (row / 2) * ${f} + (col / 2)`;for(let b=2;b<i-1;b++)x=`int b${b}, `+x,m*=s[i-b-1],y=`b${b} * ${m} + `+y;return`
844    vec4 ${a}(${x}) {
845      int index = ${y};
846      int texR = index / ${c};
847      int texC = index - texR * ${c};
848      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${c}, ${d});
849      return ${r.texture2D}(${n}, uv);
850    }
851  `}function dCe(e,t){let n=e.shapeInfo.logicalShape,a=e.name,r="get"+a.charAt(0).toUpperCase()+a.slice(1),s=n[3],i=n[2]*s,o=n[1]*i,{newShape:l,keptDims:d}=R.squeezeShape(n);if(l.length<n.length){let k=Ag(e,l),C=["row","col","depth","depth2"];return`
852      ${Ig(k,t)}
853      float ${r}(int row, int col, int depth, int depth2) {
854        return ${r}(${_g(C,d)});
855      }
856    `}if(e.shapeInfo.isUniform)return`
857      float ${r}(int row, int col, int depth, int depth2) {
858        int index = round(dot(vec4(row, col, depth, depth2),
859                          vec4(${o}, ${i}, ${s}, 1)));
860        ${Tg(e)}
861      }
862    `;let c=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,m=f[0],x=f[1],y=`int stride2 = ${a}Shape[3];`,b=`int stride1 = ${a}Shape[2] * stride2;`,w=`int stride0 = ${a}Shape[1] * stride1;`;if(x===o&&c==null)return t?`
863      float ${r}(int row, int col, int depth, int depth2) {
864        ${y}
865        ${b}
866        float texR = float(row);
867        float texC =
868            dot(vec3(col, depth, depth2),
869                vec3(stride1, stride2, 1));
870        vec2 uv = (vec2(texC, texR) + halfCR) /
871                   vec2(${a}TexShape[1], ${a}TexShape[0]);
872        return sampleTexture(${a}, uv);
873      }
874    `:`
875      float ${r}(int row, int col, int depth, int depth2) {
876        float texR = float(row);
877        float texC =
878            dot(vec3(col, depth, depth2),
879                vec3(${i}, ${s}, 1));
880        vec2 uv = (vec2(texC, texR) + halfCR) /
881                   vec2(${x}.0, ${m}.0);
882        return sampleTexture(${a}, uv);
883      }
884    `;if(x===s&&c==null)return t?`
885      float ${r}(int row, int col, int depth, int depth2) {
886        float texR = dot(vec3(row, col, depth),
887                         vec3(${a}Shape[1] * ${a}Shape[2], ${a}Shape[2], 1));
888        float texC = float(depth2);
889        vec2 uv = (vec2(texC, texR) + halfCR) /
890                  vec2(${a}TexShape[1], ${a}TexShape[0]);
891        return sampleTexture(${a}, uv);
892      }
893    `:`
894      float ${r}(int row, int col, int depth, int depth2) {
895        float texR = dot(vec3(row, col, depth),
896                         vec3(${n[1]*n[2]}, ${n[2]}, 1));
897        float texC = float(depth2);
898        vec2 uv = (vec2(texC, texR) + halfCR) /
899                  vec2(${x}.0, ${m}.0);
900        return sampleTexture(${a}, uv);
901      }
902    `;let S=yp(a);return t?`
903    float ${r}(int row, int col, int depth, int depth2) {
904      // Explicitly use integer operations as dot() only works on floats.
905      ${y}
906      ${b}
907      ${w}
908      int index = row * stride0 + col * stride1 +
909          depth * stride2 + depth2;
910      vec2 uv = uvFromFlat(${a}TexShape[0], ${a}TexShape[1], index + ${S});
911      return sampleTexture(${a}, uv);
912    }
913  `:`
914    float ${r}(int row, int col, int depth, int depth2) {
915      // Explicitly use integer operations as dot() only works on floats.
916      int index = row * ${o} + col * ${i} +
917          depth * ${s} + depth2;
918      vec2 uv = uvFromFlat(${m}, ${x}, index + ${S});
919      return sampleTexture(${a}, uv);
920    }
921  `}function hCe(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t[4],s=t[3]*r,i=t[2]*s,o=t[1]*i,{newShape:l,keptDims:d}=R.squeezeShape(t);if(l.length<t.length){let b=Ag(e,l),w=["row","col","depth","depth2","depth3"];return`
922      ${Ig(b)}
923      float ${a}(int row, int col, int depth, int depth2, int depth3) {
924        return ${a}(${_g(w,d)});
925      }
926    `}if(e.shapeInfo.isUniform)return`
927      float ${a}(int row, int col, int depth, int depth2, int depth3) {
928        float index = dot(
929          vec4(row, col, depth, depth2),
930          vec4(${o}, ${i}, ${s}, ${r})) +
931          depth3;
932        ${Tg(e)}
933      }
934    `;let c=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,m=f[0],x=f[1];if(x===o&&c==null)return`
935      float ${a}(int row, int col, int depth, int depth2, int depth3) {
936        int texR = row;
937        float texC = dot(vec4(col, depth, depth2, depth3),
938                         vec4(${i}, ${s}, ${r}, 1));
939        vec2 uv = (vec2(texC, texR) + halfCR) /
940                   vec2(${x}.0, ${m}.0);
941        return sampleTexture(${n}, uv);
942      }
943    `;if(x===r&&c==null)return`
944      float ${a}(int row, int col, int depth, int depth2, int depth3) {
945        float texR = dot(
946          vec4(row, col, depth, depth2),
947          vec4(${t[1]*t[2]*t[3]},
948               ${t[2]*t[3]}, ${t[3]}, 1));
949        int texC = depth3;
950        vec2 uv = (vec2(texC, texR) + halfCR) /
951                  vec2(${x}.0, ${m}.0);
952        return sampleTexture(${n}, uv);
953      }
954    `;let y=yp(n);return`
955    float ${a}(int row, int col, int depth, int depth2, int depth3) {
956      // Explicitly use integer operations as dot() only works on floats.
957      int index = row * ${o} + col * ${i} + depth * ${s} +
958          depth2 * ${r} + depth3 + ${y};
959      vec2 uv = uvFromFlat(${m}, ${x}, index);
960      return sampleTexture(${n}, uv);
961    }
962  `}function pCe(e){let t=e.shapeInfo.logicalShape,n=e.name,a="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:r,keptDims:s}=R.squeezeShape(t);if(r.length<t.length){let w=Ag(e,r),S=["row","col","depth","depth2","depth3","depth4"];return`
963      ${Ig(w)}
964      float ${a}(int row, int col, int depth,
965                    int depth2, int depth3, int depth4) {
966        return ${a}(${_g(S,s)});
967      }
968    `}let i=t[5],o=t[4]*i,l=t[3]*o,d=t[2]*l,c=t[1]*d;if(e.shapeInfo.isUniform)return`
969      float ${a}(int row, int col, int depth,
970                  int depth2, int depth3, int depth4) {
971        int index = round(dot(
972          vec4(row, col, depth, depth2),
973          vec4(${c}, ${d}, ${l}, ${o})) +
974          dot(
975            vec2(depth3, depth4),
976            vec2(${i}, 1)));
977        ${Tg(e)}
978      }
979    `;let f=e.shapeInfo.flatOffset,m=e.shapeInfo.texShape,x=m[0],y=m[1];if(y===c&&f==null)return`
980      float ${a}(int row, int col, int depth,
981                    int depth2, int depth3, int depth4) {
982        int texR = row;
983        float texC = dot(vec4(col, depth, depth2, depth3),
984          vec4(${d}, ${l}, ${o}, ${i})) +
985               float(depth4);
986        vec2 uv = (vec2(texC, texR) + halfCR) /
987                   vec2(${y}.0, ${x}.0);
988        return sampleTexture(${n}, uv);
989      }
990    `;if(y===i&&f==null)return`
991      float ${a}(int row, int col, int depth,
992                    int depth2, int depth3, int depth4) {
993        float texR = dot(vec4(row, col, depth, depth2),
994          vec4(${t[1]*t[2]*t[3]*t[4]},
995               ${t[2]*t[3]*t[4]},
996               ${t[3]*t[4]},
997               ${t[4]})) + float(depth3);
998        int texC = depth4;
999        vec2 uv = (vec2(texC, texR) + halfCR) /
1000                  vec2(${y}.0, ${x}.0);
1001        return sampleTexture(${n}, uv);
1002      }
1003    `;let b=yp(n);return`
1004    float ${a}(int row, int col, int depth,
1005                  int depth2, int depth3, int depth4) {
1006      // Explicitly use integer operations as dot() only works on floats.
1007      int index = row * ${c} + col * ${d} + depth * ${l} +
1008          depth2 * ${o} + depth3 * ${i} + depth4 + ${b};
1009      vec2 uv = uvFromFlat(${x}, ${y}, index);
1010      return sampleTexture(${n}, uv);
1011    }
1012  `}function Tg(e){let t=e.name,n=R.sizeFromShape(e.shapeInfo.logicalShape);return n<2?`return ${t};`:`
1013    for (int i = 0; i < ${n}; i++) {
1014      if (i == index) {
1015        return ${t}[i];
1016      }
1017    }
1018  `}function fCe(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=e.shapeInfo.logicalShape.length,i=t.logicalShape.length,o=o9(e.shapeInfo.logicalShape,t.logicalShape),l=ea(i),d=i-s,c,f=["x","y","z","w","u","v"];s===0?c="":i<2&&o.length>=1?c="coords = 0;":c=o.map(w=>`coords.${f[w+d]} = 0;`).join(`
1019`);let m="";i<2&&s>0?m="coords":m=e.shapeInfo.logicalShape.map((w,S)=>`coords.${f[S+d]}`).join(", ");let x="return outputValue;",y=R.sizeFromShape(e.shapeInfo.logicalShape)===1,b=R.sizeFromShape(t.logicalShape)===1;if(s===1&&!y&&!b)x=`
1020      return vec4(outputValue.xy, outputValue.xy);
1021    `;else if(y&&!b)i===1?x=`
1022        return vec4(outputValue.x, outputValue.x, 0., 0.);
1023      `:x=`
1024        return vec4(outputValue.x);
1025      `;else if(o.length){let w=s-2,S=s-1;o.indexOf(w)>-1&&o.indexOf(S)>-1?x="return vec4(outputValue.x);":o.indexOf(w)>-1?x="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":o.indexOf(S)>-1&&(x="return vec4(outputValue.xx, outputValue.zz);")}return`
1026    vec4 ${r}() {
1027      ${l} coords = getOutputCoords();
1028      ${c}
1029      vec4 outputValue = get${a}(${m});
1030      ${x}
1031    }
1032  `}function mCe(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&e.shapeInfo.flatOffset==null&&R.arraysEqual(i,s))return`
1033      float ${r}() {
1034        return sampleTexture(${n}, resultUV);
1035      }
1036    `;let d=ea(l),c=o9(e.shapeInfo.logicalShape,t.logicalShape),f=l-o,m,x=["x","y","z","w","u","v"];o===0?m="":l<2&&c.length>=1?m="coords = 0;":m=c.map(b=>`coords.${x[b+f]} = 0;`).join(`
1037`);let y="";return l<2&&o>0?y="coords":y=e.shapeInfo.logicalShape.map((b,w)=>`coords.${x[w+f]}`).join(", "),`
1038    float ${r}() {
1039      ${d} coords = getOutputCoords();
1040      ${m}
1041      return get${a}(${y});
1042    }
1043  `}function ea(e){if(e<=1)return"int";if(e===2)return"ivec2";if(e===3)return"ivec3";if(e===4)return"ivec4";if(e===5)return"ivec5";if(e===6)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function v4(e,t,n){let{newShape:a,keptDims:r}=R.squeezeShape(t),s=t.length,i=e&&s===3&&t[0]===1,o=i?t.slice(1):a,l=!e&&s>1&&!R.arraysEqual(t,n)&&a.length<s||i;return{useSqueezeShape:l,uniformShape:l?o:t,keptDims:r}}function Ag(e,t){let n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function _g(e,t){return t.map(n=>e[n]).join(", ")}function gCe(e,t,n,a){let r=n.map((c,f)=>{let m={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&&(m.flatOffset=c.texData.slice.flatOffset),{name:t.variableNames[f],shapeInfo:m}}),s=r.map(c=>c.shapeInfo),i={logicalShape:a.shape,texShape:a.texData.texShape,isUniform:!1,isPacked:a.texData.isPacked,flatOffset:null},o=MNe(r,i,t),l=LU(e.gl,o),d=e.createProgram(l);return fe().get("ENGINE_COMPILE_ONLY")?{program:t,fragmentShader:l,source:o,webGLProgram:d,inShapeInfos:s,outShapeInfo:i,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}
vendor: 8,338 bytes, lines 1043-1112
1043:(e.buildVao(d),Object.assign({program:t,fragmentShader:l,source:o,webGLProgram:d,inShapeInfos:s,outShapeInfo:i},c9(e,t,d)))}function c9(e,t,n){let a=[],r=[],s,i,o,l=null,d=null;d=e.getUniformLocation(n,"NAN",!1),fe().getNumber("WEBGL_VERSION")===1&&(l=e.getUniformLocation(n,"INFINITY",!1));let c=!1;for(let f of t.variableNames){let m={name:f,uniform:e.getUniformLocation(n,f,c),offset:e.getUniformLocation(n,`offset${f}`,c)};t.enableShapeUniforms&&(m.shape=e.getUniformLocation(n,`${f}Shape`,c),m.texShape=e.getUniformLocation(n,`${f}TexShape`,c)),a.push(m)}if(t.enableShapeUniforms&&(s=e.getUniformLocation(n,"outShape",c),o=e.getUniformLocation(n,"outShapeStrides",c),i=e.getUniformLocation(n,"outTexShape",c)),t.customUniforms)for(let f of t.customUniforms)r.push(e.getUniformLocation(n,f.name,c));return{variablesLocations:a,customUniformLocations:r,infLoc:l,nanLoc:d,outShapeLocation:s,outShapeStridesLocation:o,outTexShapeLocation:i}}function V$(e,t){if(e.length!==t.length)throw Error(`Binary was compiled with ${e.length} inputs, but was executed with ${t.length} inputs`);e.forEach((n,a)=>{let r=n.logicalShape,s=t[a],i=s.shape;if(!R.arraysEqual(r,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${r} and ${i} must match`);if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!R.arraysEqual(o,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${o} and ${l} must match`)})}function xCe(e,t,n,a,r){t.program.enableShapeUniforms||(V$(t.inShapeInfos,n),V$([t.outShapeInfo],[a]));let s=a.texData.texture,i=a.texData.texShape;a.texData.isPacked?e.setOutputPackedMatrixTexture(s.texture,i[0],i[1]):e.setOutputMatrixTexture(s.texture,i[0],i[1]),e.setProgram(t.webGLProgram),e.bindVertexArray(t.webGLProgram.vao),fe().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,1/0),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN);for(let l=0;l<n.length;++l){let d=n[l],{uniform:c,offset:f,shape:m,texShape:x}=t.variablesLocations[l];if(m){let{uniformShape:y}=v4(t.program.packedInputs,d.shape,d.texData.texShape);switch(y.length){case 1:e.gl.uniform1iv(m,new Int32Array(y));break;case 2:e.gl.uniform2iv(m,new Int32Array(y));break;case 3:e.gl.uniform3iv(m,new Int32Array(y));break;case 4:e.gl.uniform4iv(m,new Int32Array(y));break}}if(x&&e.gl.uniform2i(x,d.texData.texShape[0],d.texData.texShape[1]),c!=null){if(d.isUniform){if(R.sizeFromShape(d.shape)<2)e.gl.uniform1f(c,d.uniformValues[0]);else{let y=d.uniformValues;y instanceof Float32Array||(y=new Float32Array(y)),e.gl.uniform1fv(c,y)}continue}d.texData.slice!=null&&f!=null&&e.gl.uniform1i(f,d.texData.slice.flatOffset),e.setInputMatrixTexture(d.texData.texture.texture,c,l)}}let o=t.outShapeLocation;if(o)switch(a.shape.length){case 1:e.gl.uniform1iv(o,new Int32Array(a.shape));break;case 2:e.gl.uniform2iv(o,new Int32Array(a.shape));break;case 3:e.gl.uniform3iv(o,new Int32Array(a.shape));break;case 4:e.gl.uniform4iv(o,new Int32Array(a.shape));break}if(t.outShapeStridesLocation){let l=R.computeStrides(a.shape);switch(a.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(l));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(l));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(l));break}}if(t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,a.texData.texShape[0],a.texData.texShape[1]),t.program.customUniforms&&r)for(let l=0;l<t.program.customUniforms.length;++l){let d=t.program.customUniforms[l],c=t.customUniformLocations[l],f=r[l];if(d.type==="float")e.gl.uniform1fv(c,f);else if(d.type==="vec2")e.gl.uniform2fv(c,f);else if(d.type==="vec3")e.gl.uniform3fv(c,f);else if(d.type==="vec4")e.gl.uniform4fv(c,f);else if(d.type==="int")e.gl.uniform1iv(c,f);else if(d.type==="ivec2")e.gl.uniform2iv(c,f);else if(d.type==="ivec3")e.gl.uniform3iv(c,f);else if(d.type==="ivec4")e.gl.uniform4iv(c,f);else throw Error(`uniform type ${d.type} is not supported yet.`)}e.executeProgram()}function yCe(e,t,n){let a="";t.concat(n).forEach(i=>{let o=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!i.isUniform){let l=i.texData.texShape,{useSqueezeShape:d,uniformShape:c,keptDims:f}=v4(e.packedInputs,i.shape,l),m="",x="",y="";if(c.length===1&&e.packedInputs){let T=[Math.ceil(l[0]/2),Math.ceil(l[1]/2)];m=`${T[0]>1}_${T[1]>1}`}else if(c.length===2&&!e.packedInputs)x=`${c[0]>1}_${c[1]>1}`;else if(c.length>2&&!e.packedInputs){let T=R.computeStrides(c);y=`${T[0]===l[1]}_${T[T.length-1]===l[1]}`}let b=i.shape.length,w=c.length===2&&R.arraysEqual(i.shape,l),S=R.sizeFromShape(i.shape)===1,k=W.getBroadcastDims(i.shape,n.shape),C=!e.packedInputs&&b===n.shape.length&&R.arraysEqual(l,n.texData.texShape),E=e.packedInputs||c.length>2?"":`${l[0]>1}_${l[1]>1}`;a+=`${b}_${C}_${d?f:""}_${c.length}_${S}_${k}_${w}_${m}_${x}_${y}_${E}_${o}`}else{let l=i.isUniform?"uniform":i.texData.texShape;a+=`${i.shape}_${l}_${o}`}});let r=e.userCode,s=e.constructor.name;return s+="_"+a+"_"+r+`${fe().getNumber("WEBGL_VERSION")}`,s}function ss(e){return fe().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4}var bCe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Uy.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];let t=Is();this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length),this.userCode=`
1044      ivec3 outCoordsFromFlatIndex(int index) {
1045        ${this.enableShapeUniforms?F2(["r","c","d"],e):xp(["r","c","d"],e)}
1046        return ivec3(r, c, d);
1047      }
1048
1049      void main() {
1050        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
1051        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);
1052
1053        vec4 result = vec4(0.);
1054
1055        for (int i=0; i<4; i++) {
1056          int flatIndex = index + i;
1057          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
1058          result[i] = getA(rc.x, rc.y, rc.z);
1059        }
1060
1061        ${t.output} = result;
1062      }
1063    `}},vCe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Uy.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];let t=Is();this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length),this.userCode=`
1064      ivec3 outCoordsFromFlatIndex(int index) {
1065        ${this.enableShapeUniforms?F2(["r","c","d"],e):xp(["r","c","d"],e)}
1066        return ivec3(r, c, d);
1067      }
1068
1069      void main() {
1070        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
1071        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);
1072
1073        vec4 result = vec4(0.);
1074
1075        for (int i=0; i<4; i++) {
1076          int flatIndex = index + i;
1077          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
1078          result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));
1079        }
1080
1081        ${t.output} = result;
1082      }
1083    `}},wCe=class{constructor(e){this.variableNames=["A"],this.outTexUsage=Ti.DOWNLOAD;let t=Is();this.outputShape=e,this.userCode=`
1084      ${i9}
1085
1086      void main() {
1087        float x = getAAtOutCoords();
1088        ${t.output} = encode_float(x);
1089      }
1090    `}},SCe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Ti.DOWNLOAD;let t=Is();this.outputShape=e,this.userCode=`
1091      ${i9}
1092
1093      void main() {
1094        ivec3 coords = getOutputCoords();
1095        float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));
1096        ${t.output} = encode_float(x);
1097      }
1098    `}},kCe={R:0,G:1,B:2,A:3},H$=class{constructor(e,t=!1,n="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];let a=Is();this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length);let r="result";t&&(r="floor(result * 255. + 0.5)");let s="";for(let i=0;i<n.length;i++){let o=n[i];s+=`
1099          if(offset == ${i}) {
1100            result = values[${kCe[o]}];
1101          }`}this.userCode=`
1102      ${this.enableShapeUniforms?b4():y4(e)}
1103
1104      void main() {
1105        ivec3 coords = getOutputCoords();
1106        int flatIndex = getFlatIndex(coords);
1107        float result = 0.;
1108        int offset = imod(flatIndex, ${n.length});
1109
1110        flatIndex = idiv(flatIndex, ${n.length}, 1.);
1111
1112        int r = flatIndex / texShape[1];
1113        if (r < texShape[0]) {
1114          int c = imod(flatIndex, texShape[1]);
1115          vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
1116          vec4 values = ${a.texture2D}(A, uv);
1117          ${s}
1118        }
1119        ${a.output} = vec4(${r}, 0., 0., 0.);
1120      }
1121    `}},NCe=class{constructor(e,t=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];let n=Is();this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length);let a="",r="result";t&&(r="floor(result * 255. + 0.5)");for(let s=0;s<=1;s++)for(let i=0;i<=1;i++){let o=s*2+i;a+=`
1122          localCoords = coords;
1123          if(localCoords[2] + ${i} < ${this.enableShapeUniforms?"outShape[2]":`${e[2]}`}) {
1124          localCoords[2] += ${i};
1125          if (localCoords[1] + ${s} < ${this.enableShapeUniforms?"outShape[1]":`${e[1]}`}) {
1126            localCoords[1] += ${s};
1127
1128            flatIndex = getFlatIndex(localCoords);
1129            offset = imod(flatIndex, 4);
1130
1131            flatIndex = idiv(flatIndex, 4, 1.);
1132
1133            int r = flatIndex / texShape[1];
1134            int c = imod(flatIndex, texShape[1]);
1135            vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
1136            values = ${n.texture2D}(A, uv);
1137
1138            if (offset == 0) {
1139              result[${o}] = values[0];
1140            } else if (offset == 1) {
1141              result[${o}] = values[1];
1142            } else if (offset == 2) {
1143              result[${o}] = values[2];
1144            } else {
1145              result[${o}] = values[3];
1146            }
1147          }
1148        }
1149        `}this.userCode=`
1150        ${this.enableShapeUniforms?b4():y4(e)}
1151
1152        void main() {
1153          ivec3 coords = getOutputCoords();
1154
1155          vec4 result = vec4(0.);
1156          int flatIndex, r, c, offset;
1157          ivec3 localCoords;
1158          vec2 uv;
1159          vec4 values;
1160
1161          ${a}
1162
1163          ${n.output} = ${r};
1164        }
1165    `}},d9={};Xt(d9,{bindVertexProgramAttributeStreams:()=>v9,createBufferFromOutputTexture:()=>k9,createFloat16MatrixTexture:()=>g9,createFloat16PackedMatrixTexture:()=>b9,createFloat32MatrixTexture:()=>m9,createIndexBuffer:()=>f9,createPackedMatrixTexture:()=>y9,createUnsignedBytesMatrixTexture:()=>x9,createVertexBuffer:()=>p9,createVertexShader:()=>h9,downloadByteEncodedFloatMatrixFromOutputTexture:()=>C9,downloadFloat32MatrixFromBuffer:()=>N9,downloadMatrixFromPackedOutputTexture:()=>I9,downloadPackedMatrixFromBuffer:()=>E9,getInternalFormatForFloat16MatrixTexture:()=>S4,getInternalFormatForFloat16PackedMatrixTexture:()=>C4,getInternalFormatForFloat32MatrixTexture:()=>w4,getInternalFormatForPackedMatrixTexture:()=>N4,getInternalFormatForUnsignedBytesMatrixTexture:()=>k4,uploadDenseMatrixToTexture:()=>w9,uploadPixelDataToTexture:()=>S9});function h9(e){let t=Is(),n=`${t.version}
1166    precision highp float;
1167    ${t.attribute} vec3 clipSpacePos;
1168    ${t.attribute} vec2 uv;
1169    ${t.varyingVs} vec2 resultUV;
1170
1171    void main() {
1172      gl_Position = vec4(clipSpacePos, 1);
1173      resultUV = uv;
1174    }`;return OU(e,n)}function p9(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return UU(e,t)}function f9(e){let t=new Uint16Array([0,1,2,2,1,3]);return WU(e,t)}function e0(e,t,n,a,r,s){HU(t,n);let i=VU(e),o=e.TEXTURE_2D;return at(e,()=>e.bindTexture(o,i)),at(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),at(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),at(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),at(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),fe().getNumber("WEBGL_VERSION")===1?at(e,()=>e.texImage2D(o,0,a,t,n,0,r,s,null)):at(e,()=>e.texStorage2D(o,1,a,t,n)),at(e,()=>e.bindTexture(e.TEXTURE_2D,null)),{texture:i,texShape:[n,t]}}function w4(e){return e.internalFormatFloat}function m9(e,t,n,a){let[r,s]=Zb(t,n);return e0(e,r,s,w4(a),a.textureFormatFloat,e.FLOAT)}function S4(e){return e.internalFormatHalfFloat}function g9(e,t,n,a){let[r,s]=Zb(t,n);return e0(e,r,s,S4(a),a.textureFormatFloat,a.textureTypeHalfFloat)}function k4(e){return e.downloadTextureFormat}function x9(e,t,n,a){let[r,s]=Zb(t,n);return e0(e,r,s,k4(a),e.RGBA,e.UNSIGNED_BYTE)}function N4(e){return e.internalFormatPackedFloat}function y9(e,t,n,a){let[r,s]=Cg(t,n);return e0(e,r,s,N4(a),e.RGBA,e.FLOAT)}function C4(e){return e.internalFormatPackedHalfFloat}function b9(e,t,n,a){let[r,s]=Cg(t,n);return e0(e,r,s,C4(a),e.RGBA,a.textureTypeHalfFloat)}function v9(e,t,n){return at(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),IE(e,t,"clipSpacePos",n,3,20,0)&&IE(e,t,"uv",n,2,20,12)}function w9(e,t,n,a,r,s){at(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;r instanceof Uint8Array?(i=new Uint8Array(n*a*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*a*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(r),fe().getNumber("WEBGL_VERSION")===2?at(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA,o,i)):at(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,a,0,e.RGBA,o,i)),at(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function S9(e,t,n){at(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?fe().getNumber("WEBGL_VERSION")===2?at(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data)):at(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):fe().getNumber("WEBGL_VERSION")===2?at(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n)):at(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),at(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function k9(e,t,n,a){let r=e.createBuffer();at(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));let s=16*t*n;return at(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),at(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),at(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function N9(e,t,n){let a=e,r=new Float32Array(n);return a.bindBuffer(a.PIXEL_PACK_BUFFER,t),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,r),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),r}function C9(e,t,n,a){let[r,s]=Zb(t,n),i=4,o=new Uint8Array(vNe(t*n,i));return at(e,()=>e.readPixels(0,0,r,s,a.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function E9(e,t,n,a,r,s,i,o){let l=e,d=new Float32Array(wNe(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,d),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),d}function I9(e,t,n){let a=new Float32Array(t*n*4);return at(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,a)),a}var cv=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];let t=fe().getNumber("WEBGL_VERSION");if(e!=null?(this.gl=e,$U(t,e)):this.gl=jo(t),e=this.gl,fe().getNumber("WEBGL_VERSION")===2){let r=e;this.createVertexArray=()=>at(r,()=>r.createVertexArray()),this.bindVertexArray=s=>at(r,()=>r.bindVertexArray(s)),this.deleteVertexArray=s=>at(r,()=>r.deleteVertexArray(s)),this.getVertexArray=()=>at(r,()=>r.getParameter(r.VERTEX_ARRAY_BINDING))}else if(e!=null){let r=e.getExtension("OES_vertex_array_object");
vendor: 26,730 bytes, lines 1174-1296
1174if(r==null)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>at(e,()=>r.createVertexArrayOES()),this.bindVertexArray=s=>at(e,()=>r.bindVertexArrayOES(s)),this.deleteVertexArray=s=>at(e,()=>r.deleteVertexArrayOES(s)),this.getVertexArray=()=>at(e,()=>e.getParameter(r.VERTEX_ARRAY_BINDING_OES))}let n="WEBGL_color_buffer_float",a="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),fe().getNumber("WEBGL_VERSION")===1){let r="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=qx(this.gl,r),Ai(this.gl,s))this.textureHalfFloatExtension=qx(this.gl,s);else if(fe().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),Ai(this.gl,a))this.colorBufferHalfFloatExtension=qx(this.gl,a);else if(fe().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",Ai(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(Ai(this.gl,a))this.colorBufferHalfFloatExtension=this.gl.getExtension(a);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=p9(this.gl),this.indexBuffer=f9(this.gl),this.framebuffer=GU(this.gl),this.textureConfig=g4(this.gl,this.textureHalfFloatExtension)}get debug(){return fe().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.");let e=this.gl;at(e,()=>e.finish()),at(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),at(e,()=>e.deleteFramebuffer(this.framebuffer)),at(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),at(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),at(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),m9(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),g9(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),x9(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),S9(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,a){this.throwIfDisposed(),w9(this.gl,e,t,n,a,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),b9(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),y9(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(TE(this.gl,this.framebuffer),this.outputTexture=null),at(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>C9(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,a,r,s){return E9(this.gl,e,t,n,a,r,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return N9(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);let a=k9(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),a}createAndWaitForFence(){let e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(fe().getBool("WEBGL_FENCE_API_ENABLED")){let a=e,r=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{let s=a.clientWaitSync(r,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},t=r}else fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>I9(this.gl,t,n))}createProgram(e){this.throwIfDisposed();let t=this.gl;this.vertexShader==null&&(this.vertexShader=h9(t));let n=PU(t);at(t,()=>t.attachShader(n,this.vertexShader)),at(t,()=>t.attachShader(n,e)),zU(t,n);let a=Object.assign(n,{vao:this.createVertexArray()});return this.debug&&iv(t,a),a}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);let t=this.gl;at(t,()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),v9(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&(at(this.gl,()=>this.gl.deleteProgram(e)),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&iv(this.gl,this.program),at(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?KU(this.gl,e,t):XU(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),at(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),YU(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();let[a,r]=Cg(t,n);this.setOutputMatrixTextureDriver(e,a,r)}setOutputMatrixWriteRegion(e,t,n,a){this.setOutputMatrixWriteRegionDriver(n,e,a,t)}setOutputPackedMatrixWriteRegion(e,t,n,a){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&iv(this.gl,this.program),Kx(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();let e=this.gl;if(this.debug){let t=this.getVertexArray();console.assert(t===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}at(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),at(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=qx(this.gl,fe().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(fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.createQuery();return n.beginQuery(a.TIME_ELAPSED_EXT,r),r}let e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);return}let e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await R.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){let n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}else{let n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(a.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{let n=this.getQueryTimerExtensionWebGL1(),a=n.getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){let e=CCe(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){let{resolveFn:n}=this.itemsToPoll[t];n()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let n;"setTimeoutCustom"in fe().platform&&(n=fe().platform.setTimeoutCustom.bind(fe().platform)),R.repeatedTry(()=>(this.pollItems(),this.itemsToPoll.length===0),()=>0,null,n)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),ov(this.gl,e,this.framebuffer),this.debug&&Kx(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(ov(this.gl,this.outputTexture,this.framebuffer),this.debug&&Kx(this.gl)):TE(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);let n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();let a=this.gl;ov(a,e,this.framebuffer),this.debug&&Kx(a),this.outputTexture=e,at(a,()=>a.viewport(0,0,t,n)),at(a,()=>a.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,a){this.throwIfDisposed(),at(this.gl,()=>this.gl.scissor(e,t,n,a))}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 CCe(e){let t=0;for(;t<e.length&&e[t]();++t);return t-1}var{addImpl:ECe,bincountImpl:T9,bincountReduceImpl:ICe,bitwiseAndImpl:TCe,castImpl:ACe,ceilImpl:_Ce,concatImpl:jCe,equalImpl:DCe,expImpl:RCe,expm1Impl:MCe,floorImpl:$Ce,gatherNdImpl:BCe,gatherV2Impl:FCe,greaterImpl:OCe,greaterEqualImpl:LCe,lessImpl:PCe,lessEqualImpl:zCe,linSpaceImpl:UCe,logImpl:WCe,maxImpl:VCe,maximumImpl:HCe,minimumImpl:GCe,multiplyImpl:qCe,negImpl:KCe,notEqualImpl:XCe,prodImpl:YCe,raggedGatherImpl:JCe,raggedRangeImpl:QCe,raggedTensorToTensorImpl:ZCe,rangeImpl:eEe,rsqrtImpl:tEe,scatterImpl:nEe,sigmoidImpl:aEe,simpleAbsImpl:A9,sliceImpl:rEe,sparseFillEmptyRowsImpl:sEe,sparseReshapeImpl:iEe,sparseSegmentReductionImpl:_9,sqrtImpl:oEe,staticRegexReplaceImpl:lEe,stridedSliceImpl:uEe,stringNGramsImpl:cEe,stringSplitImpl:dEe,stringToHashBucketFastImpl:hEe,subImpl:pEe,tileImpl:fEe,topKImpl:mEe,transposeImpl:E4,uniqueImpl:gEe}=e4;function j9(e,t){return["x","y","z","w","u","v"].slice(0,t).map(n=>`${e}.${n}`)}function xs(e,t){return t===1?[e]:j9(e,t)}function xEe(e,t){if(e===1)return"rc";let n="";for(let a=0;a<e;a++)n+=t[a],a<e-1&&(n+=",");return n}var yEe=class{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=ss(this.outputShape.length),this.rank===0)this.userCode=`
1175        void main() {
1176          setOutput(vec4(getA(), 0., 0., 0.));
1177        }
1178      `;else{let t=xs("rc",this.rank),n=ea(this.rank),a=this.getOutOfBoundsCondition(t),r=this.getSetup(t),s=this.getOutput(t);this.userCode=`
1179        void main() {
1180          ${n} rc = getOutputCoords();
1181
1182          if(${a}) {
1183            setOutput(vec4(0));
1184          } else {
1185            ${r}
1186
1187            setOutput(vec4(${s}));
1188          }
1189        }
1190      `}}getSourceCoordsArr(e){let t=[];for(let n=0;n<=1;n++)for(let a=0;a<=1;a++){let r=`${n===0?"r":"rp1"}, ${a===0?"c":"cp1"}`;for(let s=2;s<this.rank;s++)r=`${e[e.length-1-s]},`+r;t.push(r)}return t}getOutOfBoundsCondition(e){if(this.rank===1)return`rc > ${this.enableShapeUniforms?"outShape":this.outputShape[0]}`;let t="";for(let n=this.rank-2;n<this.rank;n++)t+=`${e[n]} >= ${this.enableShapeUniforms?`outShape[${n}]`:this.outputShape[n]}`,n<this.rank-1&&(t+="||");return t}getSetup(e){if(this.rank===1)return"";let t=e.slice(-2),n=this.enableShapeUniforms?`outShape[${this.rank} - 1]`:this.outputShape[this.rank-1],a=this.enableShapeUniforms?`outShape[${this.rank} - 2]`:this.outputShape[this.rank-2];return`
1191      int r = ${t[0]};
1192      int c = ${t[1]};
1193      int rp1 = r + 1;
1194      int cp1 = c + 1;
1195
1196      bool cEdge = cp1 >= ${n};
1197      bool rEdge = rp1 >= ${a};
1198    `}getOutput(e){let t=this.getSourceCoordsArr(e);return this.rank===1?`getA(rc), (rc + 1 >= ${this.enableShapeUniforms?"outShape":this.outputShape[0]} ? 0. : getA(rc + 1)), 0, 0`:`getA(${t[0]}),
1199            cEdge ? 0. : getA(${t[1]}),
1200            rEdge ? 0. : getA(${t[2]}),
1201            rEdge || cEdge ? 0. : getA(${t[3]})`}},D9=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length);let n="";for(let a=0;a<4;a++){let r="thisRC = rc;";a%2===1&&(r+="thisRC.z += 1;"),a>1&&(r+="thisRC.y += 1;"),n+=`
1202        ${r}
1203        ${a>0?"if(thisRC.y < rows && thisRC.z < cols){":""}
1204          int flatIndex = getFlatIndex(thisRC);
1205
1206          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
1207          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));
1208
1209          result[${a}] =
1210            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
1211        ${a>0?"}":""}
1212      `}this.userCode=`
1213      ${bEe(t,this.enableShapeUniforms)}
1214      ${this.enableShapeUniforms?b4():y4(e)}
1215
1216      void main() {
1217        ivec3 rc = getOutputCoords();
1218
1219        vec4 result = vec4(0.);
1220
1221        ivec3 thisRC;
1222        int rows = ${this.enableShapeUniforms?"outShape[1]":e[1]};
1223        int cols = ${this.enableShapeUniforms?"outShape[2]":e[2]};
1224
1225        ${n}
1226
1227        setOutput(result);
1228      }
1229    `}};function bEe(e,t){return`
1230    ivec3 inputCoordsFromReshapedOutCoords(int index) {
1231      ${t?RNe(["r","c","d"],"inputShape"):xp(["r","c","d"],e)}
1232      return ivec3(r, c, d);
1233    }
1234  `}var vEe=class{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,t,n){let a=q$(t,n),r=K$(e,a,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);let s=G$(e,a,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[r].pop();return this.usedTextures[r].push(o),o}let i;return a===Vr.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):a===Vr.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):a===Vr.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):a===Vr.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):a===Vr.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,a){if(this.freeTextures==null)return;let r=q$(n,a),s=K$(t,r,a);s in this.freeTextures||(this.freeTextures[s]=[]);let i=G$(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,a),o=fe().getNumber("WEBGL_DELETE_TEXTURE_THRESHOLD");o!==-1&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;let l=this.usedTextures[s],d=l&&l.indexOf(e);if(d==null||d<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l[d]=l[l.length-1],l.pop(),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);let t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function wEe(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F||t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error(`Unknown internal format ${t}`)}function G$(e,t,n,a,r){let s=SEe(t,a),i;if(r){let[l,d]=Cg(e[0],e[1]);i=l*d}else{let[l,d]=Zb(e[0],e[1]);i=l*d}let o=wEe(n,s);return i*o}function SEe(e,t){switch(e){case Vr.PACKED_2X2_FLOAT32:return N4(t);case Vr.PACKED_2X2_FLOAT16:return C4(t);case Vr.UNPACKED_FLOAT32:return w4(t);case Vr.UNPACKED_FLOAT16:return S4(t);case Vr.PACKED_4X1_UNSIGNED_BYTE:return k4(t);default:throw new Error(`Unknown physical texture type ${e}`)}}function kEe(e){return fe().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Vr.PACKED_2X2_FLOAT32:Vr.UNPACKED_FLOAT32:e?Vr.PACKED_2X2_FLOAT16:Vr.UNPACKED_FLOAT16}function q$(e,t){if(e===Ti.UPLOAD)return Vr.PACKED_2X2_FLOAT32;if(e===Ti.RENDER||e==null)return kEe(t);if(e===Ti.DOWNLOAD||e===Ti.PIXELS)return Vr.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function K$(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var Yo=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length),this.userCode=`
1235      float unaryOperation(float x) {
1236        ${t}
1237      }
1238
1239      void main() {
1240        float x = getAAtOutCoords();
1241        float y = unaryOperation(x);
1242
1243        setOutput(y);
1244      }
1245    `}},ro="if (isnan(x)) return x;",NEe="return x;",X$="return abs(x);",CEe="return (x >= 0.0) ? x : (exp(x) - 1.0);",EEe=ro+`
1246  return (x < 0.0) ? 0.0 : x;
1247`,IEe=ro+`
1248  return (x < 0.0) ? 0.0 : min(6.0, x);
1249`,Mu="return x;",TEe="return 1.0 / (1.0 + exp(-1.0 * x));",AEe="return x;",_Ee=`
1250  vec4 result;
1251
1252  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
1253  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
1254  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
1255  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);
1256
1257  return result;
1258`,jEe=`
1259  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
1260  bvec4 isNaN = isnan(x);
1261
1262  result.r = isNaN.r ? x.r : result.r;
1263  result.g = isNaN.g ? x.g : result.g;
1264  result.b = isNaN.b ? x.b : result.b;
1265  result.a = isNaN.a ? x.a : result.a;
1266
1267  return result;
1268`,DEe=`
1269  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
1270  bvec4 isNaN = isnan(x);
1271
1272  result.r = isNaN.r ? x.r : result.r;
1273  result.g = isNaN.g ? x.g : result.g;
1274  result.b = isNaN.b ? x.b : result.b;
1275  result.a = isNaN.a ? x.a : result.a;
1276
1277  return result;
1278`,REe="return 1.0 / (1.0 + exp(-1.0 * x));",zu=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length),this.userCode=`
1279      vec4 unaryOperation(vec4 x) {
1280        ${t}
1281      }
1282
1283      void main() {
1284        vec4 x = getAAtOutCoords();
1285        vec4 y = unaryOperation(x);
1286
1287        setOutput(y);
1288      }
1289    `}},MEe=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=ss(this.outputShape.length);let t=e.length,n=xs("rc",t),a=ea(t),r=xEe(t,n),s=n.slice(-2),i=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=`
1290      void main() {
1291        ${a} rc = getOutputCoords();
1292        vec4 packedInput = getA(${r});
1293
1294        setOutput(getChannel(packedInput, ${i}));
1295      }
1296    `}},$Ee=cl.whereImpl,BEe=1e-7,FEe=1e-4,BN={};function OEe(e){return e in BN||(BN[e]={}),BN[e]}var LEe=fe().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"),PEe=600;function zEe(){return fe().global.screen==null?1024:fe().global.screen.height*fe().global.screen.width*window.devicePixelRatio*PEe/1024/1024}var I4=class R9 extends tb{nextDataId(){return R9.nextDataId++}constructor(t){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,!fe().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let n;if(t!=null){if(t instanceof cv)n=t;else{let a=jo(fe().getNumber("WEBGL_VERSION"),t);n=new cv(a)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{let a=jo(fe().getNumber("WEBGL_VERSION"));n=new cv(a),this.binaryCache=OEe(fe().getNumber("WEBGL_VERSION")),this.gpgpuCreatedLocally=!0}this.gpgpu=n,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new vEe(this.gpgpu),this.numMBBeforeWarning=zEe(),this.texData=new mw(this,Ji())}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}writeTexture(t,n,a,r,s,i){let o=this.makeTensorInfo(n,a),l=this.texData.get(o.dataId);l.isPacked=!1,l.texture={texture:t,texShape:[r,s]},l.texShape=[r,s];let d=Xx(n),c=new H$(d,!1,i),f=this.runWebGLProgram(c,[o],a,[[r,s]]);return f.shape=n,l.texture=null,this.disposeIntermediateTensorInfo(o),f.dataId}write(t,n,a){if((fe().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||fe().getBool("DEBUG"))&&this.checkNumericalProblems(t),a==="complex64"&&t!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let r={id:this.nextDataId()};return this.texData.set(r,{shape:n,dtype:a,values:t,usage:Ti.UPLOAD,refCount:1}),r}refCount(t){return this.texData.has(t)?this.texData.get(t).refCount:0}incRef(t){let n=this.texData.get(t);n.refCount++}decRef(t){if(this.texData.has(t)){let n=this.texData.get(t);n.refCount--}}move(t,n,a,r,s){if(fe().getBool("DEBUG")&&this.checkNumericalProblems(n),r==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(t,{shape:a,dtype:r,values:n,usage:Ti.UPLOAD,refCount:s})}disposeIntermediateTensorInfo(t){this.disposeData(t.dataId)}readSync(t){let n=this.texData.get(t),{values:a,dtype:r,complexTensorInfos:s,slice:i,shape:o,isPacked:l}=n;if(i!=null){let m;l?m=new zu(o,Mu):m=new Yo(o,Mu);let x=this.runWebGLProgram(m,[{dataId:t,shape:o,dtype:r}],r),y=this.readSync(x.dataId);return this.disposeIntermediateTensorInfo(x),y}if(a!=null)return this.convertAndCacheOnCPU(t);if(r==="string")return a;let d=this.activeTimers!=null,c;d&&(c=R.now());let f;if(r==="complex64"){let m=this.readSync(s.real.dataId),x=this.readSync(s.imag.dataId);f=W.mergeRealAndImagArrays(m,x)}else f=this.getValuesFromTexture(t);return d&&(this.downloadWaitMs+=R.now()-c),this.convertAndCacheOnCPU(t,f)}async read(t){if(this.pendingRead.has(t)){let y=this.pendingRead.get(t);return new Promise(b=>y.push(b))}let n=this.texData.get(t),{values:a,shape:r,slice:s,dtype:i,complexTensorInfos:o,isPacked:l}=n;if(s!=null){let y;l?y=new zu(r,Mu):y=new Yo(r,Mu);let b=this.runWebGLProgram(y,[{dataId:t,shape:r,dtype:i}],i),w=this.read(b.dataId);return this.disposeIntermediateTensorInfo(b),w}if(a!=null)return this.convertAndCacheOnCPU(t);if(fe().getBool("DEBUG")&&!fe().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&fe().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let d=null,c;if(i!=="complex64"&&fe().get("WEBGL_BUFFER_SUPPORTED")){c=this.decode(t);let y=this.texData.get(c.dataId);d=this.gpgpu.createBufferFromTexture(y.texture.texture,...P1(r))}this.pendingRead.set(t,[]),i!=="complex64"&&await this.gpgpu.createAndWaitForFence();let f;if(i==="complex64"){let y=await Promise.all([this.read(o.real.dataId),this.read(o.imag.dataId)]),b=y[0],w=y[1];f=W.mergeRealAndImagArrays(b,w)}else if(d==null)f=this.getValuesFromTexture(t);else{let y=R.sizeFromShape(r);f=this.gpgpu.downloadFloat32MatrixFromBuffer(d,y)}if(c!=null&&this.disposeIntermediateTensorInfo(c),d!=null){let y=this.gpgpu.gl;at(y,()=>y.deleteBuffer(d))}let m=this.convertAndCacheOnCPU(t,f),x=this.pendingRead.get(t);return this.pendingRead.delete(t),x.forEach(y=>y(m)),this.pendingDisposal.has(t)&&(this.pendingDisposal.delete(t),this.disposeData(t)&&Ji().removeDataId(t,this),this.pendingDeletes--),m}readToGPU(t,n={}){let a=this.texData.get(t),{values:r,shape:s,slice:i,dtype:o,isPacked:l,texture:d}=a;if(o==="complex64")throw new Error("Does not support reading texture for complex64 dtype.");if(i!=null){let x;l?x=new zu(s,Mu):x=new Yo(s,Mu);let y=this.runWebGLProgram(x,[{dataId:t,shape:s,dtype:o}],o),b=this.readToGPU(y,n);return this.disposeIntermediateTensorInfo(y),b}if(d==null)throw r!=null?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");let c=this.decode(t,n.customTexShape),f=Ji().makeTensorFromTensorInfo(c),m=this.texData.get(c.dataId);return Object.assign({tensorRef:f},m.texture)}bufferSync(t){let n=this.readSync(t.dataId);if(t.dtype==="string")try{let a=n.map(r=>R.decodeString(r));return Zt(t.shape,t.dtype,a)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return Zt(t.shape,t.dtype,n)}checkNumericalProblems(t){if(t!=null)for(let n=0;n<t.length;n++){let a=t[n];if(!BU(a))throw fe().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error(`The value ${a} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`):Error(`The value ${a} cannot be represented on this device.`)}}getValuesFromTexture(t){let{shape:n,dtype:a,isPacked:r}=this.texData.get(t),s=R.sizeFromShape(n);if(fe().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){let m=this.decode(t),x=this.texData.get(m.dataId),y=this.gpgpu.downloadMatrixFromPackedTexture(x.texture.texture,...P1(n)).subarray(0,s);return this.disposeIntermediateTensorInfo(m),y}let i=fe().getBool("WEBGL_PACK")&&r===!0,o=i?Xx(n):n,l=i?new SCe(o):new wCe(o),d=this.runWebGLProgram(l,[{shape:o,dtype:a,dataId:t}],"float32"),c=this.texData.get(d.dataId),f=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(c.texture.texture,c.texShape[0],c.texShape[1]).subarray(0,s);return this.disposeIntermediateTensorInfo(d),f}timerAvailable(){return fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(t){let n=this.activeTimers,a=[],r=!1;this.programTimersStack==null?(this.programTimersStack=a,r=!0):this.activeTimers.push(a),this.activeTimers=a,t();let s=R.flatten(this.activeTimers.map(l=>l.query)).filter(l=>l!=null),i=R.flatten(this.activeTimers.map(l=>
vendor: 10,095 bytes, line 1296
1296l.name)).filter(l=>l!=null);this.activeTimers=n,r&&(this.programTimersStack=null);let o={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if(fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){let l=await Promise.all(s);o.kernelMs=R.sum(l),o.getExtraProfileInfo=()=>l.map((d,c)=>({name:i[c],ms:d})).map(d=>`${d.name}: ${d.ms}`).join(", ")}else o.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,o})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:R.now(),endMs:null}}endTimer(t){return fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),t):(t.endMs=R.now(),t)}async getQueryTime(t){if(fe().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(t);let n=t;return n.endMs-n.startMs}disposeData(t,n=!1){if(this.pendingDisposal.has(t))return!1;if(!this.texData.has(t))return!0;if(n?this.texData.get(t).refCount=0:this.texData.get(t).refCount--,!n&&this.texData.get(t).refCount>0)return!1;if(this.pendingRead.has(t))return this.pendingDisposal.add(t),this.pendingDeletes++,!1;this.releaseGPUData(t);let{complexTensorInfos:a}=this.texData.get(t);return a!=null&&(this.disposeData(a.real.dataId,n),this.disposeData(a.imag.dataId,n)),this.texData.delete(t),!0}releaseGPUData(t){let{texture:n,dtype:a,texShape:r,usage:s,isPacked:i,slice:o}=this.texData.get(t),l=o&&o.origDataId||t,d=this.dataRefCount.get(l);d>1?this.dataRefCount.set(l,d-1):(this.dataRefCount.delete(l),n!=null&&(this.numBytesInGPU-=this.computeBytes(r,a),this.textureManager.releaseTexture(n,r,s,i)));let c=this.texData.get(t);c.texture=null,c.texShape=null,c.isPacked=!1,c.slice=null}getTexture(t){return this.uploadToGPU(t),this.texData.get(t).texture.texture}getDataInfo(t){return this.texData.get(t)}shouldExecuteOnCPU(t,n=LEe){return fe().getBool("WEBGL_CPU_FORWARD")&&t.every(a=>this.texData.get(a.dataId).texture==null&&R.sizeFromShape(a.shape)<n)}getGPGPUContext(){return this.gpgpu}where(t){W.warn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");let n=t.dataSync();return $Ee(t.shape,n)}packedUnaryOp(t,n,a){let r=new zu(t.shape,n),s=this.compileAndRun(r,[t],a);return Ji().makeTensorFromTensorInfo(s)}abs(t){if(this.shouldExecuteOnCPU([t])&&t.dtype!=="complex64"){let r=A9(this.texData.get(t.dataId).values);return this.makeOutput(t.shape,t.dtype,r)}if(fe().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,X$,t.dtype);let n=new Yo(t.shape,X$),a=this.compileAndRun(n,[t]);return Ji().makeTensorFromTensorInfo(a)}makeTensorInfo(t,n,a){let r;if(n==="string"&&a!=null&&a.length>0&&R.isString(a[0])){let s=a.map(i=>R.encodeString(i));r=this.write(s,t,n)}else r=this.write(a,t,n);return this.texData.get(r).usage=null,{dataId:r,shape:t,dtype:n}}makeOutput(t,n,a){return Ji().makeTensorFromTensorInfo(this.makeTensorInfo(t,n,a),this)}unpackTensor(t){let n=new MEe(t.shape);return this.runWebGLProgram(n,[t],t.dtype)}packTensor(t){let n=new yEe(t.shape);return this.runWebGLProgram(n,[t],t.dtype,null,!0)}packedReshape(t,n){let a=[Ld(t.shape),...Pd(t.shape)],r={dtype:t.dtype,shape:a,dataId:t.dataId},s=[Ld(n),...Pd(n)],i=new D9(s,a),o=!0,l=[a],d=this.runWebGLProgram(i,[r],t.dtype,l,o);return{dataId:d.dataId,shape:n,dtype:d.dtype}}decode(t,n){let a=this.texData.get(t),{isPacked:r,shape:s,dtype:i}=a;if(n!=null){let m=R.sizeFromShape(s),x=n[0]*n[1]*4;R.assert(m<=x,()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.")}let o=Xx(s),l;r?l=new vCe(o):l=new bCe(o);let d=!0,c=[n??P1(o)],f=this.runWebGLProgram(l,[{shape:o,dtype:i,dataId:t}],i,c,d,n);return{dtype:i,shape:s,dataId:f.dataId}}runWebGLProgram(t,n,a,r,s=!1,i){let o=this.makeTensorInfo(t.outputShape,a),l=this.texData.get(o.dataId);if(t.packedOutput&&(l.isPacked=!0),t.outPackingScheme===Uy.DENSE){let S=i??P1(t.outputShape);l.texShape=S.map(k=>k*2)}if(t.outTexUsage!=null&&(l.usage=t.outTexUsage),R.sizeFromShape(o.shape)===0)return l.values=R.getTypedArrayFromDType(o.dtype,0),o;let d=[],c=n.map(S=>{if(S.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let k=this.texData.get(S.dataId);if(k.texture==null){if(!t.packedInputs&&R.sizeFromShape(S.shape)<=fe().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:S.shape,texData:null,isUniform:!0,uniformValues:k.values};t.packedInputs&&(k.isPacked=!0,k.shape=S.shape)}if(this.uploadToGPU(S.dataId),!!k.isPacked!=!!t.packedInputs)S=k.isPacked?this.unpackTensor(S):this.packTensor(S),d.push(S),k=this.texData.get(S.dataId);else if(k.isPacked&&!Wy(k.shape,S.shape)){let C=S,E=S.shape;S.shape=k.shape,S=this.packedReshape(S,E),d.push(S),k=this.texData.get(S.dataId),C.shape=E}return{shape:S.shape,texData:k,isUniform:!1}});this.uploadToGPU(o.dataId);let f={shape:o.shape,texData:l,isUniform:!1},m=yCe(t,c,f),x=this.getAndSaveBinary(m,()=>gCe(this.gpgpu,t,c,f)),y=this.activeTimers!=null,b;y&&(b=this.startTimer()),fe().get("ENGINE_COMPILE_ONLY")||xCe(this.gpgpu,x,c,f,r),d.forEach(S=>this.disposeIntermediateTensorInfo(S)),y&&(b=this.endTimer(b),this.activeTimers.push({name:t.constructor.name,query:this.getQueryTime(b)}));let w=fe().getNumber("WEBGL_FLUSH_THRESHOLD");if(w>0){let S=R.now();S-this.lastGlFlushTime>w&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=S)}if(!fe().getBool("WEBGL_LAZILY_UNPACK")&&l.isPacked&&s===!1){let S=this.unpackTensor(o);return this.disposeIntermediateTensorInfo(o),S}return o}compileAndRun(t,n,a,r,s=!1){return a=a||n[0].dtype,this.runWebGLProgram(t,n,a,r,s)}getAndSaveBinary(t,n){return t in this.binaryCache||(this.binaryCache[t]=n()),this.binaryCache[t]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(fe().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(t=>{this.gpgpu.deleteProgram(this.binaryCache[t].webGLProgram),delete this.binaryCache[t]}),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=ue(()=>{if(!fe().get("WEBGL_RENDER_FLOAT32_ENABLED")){let t=fe().getBool("DEBUG");fe().set("DEBUG",!1);let n=this.abs(Et(1e-8)).dataSync()[0];if(fe().set("DEBUG",t),n>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?BEe:FEe}uploadToGPU(t){let n=this.texData.get(t),{shape:a,dtype:r,values:s,texture:i,usage:o,isPacked:l}=n;if(i!=null)return;let d=this.activeTimers!=null,c;d&&(c=R.now());let f=n.texShape;if(f==null&&(f=ZU(a,l),n.texShape=f),s!=null){let m=Xx(a),x,y=f[1],b=f[0],w=s instanceof Uint8Array||s instanceof Uint8ClampedArray;(l||!w)&&([y,b]=Cg(f[0],f[1])),l?x=new NCe(m,w):x=new H$(m,w);let S=w?[b,y]:f,k=this.makeTensorInfo(S,r),C=this.texData.get(k.dataId);w?C.usage=Ti.PIXELS:C.usage=Ti.UPLOAD,C.texShape=S,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(k.dataId),y,b,s);let E=[[b,y]],T=this.runWebGLProgram(x,[k],r,E,!0),_=this.texData.get(T.dataId);n.texShape=_.texShape,n.isPacked=_.isPacked,n.usage=_.usage,fe().get("ENGINE_COMPILE_ONLY")?this.disposeData(T.dataId):(n.texture=_.texture,n.values=null,this.texData.delete(T.dataId)),this.disposeIntermediateTensorInfo(k),d&&(this.uploadWaitMs+=R.now()-c)}else{let m=this.acquireTexture(f,o,r,l);n.texture=m}}convertAndCacheOnCPU(t,n){let a=this.texData.get(t),{dtype:r}=a;return n!=null&&(a.values=UEe(n,r)),a.values}acquireTexture(t,n,a,r){if(this.numBytesInGPU+=this.computeBytes(t,a),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){let s=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${s} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(t,n,r)}computeBytes(t,n){return t[0]*t[1]*R.bytesPerElement(n)}checkCompileCompletion(){for(let[,t]of Object.entries(this.binaryCache))this.checkCompletion_(t)}async checkCompileCompletionAsync(){let t=[];if(this.gpgpu.parallelCompilationExtension){for(let[,n]of Object.entries(this.binaryCache))t.push(this.checkCompletionAsync_(n));return Promise.all(t)}else{for(let[,n]of Object.entries(this.binaryCache)){let a=new Promise(r=>{try{this.checkCompletion_(n),r(!0)}catch(s){throw s}});t.push(a)}return Promise.all(t)}}async checkCompletionAsync_(t){return this.gpgpu.gl.getProgramParameter(t.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(t):(await gA(),this.checkCompletionAsync_(t))}checkCompletion_(t){if(this.gpgpu.gl.getProgramParameter(t.webGLProgram,this.gpgpu.gl.LINK_STATUS)===!1)throw console.log(this.gpgpu.gl.getProgramInfoLog(t.webGLProgram)),this.gpgpu.gl.getShaderParameter(t.fragmentShader,this.gpgpu.gl.COMPILE_STATUS)===!1?(x4(t.source,this.gpgpu.gl.getShaderInfoLog(t.fragmentShader)),new Error("Failed to compile fragment shader.")):new Error("Failed to link vertex and fragment shaders.");return!0}getUniformLocations(){for(let t of Object.values(this.binaryCache)){this.gpgpu.buildVao(t.webGLProgram);let{variablesLocations:n,customUniformLocations:a,infLoc:r,nanLoc:s,outShapeLocation:i,outShapeStridesLocation:o,outTexShapeLocation:l}=c9(this.gpgpu,t.program,t.webGLProgram);t.variablesLocations=n,t.customUniformLocations=a,t.infLoc=r,t.nanLoc=s,t.outShapeLocation=i,t.outShapeStridesLocation=o,t.outTexShapeLocation=l}}createTensorFromGPUData(t,n,a){t.channels=t.channels||"RGBA";let{texture:r,height:s,width:i,channels:o}=t,l=Ji().backend;if(!l.gpgpu.gl.isTexture(r))throw new Error("The texture is invali
1296d. 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)'.");let d=l.writeTexture(r,n,a,s,i,o);return Ji().makeTensorFromDataId(d,n,a,l)}};I4.nextDataId=0;function UEe(e,t){if(t==="float32"||t==="complex64")return e;if(t==="int32"||t==="bool"){let n=t==="int32"?new Int32Array(e.length):new Uint8Array(e.length);for(let a=0;a<n.length;++a)n[a]=Math.round(e[a]);return n}else throw new Error(`Unknown dtype ${t}`)}var WEe="4.22.0";function M9(){fe().set("WEBGL_FORCE_F16_TEXTURES",!0)}Ib.isBrowser()&&Rw("webgl",()=>new I4,2);var VEe={forceHalfFloat:M9},T4=`
1297  if (isnan(a)) return a;
1298  if (isnan(b)) return b;
1299`,zd=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=W.assertAndGetBroadcastShape(t,n),this.enableShapeUniforms=ss(this.outputShape.length),this.userCode=`
1300      float binaryOperation(float a, float b) {
1301        ${e}
1302      }
1303
1304      void main() {
1305        float a = getAAtOutCoords();
1306        float b = getBAtOutCoords();
1307        setOutput(binaryOperation(a, b));
1308      }
1309    `}},bp=`
1310  result.r = isNaN.r ? NAN : result.r;
1311  result.g = isNaN.g ? NAN : result.g;
1312  result.b = isNaN.b ? NAN : result.b;
1313  result.a = isNaN.a ? NAN : result.a;
1314`,jg=class{constructor(e,t,n,a=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=W.assertAndGetBroadcastShape(t,n);let r=this.outputShape.length;this.enableShapeUniforms=ss(r);let s="";if(a)if(r===0||R.sizeFromShape(this.outputShape)===1)s=`
1315          result.y = 0.;
1316          result.z = 0.;
1317          result.w = 0.;
1318        `;else if(s=`
1319          ${ea(r)} coords = getOutputCoords();
1320        `,r===1)this.enableShapeUniforms?s+=`
1321            result.y = (coords + 1) >= outShape ? 0. : result.y;
1322            result.z = 0.;
1323            result.w = 0.;
1324          `:s+=`
1325            result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;
1326            result.z = 0.;
1327            result.w = 0.;
1328          `;else{let i=xs("coords",r);this.enableShapeUniforms?s+=`
1329            bool nextRowOutOfBounds =
1330              (${i[r-2]} + 1) >= outShape[${r} - 2];
1331            bool nextColOutOfBounds =
1332              (${i[r-1]} + 1) >= outShape[${r} - 1];
1333            result.y = nextColOutOfBounds ? 0. : result.y;
1334            result.z = nextRowOutOfBounds ? 0. : result.z;
1335            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
1336          `:s+=`
1337            bool nextRowOutOfBounds =
1338              (${i[r-2]} + 1) >= ${this.outputShape[r-2]};
1339            bool nextColOutOfBounds =
1340              (${i[r-1]} + 1) >= ${this.outputShape[r-1]};
1341            result.y = nextColOutOfBounds ? 0. : result.y;
1342            result.z = nextRowOutOfBounds ? 0. : result.z;
1343            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
1344          `}this.userCode=`
1345      vec4 binaryOperation(vec4 a, vec4 b) {
1346        ${e}
1347      }
1348
1349      void main() {
1350        vec4 a = getAAtOutCoords();
1351        vec4 b = getBAtOutCoords();
1352
1353        vec4 result = binaryOperation(a, b);
1354        ${s}
1355
1356        setOutput(result);
1357      }
1358    `}};function li(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var HEe={kernelName:wh,backendName:"webgl",kernelFunc:li};function Sc(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.makeTensorInfo(a.shape,"complex64"),i=n.texData.get(s.dataId),o=li({inputs:{x:a},backend:n}),l=li({inputs:{x:r},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var GEe={kernelName:yw,backendName:"webgl",kernelFunc:Sc},$9="return (a < 0.) ? b * a : a;",B9=`
1359  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
1360  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
1361`;function qEe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a,i=n.makeTensorInfo([],"float32",R.createScalarValue(s,"float32")),o=fe().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new jg(B9,r.shape,i.shape):new zd($9,r.shape,i.shape),l=n.runWebGLProgram(o,[r,i],"float32");return n.disposeIntermediateTensorInfo(i),l}var KEe={kernelName:Ch,backendName:"webgl",kernelFunc:qEe},F9="return (a < 0.) ? b * a : a;",O9=`
1362  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
1363  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
1364`;function XEe(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=fe().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new jg(O9,a.shape,r.shape):new zd(F9,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],"float32")}var YEe={kernelName:zh,backendName:"webgl",kernelFunc:XEe},Dg="if (isnan(x)) return x;";function kn({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:r,backend:s})=>{let{x:i}=r,o=s,l=a||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let f=o.texData.get(i.dataId),m=n(f.values,l);return o.makeTensorInfo(i.shape,l,m)}let d=fe().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,c;return d?c=new zu(i.shape,t):c=new Yo(i.shape,e),o.runWebGLProgram(c,[i],l)}}function Gr({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:a=!1,cpuKernelImpl:r,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:d}=i,c=o;if(a&&l.dtype==="complex64"){let y=c.texData.get(l.dataId),b=c.texData.get(d.dataId),[w,S]=[[y.complexTensorInfos.real,b.complexTensorInfos.real],[y.complexTensorInfos.imag,b.complexTensorInfos.imag]].map(C=>{let[E,T]=C,_={dataId:E.dataId,dtype:E.dtype,shape:l.shape},A={dataId:T.dataId,dtype:T.dtype,shape:d.shape},$=new zd(e,l.shape,d.shape);return c.runWebGLProgram($,[_,A],Di(E.dtype,T.dtype))}),k=Sc({inputs:{real:w,imag:S},backend:c});return c.disposeIntermediateTensorInfo(w),c.disposeIntermediateTensorInfo(S),k}let f=s||Di(l.dtype,d.dtype);if((l.dtype==="string"||d.dtype==="string"||c.shouldExecuteOnCPU([l,d]))&&r!=null){let y=c.texData.get(l.dataId).values,b=c.texData.get(d.dataId).values,w=l.dtype==="string"?W.fromUint8ToStringArray(y):y,S=l.dtype==="string"?W.fromUint8ToStringArray(b):b,[k,C]=r(l.shape,d.shape,w,S,f),E=c.makeTensorInfo(C,f),T=c.texData.get(E.dataId);return T.values=k,E}
vendor: 1,953 bytes, lines 1364-1385
1364let m=fe().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,x;return m?x=new jg(t,l.shape,d.shape,n):x=new zd(e,l.shape,d.shape),c.runWebGLProgram(x,[l,d],f)}}function Vy(e,t=!1){if(e==="linear")return t?AEe:NEe;if(e==="relu")return t?jEe:EEe;if(e==="elu")return t?_Ee:CEe;if(e==="relu6")return t?DEe:IEe;if(e==="prelu")return t?O9:F9;if(e==="leakyrelu")return t?B9:$9;if(e==="sigmoid")return t?REe:TEe;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}var L9=class{constructor(e,t,n,a=!1,r=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.enableShapeUniforms=ss(this.outputShape.length);let d=a?e[1]:e[2],c=Math.ceil(d/2),f=a?"i * 2, rc.y":"rc.y, i * 2",m=r?"rc.z, i * 2":"i * 2, rc.z",x=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],y=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],b="",w="";i&&(o?b=`vec4 activation(vec4 a) {
1365          vec4 b = getPreluActivationWeightsAtOutCoords();
1366          ${i}
1367        }`:l?b=`vec4 activation(vec4 a) {
1368          vec4 b = getLeakyreluAlphaAtOutCoords();
1369          ${i}
1370        }`:b=`vec4 activation(vec4 x) {
1371          ${i}
1372        }`,w="result = activation(result);");let S=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),o&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let k="rc.x",C="rc.x";e[0]<t[0]?k=`imod(rc.x, ${e[0]})`:t[0]<e[0]&&(C=`imod(rc.x, ${t[0]})`),this.userCode=`
1373      ${b}
1374      // Don't use uniform for sharedDimensionPacked for performance.
1375      const float sharedDimension = ${c}.0;
1376
1377      vec4 dot2x2ARowBCol(ivec3 rc) {
1378        vec4 result = vec4(0);
1379        int batchA = ${k};
1380        int batchB = ${C};
1381        for (int i = 0; i < ${c}; i++) {
1382          vec4 a = getMatrixA(batchA, ${f});
1383          vec4 b = getMatrixB(batchB, ${m});
1384
1385          // These swizzled products need to be separately added.
1386          // See: https://github.com/tensorflow/tfjs/issues/1735
1387          result += (${x[0]} * ${y[0]});
1388          result += (${x[1]} * ${y[1]});
1389        }
1390        return result;
1391      }
1392
1393      void main() {
1394        ivec3 rc = getOutputCoords();
1395        vec4 result = dot2x2ARowBCol(rc);
1396
1397        ${S}
1398
1399        ${w}
1400
1401        setOutput(result);
1402      }
1403    `}},Y$={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"},J$=class{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=W.assertAndGetBroadcastShape(t,n),this.userCode=`
1404      float binaryOpComplex(
1405          float areal, float aimag, float breal, float bimag) {
1406        ${e}
1407      }
1408
1409      void main() {
1410        float areal = getARealAtOutCoords();
1411        float aimag = getAImagAtOutCoords();
1412        float breal = getBRealAtOutCoords();
1413        float bimag = getBImagAtOutCoords();
1414        setOutput(binaryOpComplex(areal, aimag, breal, bimag));
1415      }
1416    `}},Q$="return a * b;";function A4(e){let{inputs:t,backend:n}=e,{a,b:r}=t,s=W.upcastType(a.dtype,r.dtype);if(a.dtype==="complex64"){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),d=new J$(Y$.REAL,a.shape,r.shape),c=new J$(Y$.IMAG,a.shape,r.shape),f=[{dataId:o.complexTensorInfos.real.dataId,dtype:o.complexTensorInfos.real.dtype,shape:a.shape},{dataId:o.complexTensorInfos.imag.dataId,dtype:o.complexTensorInfos.imag.dtype,shape:a.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:r.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:r.shape}],m=n.runWebGLProgram(d,f,"float32"),x=n.runWebGLProgram(c,f,"float32"),y=Sc({inputs:{real:m,imag:x},backend:n});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x),y}if(n.shouldExecuteOnCPU([a,r])){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),[d,c]=qCe(a.shape,r.shape,o.values,l.values,s),f=n.makeTensorInfo(c,s),m=n.texData.get(f.dataId);return m.values=d,f}let i;return fe().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new jg(Q$,a.shape,r.shape):i=new zd(Q$,a.shape,r.shape),n.runWebGLProgram(i,[a,r],s)}var JEe={kernelName:Fh,backendName:"webgl",kernelFunc:A4};function QEe(e,t,n){let a=[Ld(e.shape),...Pd(e.shape)],r={dtype:e.dtype,shape:a,dataId:e.dataId},s=[Ld(t),...Pd(t)],i=new D9(s,a),o=!0,l=[a],d=n.runWebGLProgram(i,[r],e.dtype,l,o);return{dataId:d.dataId,shape:t,dtype:d.dtype}}function et(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=n,o=R.sizeFromShape(r.shape),l=R.inferFromImplicitShape(s,o),d=R.sizeFromShape(l);R.assert(o===d,()=>`The new shape (${l}) has ${d} elements and the old shape (${r.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`);let c=i.texData.get(r.dataId);return c.isPacked&&!Wy(r.shape,l)&&!(c.texture!==null&&Wy(c.shape,l))?QEe(r,l,i):(i.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var ZEe={kernelName:Ym,backendName:"webgl",kernelFunc:et},Z$=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i=Math.floor(n/4)*4,o=n%4,l="sumValue += dot(values, ones);";if(t!=null){let c=1/t;l=`sumValue += dot(values * ${R.isInt(c)?c.toPrecision(2):c}, ones);`}let d="";r%n>0&&(d=`
1417        if (inIdx < 0 || inIdx >= ${r}) {
1418          return 0.0;
1419        }
1420      `),this.userCode=`
1421      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
1422
1423      float getValue(int batch, int inIdx) {
1424        ${d}
1425        return getX(batch, inIdx);
1426      }
1427
1428      void main() {
1429        ivec2 coords = getOutputCoords();
1430        int batch = coords[0];
1431        int outIdx = coords[1];
1432        int inOffset = outIdx * ${n};
1433
1434        float sumValue = 0.0;
1435
1436        for (int i = 0; i < ${i}; i += 4) {
1437          int inIdx = inOffset + i;
1438          vec4 values = vec4(
1439            getValue(batch, inIdx),
1440            getValue(batch, inIdx + 1),
1441            getValue(batch, inIdx + 2),
1442            getValue(batch, inIdx + 3)
1443          );
1444
1445          ${l}
1446        }
1447
1448        int inIdx = inOffset + ${i};
1449        if (${o===1}) {
1450          vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);
1451
1452          ${l}
1453        } else if (${o===2}) {
1454          vec4 values = vec4(
1455            getValue(batch, inIdx),
1456            getValue(batch, inIdx + 1), 0.0, 0.0);
1457
1458          ${l}
1459        } else if (${o===3}) {
1460          vec4 values = vec4(
1461            getValue(batch, inIdx),
1462            getValue(batch, inIdx + 1),
1463            getValue(batch, inIdx + 2), 0.0);
1464
1465          ${l}
1466        }
1467        setOutput(sumValue);
1468      }
1469    `}},eIe=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i="0.0",o="";t==="prod"?i="1.0":t==="min"?(i="1.0 / 1e-20",o="min"):t==="max"&&(i="-1.0 / 1e-20",o="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let d=Math.floor(n/4)*4,c=n%4,f=`
1470      if (${t==="sum"}) {
1471        sumValue += dot(values, ones);
1472      } else if (${t==="prod"}) {
1473        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
1474        prodValue *= tmp[0] * tmp[1];
1475      } else {
1476        minMaxValue = ${o}(values, minMaxValue);
1477        if (${t==="min"} || ${t==="max"}) {
1478          minMaxValue = ${o}(values, minMaxValue);
1479          bvec4 isNaN = isnan(values);
1480          if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {
1481            minMaxValue = vec4(NAN);
1482          }
1483        }
1484      }
1485    `,m="vec4";t==="all"?(i="1.0",f=`
1486        bool reducedAllValue = all(values);
1487        float floatedReducedAllValue = float(reducedAllValue);
1488        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
1489      `,m="bvec4"):t==="any"&&(i="0.0",f=`
1490        bool reducedAnyValue = any(values);
1491        float floatedReducedAnyValue = float(reducedAnyValue);
1492        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
1493      `,m="bvec4");let x="";r%n>0&&(x=`
1494        if (inIdx < 0 || inIdx >= ${r}) {
1495          return initializationValue;
1496        }
1497      `),this.userCode=`
1498      const float initializationValue = ${i};
1499      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
1500
1501      float getValue(int batch, int inIdx) {
1502        ${x}
1503        return getX(batch, inIdx);
1504      }
1505
1506      void main() {
1507        ivec2 coords = getOutputCoords();
1508        int batch = coords[0];
1509        int outIdx = coords[1];
1510        int inOffset = outIdx * ${n};
1511
1512        vec4 minMaxValue = vec4(${i});
1513        float prodValue = 1.0;
1514        float sumValue = 0.0;
1515        float allValue = 1.0;
1516        float anyValue = 0.0;
1517
1518        for (int i = 0; i < ${d}; i += 4) {
1519          int inIdx = inOffset + i;
1520          ${m} values = ${m}(
1521            getValue(batch, inIdx),
1522            getValue(batch, inIdx + 1),
1523            getValue(batch, inIdx + 2),
1524            getValue(batch, inIdx + 3)
1525          );
1526
1527          ${f}
1528        }
1529
1530        int inIdx = inOffset + ${d};
1531        if (${c===1}) {
1532          ${m} values = ${m}(
1533            getValue(batch, inIdx),
1534            initializationValue,
1535            initializationValue,
1536            initializationValue
1537          );
1538
1539          ${f}
1540        } else if (${c===2}) {
1541          ${m} values = ${m}(
1542            getValue(batch, inIdx),
1543            getValue(batch, inIdx + 1),
1544            initializationValue,
1545            initializationValue
1546          );
1547
1548          ${f}
1549        } else if (${c===3}) {
1550          ${m} values = ${m}(
1551            getValue(batch, inIdx),
1552            getValue(batch, inIdx + 1),
1553            getValue(batch, inIdx + 2),
1554            initializationValue
1555          );
1556
1557          ${f}
1558        }
1559        setOutput(${l});
1560      }
1561    `}};function tIe(e){let t=[];for(;t.length===0||t[t.length-1].outSize!==1;){let n=t.length?t[t.length-1].outSize:e[1],a=W.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}function vp(e,t,n,a){let r=tIe(e.shape),s=e;for(let i=0;i<r.length;i++){let{inSize:o,windowSize:l,outSize:d}=r[i],c,f;n==="mean"?c=i===0?new Z$({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d},o):new Z$({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d}):c=new eIe({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:d},n),f=s,s=a.runWebGLProgram(c,[s],t),f.dataId!==e.dataId&&a.disposeIntermediateTensorInfo(f)}return s}var nIe=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[t[s]];this.outputShape=n,this.rank=n.length;let a=ea(this.rank),r=aIe(t);this.userCode=`
1562    void main() {
1563      ${a} resRC = getOutputCoords();
1564      setOutput(getA(${r}));
1565    }
1566    `}};function aIe(e){let t=e.length;if(t>6)throw Error(`Transpose for rank ${t} is not yet supported`);let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],a=new Array(t);for(let r=0;r<e.length;r++)a[e[r]]=n[r];return a.join()}var rIe=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;let n=new Array(e.length);for(let d=0;d<n.length;d++)n[d]=e[t[d]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);let a=ea(this.rank),r=j9("rc",this.rank),s=new Array(this.rank);for(let d=0;d<t.length;d++)s[t[d]]=r[d];let i=`vec2(${s.slice(-2).join()})`,o=`++${r[this.rank-1]} < ${n[this.rank-1]}`,l=`getChannel(getA(${s.join()}), ${i})`;this.userCode=`
1567    void main() {
1568      ${a} rc = getOutputCoords();
1569      vec4 result = vec4(0.);
1570      result[0] = ${l};
1571      if(${o}) {
1572        result[1] = ${l};
1573      }
1574      --${r[this.rank-1]};
1575      if(++${r[this.rank-2]} < ${n[this.rank-2]}) {
1576        result[2] = ${l};
1577        if(${o}) {
1578          result[3] = ${l};
1579        }
1580      }
1581      setOutput(result);
1582    }
1583    `}};function O2(e,t,n){let a=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new rIe(e.shape,t):new nIe(e.shape,t);return n.runWebGLProgram(a,[e],e.dtype)}function sIe(e,t,n,a){let r=t,s=e.shape.length,i=R.parseAxisParam(r,e.shape),o=i,l=W.getAxesPermutation(o,s),d=l!=null,c=e;d&&(c=O2(e,l,a),o=W.getInnerMostAxes(o.length,s)),W.assertAxesAreInnerMostDims("sum",o,s);let[f,m]=W.computeOutAndReduceShapes(c.shape,o),x=f;n&&(x=W.expandShapeToKeepDim(f,i));let y=R.sizeFromShape(m),b=R.sizeFromShape(e.shape)/y,w=et({inputs:{x:c},attrs:{shape:[b,y]},backend:a}),S=Dw(e.dtype),k=vp(w,S,"sum",a),C=et({inputs:{x:k}
vendor: 27,083 bytes, lines 1583-2066
1583,attrs:{shape:x},backend:a});return a.disposeIntermediateTensorInfo(w),a.disposeIntermediateTensorInfo(k),d&&a.disposeIntermediateTensorInfo(c),C}function L2(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;return sIe(r,s,i,n)}var iIe={kernelName:rp,backendName:"webgl",kernelFunc:L2};function Ss(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{perm:s}=a,i=n,o=r.shape.length,l=new Array(o);for(let c=0;c<l.length;c++)l[c]=r.shape[s[c]];let d;if(i.shouldExecuteOnCPU([r])){let c=i.texData.get(r.dataId).values,f=E4(c,r.shape,r.dtype,s,l);d=i.makeTensorInfo(l,r.dtype);let m=i.texData.get(d.dataId);m.values=f}else d=O2(r,s,i);return d}var oIe={kernelName:Fl,backendName:"webgl",kernelFunc:Ss},P9=1e3;function qv({a:e,b:t,transposeA:n,transposeB:a,backend:r,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:l=null}){let d=e.shape.length,c=t.shape.length,f=n?e.shape[d-2]:e.shape[d-1],m=a?t.shape[c-1]:t.shape[c-2],x=n?e.shape[d-1]:e.shape[d-2],y=a?t.shape[c-2]:t.shape[c-1],b=e.shape.slice(0,-2),w=t.shape.slice(0,-2),S=R.sizeFromShape(b),k=R.sizeFromShape(w),C=fg.assertAndGetBroadcastShape(e.shape.slice(0,-2),t.shape.slice(0,-2)).concat([x,y]);R.assert(f===m,()=>`Error in matMul: inner shapes (${f}) and (${m}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${a} must match.`);let E=n?[S,f,x]:[S,x,f],T=a?[k,y,m]:[k,m,y],_=et({inputs:{x:e},backend:r,attrs:{shape:E}}),A=et({inputs:{x:t},backend:r,attrs:{shape:T}}),$=[_,A],O=Math.max(S,k),z=n?_.shape[1]:_.shape[2],P=s!=null,j=i!=null,G=l==="leakyrelu",X=l!=null?Vy(l,!0):null,J=P||j||G||X!=null,V;if((x===1||y===1)&&z>P9&&J===!1){let F=_,H=A;n&&(F=Ss({inputs:{x:_},backend:r,attrs:{perm:[0,2,1]}}),$.push(F)),a&&(H=Ss({inputs:{x:A},backend:r,attrs:{perm:[0,2,1]}}),$.push(H));let B=y!==1,Y=y===1,ne=F;B&&(ne=et({inputs:{x:F},backend:r,attrs:{shape:[O,z,1]}}),$.push(ne));let ee=y===1?2:1,U=H;Y&&(U=et({inputs:{x:H},backend:r,attrs:{shape:[O,1,z]}}),$.push(U));let oe=A4({inputs:{a:ne,b:U},backend:r});V=L2({inputs:{x:oe},backend:r,attrs:{axis:ee,keepDims:!0}}),$.push(oe)}else{let F=Di(e.dtype,t.dtype),H=new L9(E,T,[O,x,y],n,a,P,X,j,G),B=[_,A];if(s!=null&&B.push(s),j&&B.push(i),G){let Y=r.makeTensorInfo([],"float32",R.createScalarValue(o,"float32"));B.push(Y),$.push(Y)}V=r.runWebGLProgram(H,B,F)}let Q=et({inputs:{x:V},backend:r,attrs:{shape:C}});$.push(V);for(let F of $)r.disposeIntermediateTensorInfo(F);return Q}function lIe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:d,activation:c,leakyreluAlpha:f}=a;return qv({a:r,b:s,transposeA:l,transposeB:d,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:f,activation:c})}var uIe={kernelName:Nd,backendName:"webgl",kernelFunc:lIe},eB="return abs(x);";function cIe(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])&&a.dtype!=="complex64"){let s=n.texData.get(a.dataId),i=A9(s.values);return n.makeTensorInfo(a.shape,a.dtype,i)}let r;return fe().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new zu(a.shape,eB):r=new Yo(a.shape,eB),n.runWebGLProgram(r,[a],a.dtype)}var dIe={kernelName:hm,backendName:"webgl",kernelFunc:cIe},hIe=ro+`
1584  if (abs(x) > 1.) {
1585    return NAN;
1586  }
1587  return acos(x);
1588`,pIe=kn({opSnippet:hIe}),fIe={kernelName:Gd,backendName:"webgl",kernelFunc:pIe},mIe=ro+`
1589  if (x < 1.0) return NAN;
1590return log(x + sqrt(x * x - 1.0));`,gIe=kn({opSnippet:mIe}),xIe={kernelName:qd,backendName:"webgl",kernelFunc:gIe},tB="return a + b;",yIe=Gr({opSnippet:tB,packedOpSnippet:tB,supportsComplex:!0,cpuKernelImpl:ECe}),bIe={kernelName:hc,backendName:"webgl",kernelFunc:yIe},vIe=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`float v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=`
1591      void main() {
1592        ${n.join(`
1593        `)}
1594
1595        float result = ${a};
1596        setOutput(result);
1597      }
1598    `}},wIe=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`vec4 v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=`
1599      void main() {
1600        ${n.join(`
1601        `)}
1602
1603        vec4 result = ${a};
1604        setOutput(result);
1605      }
1606    `}};function dv(e){let{inputs:t,backend:n}=e,a=t;if(a.length===1)return li({inputs:{x:a[0]},backend:n});if(a.length>fe().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(a.length/2),l=dv({inputs:a.slice(0,o),backend:n}),d=dv({inputs:a.slice(o),backend:n});return dv({inputs:[l,d],backend:n})}let r=a.map(o=>o.dtype).reduce((o,l)=>Di(o,l)),s=a.map(o=>o.shape),i=fe().getBool("WEBGL_PACK")?new wIe(a[0].shape,s):new vIe(a[0].shape,s);return n.runWebGLProgram(i,a,r)}var SIe={kernelName:Kd,backendName:"webgl",kernelFunc:dv};function kIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=R.parseAxisParam(s,r.shape),d=l,c=W.getAxesPermutation(d,o),f=r;c!=null&&(f=Ss({inputs:{x:r},backend:n,attrs:{perm:c}}),d=W.getInnerMostAxes(d.length,o)),W.assertAxesAreInnerMostDims("all",d,o);let[m,x]=W.computeOutAndReduceShapes(f.shape,d),y=R.sizeFromShape(x),b=et({inputs:{x:f},backend:n,attrs:{shape:[-1,y]}}),w=vp(b,b.dtype,"all",n),S;if(i){let k=W.expandShapeToKeepDim(m,l);S=et({inputs:{x:w},backend:n,attrs:{shape:k}})}else S=et({inputs:{x:w},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(w),c!=null&&n.disposeIntermediateTensorInfo(f),S}var NIe={kernelName:pm,backendName:"webgl",kernelFunc:kIe};function CIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=R.parseAxisParam(s,r.shape),d=l,c=W.getAxesPermutation(d,o),f=r;c!=null&&(f=Ss({inputs:{x:r},backend:n,attrs:{perm:c}}),d=W.getInnerMostAxes(d.length,o)),W.assertAxesAreInnerMostDims("any",d,o);let[m,x]=W.computeOutAndReduceShapes(f.shape,d),y=R.sizeFromShape(x),b=et({inputs:{x:f},backend:n,attrs:{shape:[-1,y]}}),w=vp(b,b.dtype,"any",n),S;if(i){let k=W.expandShapeToKeepDim(m,l);S=et({inputs:{x:w},backend:n,attrs:{shape:k}})}else S=et({inputs:{x:w},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(w),c!=null&&n.disposeIntermediateTensorInfo(f),S}var EIe={kernelName:fm,backendName:"webgl",kernelFunc:CIe},IIe=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:a,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];let i=t==="max"?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`
1607      void main() {
1608        ivec2 coords = getOutputCoords();
1609        int batch = coords[0];
1610        int outIdx = coords[1];
1611        int inOffset = outIdx * ${a};
1612
1613        int bestIndex = inOffset;
1614        float bestValue = getA(batch, bestIndex);
1615
1616        for (int i = 0; i < ${a}; i++) {
1617          int inIdx = ${o};
1618          float candidate = getA(batch, inIdx);
1619          if (candidate ${i} bestValue) {
1620            bestValue = candidate;
1621            bestIndex = inIdx;
1622          }
1623        }
1624        setOutput(float(bestIndex));
1625      }
1626    `}},TIe=class{constructor(e,t,n,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,R.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);let r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),a||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=ea(o),d=xs("coords",o),c,f;if(s===1){f=o+1;let A=ea(f);c=`
1627        ${A} sourceLocR = ${A}(${d.join()}, 0);
1628        ++${d[o-1]};
1629        ${A} sourceLocG = ${A}(${d.join()}, 0);
1630        ++${d[o-2]};
1631        ${A} sourceLocA = ${A}(${d.join()}, 0);
1632        --${d[o-1]};
1633        ${A} sourceLocB = ${A}(${d.join()}, 0);
1634        --${d[o-2]};`}else f=o,c=`
1635        ${l} sourceLocR = coords;
1636        ++${d[o-1]};
1637        ${l} sourceLocG = coords;
1638        ++${d[o-2]};
1639        ${l} sourceLocA = coords;
1640        --${d[o-1]};
1641        ${l} sourceLocB = coords;
1642        --${d[o-2]};`;let m=["x","y","z","w","u","v"].slice(0,f),x="."+m[f-1],y=m.map(A=>"int "+A),b=xs("sourceLocR",f-1).concat("inIdx.r"),w=xs("sourceLocG",f-1).concat("inIdx.g"),S=xs("sourceLocB",f-1).concat("inIdx.b"),k=xs("sourceLocA",f-1).concat("inIdx.a"),C=n==="max"?"greaterThan":"lessThan",E=a?"":`
1643          inIdx = round(vec4(getBestIndicesAChannel(${b.join()}),
1644                             getBestIndicesAChannel(${w.join()}),
1645                             getBestIndicesAChannel(${S.join()}),
1646                             getBestIndicesAChannel(${k.join()})));`,T=`vec4(
1647            getAChannel(${b.join()}),
1648            hasNextCol ? getAChannel(${w.join()}) : 0.,
1649            hasNextRow ? getAChannel(${S.join()}) : 0.,
1650            hasNextRow && hasNextCol ? getAChannel(${k.join()}) : 0.)`,_=a?"":`
1651      float getBestIndicesAChannel(${y.join()}) {
1652        return getChannel(getBestIndicesA(${m.join()}),
1653                                          vec2(${m.slice(-2).join()}));
1654      }`;this.userCode=`
1655      float getAChannel(${y.join()}) {
1656        return getChannel(getA(${m.join()}),
1657                               vec2(${m.slice(-2).join()}));
1658      }
1659      ${_}
1660      void main() {
1661        ${l} coords = getOutputCoords();
1662        bool hasNextCol = ${d[o-1]} < ${i[o-1]-1};
1663        bool hasNextRow = ${d[o-2]} < ${i[o-2]-1};
1664        ${c}
1665        ivec4 srcIdx = ivec4(sourceLocR${x}, sourceLocG${x},
1666          sourceLocB${x}, sourceLocA${x}) * ${t};
1667        ivec4 inIdx = srcIdx;
1668        vec4 bestIndex = vec4(inIdx);
1669        vec4 bestValue = ${T};
1670
1671        for (int i = 0; i < ${t}; i++) {
1672          inIdx = srcIdx;
1673          ${E}
1674          vec4 candidate = ${T};
1675          bvec4 nan = isnan(candidate);
1676          bvec4 replace = bvec4(
1677            vec4(${C}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));
1678
1679          bestValue = vec4(replace.x  ? candidate.x : bestValue.x,
1680                           replace.y  ? candidate.y : bestValue.y,
1681                           replace.z  ? candidate.z : bestValue.z,
1682                           replace.w  ? candidate.w : bestValue.w);
1683          bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));
1684          srcIdx++;
1685        }
1686        setOutput(bestIndex);
1687      }
1688    `}};function z9(e,t,n,a=null){let r=t.shape[0],s=t.shape[1];a!=null&&(r=a.shape[0],s=a.shape[1]);let i=W.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:r,outSize:Math.ceil(s/i)},l=new IIe(o,n,a==null),d=[t];a!=null&&d.push(a);let c=e.runWebGLProgram(l,d,"int32");if(c.shape[1]===1)return c;let f=z9(e,t,n,c);return e.disposeIntermediateTensorInfo(c),f}function U9(e,t,n,a=null){let r=a!=null?a.shape:t.shape,s=r[r.length-1],i=W.computeOptimalWindowSize(s),o=new TIe(r,i,n,a==null),l=a==null?[t]:[t,a],d=e.runWebGLProgram(o,l,"int32");if(d.shape.length===t.shape.length){let c=U9(e,t,n,d);return e.disposeIntermediateTensorInfo(d),c}return d}function W9(e,t,n,a){let r=[n];if(W.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),r,t.shape.length),!fe().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],i=e.texData.get(t.dataId),o=i!==null&&i.isPacked,l=t;o&&(l=e.unpackTensor(t),s.push(l));let[d,c]=W.computeOutAndReduceShapes(l.shape,r),f=R.sizeFromShape(c),m=et({inputs:{x:l},backend:e,attrs:{shape:[-1,f]}});s.push(m);let x=z9(e,m,a);s.push(x);let y=et({inputs:{x},backend:e,attrs:{shape:d}});return s.forEach(b=>e.disposeIntermediateTensorInfo(b)),y}return U9(e,t,a)}function AIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=R.parseAxisParam(s,r.shape),o=W.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Ss({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=W.getInnerMostAxes(i.length,l.shape.length)),W.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let c=W9(n,l,i[0],"max");return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),c}var _Ie={kernelName:mm,backendName:"webgl",kernelFunc:AIe};function jIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=R.parseAxisParam(s,r.shape),o=W.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Ss({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=W.getInnerMostAxes(i.length,l.shape.length)),W.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let c=W9(n,l,i[0],"min");return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),c}var DIe={kernelName:gm,backendName:"webgl",kernelFunc:jIe},RIe=ro+`
1689  if (abs(x) > 1.) {
1690    return NAN;
1691  }
1692  return asin(x);
1693`,MIe=kn({opSnippet:RIe}),$Ie={kernelName:Xd,backendName:"webgl",kernelFunc:MIe},BIe=ro+"return log(x + sqrt(x * x + 1.0));",FIe=kn({opSnippet:BIe}),OIe={kernelName:Yd,backendName:"webgl",kernelFunc:FIe},LIe=ro+`
1694  return atan(x);
1695`,PIe=kn({opSnippet:LIe}),zIe={kernelName:Jd,backendName:"webgl",kernelFunc:PIe},UIe=T4+`
1696  return atan(a, b);
1697`,WIe=`
1698  vec4 result = atan(a, b);
1699  bvec4 isNaNA = isnan(a);
1700  bvec4 isNaNB = isnan(b);
1701  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
1702  `+bp+`
1703  return result;
1704`,VIe=Gr({opSnippet:UIe,packedOpSnippet:WIe}),HIe={kernelName:Zd,backendName:"webgl",kernelFunc:VIe},GIe=ro+`
1705  if ((x < -1.0) || (x > 1.0)) return NAN;
1706return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,qIe=kn({opSnippet:GIe}),KIe={kernelName:Qd,backendName:"webgl",kernelFunc:qIe},Hy=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,d=e.dilationWidth,c=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.top,x=e.padInfo.left;this.outputShape=e.outShape;let y=t==="avg",b=`((batch  * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,w=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`,S="0.0";if(y||(S="-1.0 / 1e-20"),n){let A=">=";this.userCode=`
1707        const ivec2 strides = ivec2(${i}, ${o});
1708        const ivec2 pads = ivec2(${m}, ${x});
1709
1710        void main() {
1711          ivec4 coords = getOutputCoords();
1712          int batch = coords[0];
1713          int d = coords[3];
1714
1715          ivec2 xRCCorner = coords.yz * strides - pads;
1716          int xRCorner = xRCCorner.x;
1717          int xCCorner = xRCCorner.y;
1718
1719          // max/min x(?, ?, d) to get y(yR, yC, d).
1720          // ? = to be determined
1721          float minMaxValue = 0.0;
1722          float minMaxValueFound = 0.0;
1723          int minMaxPosition = 0;
1724          float avgValue = 0.0;
1725
1726          for (int wR = 0; wR < ${c};
1727              wR += ${l}) {
1728            int xR = xRCorner + wR;
1729
1730            if (xR < 0 || xR >= ${e.inHeight}) {
1731              continue;
1732            }
1733
1734            for (int wC = 0; wC < ${f};
1735                wC += ${d}) {
1736              int xC = xCCorner + wC;
1737
1738              if (xC < 0 || xC >= ${e.inWidth}) {
1739                continue;
1740              }
1741
1742              float value = getX(batch, xR, xC, d);
1743
1744              // If a min / max value has already been found, use it. If not,
1745              // use the current value.
1746              float currMinMaxValue = mix(
1747                  value, minMaxValue, minMaxValueFound);
1748              if (value ${A} currMinMaxValue) {
1749                minMaxValue = value;
1750                minMaxValueFound = 1.0;
1751                minMaxPosition = ${a?r?b:w:`wR * ${f} + wC`};
1752              }
1753            }
1754          }
1755          setOutput(float(minMaxPosition));
1756        }
1757      `;return}let k="max",C=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(C="avgValue / max(count, 1.0)");let E=Math.floor(s/4)*4,T=s%4,_=`
1758      if (${y}) {
1759        avgValue += dot(values, ones);
1760      } else {
1761        minMaxValue = ${k}(values, minMaxValue);
1762      }
1763    `;this.userCode=`
1764      const ivec2 strides = ivec2(${i}, ${o});
1765      const ivec2 pads = ivec2(${m}, ${x});
1766      const float initializationValue = ${S};
1767      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
1768
1769      float count = 0.0;
1770
1771      float getValue(int batch, int xR, int xC, int d) {
1772        if (xC < 0 || xC >= ${e.inWidth}) {
1773          return initializationValue;
1774        }
1775        count += 1.0;
1776        return getX(batch, xR, xC, d);
1777      }
1778
1779      void main() {
1780        ivec4 coords = getOutputCoords();
1781        int batch = coords[0];
1782        int d = coords[3];
1783
1784        ivec2 xRCCorner = coords.yz * strides - pads;
1785        int xRCorner = xRCCorner.x;
1786        int xCCorner = xRCCorner.y;
1787
1788        // max/min x(?, ?, d) to get y(yR, yC, d).
1789        // ? = to be determined
1790        vec4 minMaxValue = vec4(${S});
1791        float avgValue = 0.0;
1792        count = 0.0;
1793
1794        for (int wR = 0; wR < ${c};
1795            wR += ${l}) {
1796          int xR = xRCorner + wR;
1797
1798          if (xR < 0 || xR >= ${e.inHeight}) {
1799            continue;
1800          }
1801
1802          for (int wC = 0; wC < ${E}; wC += 4) {
1803            int xC = xCCorner + wC * ${d};
1804
1805            vec4 values = vec4(
1806              getValue(batch, xR, xC, d),
1807              getValue(batch, xR, xC + ${d}, d),
1808              getValue(batch, xR, xC + 2 * ${d}, d),
1809              getValue(batch, xR, xC + 3 * ${d}, d)
1810            );
1811
1812            ${_}
1813          }
1814
1815          int xC = xCCorner + ${E};
1816          if (${T===1}) {
1817            vec4 values = vec4(
1818              getValue(batch, xR, xC, d),
1819              initializationValue,
1820              initializationValue,
1821              initializationValue
1822            );
1823
1824            ${_}
1825          } else if (${T===2}) {
1826            vec4 values = vec4(
1827              getValue(batch, xR, xC, d),
1828              getValue(batch, xR, xC + ${d}, d),
1829              initializationValue,
1830              initializationValue
1831            );
1832
1833            ${_}
1834          } else if (${T===3}) {
1835            vec4 values = vec4(
1836              getValue(batch, xR, xC, d),
1837              getValue(batch, xR, xC + ${d}, d),
1838              getValue(batch, xR, xC + 2 * ${d}, d),
1839              initializationValue
1840            );
1841
1842            ${_}
1843          }
1844        }
1845        setOutput(${C});
1846      }
1847    `}},_4=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,d=e.dilationDepth,c=e.dilationHeight,f=e.dilationWidth,m=e.effectiveFilterDepth,x=e.effectiveFilterHeight,y=e.effectiveFilterWidth,b=e.padInfo.front,w=e.padInfo.top,S=e.padInfo.left;this.outputShape=e.outShape;let k=t==="avg",C="0.0";if(k||(C="-1.0 / 1e-20"),n){let O=">=";this.userCode=`
1848        const ivec3 strides =
1849            ivec3(${i}, ${o}, ${l});
1850        const ivec3 pads = ivec3(${b}, ${w}, ${S});
1851
1852        void main() {
1853          ivec5 coords = getOutputCoords();
1854          int batch = coords.x;
1855          int ch = coords.u;
1856
1857          ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
1858          int xDCorner = xCorner.x;
1859          int xRCorner = xCorner.y;
1860          int xCCorner = xCorner.z;
1861
1862          // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
1863          // ? = to be determined
1864          float minMaxValue = 0.0;
1865          float minMaxValueFound = 0.0;
1866          int minMaxPosition = 0;
1867
1868          for (int wD = 0; wD < ${m};
1869              wD += ${d}) {
1870            int xD = xDCorner + wD;
1871
1872            if (xD < 0 || xD >= ${e.inDepth}) {
1873              continue;
1874            }
1875
1876            for (int wR = 0; wR < ${x};
1877                wR += ${c}) {
1878              int xR = xRCorner + wR;
1879
1880              if (xR < 0 || xR >= ${e.inHeight}) {
1881                continue;
1882              }
1883
1884              for (int wC = 0; wC < ${y};
1885                  wC += ${f}) {
1886                int xC = xCCorner + wC;
1887
1888                if (xC < 0 || xC >= ${e.inWidth}) {
1889                  continue;
1890                }
1891
1892                float value = getX(batch, xD, xR, xC, ch);
1893
1894                // If a min / max value has already been found, use it. If not,
1895                // use the current value.
1896                float currMinMaxValue = mix(
1897                    value, minMaxValue, minMaxValueFound);
1898                if (value ${O} currMinMaxValue) {
1899                  minMaxValue = value;
1900                  minMaxValueFound = 1.0;
1901                  minMaxPosition = ${a?r?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${x} * ${y} +
1902                      wR * ${y} + wC`};
1903                }
1904              }
1905            }
1906          }
1907          setOutput(float(minMaxPosition));
1908        }
1909      `;return}let E="max",T=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(T="avgValue / max(count, 1.0)");let _=Math.floor(s/4)*4,A=s%4,$=`
1910      if (${k}) {
1911        avgValue += dot(values, ones);
1912      } else {
1913        minMaxValue = ${E}(values, minMaxValue);
1914      }
1915    `;this.userCode=`
1916      const ivec3 strides =
1917        ivec3(${i}, ${o}, ${l});
1918      const ivec3 pads = ivec3(${b}, ${w}, ${S});
1919      const float initializationValue = ${C};
1920      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
1921
1922      float count = 0.0;
1923
1924      float getValue(int batch, int xD, int xR, int xC, int ch) {
1925        if (xC < 0 || xC >= ${e.inWidth}) {
1926          return initializationValue;
1927        }
1928        count += 1.0;
1929        return getX(batch, xD, xR, xC, ch);
1930      }
1931
1932      void main() {
1933        ivec5 coords = getOutputCoords();
1934        int batch = coords.x;
1935        int ch = coords.u;
1936
1937        ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
1938        int xDCorner = xCorner.x;
1939        int xRCorner = xCorner.y;
1940        int xCCorner = xCorner.z;
1941
1942        // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).
1943        // ? = to be determined
1944        vec4 minMaxValue = vec4(${C});
1945        float avgValue = 0.0;
1946        count = 0.0;
1947
1948        for (int wD = 0; wD < ${m};
1949            wD += ${d}) {
1950          int xD = xDCorner + wD;
1951
1952          if (xD < 0 || xD >= ${e.inDepth}) {
1953            continue;
1954          }
1955
1956          for (int wR = 0; wR < ${x};
1957            wR += ${c}) {
1958            int xR = xRCorner + wR;
1959
1960            if (xR < 0 || xR >= ${e.inHeight}) {
1961              continue;
1962            }
1963
1964            for (int wC = 0; wC < ${_}; wC += 4) {
1965              int xC = xCCorner + wC * ${f};
1966
1967              vec4 values = vec4(
1968                getValue(batch, xD, xR, xC, ch),
1969                getValue(batch, xD, xR, xC + ${f}, ch),
1970                getValue(batch, xD, xR, xC + 2 * ${f}, ch),
1971                getValue(batch, xD, xR, xC + 3 * ${f}, ch)
1972              );
1973
1974              ${$}
1975            }
1976
1977            int xC = xCCorner + ${_};
1978            if (${A===1}) {
1979              vec4 values = vec4(
1980                getValue(batch, xD, xR, xC, ch),
1981                initializationValue,
1982                initializationValue,
1983                initializationValue
1984              );
1985
1986              ${$}
1987            } else if (${A===2}) {
1988              vec4 values = vec4(
1989                getValue(batch, xD, xR, xC, ch),
1990                getValue(batch, xD, xR, xC + ${f}, ch),
1991                initializationValue,
1992                initializationValue
1993              );
1994
1995              ${$}
1996            } else if (${A===3}) {
1997              vec4 values = vec4(
1998                getValue(batch, xD, xR, xC, ch),
1999                getValue(batch, xD, xR, xC + ${f}, ch),
2000                getValue(batch, xD, xR, xC + 2 * ${f}, ch),
2001                initializationValue
2002              );
2003
2004              ${$}
2005            }
2006          }
2007        }
2008        setOutput(${T});
2009      }
2010    `}};function XIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Eg(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;R.assert(W.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let c=W.computePool2DInfo(r.shape,s,i,d,o,l);if(c.filterWidth===1&&c.filterHeight===1&&R.arraysEqual(c.inShape,c.outShape))return li({inputs:{x:r},backend:n});let f=new Hy(c,"avg",!1);return n.runWebGLProgram(f,[r],"float32")}var YIe={kernelName:eh,backendName:"webgl",kernelFunc:XIe};function JIe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,c=[1,1,1],f=W.computePool3DInfo(r.shape,s,i,c,o,l,d),m=new _4(f,"avg",!1);return n.runWebGLProgram(m,[r],"float32")}var QIe={kernelName:xm,backendName:"webgl",kernelFunc:JIe},ZIe=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,d=o-1-e.padInfo.top,c=l-1-e.padInfo.left,f=1/(t*n);this.userCode=`
2011      const ivec2 pads = ivec2(${d}, ${c});
2012      const float avgMultiplier = float(${f});
2013
2014      void main() {
2015        ivec4 coords = getOutputCoords();
2016        int b = coords[0];
2017        int d = coords[3];
2018
2019        ivec2 dyRCCorner = coords.yz - pads;
2020        int dyRCorner = dyRCCorner.x;
2021        int dyCCorner = dyRCCorner.y;
2022
2023        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
2024        // ? = to be determined. : = across all values in that axis.
2025        float dotProd = 0.0;
2026        for (int wR = 0; wR < ${o};
2027            wR += ${s}) {
2028          float dyR = float(dyRCorner + wR) / ${a}.0;
2029
2030          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
2031            continue;
2032          }
2033          int idyR = int(dyR);
2034
2035          for (int wC = 0; wC < ${l};
2036            wC+= ${i}) {
2037            float dyC = float(dyCCorner + wC) / ${r}.0;
2038
2039            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
2040                fract(dyC) > 0.0) {
2041              continue;
2042            }
2043            int idyC = int(dyC);
2044
2045            float dyValue = getDy(b, idyR, idyC, d);
2046
2047            dotProd += dyValue * avgMultiplier;
2048          }
2049        }
2050        setOutput(dotProd);
2051      }
2052    `}},eTe=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,c=e.effectiveFilterDepth,f=e.effectiveFilterHeight,m=e.effectiveFilterWidth,x=c-1-e.padInfo.front,y=f-1-e.padInfo.top,b=m-1-e.padInfo.left,w=1/(t*n*a);this.userCode=`
2053      const ivec3 pads = ivec3(${x}, ${y}, ${b});
2054      const float avgMultiplier = float(${w});
2055
2056      void main() {
2057        ivec5 coords = getOutputCoords();
2058        int batch = coords.x;
2059        int ch = coords.u;
2060
2061        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
2062        int dyDCorner = dyCorner.x;
2063        int dyRCorner = dyCorner.y;
2064        int dyCCorner = dyCorner.z;
2065
2066        // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
2067        // dx(xD, xR, xC, ch).
2068        // ? = to be determined. : = across all values in that axis.
2069        float dotProd = 0.0;
2070
2071        for (int wD = 0; wD < ${c};
2072            wD += ${o}) {
2073          float dyD = float(dyDCorner + wD) / ${r}.0;
2074
2075          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {
2076            continue;
2077          }
2078          int idyD = int(dyD);
2079
2080          for (int wR = 0; wR < ${f};
2081              wR += ${l}) {
2082            float dyR = float(dyRCorner + wR) / ${s}.0;
2083
2084            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
2085                fract(dyR) > 0.0) {
2086              continue;
2087            }
2088            int idyR = int(dyR);
2089
2090            for (int wC = 0; wC < ${m};
2091                wC += ${d}) {
2092              float dyC = float(dyCCorner + wC) / ${i}.0;
2093
2094              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
2095                  fract(dyC) > 0.0) {
2096                continue;
2097              }
2098              int idyC = int(dyC);
2099
2100              float dyValue = getDy(batch, idyD, idyR, idyC, ch);
2101
2102              dotProd += dyValue * avgMultiplier;
2103            }
2104          }
2105        }
2106        setOutput(dotProd);
2107      }
2108    `}};function tTe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:c}=a,f=[1,1,1],m=W.computePool3DInfo(i.shape,o,l,f,d,c),x=new eTe(m);return n.runWebGLProgram(x,[r],i.dtype)}var nTe={kernelName:rb,backendName:"webgl",kernelFunc:tTe};function aTe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;Eg([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,c=W.computePool2DInfo(i.shape,o,l,1,d),f=new ZIe(c);return n.runWebGLProgram(f,[r],i.dtype)}var rTe={kernelName:ab,backendName:"webgl",kernelFunc:aTe};function sTe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;return qv({a:r,b:s,transposeA:i,transposeB:o,backend:n})}var iTe={kernelName:th,backendName:"webgl",kernelFunc:sTe},oTe=class{constructor(e,t,n,a,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],W.assertAndGetBroadcastShape(e,t),W.assertAndGetBroadcastShape(e,n);let i="0.0";a!=null&&(W.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";r!=null&&(W.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`
2109      void main() {
2110        float x = getXAtOutCoords();
2111        float mean = getMeanAtOutCoords();
2112        float variance = getVarianceAtOutCoords();
2113        float offset = ${i};
2114        float scale = ${o};
2115        float inv = scale * inversesqrt(variance + float(${s}));
2116        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));
2117      }
2118    `}},lTe=class{constructor(e,t,n,a,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],W.assertAndGetBroadcastShape(e,t),W.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";a!=null&&(W.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";r!=null&&(W.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`
2119      void main() {
2120        vec4 offset = ${i};
2121        vec4 scale = ${o};
2122
2123        vec4 x = getXAtOutCoords();
2124        vec4 mean = getMeanAtOutCoords();
2125        vec4 variance = getVarianceAtOutCoords();
2126
2127        vec4 inv = scale * inversesqrt(variance + vec4(${s}));
2128
2129        setOutput((x - mean) * inv + offset);
2130      }
2131    `}},uTe=({inputs:e,backend:t,attrs:n})=>{let{x:a,mean:r,variance:s,offset:i,scale:o}=e;R.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),R.assert(i==null||r.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),R.assert(o==null||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let d=[a,r,s],c=null;i!=null&&(c=i.shape,d.push(i));let f=null;o!=null&&(f=o.shape,d.push(o));
vendor: 31,002 bytes, lines 2131-2689
2131let m=fe().getBool("WEBGL_PACK_NORMALIZATION")?new lTe(a.shape,r.shape,s.shape,c,f,l):new oTe(a.shape,r.shape,s.shape,c,f,l);return t.runWebGLProgram(m,d,d[0].dtype)},cTe={kernelName:bh,backendName:"webgl",kernelFunc:uTe},dTe=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=ea(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];let n=hTe(this.rank),a,r=e.map((s,i)=>`sourceLoc.${jE[i]} = start[${i}] + coords.${jE[i]};`);a=`
2132        ${t} sourceLoc;
2133        ${t} coords = getOutputCoords();
2134        ${r.join(`
2135`)}
2136      `,this.userCode=`
2137      void main() {
2138        ${a}
2139        setOutput(getSource(${n}));
2140      }
2141    `}},jE=["x","y","z","w","u","v"];function hTe(e){if(e===1)return"sourceLoc";if(e<=6)return jE.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}var pTe=class{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"}];let t=ea(this.rank),n=xs("coords",this.rank),a=xs("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${a.slice(-2).join()})`,s=`getChannel(getSource(${a.join()}), ${r})`,i=`
2142      result.x = ${s};
2143      if (++${n[this.rank-1]} < ${e[this.rank-1]}) {
2144        ++${a[this.rank-1]};
2145        result.y = ${s};
2146        --${a[this.rank-1]};
2147      }
2148    `,o=this.rank===1?"":`
2149      --${n[this.rank-1]};
2150      if (++${n[this.rank-2]} < ${e[this.rank-2]}) {
2151        ++${a[this.rank-2]};
2152        result.z = ${s};
2153        if (++${n[this.rank-1]} < ${e[this.rank-1]}) {
2154          ++${a[this.rank-1]};
2155          result.w = ${s};
2156        }
2157      }
2158    `,l=this.rank<=4?`sourceLoc = coords +
2159            ${t}(${e.map((d,c)=>`start[${c}]`).join()});`:e.map((d,c)=>`${a[c]} = ${n[c]} + start[${c}];`).join(`
2160`);this.userCode=`
2161      void main() {
2162        ${t} coords = getOutputCoords();
2163        ${t} sourceLoc;
2164        ${l}
2165        vec4 result = vec4(0.);
2166        ${i}
2167        ${o}
2168        setOutput(result);
2169      }
2170    `}};function fTe(e,t,n,a){let r=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,r),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=vr.computeFlatOffset(t,R.computeStrides(e.shape));r.slice&&(o+=r.slice.flatOffset),i.slice={flatOffset:o,origDataId:r.slice&&r.slice.origDataId||e.dataId};let l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}function Rg(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a,[o,l]=vr.parseSliceParams(r,s,i);if(vr.assertParamsValid(r,o,l),R.sizeFromShape(l)===0)return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||r.dtype==="string"){let f=n.texData.get(r.dataId),m=rEe(f.values,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,m)}let{isPacked:d}=n.texData.get(r.dataId),c=vr.isSliceContinous(r.shape,o,l);if(d||!c){let f=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new pTe(l):new dTe(l),m=[o];return n.runWebGLProgram(f,[r],r.dtype,m)}return n.uploadToGPU(r.dataId),fTe(r,o,l,n)}var mTe={kernelName:ag,backendName:"webgl",kernelFunc:Rg},gTe=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;R.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((k,C)=>k*C),l=W.getReshaped(r.shape,s,o),d=W.getPermuted(l.length,s.length),c=W.getReshapedPermuted(r.shape,s,o),f=W.getSliceBeginCoords(i,s.length),m=W.getSliceSize(c,i,s.length),x=[],y=et({inputs:{x:r},backend:n,attrs:{shape:l}}),b=Ss({inputs:{x:y},backend:n,attrs:{perm:d}}),w=et({inputs:{x:b},backend:n,attrs:{shape:c}}),S=Rg({inputs:{x:w},backend:n,attrs:{begin:f,size:m}});return x.push(y),x.push(b),x.push(w),x.forEach(k=>n.disposeIntermediateTensorInfo(k)),S},xTe={kernelName:ym,backendName:"webgl",kernelFunc:gTe};function yTe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.readSync(r.dataId),l=n.readSync(s.dataId),d=T9(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var bTe={kernelName:bm,backendName:"webgl",kernelFunc:yTe},vTe=`
2171  int r = int(a.r) & int(b.r);
2172  int g = int(a.g) & int(b.g);
2173  int rb = int(a.b) & int(b.b);
2174  int ra = int(a.a) & int(b.a);
2175  return vec4(r, g, rb, ra);
2176`,wTe=`
2177  return float(int(a.r) & int(b.r));
2178`;function STe(e){let{inputs:t,backend:n}=e,{a,b:r}=t,s=fe().getBool("WEBGL_PACK_BINARY_OPERATIONS"),i=fe().getNumber("WEBGL_VERSION");if(n.shouldExecuteOnCPU([a,r])||i===1){let l=n.texData.get(a.dataId).values,d=n.texData.get(r.dataId).values,[c,f]=TCe(a.shape,r.shape,l,d,a.dtype),m=n.makeTensorInfo(f,a.dtype),x=n.texData.get(m.dataId);return x.values=c,m}let o;return s?o=new jg(vTe,a.shape,r.shape,!1):o=new zd(wTe,a.shape,r.shape),n.runWebGLProgram(o,[a,r],a.dtype)}var kTe={kernelName:vm,backendName:"webgl",kernelFunc:STe};function NTe(e){let{inputs:t,backend:n}=e,{s0:a,s1:r}=t,s=n.readSync(a.dataId),i=n.readSync(r.dataId),o=W.assertAndGetBroadcastShape(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}var CTe={kernelName:sb,backendName:"webgl",kernelFunc:NTe},ETe="return float(a != b);",V9=Gr({opSnippet:ETe,cpuKernelImpl:XCe,dtype:"bool"}),ITe={kernelName:Vm,backendName:"webgl",kernelFunc:V9};function t0(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return li({inputs:{x:r.complexTensorInfos.real},backend:n})}var TTe={kernelName:_w,backendName:"webgl",kernelFunc:t0},ATe="return float(int(x));";function _Te(e,t){let n=new Yo(e.shape,ATe),a=t.runWebGLProgram(n,[e],"int32");return{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function DE(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return li({inputs:{x:r},backend:n});let i=va(r.shape),o=DE({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=Sc({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=t0({inputs:{input:r},backend:n}),o=DE({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!R.hasEncodingLoss(r.dtype,s)){let i=li({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(n.shouldExecuteOnCPU([r])){let i=n.texData.get(r.dataId).values,[o,l,d]=ACe(i,r.shape,r.dtype,s);return n.makeTensorInfo(o,l,d)}if(s==="int32")return _Te(r,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",R.getTypedArrayFromDType("bool",1)),o=V9({inputs:{a:r,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var jTe={kernelName:nh,backendName:"webgl",kernelFunc:DE},nB="return ceil(x);",DTe=kn({opSnippet:nB,packedOpSnippet:nB,cpuKernelImpl:_Ce}),RTe={kernelName:ah,backendName:"webgl",kernelFunc:DTe},MTe=class{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=`
2179
2180      void main() {
2181        float value = getAAtOutCoords();
2182        if (isnan(value)) {
2183          setOutput(value);
2184          return;
2185        }
2186
2187        setOutput(clamp(value, minVal, maxVal));
2188      }
2189    `}},$Te=class{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=`
2190      void main() {
2191        vec4 value = getAAtOutCoords();
2192
2193        if (any(isnan(value))) {
2194          setOutput(value);
2195          return;
2196        }
2197
2198        setOutput(clamp(value, vec4(minVal), vec4(maxVal)));
2199      }
2200    `}};function BTe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o;fe().getBool("WEBGL_PACK_CLIP")?o=new $Te(r.shape):o=new MTe(r.shape);let l=[[s],[i]];return n.runWebGLProgram(o,[r],r.dtype,l)}var FTe={kernelName:pc,backendName:"webgl",kernelFunc:BTe},OTe=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=`
2201      void main() {
2202        float re = abs(getRealAtOutCoords());
2203        float im = abs(getImagAtOutCoords());
2204        float mx = max(re, im);
2205
2206        // sadly the length function in glsl is not underflow-safe
2207        // (at least not on Intel GPUs). So the safe solution is
2208        // to ensure underflow-safety in all cases.
2209        setOutput(
2210          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))
2211        );
2212      }
2213    `}};function aB(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function LTe(e){let{inputs:t,backend:n}=e,{x:a}=t,r=n.texData.get(a.dataId),s=new OTe(a.shape),i=[aB(a,r.complexTensorInfos.real),aB(a,r.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}var PTe={kernelName:ib,backendName:"webgl",kernelFunc:LTe},zTe=class{constructor(e){this.outputShape=[],this.outputShape=W.computeOutShape(e,1),this.variableNames=e.map((s,i)=>`T${i}`);let t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s<t.length;s++)t[s]=t[s-1]+e[s][1];let n=[`if (yC < ${t[0]}) setOutput(getT0(yR, yC));`];for(let s=1;s<t.length;s++){let i=t[s-1];n.push(`else if (yC < ${t[s]}) setOutput(getT${s}(yR, yC-${i}));`)}let a=t.length,r=t[t.length-1];n.push(`else setOutput(getT${a}(yR, yC-${r}));`),this.userCode=`
2214      void main() {
2215        ivec2 coords = getOutputCoords();
2216        int yR = coords.x;
2217        int yC = coords.y;
2218
2219        ${n.join(`
2220        `)}
2221      }
2222    `}},UTe=class{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=W.computeOutShape(e,t);let n=this.outputShape,a=n.length,r=ea(a),s=xs("coords",a),i=["x","y","z","w","u","v"].slice(0,a);this.variableNames=e.map((y,b)=>`T${b}`);let o=new Array(e.length-1);o[0]=e[0][t];for(let y=1;y<o.length;y++)o[y]=o[y-1]+e[y][t];let l=i[t],d=i.slice(-2),c=i.join(),f=`if (${l} < ${o[0]}) {
2223        return getChannel(
2224            getT0(${c}), vec2(${d.join()}));
2225        }`;for(let y=1;y<o.length;y++){let b=o[y-1];f+=`
2226        if (${l} < ${o[y]}  && ${l} >= ${o[y-1]}) {
2227          return getChannel(
2228            getT${y}(${U1(i,l,b)}),
2229            vec2(${U1(d,l,b)}));
2230        }`}let m=o.length,x=o[o.length-1];f+=`
2231        return getChannel(
2232          getT${m}(${U1(i,l,x)}),
2233          vec2(${U1(d,l,x)}));`,this.userCode=`
2234      float getValue(${i.map(y=>"int "+y)}) {
2235        ${f}
2236      }
2237
2238      void main() {
2239        ${r} coords = getOutputCoords();
2240        vec4 result = vec4(getValue(${s}), 0., 0., 0.);
2241
2242        ${s[a-1]} = ${s[a-1]} + 1;
2243        if (${s[a-1]} < ${n[a-1]}) {
2244          result.g = getValue(${s});
2245        }
2246
2247        ${s[a-2]} = ${s[a-2]} + 1;
2248        if (${s[a-2]} < ${n[a-2]}) {
2249          result.a = getValue(${s});
2250        }
2251
2252        ${s[a-1]} = ${s[a-1]} - 1;
2253        if (${s[a-2]} < ${n[a-2]} &&
2254            ${s[a-1]} < ${n[a-1]}) {
2255          result.b = getValue(${s});
2256        }
2257        setOutput(result);
2258      }
2259    `}};function U1(e,t,n){let a=e.indexOf(t);return e.map((r,s)=>s===a?`${r} - ${n}`:r).join()}function P2(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return li({inputs:{x:r.complexTensorInfos.imag},backend:n})}var WTe={kernelName:Ew,backendName:"webgl",kernelFunc:P2};function Yx(e,t,n){let a=e[0].dtype;if(a==="complex64"){let x=e.map(k=>t0({inputs:{input:k},backend:n})),y=e.map(k=>P2({inputs:{input:k},backend:n})),b=Yx(x,t,n),w=Yx(y,t,n),S=Sc({inputs:{real:b,imag:w},backend:n});return x.forEach(k=>n.disposeIntermediateTensorInfo(k)),y.forEach(k=>n.disposeIntermediateTensorInfo(k)),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(w),S}let r=n.shouldExecuteOnCPU(e);if(a==="string"&&(r=!0),r){let x=e.map(E=>{let T=[-1,R.sizeFromShape(E.shape.slice(t))];return et({inputs:{x:E},backend:n,attrs:{shape:T}})}),y=x.map(E=>({vals:n.readSync(E.dataId),shape:E.shape})),b=W.computeOutShape(x.map(E=>E.shape),1),w=x[0].shape[0]===1,S=jCe(y,b,a,w),k=W.computeOutShape(e.map(E=>E.shape),t),C=n.makeTensorInfo(k,a,S);return x.forEach(E=>n.disposeIntermediateTensorInfo(E)),C}let s=e.filter(x=>R.sizeFromShape(x.shape)>0),i=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&s[0].shape.length>1;if(s.length===1){let x=i?new Yo(e[0].shape,Mu):new zu(e[0].shape,Mu);return n.runWebGLProgram(x,e,a)}let o=fe().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(s.length>o){let x=[];for(let b=0;b<s.length;b+=o){let w=s.slice(b,b+o);x.push(Yx(w,t,n))}let y=Yx(x,t,n);for(let b of x)n.disposeIntermediateTensorInfo(b);return y}if(i){let x=new UTe(s.map(y=>y.shape),t);return n.runWebGLProgram(x,s,a)}let{tensors2D:l,outShape:d}=VTe(s,t,n),c=new zTe(l.map(x=>x.shape)),f=n.runWebGLProgram(c,l,a);l.forEach(x=>n.disposeIntermediateTensorInfo(x));let m=et({inputs:{x:f},attrs:{shape:d},backend:n});return n.disposeIntermediateTensorInfo(f),m}function VTe(e,t,n){let a=W.computeOutShape(e.map(r=>r.shape),t);return{tensors2D:e.map(r=>et({inputs:{x:r},attrs:{shape:[-1,R.sizeFromShape(r.shape.slice(t))]},backend:n})),outShape:a}}function H9(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=R.parseAxisParam(r,t[0].shape)[0],i=t.map(d=>d.shape);W.assertParamsConsistent(i,s);let o=W.computeOutShape(t.map(d=>d.shape),s);if(R.sizeFromShape(o)===0)return n.makeTensorInfo(o,t[0].dtype,[]);let l=t.filter(d=>R.sizeFromShape(d.shape)>0);return l.length===1?li({inputs:{x:l[0]},backend:n}):Yx(l,s,n)}var HTe={kernelName:wm,backendName:"webgl",kernelFunc:H9},G9=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,d=e.dilationHeight,c=e.dilationWidth,f=e.filterHeight,m=e.filterWidth,x=Math.floor(e.inChannels/4)*4,y=e.inChannels%4,b=e.dataFormat==="channelsLast",w=b?1:2,S=b?2:3,k=b?3:1,C="",E="";n&&(a?C=`float activation(float a) {
2260          float b = getPreluActivationWeightsAtOutCoords();
2261          ${n}
2262        }`:r?C=`float activation(float a) {
2263          float b = getLeakyreluAlphaAtOutCoords();
2264          ${n}
2265        }`:C=`
2266          float activation(float x) {
2267            ${n}
2268          }
2269        `,E="result = activation(result);");let T=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
2270      ${C}
2271
2272      const ivec2 strides = ivec2(${o}, ${l});
2273      const ivec2 pads = ivec2(${s}, ${i});
2274
2275      void main() {
2276        ivec4 coords = getOutputCoords();
2277        int batch = coords[0];
2278        int d2 = coords[${k}];
2279
2280        ivec2 xRCCorner =
2281            ivec2(coords[${w}], coords[${S}]) * strides - pads;
2282        int xRCorner = xRCCorner.x;
2283        int xCCorner = xRCCorner.y;
2284
2285        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
2286        // ? = to be determined. : = across all values in that axis.
2287        float dotProd = 0.0;
2288        for (int wR = 0; wR < ${f}; wR++) {
2289          int xR = xRCorner + wR * ${d};
2290
2291          if (xR < 0 || xR >= ${e.inHeight}) {
2292            continue;
2293          }
2294
2295          for (int wC = 0; wC < ${m}; wC++) {
2296            int xC = xCCorner + wC * ${c};
2297
2298            if (xC < 0 || xC >= ${e.inWidth}) {
2299              continue;
2300            }
2301
2302            for (int d1 = 0; d1 < ${x}; d1 += 4) {
2303              vec4 wValues = vec4(
2304                getW(wR, wC, d1, d2),
2305                getW(wR, wC, d1 + 1, d2),
2306                getW(wR, wC, d1 + 2, d2),
2307                getW(wR, wC, d1 + 3, d2)
2308              );
2309
2310              if (${b}) {
2311                vec4 xValues = vec4(
2312                  getX(batch, xR, xC, d1),
2313                  getX(batch, xR, xC, d1 + 1),
2314                  getX(batch, xR, xC, d1 + 2),
2315                  getX(batch, xR, xC, d1 + 3)
2316                );
2317                dotProd += dot(xValues, wValues);
2318              } else {
2319                vec4 xValues = vec4(
2320                  getX(batch, d1, xR, xC),
2321                  getX(batch, d1 + 1, xR, xC),
2322                  getX(batch, d1 + 2, xR, xC),
2323                  getX(batch, d1 + 3, xR, xC)
2324                );
2325                dotProd += dot(xValues, wValues);
2326              }
2327            }
2328
2329            if (${y===1}) {
2330
2331              if (${b}) {
2332                dotProd +=
2333                    getX(batch, xR, xC, ${x}) *
2334                    getW(wR, wC, ${x}, d2);
2335              } else {
2336                dotProd +=
2337                    getX(batch, ${x}, xR, xC) *
2338                    getW(wR, wC, ${x}, d2);
2339              }
2340
2341            } else if (${y===2}) {
2342              vec2 wValues = vec2(
2343                getW(wR, wC, ${x}, d2),
2344                getW(wR, wC, ${x} + 1, d2)
2345              );
2346
2347              if (${b}) {
2348                vec2 xValues = vec2(
2349                  getX(batch, xR, xC, ${x}),
2350                  getX(batch, xR, xC, ${x} + 1)
2351                );
2352                dotProd += dot(xValues, wValues);
2353              } else {
2354                vec2 xValues = vec2(
2355                  getX(batch, ${x}, xR, xC),
2356                  getX(batch, ${x} + 1, xR, xC)
2357                );
2358                dotProd += dot(xValues, wValues);
2359              }
2360
2361            } else if (${y===3}) {
2362              vec3 wValues = vec3(
2363                getW(wR, wC, ${x}, d2),
2364                getW(wR, wC, ${x} + 1, d2),
2365                getW(wR, wC, ${x} + 2, d2)
2366              );
2367
2368              if (${b}) {
2369                vec3 xValues = vec3(
2370                  getX(batch, xR, xC, ${x}),
2371                  getX(batch, xR, xC, ${x} + 1),
2372                  getX(batch, xR, xC, ${x} + 2)
2373                );
2374                dotProd += dot(xValues, wValues);
2375              } else {
2376                vec3 xValues = vec3(
2377                  getX(batch, ${x}, xR, xC),
2378                  getX(batch, ${x} + 1, xR, xC),
2379                  getX(batch, ${x} + 2, xR, xC)
2380                );
2381                dotProd += dot(xValues, wValues);
2382              }
2383
2384            }
2385          }
2386        }
2387
2388        float result = dotProd;
2389        ${T}
2390        ${E}
2391        setOutput(result);
2392      }
2393    `}},GTe=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,a=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,c=e.filterDepth,f=e.filterHeight,m=e.filterWidth,x=Math.floor(e.inChannels/4)*4,y=e.inChannels%4;this.userCode=`
2394      const ivec3 strides = ivec3(${r}, ${s}, ${i});
2395      const ivec3 pads = ivec3(${t}, ${n}, ${a});
2396
2397      void main() {
2398        ivec5 coords = getOutputCoords();
2399        int batch = coords.x;
2400        int d2 = coords.u;
2401
2402        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
2403        int xFCorner = xFRCCorner.x;
2404        int xRCorner = xFRCCorner.y;
2405        int xCCorner = xFRCCorner.z;
2406
2407        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
2408        // y(yF, yR, yC, d2). ? = to be determined. : = across all
2409        // values in that axis.
2410        float dotProd = 0.0;
2411        for (int wF = 0; wF < ${c}; wF++) {
2412          int xF = xFCorner + wF * ${o};
2413
2414          if (xF < 0 || xF >= ${e.inDepth}) {
2415            continue;
2416          }
2417
2418          for (int wR = 0; wR < ${f}; wR++) {
2419            int xR = xRCorner + wR * ${l};
2420
2421            if (xR < 0 || xR >= ${e.inHeight}) {
2422              continue;
2423            }
2424
2425            for (int wC = 0; wC < ${m}; wC++) {
2426              int xC = xCCorner + wC * ${d};
2427
2428              if (xC < 0 || xC >= ${e.inWidth}) {
2429                continue;
2430              }
2431
2432              for (int d1 = 0; d1 < ${x}; d1 += 4) {
2433                vec4 xValues = vec4(
2434                  getX(batch, xF, xR, xC, d1),
2435                  getX(batch, xF, xR, xC, d1 + 1),
2436                  getX(batch, xF, xR, xC, d1 + 2),
2437                  getX(batch, xF, xR, xC, d1 + 3)
2438                );
2439                vec4 wValues = vec4(
2440                  getW(wF, wR, wC, d1, d2),
2441                  getW(wF, wR, wC, d1 + 1, d2),
2442                  getW(wF, wR, wC, d1 + 2, d2),
2443                  getW(wF, wR, wC, d1 + 3, d2)
2444                );
2445
2446                dotProd += dot(xValues, wValues);
2447              }
2448
2449              if (${y===1}) {
2450                dotProd +=
2451                  getX(batch, xF, xR, xC, ${x}) *
2452                  getW(wF, wR, wC, ${x}, d2);
2453              } else if (${y===2}) {
2454                vec2 xValues = vec2(
2455                  getX(batch, xF, xR, xC, ${x}),
2456                  getX(batch, xF, xR, xC, ${x} + 1)
2457                );
2458                vec2 wValues = vec2(
2459                  getW(wF, wR, wC, ${x}, d2),
2460                  getW(wF, wR, wC, ${x} + 1, d2)
2461                );
2462                dotProd += dot(xValues, wValues);
2463              } else if (${y===3}) {
2464                vec3 xValues = vec3(
2465                  getX(batch, xF, xR, xC, ${x}),
2466                  getX(batch, xF, xR, xC, ${x} + 1),
2467                  getX(batch, xF, xR, xC, ${x} + 2)
2468                );
2469                vec3 wValues = vec3(
2470                  getW(wF, wR, wC, ${x}, d2),
2471                  getW(wF, wR, wC, ${x} + 1, d2),
2472                  getW(wF, wR, wC, ${x} + 2, d2)
2473                );
2474                dotProd += dot(xValues, wValues);
2475              }
2476            }
2477          }
2478        }
2479        setOutput(dotProd);
2480      }
2481    `}},q9=class{constructor(e,t=!1,n=null,a=!1,r=!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=ss(this.outputShape.length);let s=e.padInfo.left,i=e.strideWidth,o=e.dilationWidth,l=e.filterHeight,d=e.filterWidth,c=d,f=`
2482       int xR; int xC; int xCOffset;
2483       vec4 wTexel; vec4 previous; vec4 final;`;for(let b=0;b<d;b++)f+=`
2484           vec4 xTexelC${b*2};
2485           int xTexelC${b*2}Ready;
2486           vec4 xTexelC${b*2+1};
2487           int xTexelC${b*2+1}Ready;
2488           vec4 xC${b};`;f+=`
2489     for (int r = 0; r < ${l}; r++) {
2490      for (int d1 = 0; d1 < ${e.inChannels}; d1 += 2) {
2491       `;for(let b=0;b<d;b++)f+=`
2492           xTexelC${b*2} = vec4(0.0);
2493           xTexelC${b*2}Ready = 0;
2494           xTexelC${b*2+1} = vec4(0.0);
2495           xTexelC${b*2+1}Ready = 0;
2496           xC${b} = vec4(0.0);`;f+=`
2497         xR = xRCorner + r * dilations[0];
2498         if (xR >=0 && xR < inDims[0]) {
2499       `;for(let b=0;b<(c+1)/2;b++){let w=b*2;if(f+=`
2500           xC = xCCorner + ${w*o};
2501           `,i===1){if(w<d&&(s%2===1?(f+=`
2502                 xCOffset = xC + 1;
2503                 if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${w}Ready == 0) {
2504                   xTexelC${w} = getX(batch, xR, xCOffset, d1);
2505
2506                   // Need to manually clear unused channels in case
2507                   // we're reading from recycled texture.
2508                   if (xCOffset + 1 >= inDims[1]) {
2509                     xTexelC${w}.zw = vec2(0.0);
2510                   }
2511                   xTexelC${w}Ready = 1;
2512                 }
2513               `,o===1&&w>0?f+=`
2514                 xC${w} = vec4(xTexelC${w-2}.zw, xTexelC${w}.xy);
2515                 `:f+=`
2516                   xCOffset = xC + 1 - 2;
2517
2518                   if (xCOffset >= 0 && xCOffset < inDims[1]) {
2519                     previous = getX(batch, xR, xCOffset, d1);
2520
2521                     // Need to manually clear unused channels in case
2522                     // we're reading from recycled texture.
2523                     if (xCOffset + 1 >= inDims[1]) {
2524                       previous.zw = vec2(0.0);
2525                     }
2526
2527                     xC${w} = vec4(previous.zw, xTexelC${w}.xy);
2528                   } else {
2529                     xC${w} = vec4(0.0, 0.0, xTexelC${w}.xy);
2530                   }
2531                   `):f+=`
2532                 if (xC >= 0 && xC < inDims[1] && xTexelC${w}Ready == 0) {
2533                   xTexelC${w} = getX(batch, xR, xC, d1);
2534                   if (xC + 1 >= inDims[1]) {
2535                     xTexelC${w}.zw = vec2(0.0);
2536                   }
2537                   xTexelC${w}Ready = 1;
2538                 }
2539
2540                 xC${w} = xTexelC${w};
2541                 `,w+1<d)){let S=s%2===0?R.nearestLargerEven(o):o;o%2===0&&s%2===1||o%2!==0&&s%2!==1?(f+=`
2542                   xCOffset = xC + imod(pads[1], 2) + ${S};
2543
2544                   if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${w+1}Ready == 0) {
2545                     xTexelC${w+1} = getX(batch, xR, xCOffset, d1);
2546
2547                     // Need to manually clear unused channels in case
2548                     // we're reading from recycled texture.
2549                     if (xCOffset + 1 >= inDims[1]) {
2550                       xTexelC${w+1}.zw = vec2(0.0);
2551                     }
2552                     xTexelC${w+1}Ready = 1;
2553                   }
2554                   `,o>1?f+=`
2555                     xCOffset -= 2;
2556                     if (xCOffset >= 0 && xCOffset < inDims[1]) {
2557                      previous = getX(batch, xR, xCOffset, d1);
2558                      xC${w+1} = vec4(previous.zw, xTexelC${w+1}.xy);
2559                     } else {
2560                      xC${w+1} = vec4(0.0, 0.0, xTexelC${w+1}.xy);
2561                     }
2562                     `:f+=`
2563                     xC${w+1} = vec4(xTexelC${w}.zw, xTexelC${w+1}.xy);
2564                     `):S===1?f+=`
2565                     xC${w+1} = xTexelC${w};
2566                     `:f+=`
2567                     xCOffset = xC + ${S};
2568
2569                     if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${w+1}Ready == 0) {
2570                       xTexelC${w+1} = getX(batch, xR, xCOffset, d1);
2571                       if (xCOffset + 1 >= inDims[1]) {
2572                         xTexelC${w+1}.zw = vec2(0.0);
2573                       }
2574                       xTexelC${w+1}Ready = 1;
2575                     }
2576
2577                     xC${w+1} = xTexelC${w+1};
2578                     `}}else w<d&&(s%2===1?(f+=`
2579                 xCOffset = xC + 1 - strides[1];
2580                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${w}Ready == 0) {
2581                   xTexelC${w} = getX(batch, xR, xCOffset, d1);
2582                   // Need to manually clear unused channels in case
2583                   // we're reading from recycled texture.
2584                   if (xCOffset + 1 >= inDims[1]) {
2585                     xTexelC${w}.zw = vec2(0.0);
2586                   }
2587                   xTexelC${w}Ready = 1;
2588                 }
2589
2590                 if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${w+1}Ready == 0) {
2591                   xTexelC${w+1} = getX(batch, xR, xC + 1, d1);
2592                   // Need to manually clear unused channels in case
2593                   // we're reading from recycled texture.
2594                   if (xC + 2 >= inDims[1]) {
2595                     xTexelC${w+1}.zw = vec2(0.0);
2596                   }
2597                   xTexelC${w+1}Ready = 1;
2598                 }
2599
2600                 xC${w} = vec4(xTexelC${w}.zw, xTexelC${w+1}.zw);
2601               `,w+1<d&&(f+=`
2602                   final = vec4(0.0);
2603                   xCOffset = xC + 1 + strides[1];
2604                   if(xCOffset >= 0 && xCOffset < inDims[1]) {
2605                     final = getX(batch, xR, xCOffset, d1);
2606                   }
2607                   xC${w+1} = vec4(xTexelC${w+1}.xy, final.xy);
2608                 `)):(f+=`
2609                 if(xC >= 0 && xC < inDims[1] && xTexelC${w}Ready == 0) {
2610                   xTexelC${w} = getX(batch, xR, xC, d1);
2611                   if (xC + 1 >= inDims[1]) {
2612                     xTexelC${w}.zw = vec2(0.0);
2613                   }
2614                   xTexelC${w}Ready = 1;
2615                 }
2616
2617                 xCOffset = xC + strides[1];
2618                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${w+1}Ready == 0) {
2619                   xTexelC${w+1} = getX(batch, xR, xCOffset, d1);
2620                   if (xCOffset + 1 >= inDims[1]) {
2621                     xTexelC${w+1}.zw = vec2(0.);
2622                   }
2623                   xTexelC${w+1}Ready = 1;
2624                 }
2625
2626                 xC${w} = vec4(
2627                   xTexelC${w}.xy, xTexelC${w+1}.xy);
2628               `,w+1<d&&(f+=`
2629                   xC${w+1} = vec4(xTexelC${w}.zw, xTexelC${w+1}.zw);
2630                 `)));w<d&&(f+=`
2631             wTexel = getW(r, ${w}, d1, d2);
2632             dotProd += xC${w}.xxzz * vec4(wTexel.xy, wTexel.xy);
2633             if(d1 + 1 < ${e.inChannels}) {
2634               dotProd += xC${w}.yyww * vec4(wTexel.zw, wTexel.zw);
2635             }
2636           `,w+1<d&&(f+=`
2637               wTexel = getW(r, ${w+1}, d1, d2);
2638               dotProd += xC${w+1}.xxzz * vec4(wTexel.xy, wTexel.xy);
2639               if(d1 + 1 < ${e.inChannels}) {
2640                 dotProd += xC${w+1}.yyww * vec4(wTexel.zw, wTexel.zw);
2641               }
2642             `))}f+=`
2643     }
2644   `,f+=`
2645     }
2646   `,f+=`
2647     }
2648   `;let m="",x="";n&&(a?m=`vec4 activation(vec4 a) {
2649           vec4 b = getPreluActivationWeightsAtOutCoords();
2650           ${n}
2651         }`:r?m=`vec4 activation(vec4 a) {
2652           vec4 b = getLeakyreluAlphaAtOutCoords();
2653           ${n}
2654         }`:m=`vec4 activation(vec4 x) {
2655           ${n}
2656         }`,x="result = activation(result);");let y=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
2657       ${m}
2658
2659       void main() {
2660         ivec4 coords = getOutputCoords();
2661         int batch = coords.x;
2662         ivec2 xRCCorner = coords.yz * strides - pads;
2663         int d2 = coords.w;
2664         int xRCorner = xRCCorner.x;
2665         int xCCorner = xRCCorner.y;
2666
2667         //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
2668         vec4 dotProd = vec4(0.000000000000001);
2669
2670         ${f}
2671
2672         vec4 result = dotProd - vec4(0.000000000000001);
2673         ${y}
2674         ${x}
2675         setOutput(result);
2676       }
2677     `}},qTe=class{constructor(e,t){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=ss(this.outputShape.length);let{dataFormat:n}=t,a=Is(),r=n==="channelsLast",s=r?1:2,i=r?2:3,o=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`,l="";for(let d=0;d<=1;d++)for(let c=0;c<=1;c++)l+=`
2678          blockIndex = rc.z + ${c};
2679          pos = rc.y + ${d};
2680
2681          ${o}
2682            offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];
2683            d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);
2684
2685            if(d0 < inputShape[${s}] && d0 >= 0) {
2686              // Use custom imod instead mod. On Intel GPU, mod may generate
2687              // unexpected value.
2688              // https://github.com/tensorflow/tfjs/issues/5447
2689              offsetX = imod(blockIndex, outWidth) * stride[1] - pad[
26891];
2690              d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /
2691                  inChannels);
2692
2693              if(d1 < inputShape[${i}] && d1 >= 0) {
2694
2695                ch = imod(pos, inChannels);
2696
2697                if (${r}) {
2698                  innerDims = vec2(d1, ch);
2699                  result[${d*2+c}] = getChannel(
2700                    getA(rc.x, d0, int(innerDims.x),
2701                    int(innerDims.y)), innerDims);
2702                } else {
2703                  innerDims = vec2(d0, d1);
2704                  result[${d*2+c}] = getChannel(
2705                    getA(rc.x, ch, int(innerDims.x),
2706                    int(innerDims.y)), innerDims);
2707                }
2708              }
2709            }
2710          }
2711        `;this.userCode=`
2712      void main() {
2713        ivec3 rc = getOutputCoords();
2714
2715        vec4 result = vec4(0);
2716
2717        int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
2718        vec2 innerDims;
2719
2720        ${l}
2721
2722        ${a.output} = result;
2723      }
2724    `}};function Kv(e,t){let n=e.length;return n>=3?t?[...e.slice(0,-3),e[n-3]*e[n-2],e[n-1]]:[...e.slice(0,-3),e[n-3],e[n-2]*e[n-1]]:!t&&n===1&&e[0]>1?[e[0],1]:null}function K9({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,d=a.texData.get(e.dataId),c=n.inChannels,f=l[0]*l[1]*l[2],m=n.outChannels,x=n.dataFormat==="channelsLast",y=!1,b=!1,w,S=[];if(s!=null){let k=Kv(s.shape,x);k!=null&&(s=et({inputs:{x:s},backend:a,attrs:{shape:k}}),S.push(s))}if(r!=null){let k=Kv(r.shape,x);k!=null&&(r=et({inputs:{x:r},backend:a,attrs:{shape:k}}),S.push(r))}if(!((f===1||m===1)&&c>P9)&&d.isPacked&&x&&d.texture!=null&&l[2]%2!==0&&R.arraysEqual(d.shape.slice(-3),l.slice(-3))){let k=l[0]*l[1]*(l[2]+1),C={dataId:e.dataId,shape:[1,k,n.inChannels],dtype:e.dtype},E=d.shape;d.shape=d.shape.slice(),d.shape[d.shape.length-2]++,R.assert(Wy(d.shape,C.shape),()=>`packed reshape ${d.shape} to ${C.shape} isn't free`);let T=et({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});S.push(T);let _=qv({a:C,b:T,backend:a,transposeA:y,transposeB:b,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),A=a.texData.get(_.dataId);R.assert(A.isPacked,()=>"batchMatMul result is expected to be packed"),d.shape=E,A.shape=n.outShape,w=li({inputs:{x:_},backend:a}),w.shape=n.outShape,S.push(_)}else{let k=n.outHeight*n.outWidth,C=et({inputs:{x:e},backend:a,attrs:{shape:x?[n.batchSize,k,n.inChannels]:[n.batchSize,n.inChannels,k]}}),E=et({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),T=qv({a:x?C:E,b:x?E:C,transposeA:!x,transposeB:b,backend:a,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i});w=et({inputs:{x:T},backend:a,attrs:{shape:n.outShape}}),S.push(C),S.push(E),S.push(T)}for(let k of S)a.disposeIntermediateTensorInfo(k);return w}function X9({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:d,inChannels:c,outWidth:f,outHeight:m,dataFormat:x}=n,y=x==="channelsLast",b=l*d*c,w=m*f,S=[n.batchSize,b,w],k=!0,C=!1,E=[];if(s!=null){let F=Kv(s.shape,y);F!=null&&(s=et({inputs:{x:s},backend:a,attrs:{shape:F}}),E.push(s))}if(r!=null){let F=Kv(r.shape,y);F!=null&&(r=et({inputs:{x:r},backend:a,attrs:{shape:F}}),E.push(r))}let T=et({inputs:{x:t},backend:a,attrs:{shape:[1,b,R.sizeFromShape(t.shape)/b]}});E.push(T);let _=new qTe(S,n),A=[e.shape,[n.padInfo.top,n.padInfo.left],[n.strideHeight,n.strideWidth],[n.dilationHeight,n.dilationWidth],[n.inChannels],[n.filterWidth*n.inChannels],[n.outWidth]],$=a.runWebGLProgram(_,[e],"float32",A),O=et({inputs:{x:$},backend:a,attrs:{shape:S}});E.push($),E.push(O);let z=r!=null,P=s!=null,j=o==="leakyrelu",G=o?Vy(o,!0):null,X=new L9(y?O.shape:T.shape,y?T.shape:O.shape,y?[n.batchSize,w,n.outChannels]:[n.batchSize,n.outChannels,w],k,C,z,G,P,j),J=y?[O,T]:[T,O];if(r&&J.push(r),P&&J.push(s),j){let F=a.makeTensorInfo([],"float32",R.createScalarValue(i,"float32"));J.push(F),E.push(F)}let V=a.runWebGLProgram(X,J,"float32"),Q=et({inputs:{x:V},backend:a,attrs:{shape:n.outShape}});E.push(V);for(let F of E)a.disposeIntermediateTensorInfo(F);return Q}function KTe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:c}
vendor: 24,820 bytes, lines 2724-3205
2724=a,f=W.convertConv2DDataFormat(l),m=W.computeConv2DInfo(r.shape,s.shape,i,d,o,c,!1,f),x;if(m.filterHeight===1&&m.filterWidth===1&&m.dilationHeight===1&&m.dilationWidth===1&&m.strideHeight===1&&m.strideWidth===1&&(m.padInfo.type==="SAME"||m.padInfo.type==="VALID"))x=K9({x:r,filter:s,convInfo:m,backend:n});else if(m.strideWidth<=2&&f==="channelsLast"&&fe().getBool("WEBGL_EXP_CONV")){let b=new q9(m),w=[[m.padInfo.top,m.padInfo.left],[m.strideHeight,m.strideWidth],[m.dilationHeight,m.dilationWidth],[m.inHeight,m.inWidth]];x=n.runWebGLProgram(b,[r,s],"float32",w)}else if(fe().getBool("WEBGL_CONV_IM2COL"))x=X9({x:r,filter:s,convInfo:m,backend:n});else{let b=new G9(m);x=n.runWebGLProgram(b,[r,s],"float32")}let y=et({inputs:{x},backend:n,attrs:{shape:m.outShape}});return n.disposeIntermediateTensorInfo(x),y}var XTe={kernelName:rh,backendName:"webgl",kernelFunc:KTe},YTe=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.dataFormat==="channelsLast";this.userCode=`
2725      void main() {
2726        ivec4 coords = getOutputCoords();
2727        int wR = coords.x;
2728        int wC = coords.y;
2729        int d1 = coords.z;
2730        int d2 = coords.w;
2731
2732        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
2733        // ? = to be determined. : = across all values in that axis.
2734        float dotProd = 0.0;
2735
2736        for (int b = 0; b < ${e.batchSize}; b++) {
2737          for (int yR = 0; yR < ${e.outHeight}; yR++) {
2738            int xR = wR + yR * ${t} - ${a};
2739
2740            if (xR < 0 || xR >= ${e.inHeight}) {
2741              continue;
2742            }
2743
2744            for (int yC = 0; yC < ${e.outWidth}; yC++) {
2745              int xC = wC + yC * ${n} - ${r};
2746
2747              if (xC < 0 || xC >= ${e.inWidth}) {
2748                continue;
2749              }
2750
2751              ${s?`float dyValue = getDy(b, yR, yC, d2);
2752              float xValue = getX(b, xR, xC, d1);
2753              dotProd += (xValue * dyValue);`:`float dyValue = getDy(b, d2, yR, yC);
2754              float xValue = getX(b, d1, xR, xC);
2755              dotProd += (xValue * dyValue);`}
2756            }
2757          }
2758        }
2759        setOutput(dotProd);
2760      }
2761    `}},JTe=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,d=s?2:3,c=s?3:1;this.userCode=`
2762      const ivec2 pads = ivec2(${i}, ${o});
2763
2764      void main() {
2765        ivec4 coords = getOutputCoords();
2766        int batch = coords[0];
2767        int d1 = coords[${c}];
2768
2769        ivec2 dyCorner = ivec2(coords[${l}], coords[${d}]) - pads;
2770        int dyRCorner = dyCorner.x;
2771        int dyCCorner = dyCorner.y;
2772
2773        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
2774        // ? = to be determined. : = across all values in that axis.
2775        float dotProd = 0.0;
2776        for (int wR = 0; wR < ${t}; wR++) {
2777          float dyR = float(dyRCorner + wR) / ${a}.0;
2778
2779          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
2780            continue;
2781          }
2782          int idyR = int(dyR);
2783
2784          int wRPerm = ${t} - 1 - wR;
2785
2786          for (int wC = 0; wC < ${n}; wC++) {
2787            float dyC = float(dyCCorner + wC) / ${r}.0;
2788
2789            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
2790                fract(dyC) > 0.0) {
2791              continue;
2792            }
2793            int idyC = int(dyC);
2794
2795            int wCPerm = ${n} - 1 - wC;
2796
2797            for (int d2 = 0; d2 < ${e.outChannels}; d2++) {
2798
2799              if (${s}) {
2800                float xValue = getDy(batch, idyR, idyC, d2);
2801                float wValue = getW(wRPerm, wCPerm, d1, d2);
2802                dotProd += xValue * wValue;
2803              } else {
2804                float xValue = getDy(batch, d2, idyR, idyC);
2805                float wValue = getW(wRPerm, wCPerm, d1, d2);
2806                dotProd += xValue * wValue;
2807              }
2808
2809            }
2810          }
2811        }
2812        setOutput(dotProd);
2813      }
2814    `}},QTe=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode=`
2815      void main() {
2816        ivec5 coords = getOutputCoords();
2817        int wF = coords.x;
2818        int wR = coords.y;
2819        int wC = coords.z;
2820        int d1 = coords.w;
2821        int d2 = coords.u;
2822
2823        float dotProd = 0.0;
2824
2825        for (int b = 0; b < ${e.batchSize}; b++) {
2826          for (int yF = 0; yF < ${e.outDepth}; yF++) {
2827            int xF = wF + yF * ${t} - ${r};
2828
2829            if (xF < 0 || xF >= ${e.inDepth}) {
2830              continue;
2831            }
2832
2833            for (int yR = 0; yR < ${e.outHeight}; yR++) {
2834              int xR = wR + yR * ${n} - ${s};
2835
2836              if (xR < 0 || xR >= ${e.inHeight}) {
2837                continue;
2838              }
2839
2840              for (int yC = 0; yC < ${e.outWidth}; yC++) {
2841                int xC = wC + yC * ${a} - ${i};
2842
2843                if (xC < 0 || xC >= ${e.inWidth}) {
2844                  continue;
2845                }
2846
2847                float dyValue = getDy(b, yF, yR, yC, d2);
2848                float xValue = getX(b, xF, xR, xC, d1);
2849                dotProd += (xValue * dyValue);
2850              }
2851            }
2852          }
2853        }
2854        setOutput(dotProd);
2855      }
2856    `}},ZTe=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,d=a-1-e.padInfo.left;this.userCode=`
2857      const ivec3 pads = ivec3(${o}, ${l}, ${d});
2858
2859      void main() {
2860        ivec5 coords = getOutputCoords();
2861        int batch = coords.x;
2862        int d1 = coords.u;
2863
2864
2865        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
2866        int dyFCorner = dyCorner.x;
2867        int dyRCorner = dyCorner.y;
2868        int dyCCorner = dyCorner.z;
2869
2870        float dotProd = 0.0;
2871        for (int wF = 0; wF < ${t}; wF++) {
2872          float dyF = float(dyFCorner + wF) / ${r}.0;
2873
2874          if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) {
2875            continue;
2876          }
2877          int idyF = int(dyF);
2878
2879          int wFPerm = ${t} - 1 - wF;
2880
2881          for (int wR = 0; wR < ${n}; wR++) {
2882            float dyR = float(dyRCorner + wR) / ${s}.0;
2883
2884            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
2885              fract(dyR) > 0.0) {
2886              continue;
2887            }
2888            int idyR = int(dyR);
2889
2890            int wRPerm = ${n} - 1 - wR;
2891
2892            for (int wC = 0; wC < ${a}; wC++) {
2893              float dyC = float(dyCCorner + wC) / ${i}.0;
2894
2895              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
2896                  fract(dyC) > 0.0) {
2897                continue;
2898              }
2899              int idyC = int(dyC);
2900
2901              int wCPerm = ${a} - 1 - wC;
2902
2903              for (int d2 = 0; d2 < ${e.outChannels}; d2++) {
2904                float xValue = getDy(batch, idyF, idyR, idyC, d2);
2905                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);
2906                dotProd += xValue * wValue;
2907              }
2908            }
2909          }
2910        }
2911        setOutput(dotProd);
2912      }
2913    `}};function eAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,filterShape:c}=a,f=W.convertConv2DDataFormat(l),m=W.computeConv2DInfo(r.shape,c,i,1,o,d,!1,f),x=new YTe(m);return n.runWebGLProgram(x,[r,s],"float32")}var tAe={kernelName:bw,backendName:"webgl",kernelFunc:eAe},nAe=class{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=ss(this.outputShape.length);let t=e.filterHeight,n=e.filterWidth,a=t-1-e.padInfo.top,r=n-1-e.padInfo.left;this.userCode=`
2914      const ivec2 pads = ivec2(${a}, ${r});
2915
2916      void main() {
2917        ivec4 coords = getOutputCoords();
2918        int batch = coords[0];
2919        int d1 = coords[3];
2920
2921        ivec2 dyCorner = ivec2(coords[1], coords[2]) - pads;
2922        int dyRCorner = dyCorner.x;
2923        int dyCCorner = dyCorner.y;
2924
2925        vec4 result = vec4(0.);
2926        for (int wR = 0; wR < ${t}; wR++) {
2927          float dyR = float(dyRCorner + wR) / strides[0];
2928          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
2929            continue;
2930          }
2931          int idyR = int(dyR);
2932          int wRPerm = ${t} - 1 - wR;
2933
2934          for (int wC = 0; wC < ${n}; wC++) {
2935            int wCPerm = ${n} - 1 - wC;
2936
2937            float dyC = float(dyCCorner + wC) / strides[1];
2938            bool idyCVal = (dyC >= 0.0) && (dyC < ${e.outWidth}.0)
2939              && (fract(dyC) == 0.0);
2940            int idyC = int(dyC);
2941
2942            float dyC2 = float(dyCCorner + wC + 1) / strides[1];
2943            bool idyCVal2 = (dyC2 >= 0.0) && (dyC2 < ${e.outWidth}.0)
2944              && (fract(dyC2) == 0.0);
2945            int idyC2 = int(dyC2);
2946
2947            if (idyCVal && idyCVal2) {
2948              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
2949                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
2950                vec4 dySample = getDy(batch, idyR, idyC, d2);
2951                vec4 dySample2 = (idyC / 2 == idyC2 / 2) ?
2952                  dySample : getDy(batch, idyR, idyC2, d2);
2953
2954                vec2 dyValue = mod(float(idyC), 2.) == 0. ?
2955                  dySample.xy : dySample.zw;
2956                result.xy += vec2(dot(dyValue, wValue.xy),
2957                  dot(dyValue, wValue.zw));
2958
2959                dyValue = mod(float(idyC2), 2.) == 0. ?
2960                  dySample2.xy : dySample2.zw;
2961                result.zw += vec2(dot(dyValue, wValue.xy),
2962                  dot(dyValue, wValue.zw));
2963              }
2964            } else if (idyCVal) {
2965              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
2966                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
2967                vec4 dySample = getDy(batch, idyR, idyC, d2);
2968                vec2 dyValue = mod(float(idyC), 2.) == 0. ?
2969                  dySample.xy : dySample.zw;
2970                result.xy += vec2(dot(dyValue, wValue.xy),
2971                  dot(dyValue, wValue.zw));
2972              }
2973            } else if (idyCVal2) {
2974              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {
2975                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);
2976                vec4 dySample = getDy(batch, idyR, idyC2, d2);
2977                vec2 dyValue = mod(float(idyC2), 2.) == 0. ?
2978                  dySample.xy : dySample.zw;
2979                result.zw += vec2(dot(dyValue, wValue.xy),
2980                  dot(dyValue, wValue.zw));
2981              }
2982            }
2983          }
2984        }
2985        setOutput(result);
2986      }
2987    `}};function aAe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:d,dimRoundingMode:c}=a,f=W.convertConv2DDataFormat(d),m=W.computeConv2DInfo(i,s.shape,o,1,l,c,!1,f);if(fe().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&f==="channelsLast"){let x=[[m.strideHeight,m.strideWidth]],y=new nAe(m);return n.runWebGLProgram(y,[r,s],"float32",x)}else{let x=new JTe(m);return n.runWebGLProgram(x,[r,s],"float32")}}var rAe={kernelName:sh,backendName:"webgl",kernelFunc:aAe};function sAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=W.computeConv3DInfo(r.shape,s.shape,i,l,o),c=new GTe(d);return n.runWebGLProgram(c,[r,s],"float32")}var iAe={kernelName:ih,backendName:"webgl",kernelFunc:sAe};function oAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a,d=W.computeConv3DInfo(r.shape,l,i,1,o),c=new QTe(d);return n.runWebGLProgram(c,[r,s],"float32")}var lAe={kernelName:Sm,backendName:"webgl",kernelFunc:oAe};function uAe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a,d=W.computeConv3DInfo(l,s.shape,o,1,i),c=new ZTe(d);return n.runWebGLProgram(c,[r,s],"float32")}var cAe={kernelName:km,backendName:"webgl",kernelFunc:uAe},dAe=Dg+`
2988  return cos(x);
2989`,hAe=`
2990  vec4 result = cos(x);
2991  bvec4 isNaN = isnan(x);
2992  ${bp}
2993  return result;
2994`,pAe=kn({opSnippet:dAe,packedOpSnippet:hAe}),fAe={kernelName:oh,backendName:"webgl",kernelFunc:pAe},mAe=`
2995  float e2x = exp(-x);
2996  return (e2x + 1.0 / e2x) / 2.0;
2997`,gAe=kn({opSnippet:mAe}),xAe={kernelName:lh,backendName:"webgl",kernelFunc:gAe},yAe=class{constructor(e,t,n,a,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[d]=t,[c,f]=n;this.outputShape=[d,c,f,l];let m=a==="bilinear"?1:0,[x,y]=[`${i-1}.0`,`${o-1}.0`],[b,w,S]=c>1?[`${(i-1)/(c-1)}`,"(y2-y1) * height_ratio",`y1*${x} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${x}`],[k,C,E]=f>1?[`${(o-1)/(f-1)}`,"(x2-x1) * width_ratio",`x1*${y} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${y}`];this.userCode=`
2998      const float height_ratio = float(${b});
2999      const float width_ratio = float(${k});
3000      void main() {
3001        ivec4 coords = getOutputCoords();
3002        int b = coords[0];
3003        int y = coords[1];
3004        int x = coords[2];
3005        int d = coords[3];
3006
3007        // get box vals
3008        float y1 = getBoxes(b,0);
3009        float x1 = getBoxes(b,1);
3010        float y2 = getBoxes(b,2);
3011        float x2 = getBoxes(b,3);
3012
3013        // get image in batch index
3014        int bInd = round(getBoxInd(b));
3015        if(bInd < 0 || bInd >= ${s}) {
3016          return;
3017        }
3018
3019        float height_scale = ${w};
3020        float width_scale = ${C};
3021
3022        float in_y = ${S};
3023        if( in_y < 0.0 || in_y > ${x} ) {
3024          setOutput(float(${r}));
3025          return;
3026        }
3027        float in_x = ${E};
3028        if( in_x < 0.0 || in_x > ${y} ) {
3029          setOutput(float(${r}));
3030          return;
3031        }
3032
3033        vec2 sourceFracIndexCR = vec2(in_x,in_y);
3034        if(${m} == 1) {
3035          // Compute the four integer indices.
3036          ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);
3037          ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));
3038
3039          float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);
3040          float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);
3041          float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);
3042          float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);
3043
3044          vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);
3045
3046          float top = topLeft + (topRight - topLeft) * fracCR.x;
3047          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;
3048          float newValue = top + (bottom - top) * fracCR.y;
3049          setOutput(newValue);
3050        } else {
3051          // Compute the coordinators of nearest neighbor point.
3052          ivec2 sourceNearestCR = ivec2(floor(
3053            sourceFracIndexCR + vec2(0.5,0.5)));
3054          float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);
3055          setOutput(newValue);
3056        }
3057      }
3058    `}},bAe=e=>{let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,c=new yAe(r.shape,s.shape,o,l,d);return n.runWebGLProgram(c,[r,s,i],"float32")},vAe={kernelName:Cm,backendName:"webgl",kernelFunc:bAe},Gy;(function(e){e.Prod="*",e.Sum="+"})(Gy||(Gy={}));var rB=class{constructor(e,t,n,a){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];let r=this.outputShape.length,s=this.op===Gy.Prod?"1.0":"0.0",i=n?s:`getX(${sB(r,"coords",this.op)})`,o=this.outputShape[this.outputShape.length-1],l="",d="";n?(l=a?`end != ${o-1}`:"end != 0",d=a?"end + 1":"end - 1"):(l=a?`end + pow2 < ${o}`:"end >= pow2",d=a?"end + pow2":"end - pow2"),this.userCode=`
3059      void main() {
3060        ${ea(r)} coords = getOutputCoords();
3061        int end = ${iB(r,"coords",this.op)};
3062        float val = ${i};
3063        int pow2 = int(pow(2.0, index));
3064        if (${l}) {
3065          int idx = ${d};
3066          ${iB(r,"coords",this.op)} = idx;
3067          val ${this.op}= getX(${sB(r,"coords",this.op)});
3068        }
3069        setOutput(val);
3070      }
3071    `}};function sB(e,t,n){if(e===1)return`${t}`;if(e===2)return`${t}.x, ${t}.y`;if(e===3)return`${t}.x, ${t}.y, ${t}.z`;if(e===4)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function iB(e,t,n){if(e===1)return`${t}`;if(e===2)return`${t}.y`;if(e===3)return`${t}.z`;if(e===4)return`${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function Y9(e,t,n,a,r,s){let i=t.shape.length,o=W.getAxesPermutation([a],i),l=t;o!=null&&(l=Ss({inputs:{x:t},backend:n,attrs:{perm:o}}));let d=W.getInnerMostAxes(1,i)[0];if(d!==i-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${t.shape.length-1} but got axis=${a}`);let c=l.shape[d],f=li({inputs:{x:l},backend:n});for(let m=0;m<=Math.ceil(Math.log2(c))-1;m++){let x=new rB(e,l.shape,!1,s),y=[[m]],b=f;f=n.runWebGLProgram(x,[f],f.dtype,y),n.disposeIntermediateTensorInfo(b)}if(r){let m=new rB(e,l.shape,r,s),x=f;f=n.runWebGLProgram(m,[f],f.dtype),n.disposeIntermediateTensorInfo(x)}if(o!=null){let m=W.getUndoAxesPermutation(o),x=Ss({inputs:{x:f},backend:n,attrs:{perm:m}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(l),x}return f}function wAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a;return Y9(Gy.Prod,r,n,s,i,o)}var SAe={kernelName:Nm,backendName:"webgl",kernelFunc:wAe};function kAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a;return Y9(Gy.Sum,r,n,s,i,o)}var NAe={kernelName:uh,backendName:"webgl",kernelFunc:kAe};function CAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.readSync(r.dataId),d=n.readSync(s.dataId),c=T9(l,d,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,c)}else if(r.shape.length===2){let l=n.bufferSync(r),d=n.bufferSync(s),c=ICe(l,d,i,o);return n.makeTensorInfo(c.shape,s.dtype,c.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}var EAe={kernelName:ob,backendName:"webgl",kernelFunc:CAe},IAe=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=`
3072    void main() {
3073      ivec4 coords = getOutputCoords();
3074      int b = coords[0];
3075      int h = ${this.getHeightCoordString()};
3076      int w = ${this.getWidthCoordString()};
3077      int d = ${this.getDepthCoordString()};
3078
3079      int in_h = h / ${t};
3080      int offset_h = imod(h, ${t});
3081      int in_w = w / ${t};
3082      int offset_w = imod(w, ${t});
3083      int offset_d = (offset_h * ${t} + offset_w) *
3084        ${this.getOutputDepthSize()};
3085      int in_d = d + offset_d;
3086
3087      float result = ${this.getInputSamplingString()};
3088      setOutput(result);
3089    }
3090  `}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)"}};function TAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a,o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],c=i==="NHWC"?r.shape[3]:r.shape[1],f=l*s,m=d*s,x=c/(s*s),y=i==="NHWC"?[o,f,m,x]:[o,x,f,m],b=new IAe(y,s,i);return n.runWebGLProgram(b,[r],r.dtype)}var AAe={kernelName:Em,backendName:"webgl",kernelFunc:TAe},J9=class{constructor(e,t=!1,n=null,a=!1,r=!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=ss(this.outputShape.length);let s=e.filterHeight,i=e.filterWidth,o=e.outChannels/e.inChannels,l="",d="";n&&(a?l=`float activation(float a) {
3091          float b = getPreluActivationWeightsAtOutCoords();
3092          ${n}
3093        }`:r?l=`float activation(float a) {
3094          float b = getLeakyreluAlphaAtOutCoords();
3095          ${n}
3096        }`:l=`
3097          float activation(float x) {
3098            ${n}
3099          }
3100        `,d="result = activation(result);");let c=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
3101      ${l}
3102
3103      void main() {
3104        ivec4 coords = getOutputCoords();
3105        int batch = coords.x;
3106        ivec2 xRCCorner = coords.yz * strides - pads;
3107        int d2 = coords.w;
3108        int d1 = d2 / ${o};
3109        int q = d2 - d1 * ${o};
3110
3111        int xRCorner = xRCCorner.x;
3112        int xCCorner = xRCCorner.y;
3113
3114        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
3115        // ? = to be determined. : = across all values in that axis.
3116        float dotProd = 0.0;
3117        // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
3118        for (int wR = 0; wR < ${s}; wR++) {
3119          int xR = xRCorner + wR * dilations[0];
3120
3121          if (xR < 0 || xR >= inDims[0]) {
3122            continue;
3123          }
3124
3125          for (int wC = 0; wC < ${i}; wC++) {
3126            int xC = xCCorner + wC * dilations[1];
3127
3128            if (xC < 0 || xC >= inDims[1]) {
3129              continue;
3130            }
3131
3132            float xVal = getX(batch, xR, xC, d1);
3133            float wVal = getW(wR, wC, d1, q);
3134            dotProd += xVal * wVal;
3135          }
3136        }
3137
3138        float result = dotProd;
3139        ${c}
3140        ${d}
3141        setOutput(result);
3142      }
3143    `}},Q9=class{constructor(e,t=!1,n=null,a=!1,r=!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=ss(this.outputShape.length);let s=e.outChannels/e.inChannels,i=e.padInfo.left,o=e.strideWidth,l=e.dilationWidth,d=e.filterHeight,c=e.filterWidth,f=c,m=`
3144      int xR; int xC; int xCOffset;
3145      vec4 wTexel; vec4 previous; vec4 final;`;for(let w=0;w<c;w++)m+=`
3146          vec4 xTexelC${w*2};
3147          int xTexelC${w*2}Ready;
3148          vec4 xTexelC${w*2+1};
3149          int xTexelC${w*2+1}Ready;
3150          vec4 xC${w};`;m+=`
3151    for (int r = 0; r < ${d}; r++) {
3152      `;for(let w=0;w<c;w++)m+=`
3153          xTexelC${w*2} = vec4(0.0);
3154          xTexelC${w*2}Ready = 0;
3155          xTexelC${w*2+1} = vec4(0.0);
3156          xTexelC${w*2+1}Ready = 0;
3157          xC${w} = vec4(0.0);`;m+=`
3158        xR = xRCorner + r * dilations[0];
3159        if (xR >=0 && xR < inDims[0]) {
3160      `;for(let w=0;w<(f+1)/2;w++){let S=w*2;if(m+=`
3161          xC = xCCorner + ${S*l};
3162          `,o===1){if(S<c&&(i%2===1?(m+=`
3163                xCOffset = xC + 1;
3164                if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${S}Ready == 0) {
3165                  xTexelC${S} = getX(batch, xR, xCOffset, d1);
3166
3167                  // Need to manually clear unused channels in case
3168                  // we're reading from recycled texture.
3169                  if (xCOffset + 1 >= inDims[1]) {
3170                    xTexelC${S}.zw = vec2(0.0);
3171                  }
3172                  xTexelC${S}Ready = 1;
3173                }
3174              `,l===1&&S>0?m+=`
3175                xC${S} = vec4(xTexelC${S-2}.zw, xTexelC${S}.xy);
3176                `:m+=`
3177                  xCOffset = xC + 1 - 2;
3178
3179                  if (xCOffset >= 0 && xCOffset < inDims[1]) {
3180                    previous = getX(batch, xR, xCOffset, d1);
3181
3182                    // Need to manually clear unused channels in case
3183                    // we're reading from recycled texture.
3184                    if (xCOffset + 1 >= inDims[1]) {
3185                      previous.zw = vec2(0.0);
3186                    }
3187
3188                    xC${S} = vec4(previous.zw, xTexelC${S}.xy);
3189                  } else {
3190                    xC${S} = vec4(0.0, 0.0, xTexelC${S}.xy);
3191                  }
3192                  `):m+=`
3193                if (xC >= 0 && xC < inDims[1] && xTexelC${S}Ready == 0) {
3194                  xTexelC${S} = getX(batch, xR, xC, d1);
3195                  if (xC + 1 >= inDims[1]) {
3196                    xTexelC${S}.zw = vec2(0.0);
3197                  }
3198                  xTexelC${S}Ready = 1;
3199                }
3200
3201                xC${S} = xTexelC${S};
3202                `,S+1<c)){let k=i%2===0?R.nearestLargerEven(l):l;l%2===0&&i%2===1||l%2!==0&&i%2!==1?(m+=`
3203                  xCOffset = xC + imod(pads[1], 2) + ${k};
3204
3205                  if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${S+1}
3205Ready == 0) {
3206                    xTexelC${S+1} = getX(batch, xR, xCOffset, d1);
3207
3208                    // Need to manually clear unused channels in case
3209                    // we're reading from recycled texture.
3210                    if (xCOffset + 1 >= inDims[1]) {
3211                      xTexelC${S+1}.zw = vec2(0.0);
3212                    }
3213                    xTexelC${S+1}Ready = 1;
3214                  }
3215                  `,l>1?m+=`
3216                    xCOffset -= 2;
3217                    if (xCOffset >= 0 && xCOffset < inDims[1]) {
3218                     previous = getX(batch, xR, xCOffset, d1);
3219                     xC${S+1} = vec4(previous.zw, xTexelC${S+1}.xy);
3220                    } else {
3221                     xC${S+1} = vec4(0.0, 0.0, xTexelC${S+1}.xy);
3222                    }
3223                    `:m+=`
3224                    xC${S+1} = vec4(xTexelC${S}.zw, xTexelC${S+1}.xy);
3225                    `):k===1?m+=`
3226                    xC${S+1} = xTexelC${S};
3227                    `:m+=`
3228                    xCOffset = xC + ${k};
3229
3230                    if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${S+1}Ready == 0) {
3231                      xTexelC${S+1} = getX(batch, xR, xCOffset, d1);
3232                      if (xCOffset + 1 >= inDims[1]) {
3233                        xTexelC${S+1}.zw = vec2(0.0);
3234                      }
3235                      xTexelC${S+1}Ready = 1;
3236                    }
3237
3238                    xC${S+1} = xTexelC${S+1};
3239                    `}}else S<c&&(i%2===1?(m+=`
3240                xCOffset = xC + 1 - strides[1];
3241                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${S}Ready == 0) {
3242                  xTexelC${S} = getX(batch, xR, xCOffset, d1);
3243                  // Need to manually clear unused channels in case
3244                  // we're reading from recycled texture.
3245                  if (xCOffset + 1 >= inDims[1]) {
3246                    xTexelC${S}.zw = vec2(0.0);
3247                  }
3248                  xTexelC${S}Ready = 1;
3249                }
3250
3251                if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${S+1}Ready == 0) {
3252                  xTexelC${S+1} = getX(batch, xR, xC + 1, d1);
3253                  // Need to manually clear unused channels in case
3254                  // we're reading from recycled texture.
3255                  if (xC + 2 >= inDims[1]) {
3256                    xTexelC${S+1}.zw = vec2(0.0);
3257                  }
3258                  xTexelC${S+1}Ready = 1;
3259                }
3260
3261                xC${S} = vec4(xTexelC${S}.zw, xTexelC${S+1}.zw);
3262              `,S+1<c&&(m+=`
3263                  final = vec4(0.0);
3264                  xCOffset = xC + 1 + strides[1];
3265                  if(xCOffset >= 0 && xCOffset < inDims[1]) {
3266                    final = getX(batch, xR, xCOffset, d1);
3267                  }
3268                  xC${S+1} = vec4(xTexelC${S+1}.xy, final.xy);
3269                `)):(m+=`
3270                if(xC >= 0 && xC < inDims[1] && xTexelC${S}Ready == 0) {
3271                  xTexelC${S} = getX(batch, xR, xC, d1);
3272                  if (xC + 1 >= inDims[1]) {
3273                    xTexelC${S}.zw = vec2(0.0);
3274                  }
3275                  xTexelC${S}Ready = 1;
3276                }
3277
3278                xCOffset = xC + strides[1];
3279                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${S+1}Ready == 0) {
3280                  xTexelC${S+1} = getX(batch, xR, xCOffset, d1);
3281                  if (xCOffset + 1 >= inDims[1]) {
3282                    xTexelC${S+1}.zw = vec2(0.);
3283                  }
3284                  xTexelC${S+1}Ready = 1;
3285                }
3286
3287                xC${S} = vec4(
3288                  xTexelC${S}.xy, xTexelC${S+1}.xy);
3289              `,S+1<c&&(m+=`
3290                  xC${S+1} = vec4(xTexelC${S}.zw, xTexelC${S+1}.zw);
3291                `)));S<c&&(m+=`
3292            wTexel = getW(r, ${S}, d1, q);
3293            dotProd += xC${S} * vec4(wTexel.xz, wTexel.xz);
3294          `,S+1<c&&(m+=`
3295              wTexel = getW(r, ${S+1}, d1, q);
3296              dotProd += xC${S+1} * vec4(wTexel.xz, wTexel.xz);
3297            `))}m+=`
3298    }
3299  `,m+=`
3300      }
3301    `;let x="",y="";n&&(a?x=`vec4 activation(vec4 a) {
3302          vec4 b = getPreluActivationWeightsAtOutCoords();
3303          ${n}
3304        }`:r?x=`vec4 activation(vec4 a) {
3305          vec4 b = getLeakyreluAlphaAtOutCoords();
3306          ${n}
3307        }`:x=`vec4 activation(vec4 x) {
3308          ${n}
3309        }`,y="result = activation(result);");let b=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`
3310      ${x}
3311
3312      void main() {
3313        ivec4 coords = getOutputCoords();
3314        int batch = coords.x;
3315        ivec2 xRCCorner = coords.yz * strides - pads;
3316        int d2 = coords.w;
3317        int d1 = d2 / ${s};
3318        int q = d2 - d1 * ${s};
3319        int xRCorner = xRCCorner.x;
3320        int xCCorner = xRCCorner.y;
3321
3322        //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
3323        vec4 dotProd = vec4(0.000000000000001);
3324
3325        ${m}
3326
3327        vec4 result = dotProd - vec4(0.000000000000001);
3328        ${b}
3329        ${y}
3330        setOutput(result);
3331      }
3332    `}};function _Ae(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:d}=a,c=l;c==null&&(c=[1,1]),R.assert(W.eitherStridesOrDilationsAreOne(i,c),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);let f=W.computeConv2DInfo(r.shape,s.shape,i,c,o,d,!0),m;fe().getBool("WEBGL_PACK_DEPTHWISECONV")&&f.strideWidth<=2&&f.outChannels/f.inChannels===1?m=new Q9(f):m=new J9(f);let x=[[f.padInfo.top,f.padInfo.left],[f.strideHeight,f.strideWidth],[f.dilationHeight,f.dilationWidth],[f.inHeight,f.inWidth]];return n.runWebGLProgram(m,[r,s],"float32",x)}var jAe={kernelName:ch,backendName:"webgl",kernelFunc:_Ae},DAe=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=`
3333      void main() {
3334        ivec4 coords = getOutputCoords();
3335        int wR = coords.x;
3336        int wC = coords.y;
3337        int d1 = coords.z;
3338        int dm = coords.w;
3339        int d2 = d1 * ${s} + dm;
3340
3341        float dotProd = 0.0;
3342
3343        // TO DO: Vec4 over the batch size
3344        for (int b = 0; b < ${e.batchSize}; b++) {
3345          for (int yR = 0; yR < ${e.outHeight}; yR++) {
3346            int xR = wR + yR * ${t} - ${a};
3347
3348            if (xR < 0 || xR >= ${e.inHeight}) {
3349              continue;
3350            }
3351
3352            for (int yC = 0; yC < ${e.outWidth}; yC++) {
3353              int xC = wC + yC * ${n} - ${r};
3354
3355              if (xC < 0 || xC >= ${e.inWidth}) {
3356                continue;
3357              }
3358
3359              float dyValue = getDy(b, yR, yC, d2);
3360              float xValue = getX(b, xR, xC, d1);
3361              dotProd += (xValue * dyValue);
3362            }
3363          }
3364        }
3365        setOutput(dotProd);
3366      }
3367    `}},RAe=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=`
3368      const ivec2 pads = ivec2(${s}, ${i});
3369
3370      void main() {
3371        ivec4 coords = getOutputCoords();
3372        int batch = coords[0];
3373        int d1 = coords[3];
3374        ivec2 dyCorner = coords.yz - pads;
3375        int dyRCorner = dyCorner.x;
3376        int dyCCorner = dyCorner.y;
3377
3378        float dotProd = 0.0;
3379
3380        for (int wR = 0; wR < ${t}; wR++) {
3381          float dyR = float(dyRCorner + wR) / ${a}.0;
3382
3383          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
3384            continue;
3385          }
3386          int idyR = int(dyR);
3387
3388          int wRPerm = ${t} - 1 - wR;
3389
3390          for (int wC = 0; wC < ${n}; wC++) {
3391            float dyC = float(dyCCorner + wC) / ${r}.0;
3392
3393            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
3394                fract(dyC) > 0.0) {
3395              continue;
3396            }
3397            int idyC = int(dyC);
3398
3399            int wCPerm = ${n} - 1 - wC;
3400
3401            // TO DO: Vec4 over the channelMul
3402            for (int dm = 0; dm < ${o}; dm++) {
3403              int d2 = d1 * ${o} + dm;
3404              float xValue = getDy(batch, idyR, idyC, d2);
3405              float wValue = getW(wRPerm, wCPerm, d1, dm);
3406              dotProd += xValue * wValue;
3407            }
3408          }
3409        }
3410        setOutput(dotProd);
3411      }
3412    `}};function MAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,filterShape:c}=a,f=W.computeConv2DInfo(r.shape,c,i,o,l,d,!0),m=new DAe(f);return n.runWebGLProgram(m,[r,s],"float32")}var $Ae={kernelName:vw,backendName:"webgl",kernelFunc:MAe};function BAe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,inputShape:c}=a,f=W.computeConv2DInfo(c,s.shape,i,o,l,d,!0),m=new RAe(f);return n.runWebGLProgram(m,[r,s],"float32")}var FAe={kernelName:ww,backendName:"webgl",kernelFunc:BAe},OAe=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=`
3413      void main() {
3414          ivec2 coords = getOutputCoords();
3415          float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;
3416          setOutput(val);
3417      }
3418    `}};function LAe(e){let{inputs:t,backend:n}=e,{x:a}=t,r=[...a.shape,...a.shape],s=R.sizeFromShape(a.shape),i=et({inputs:{x:a},backend:n,attrs:{shape:[s]}}),o=new OAe(s),l=n.runWebGLProgram(o,[i],i.dtype),d=et({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),d}var PAe={kernelName:lb,backendName:"webgl",kernelFunc:LAe},zAe=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:a,strideHeight:r,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:d}=e,{top:c,left:f}=a;this.userCode=`
3419      const ivec2 strides = ivec2(${r}, ${s});
3420      const ivec2 pads = ivec2(${c}, ${f});
3421      const float neg_infinity = -3.4e38;
3422
3423      void main() {
3424        ivec4 coords = getOutputCoords();
3425        int batch = coords.x;
3426        int d1 = coords.w;
3427        ivec2 outTopLeftCorner =
3428            coords.yz * strides - pads;
3429        int hBeg = outTopLeftCorner.x;
3430        int wBeg = outTopLeftCorner.y;
3431
3432        float curVal = neg_infinity;
3433        for (int h = 0; h < ${i}; h++) {
3434          int hIn = hBeg + h * ${l};
3435
3436          if (hIn >= 0 && hIn < ${t}) {
3437            for (int w = 0; w < ${o}; w++) {
3438              int wIn = wBeg + w * ${d};
3439
3440              if (wIn >= 0 && wIn < ${n}) {
3441                float xVal = getX(batch, hIn, wIn, d1);
3442                float wVal = getW(h, w, d1);
3443
3444                float val = xVal + wVal;
3445                if (val > curVal) {
3446                  curVal = val;
3447                }
3448              }
3449            }
3450          }
3451        }
3452
3453        float result = curVal;
3454        setOutput(result);
3455      }
3456    `}};function UAe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=W.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),c,f=new zAe(d);c=n.runWebGLProgram(f,[r,s],"float32");let m=et({inputs:{x:c},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(c),m}var WAe={kernelName:dh,backendName:"webgl",kernelFunc:UAe};function VAe(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=W.decodeEinsumEquation(r,s.length);W.checkEinsumDimSizes(i.length,l,s);let{path:d,steps:c}=W.getEinsumComputePath(o,l),f=c.length,m=null,x=i.length,y=[];for(let b=0;b<f;++b){for(let w of c[b]){let{permutationIndices:S,expandDims:k}=W.getEinsumPermutation(x,l[w]),C;
vendor: 1,042 bytes, lines 3456-3466
3456W.isIdentityPermutation(S)?C=s[w]:(C=Ss({inputs:{x:s[w]},backend:n,attrs:{perm:S}}),y.push(C));let E=C.shape.slice();for(let T=0;T<k.length;++T)E.splice(k[T],0,1);R.arraysEqual(C.shape,E)||(C=et({inputs:{x:C},backend:n,attrs:{shape:E}}),y.push(C)),m===null?m=C:(m=A4({inputs:{a:C,b:m},backend:n}),y.push(m))}b<f-1&&(d[b]>=0&&(m=L2({inputs:{x:m},backend:n,attrs:{axis:d[b]-(i.length-x),keepDims:!1}}),y.push(m)),x--)}for(let b of y)b!==m&&n.disposeIntermediateTensorInfo(b);return m}var HAe={kernelName:kw,backendName:"webgl",kernelFunc:VAe},GAe="return (x >= 0.0) ? x : (exp(x) - 1.0);",qAe=`
3457  vec4 result;
3458
3459  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
3460  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
3461  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
3462  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);
3463
3464  return result;
3465`,KAe=kn({opSnippet:GAe,packedOpSnippet:qAe}),XAe={kernelName:ph,backendName:"webgl",kernelFunc:KAe},YAe="return (b >= 0.0) ? a : a * (b + 1.0);",JAe=`
3466  vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
3467  return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));
3468`,QAe=e=>{let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=fe().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new jg(JAe,a.shape,r.shape):new zd(YAe,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)},ZAe={kernelName:Im,backendName:"webgl",kernelFunc:QAe},e_e=`
3469  return vec4(equal(a, b));
3470`,t_e="return float(a == b);",n_e=Gr({opSnippet:t_e,packedOpSnippet:e_e,dtype:"bool",cpuKernelImpl:DCe}),a_e={kernelName:Tm,backendName:"webgl",kernelFunc:n_e},r_e=`
3471  // Error function is calculated approximately with elementary function.
3472  // See "Handbook of Mathematical Functions with Formulas,
3473  // Graphs, and Mathematical Tables", Abramowitz and Stegun.
3474  float p = ${W.ERF_P};
3475  float a1 = ${W.ERF_A1};
3476  float a2 = ${W.ERF_A2};
3477  float a3 = ${W.ERF_A3};
3478  float a4 = ${W.ERF_A4};
3479  float a5 = ${W.ERF_A5};
3480
3481  float sign = sign(x);
3482  x = abs(x);
3483  float t = 1.0 / (1.0 + p * x);
3484  return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));
3485`,s_e=kn({opSnippet:r_e}),i_e={kernelName:fh,backendName:"webgl",kernelFunc:s_e},o_e=Dg+`
3486  return exp(x);
3487`,l_e=`
3488  vec4 result = exp(x);
3489  bvec4 isNaN = isnan(x);
3490  result.r = isNaN.r ? x.r : result.r;
3491  result.g = isNaN.g ? x.g : result.g;
3492  result.b = isNaN.b ? x.b : result.b;
3493  result.a = isNaN.a ? x.a : result.a;
3494
3495  return result;
3496`,Z9=kn({opSnippet:o_e,packedOpSnippet:l_e,cpuKernelImpl:RCe,dtype:"float32"}),u_e={kernelName:mh,backendName:"webgl",kernelFunc:Z9};function RE(e){let{inputs:t,attrs:n,backend:a}=e,{dim:r}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=r;return r<0&&(R.assert(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),o.splice(l,0,1),et({inputs:{x:s},backend:a,attrs:{shape:o}})}var c_e={kernelName:Am,backendName:"webgl",kernelFunc:RE},oB="return exp(x) - 1.0;",d_e=kn({opSnippet:oB,packedOpSnippet:oB,cpuKernelImpl:MCe}),h_e={kernelName:gh,backendName:"webgl",kernelFunc:d_e},lB=class{constructor(e,t,n){this.variableNames=["real","imag"];let a=t[1];this.outputShape=t;let r=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${a}.0`:"1.0",i;if(e==="real")i="return real * expR - imag * expI;";else if(e==="imag")i="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=`
3497      const float exponentMultiplier = ${r};
3498
3499      float unaryOpComplex(float real, float expR, float imag, float expI) {
3500        ${i}
3501      }
3502
3503      float mulMatDFT(int batch, int index) {
3504        float indexRatio = float(index) / float(${a});
3505        float exponentMultiplierTimesIndexRatio =
3506            exponentMultiplier * indexRatio;
3507
3508        float result = 0.0;
3509
3510        for (int i = 0; i < ${a}; i++) {
3511          // x = (-2|2 * PI / N) * index * i;
3512          float x = exponentMultiplierTimesIndexRatio * float(i);
3513          float expR = cos(x);
3514          float expI = sin(x);
3515          float real = getReal(batch, i);
3516          float imag = getImag(batch, i);
3517
3518          result +=
3519              unaryOpComplex(real, expR, imag, expI) / ${s};
3520        }
3521
3522        return result;
3523      }
3524
3525      void main() {
3526        ivec2 coords = getOutputCoords();
3527        setOutput(mulMatDFT(coords[0], coords[1]));
3528      }
3529    `}};function eW(e,t,n){let a=n.texData.get(e.dataId),r=R.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=r/s,o=et({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,d=new lB("real",l,t),c=new lB("imag",l,t),f=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:l},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:l}],m=n.runWebGLProgram(d,f,"float32"),x=n.runWebGLProgram(c,f,"float32"),y=Sc({inputs:{real:m,imag:x},backend:n});n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x);let b=et({inputs:{x:y},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(y),b}function p_e(e){let{inputs:t,backend:n}=e,{input:a}=t;return eW(a,!1,n)}var f_e={kernelName:Nw,backendName:"webgl",kernelFunc:p_e},m_e=class{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode=`
3530      void main() {
3531        // Input can be obtained from uniform value.
3532        setOutput(value);
3533      }
3534    `}};function n0(e){let{backend:t,attrs:n}=e,{shape:a,value:r}=n,{dtype:s}=n;if(s=s||R.inferDtype(r),s==="string"){let i=R.getArrayFromDType(s,R.sizeFromShape(a));return i.fill(r),t.makeTensorInfo(a,s,i)}else{let i=new m_e(a,r),o=[[r]];return t.runWebGLProgram(i,[],s,o)}}var g_e={kernelName:ub,backendName:"webgl",kernelFunc:n0},x_e=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode=`
3535        void main() {
3536          ivec4 coords = getOutputCoords();
3537          int x = coords[2];
3538
3539          int coordX = ${t} - x - 1;
3540          float outputValue;
3541          if(coordX >= 0 && coordX < ${t}) {
3542            outputValue = getImage(coords[0], coords[1], coordX, coords[3]);
3543          } else {
3544            outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);
3545          }
3546          setOutput(outputValue);
3547        }
3548    `}},y_e={kernelName:_m,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,a=t,r=new x_e(n.shape);return a.runWebGLProgram(r,[n],n.dtype)}},uB="return floor(x);",b_e=kn({opSnippet:uB,packedOpSnippet:uB,cpuKernelImpl:$Ce}),v_e={kernelName:xh,backendName:"webgl",kernelFunc:b_e},w_e=`
3549  float s = sign(a) * sign(b);
3550  int ia = round(a);
3551  int ib = round(b);
3552  if (ib != 0) {
3553    // Windows (D3D) wants guaranteed non-zero int division at compile-time.
3554    return float(idiv(ia, ib, s));
3555  } else {
3556    return NAN;
3557  }
3558`,S_e=`
3559  ivec4 ia = round(a);
3560  ivec4 ib = round(b);
3561  bvec4 cond = notEqual(ib, ivec4(0));
3562  ivec4 result = ivec4(0);
3563  vec4 s = sign(a) * sign(b);
3564
3565  // Windows (D3D) wants guaranteed non-zero int division at compile-time.
3566  if (cond[0]) {
3567    result[0] = idiv(ia[0], ib[0], s[0]);
3568  }
3569  if (cond[1]) {
3570    result[1] = idiv(ia[1], ib[1], s[1]);
3571  }
3572  if (cond[2]) {
3573    result[2] = idiv(ia[2], ib[2], s[2]);
3574  }
3575  if (cond[3]) {
3576    result[3] = idiv(ia[3], ib[3], s[3]);
3577  }
3578  return vec4(result);
3579`,k_e=Gr({opSnippet:w_e,packedOpSnippet:S_e,dtype:"int32"}),N_e={kernelName:yh,backendName:"webgl",kernelFunc:k_e},C_e=class{constructor(e){this.variableNames=["A"];let t=Is(),[n,a]=e;this.outputShape=e,this.userCode=`
3580      void main() {
3581        ivec3 coords = getOutputCoords();
3582        int texR = coords[0];
3583        int texC = coords[1];
3584        int depth = coords[2];
3585        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${a}.0, ${n}.0);
3586
3587        vec4 values = ${t.texture2D}(A, uv);
3588        float value;
3589        if (depth == 0) {
3590          value = values.r;
3591        } else if (depth == 1) {
3592          value = values.g;
3593        } else if (depth == 2) {
3594          value = values.b;
3595        } else if (depth == 3) {
3596          value = values.a;
3597        }
3598
3599        setOutput(floor(value * 255.0 + 0.5));
3600      }
3601    `}},E_e=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=Is(),[n,a]=e;this.outputShape=e,this.userCode=`
3602      void main() {
3603        ivec3 coords = getOutputCoords();
3604        int texR = coords[0];
3605        int texC = coords[1];
3606        int depth = coords[2];
3607
3608        vec4 result = vec4(0.);
3609
3610        for(int row=0; row<=1; row++) {
3611          for(int col=0; col<=1; col++) {
3612            texC = coords[1] + row;
3613            depth = coords[2] + col;
3614
3615            vec2 uv = (vec2(texC, texR) + halfCR) /
3616                       vec2(${a}.0, ${n}.0);
3617            vec4 values = ${t.texture2D}(A, uv);
3618            float value;
3619            if (depth == 0) {
3620              value = values.r;
3621            } else if (depth == 1) {
3622              value = values.g;
3623            } else if (depth == 2) {
3624              value = values.b;
3625            } else if (depth == 3) {
3626              value = values.a;
3627            }
3628
3629            result[row * 2 + col] = floor(value * 255.0 + 0.5);
3630          }
3631        }
3632
3633        ${t.output} = result;
3634      }
3635    `}},I_e={kernelName:Ev,backendName:"webgl",kernelFunc:T_e},cf,FN=fe().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");function T_e(e){let{inputs:t,backend:n,attrs:a}=e,{pixels:r}=t,{numChannels:s}=a,i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement,[l,d]=i?[r.videoWidth,r.videoHeight]:[r.width,r.height],c=[d,l],f=[d,l,s];if(o||i){let b=fe().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");(cf==null||b!==FN)&&(FN=b,cf=document.createElement("canvas").getContext("2d",{willReadFrequently:FN})),cf.canvas.width=l,cf.canvas.height=d,cf.drawImage(r,0,0,l,d),r=cf.canvas}let m=n.makeTensorInfo(c,"int32");n.texData.get(m.dataId).usage=Ti.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(m.dataId),r);let x=fe().getBool("WEBGL_PACK")?new E_e(f):new C_e(f),y=n.runWebGLProgram(x,[m],"int32");return n.disposeData(m.dataId),y}function A_e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:c,dilations:f,dimRoundingMode:m,activation:x,leakyreluAlpha:y}
vendor: 10,497 bytes, lines 3635-3738
3635=a,b=W.convertConv2DDataFormat(c),w=W.computeConv2DInfo(r.shape,s.shape,l,f,d,m,!1,b),S,k=[],C=i!=null,E=o!=null,T=x==="leakyrelu",_=()=>{let $=[r,s],O=(z,P)=>{if(P==="NCHW"&&z.shape.length===1&&z.shape[0]!==1){let j=et({inputs:{x:z},backend:n,attrs:{shape:[z.shape[0],1,1]}});return k.push(j),j}return z};if(C&&$.push(O(i,c)),E&&$.push(O(o,c)),T){let z=n.makeTensorInfo([],"float32",R.createScalarValue(y,"float32"));$.push(z),k.push(z)}return $};if(w.filterHeight===1&&w.filterWidth===1&&w.dilationHeight===1&&w.dilationWidth===1&&w.strideHeight===1&&w.strideWidth===1&&(w.padInfo.type==="SAME"||w.padInfo.type==="VALID"))S=K9({x:r,filter:s,convInfo:w,backend:n,bias:i,activation:x,preluActivationWeights:o,leakyreluAlpha:y});else if(w.strideWidth<=2&&b==="channelsLast"&&fe().getBool("WEBGL_EXP_CONV")){let $=x?Vy(x,!0):null,O=new q9(w,C,$,E,T),z=[[w.padInfo.top,w.padInfo.left],[w.strideHeight,w.strideWidth],[w.dilationHeight,w.dilationWidth],[w.inHeight,w.inWidth]],P=_();S=n.runWebGLProgram(O,P,"float32",z)}else if(fe().getBool("WEBGL_CONV_IM2COL"))S=X9({x:r,filter:s,convInfo:w,backend:n,bias:i,activation:x,preluActivationWeights:o,leakyreluAlpha:y});else{let $=x?Vy(x,!1):null,O=new G9(w,C,$,E,T),z=_();S=n.runWebGLProgram(O,z,"float32")}let A=et({inputs:{x:S},backend:n,attrs:{shape:w.outShape}});return k.push(S),k.forEach($=>n.disposeIntermediateTensorInfo($)),A}var __e={kernelName:Cd,backendName:"webgl",kernelFunc:A_e};function j_e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:c,dimRoundingMode:f,activation:m,leakyreluAlpha:x}=a,y=[],b=c;b==null&&(b=[1,1]),R.assert(W.eitherStridesOrDilationsAreOne(l,b),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${b}'`);let w=W.computeConv2DInfo(r.shape,s.shape,l,b,d,f,!0),S=fe().getBool("WEBGL_PACK_DEPTHWISECONV")&&w.strideWidth<=2&&w.outChannels/w.inChannels===1,k=m?Vy(m,S):null,C=[r,s],E=i!=null,T=o!=null,_=m==="leakyrelu";if(E&&C.push(i),T&&C.push(o),_){let z=n.makeTensorInfo([],"float32",R.createScalarValue(x,"float32"));C.push(z),y.push(z)}let A;S?A=new Q9(w,E,k,T,_):A=new J9(w,E,k,T,_);let $=[[w.padInfo.top,w.padInfo.left],[w.strideHeight,w.strideWidth],[w.dilationHeight,w.dilationWidth],[w.inHeight,w.inWidth]],O=n.runWebGLProgram(A,C,"float32",$);return y.forEach(z=>n.disposeIntermediateTensorInfo(z)),O}var D_e={kernelName:Ed,backendName:"webgl",kernelFunc:j_e},R_e=class{constructor(e,t,n,a){this.sliceDim=e,this.strides=t,this.paramsShape=a,this.variableNames=["x","indices"],this.outputShape=n;let r=ea(n.length),s=`
3636    int index;`;for(let i=0;i<this.sliceDim;i++)s+=`
3637          index = round(getIndices(coords[0], ${i}));
3638          out_of_bounds = out_of_bounds || index < 0;
3639          out_of_bounds = out_of_bounds || index >= ${this.paramsShape[i]};
3640          flattenIndex += index * ${this.strides[i]};`;this.userCode=`
3641         void main() {
3642          ${r} coords = getOutputCoords();
3643          int flattenIndex = 0;
3644          bool out_of_bounds = false;
3645
3646          ${s}
3647
3648          setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));
3649        }
3650      `}};function M_e(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=r.shape,i=s[s.length-1],o=R.sizeFromShape(a.shape),[l,d,c,f]=W.prepareAndValidate(a,r),m=et({inputs:{x:r},backend:n,attrs:{shape:[d,i]}}),x=et({inputs:{x:a},backend:n,attrs:{shape:[R.sizeFromShape(a.shape)/c,c]}});if(n.shouldExecuteOnCPU([a,r])||a.dtype==="string"){let S=n.readSync(r.dataId),k=n.bufferSync(a),C=BCe(S,k,a.dtype,d,i,c,f,a.shape,o);return n.makeTensorInfo(l,a.dtype,C.values)}let y=new R_e(i,f,[d,c],a.shape),b=n.runWebGLProgram(y,[x,m],x.dtype),w=et({inputs:{x:b},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(b),w}var $_e={kernelName:Dm,backendName:"webgl",kernelFunc:M_e},B_e=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=ea(this.rank),a=F_e(e);this.userCode=`
3651      void main() {
3652        ${n} resRC = getOutputCoords();
3653        int index = int(getIndices(resRC.x, resRC.z));
3654        float inBounds = (index >= 0) && (index < ${e[2]}) ? 1.0 : 0.0;
3655        setOutput(inBounds * getA(${a}));
3656      }
3657    `}};function F_e(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[];for(let r=0;r<e.length;r++)r===2?a.push("index"):a.push(`${n[r]}`);return a.join()}function tW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,indices:s}=t,{axis:i,batchDims:o}=a,l=R.parseAxisParam(i,r.shape)[0];if(fe().get("DEBUG")){let k=n.readSync(s.dataId),C=r.shape[l];for(let E=0;E<k.length;++E){let T=k[E];R.assert(T<=C-1&&T>=0,()=>`GatherV2: the index value ${T} is not in [0, ${C-1}]`)}}let d=W.segment_util.collectGatherOpShapeInfo(r,s,l,o),c=R.sizeFromShape(s.shape),f=[],m=et({inputs:{x:r},backend:n,attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]}}),x=et({inputs:{x:s},backend:n,attrs:{shape:[d.batchSize,c/d.batchSize]}});f.push(m),f.push(x);let y=[d.batchSize,d.outerSize,c/d.batchSize,d.sliceSize];if(n.shouldExecuteOnCPU([r,s])||r.dtype==="string"){let k=n.bufferSync(x),C=n.bufferSync(m),E=FCe(C,k,y);return f.forEach(T=>n.disposeIntermediateTensorInfo(T)),n.makeTensorInfo(d.outputShape,E.dtype,E.values)}let b=new B_e(m.shape,y),w=n.runWebGLProgram(b,[m,x],m.dtype);f.push(w);let S=et({inputs:{x:w},backend:n,attrs:{shape:d.outputShape}});return f.forEach(k=>n.disposeIntermediateTensorInfo(k)),S}var O_e={kernelName:jm,backendName:"webgl",kernelFunc:tW},L_e="return float(a > b);",P_e=`
3658  return vec4(greaterThan(a, b));
3659`,z_e=Gr({opSnippet:L_e,packedOpSnippet:P_e,cpuKernelImpl:OCe,dtype:"bool"}),U_e={kernelName:Rm,backendName:"webgl",kernelFunc:z_e},W_e="return float(a >= b);",V_e=`
3660  return vec4(greaterThanEqual(a, b));
3661`,H_e=Gr({opSnippet:W_e,packedOpSnippet:V_e,dtype:"bool",cpuKernelImpl:LCe}),G_e={kernelName:vh,backendName:"webgl",kernelFunc:H_e};function q_e(e){let{inputs:t,backend:n}=e,{input:a}=t;return eW(a,!0,n)}var K_e={kernelName:Cw,backendName:"webgl",kernelFunc:q_e},X_e="return float(!isnan(x) && !isinf(x));",Y_e=kn({opSnippet:X_e,dtype:"bool"}),J_e={kernelName:Sh,backendName:"webgl",kernelFunc:Y_e},Q_e="return float(isinf(x));",Z_e=kn({opSnippet:Q_e,dtype:"bool"}),e4e={kernelName:kh,backendName:"webgl",kernelFunc:Z_e},t4e="return float(isnan(x));",n4e=kn({opSnippet:t4e,dtype:"bool"}),a4e={kernelName:Nh,backendName:"webgl",kernelFunc:n4e},r4e="return float(a < b);",s4e=`
3662  return vec4(lessThan(a, b));
3663`,i4e=Gr({opSnippet:r4e,packedOpSnippet:s4e,cpuKernelImpl:PCe,dtype:"bool"}),o4e={kernelName:Mm,backendName:"webgl",kernelFunc:i4e},l4e="return float(a <= b);",u4e=`
3664  return vec4(lessThanEqual(a, b));
3665`,c4e=Gr({opSnippet:l4e,packedOpSnippet:u4e,cpuKernelImpl:zCe,dtype:"bool"}),d4e={kernelName:$m,backendName:"webgl",kernelFunc:c4e};function h4e(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=UCe(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var p4e={kernelName:Bm,backendName:"webgl",kernelFunc:h4e},f4e=Dg+`
3666  return x < 0.0 ? 0./0. : log(x);
3667`,m4e=`
3668  vec4 result = log(x);
3669  bvec4 isNaN = isnan(x);
3670  result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);
3671  result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);
3672  result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);
3673  result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);
3674  return result;
3675`,g4e=kn({opSnippet:f4e,packedOpSnippet:m4e,cpuKernelImpl:WCe}),x4e={kernelName:Eh,backendName:"webgl",kernelFunc:g4e},y4e=Dg+`
3676  return log(1.0 + x);
3677`,b4e=kn({opSnippet:y4e}),v4e={kernelName:Ih,backendName:"webgl",kernelFunc:b4e},w4e="return float(a >= 1.0 && b >= 1.0);",S4e=`
3678  return vec4(
3679    vec4(greaterThanEqual(a, vec4(1.0))) *
3680    vec4(greaterThanEqual(b, vec4(1.0))));
3681`,k4e=Gr({opSnippet:w4e,packedOpSnippet:S4e,dtype:"bool"}),N4e={kernelName:Fm,backendName:"webgl",kernelFunc:k4e},C4e="return float(!(x >= 1.0));",E4e=kn({opSnippet:C4e}),I4e={kernelName:Om,backendName:"webgl",kernelFunc:E4e},T4e="return float(a >= 1.0 || b >= 1.0);",A4e=`
3682  return min(
3683    vec4(greaterThanEqual(a, vec4(1.0))) +
3684    vec4(greaterThanEqual(b, vec4(1.0))),
3685    vec4(1.0));
3686`,_4e=Gr({opSnippet:T4e,packedOpSnippet:A4e,dtype:"bool"}),j4e={kernelName:Lm,backendName:"webgl",kernelFunc:_4e},D4e=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=`
3687      void main() {
3688        ivec4 coords = getOutputCoords();
3689        int b = coords[0];
3690        int r = coords[1];
3691        int c = coords[2];
3692        int d = coords[3];
3693        float x = getX(b, r, c, d);
3694        float sum = 0.0;
3695        for (int j = -${s}; j <= ${s}; j++) {
3696          int idx = d + j;
3697          if (idx >= 0 && idx <=  ${i}) {
3698            float z = getX(b, r, c, idx);
3699            sum += z * z;
3700          }
3701        }
3702        float val = x * ${o};
3703        setOutput(val);
3704      }
3705    `}},R4e=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=`
3706      void main() {
3707        ivec4 coords = getOutputCoords();
3708        int b = coords.x;
3709        int r = coords.y;
3710        int c = coords.z;
3711        int d = coords.w;
3712
3713        bool hasNextCol = d < ${this.outputShape[3]};
3714        bool hasNextRow = c < ${this.outputShape[2]};
3715
3716        vec4 sum = vec4(0.);
3717        vec4 xFragAtOutputCoords = getX(b, r, c, d);
3718
3719        vec4 xAtOutputCoords = vec4(
3720          getChannel(xFragAtOutputCoords, vec2(c, d)),
3721          hasNextCol ?
3722            getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,
3723          hasNextRow ?
3724            getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,
3725          (hasNextRow && hasNextCol) ?
3726            getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0
3727        );
3728
3729        int firstChannel = d - ${s};
3730        vec2 cache = vec2(0.);
3731        if(firstChannel >= 0){
3732          vec4 firstChannelFrag = getX(b, r, c, firstChannel);
3733          cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));
3734            if(hasNextRow){
3735              cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));
3736            }
3737        }
3738
3739        ivec2 depth = ivec2(d, d + 1);
3740        for (int j = - ${s}; j <= ${s}; j++) {
3741          ivec2 idx = depth + j;
3742          bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));
3743          bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${i}));
3744
3745          bool depthInRange = aboveLowerBound.x && belowUpperBound.x;
3746          bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;
3747
3748          if(depthInRange || depthPlusOneInRange){
3749            vec4 z = vec4(0.);
3750            vec4 xFragAtCurrentDepth;
3751            z.xz = cache.xy;
3752            if(depthPlusOneInRange && hasNextCol){
3753              xFragAtCurrentDepth = idx.y != d ?
3754                getX(b, r, c, idx.y) : xFragAtOutputCoords;
3755              z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));
3756              if(hasNextRow){
3757                z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));
3758              }
3759            }
3760            cache.xy = z.yw;
3761            sum += z * z;
3762          }
3763        }
3764        vec4 result = xAtOutputCoords * ${o};
3765        setOutput(result);
3766      }
3767    `}},M4e=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a,d=fe().getBool("WEBGL_PACK_NORMALIZATION")?new R4e(r.shape,s,i,o,l):new D4e(r.shape,s,i,o,l);return n.runWebGLProgram(d,[r],r.dtype)},$4e={kernelName:Th,backendName:"webgl",kernelFunc:M4e},B4e=class{constructor(e,t,n,a,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=a,this.beta=r,this.userCode=`
3768      void main() {
3769        ivec4 coords = getOutputCoords();
3770        int b = coords[0];
3771        int r = coords[1];
3772        int c = coords[2];
3773
3774        float result = 0.0;
3775        for (int d = 0; d < ${this.depth}; ++d) {
3776          int depthBegin = int(max(0.0, float(d - ${t})));
3777          int depthEnd = int(min(float(${this.depth}),
3778              float(d + ${t} + 1)));
3779
3780          const int MIN_DEPTH_BEGIN = 0;
3781          const int MAX_DEPTH_END = ${this.depth};
3782
3783          float norm = 0.0;
3784          for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {
3785            if (k < depthBegin){
3786              continue;
3787            }
3788            else if (k >= depthBegin && k < depthEnd) {
3789              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);
3790            }
3791            else {
3792              break;
3793            }
3794          }
3795
3796          norm = float(${a}) * norm + float(${n});
3797
3798          for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){
3799            if (k < depthBegin){
3800              continue;
3801            }
3802            else if (k >= depthBegin && k < depthEnd){
3803              float dyi = -2.0 * float(${a})
3804                * float(${r})
3805                * getInputImage(b, r, c, k) * getOutputImage(b, r, c, d)
3806                / norm;
3807              if (k == d) {
3808                dyi += pow(norm, -1.0 * ${r});
3809              }
3810              if (k == coords[3]) {
3811                dyi *= getDy(b, r, c, d);
3812                result += dyi;
3813              }
3814            }
3815            else {
3816              break;
3817            }
3818          }
3819      }
3820      setOutput(result);
3821      }
3822    `}},F4e=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:c}=a,f=new B4e(r.shape,o,l,d,c);return n.runWebGLProgram(f,[r,s,i],r.dtype)},O4e={kernelName:Pm,backendName:"webgl",kernelFunc:F4e};function L4e(e,t,n,a){let r=R.sizeFromShape(t),s=R.sizeFromShape(e.shape)/r,i=et({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=vp(i,e.dtype,"max",a),l=et({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}function nW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=r.shape.length,l=R.parseAxisParam(s,r.shape),d=l,c=W.getAxesPermutation(d,o),f=c!=null,m=n.shouldExecuteOnCPU([r]),x=r;if(f){if(m){let k=n.texData.get(x.dataId).values,C=new Array(o);for(let _=0;_<C.length;_++)C[_]=r.shape[c[_]];let E=E4(k,r.shape,r.dtype,c,C);x=n.makeTensorInfo(C,r.dtype);let T=n.texData.get(x.dataId);T.values=E}else x=O2(r,c,n);d=W.getInnerMostAxes(d.length,o)}W.assertAxesAreInnerMostDims("max",d,o);let[y,b]=W.computeOutAndReduceShapes(x.shape,d),w=y;i&&(w=W.expandShapeToKeepDim(y,l));let S;if(m){let k=n.texData.get(x.dataId).values,C=VCe(k,R.sizeFromShape(b),w,r.dtype);S=n.makeTensorInfo(w,r.dtype);let E=n.texData.get(S.dataId);E.values=C}else S=L4e(x,b,w,n);return f&&n.disposeIntermediateTensorInfo(x),S}var P4e={kernelName:Ah,backendName:"webgl",kernelFunc:nW},z4e=T4+`
3823  return max(a, b);
3824`,U4e=`
3825  vec4 result = vec4(max(a, b));
3826  bvec4 isNaNA = isnan(a);
3827  bvec4 isNaNB = isnan(b);
3828  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
3829  `+bp+`
3830  return result;
3831`,W4e=Gr({opSnippet:z4e,packedOpSnippet:U4e,cpuKernelImpl:HCe}),V4e={kernelName:_h,backendName:"webgl",kernelFunc:W4e};function H4e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Eg(r,"maxPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;R.assert(W.eitherStridesOrDilationsAreOne(i,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let c=W.computePool2DInfo(r.shape,s,i,d,o,l);if(c.filterWidth===1&&c.filterHeight===1&&R.arraysEqual(c.inShape,c.outShape))return li({inputs:{x:r},backend:n});let f=new Hy(c,"max",!1);return n.runWebGLProgram(f,[r],r.dtype)}var G4e={kernelName:jh,backendName:"webgl",kernelFunc:H4e};function q4e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:d}=a,c=[1,1,1],f=W.computePool3DInfo(r.shape,s,i,c,o,d,l),m=new _4(f,"max",!1);return n.runWebGLProgram(m,[r],r.dtype)}var K4e={kernelName:zm,backendName:"webgl",kernelFunc:q4e},X4e=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,a=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=r-1-e.padInfo.top,o=s-1-e.padInfo.left,l=r*s-1;this.userCode=`
3832      const ivec2 pads = ivec2(${i}, ${o});
3833
3834      void main() {
3835        ivec4 coords = getOutputCoords();
3836        int b = coords[0];
3837        int d = coords[3];
3838
3839        ivec2 dyRCCorner = coords.yz - pads;
3840        int dyRCorner = dyRCCorner.x;
3841        int dyCCorner = dyRCCorner.y;
3842
3843        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
3844        // ? = to be determined. : = across all values in that axis.
3845        float dotProd = 0.0;
3846        for (int wR = 0; wR < ${r};
3847          wR += ${a}) {
3848          float dyR = float(dyRCorner + wR) / ${t}.0;
3849
3850          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {
3851            continue;
3852          }
3853          int idyR = int(dyR);
3854
3855          for (int wC = 0; wC < ${s}; wC++) {
3856            float dyC = float(dyCCorner + wC) / ${n}.0;
3857
3858            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
3859                fract(dyC) > 0.0) {
3860              continue;
3861            }
3862            int idyC = int(dyC);
3863
3864            float dyValue = getDy(b, idyR, idyC, d);
3865            int maxPosValue = ${l} - int(getMaxPos(b, idyR, idyC, d));
3866
3867            // Get the current value, check it against the value from the
3868            // position matrix.
3869            int curPosValue = wR * ${s} + wC;
3870            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
3871
3872            dotProd += dyValue * mask;
3873          }
3874        }
3875        setOutput(dotProd);
3876      }
3877    `}},Y4e=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,d=e.effectiveFilterWidth,c=o-1-e.padInfo.front,f=l-1-e.padInfo.top,m=d-1-e.padInfo.left,x=o*l*d-1;this.userCode=`
3878      const ivec3 pads = ivec3(${c}, ${f}, ${m});
3879
3880      void main() {
3881        ivec5 coords = getOutputCoords();
3882        int batch = coords.x;
3883        int ch = coords.u;
3884
3885        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
3886        int dyDCorner = dyCorner.x;
3887        int dyRCorner = dyCorner.y;
3888        int dyCCorner = dyCorner.z;
3889
3890        // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
3891        // dx(xD, xR, xC, ch).
3892        // ? = to be determined. : = across all values in that axis.
3893        float dotProd = 0.0;
3894
3895        for (int wD = 0; wD < ${o};
3896           wD += ${r}) {
3897          float dyD = float(dyDCorner + wD) / ${t}.0;
3898
3899          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {
3900            continue;
3901          }
3902          int idyD = int(dyD);
3903
3904          for (int wR = 0; wR < ${l};
3905              wR += ${s}) {
3906            float dyR = float(dyRCorner + wR) / ${n}.0;
3907
3908            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||
3909                fract(dyR) > 0.0) {
3910              continue;
3911            }
3912            int idyR = int(dyR);
3913
3914            for (int wC = 0; wC < ${d};
3915                wC += ${i}) {
3916              float dyC = float(dyCCorner + wC) / ${a}.0;
3917
3918              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||
3919                  fract(dyC) > 0.0) {
3920                continue;
3921              }
3922              int idyC = int(dyC);
3923
3924              float dyValue = getDy(batch, idyD, idyR, idyC, ch);
3925              int maxPosValue = ${x} -
3926                  int(getMaxPos(batch, idyD, idyR, idyC, ch));
3927
3928              // Get the current value, check it against the value from the
3929              // position matrix.
3930              int curPosValue =
3931                  wD * ${l} * ${d} +
3932                  wR * ${d} + wC;
3933              float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
3934
3935              dotProd += dyValue * mask;
3936            }
3937          }
3938        }
3939        setOutput(dotProd);
3940      }
3941    `}};function J4e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:c}=a,f=[1,1,1],m=W.computePool3DInfo(i.shape,o,l,f,d,c),x=new _4(m,"max",!0),y=n.runWebGLProgram(x,[i],i.dtype),b=new Y4e(m),w=n.runWebGLProgram(b,[r,y],i.dtype);return n.disposeIntermediateTensorInfo(y),w}var Q4e={kernelName:db,backendName:"webgl",kernelFunc:J4e};function Z4e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;Eg([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:c,dimRoundingMode:f}=a,m=W.computePool2DInfo(o.shape,l,d,1,c,f),x=!0,y=new Hy(m,"max",x),b=n.runWebGLProgram(y,[o],o.dtype),w=new X4e(m),S=n.runWebGLProgram(w,[r,b],o.dtype);return n.disposeIntermediateTensorInfo(b),S}var e3e={kernelName:cb,backendName:"webgl",kernelFunc:Z4e};function t3e(e,t,n,a){let r=new Hy(n,"max",!1),s=a.runWebGLProgram(r,[e],"float32");r=new Hy(n,"max",!0,!0,t);let i=a.runWebGLProgram(r,[e],"float32");return[s,i]}var n3e={kernelName:hb,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;R.assert(a.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.shape.length}.`);let d=[1,1];R.assert(W.eitherStridesOrDilationsAreOne(s,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${d}'`);let c=W.computePool2DInfo(a.shape,r,s,d,i),[f,m]=t3e(a,o,c,l);return[f,m]}};function a3e(e,t,n,a){let r=R.sizeFromShape(t),s=R.sizeFromShape(e.shape)/r,i=et({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=vp(i,"float32","mean",a),l=et({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}var r3e={kernelName:Dh,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{keepDims:r,axis:s}=t,i=n,o=a.shape.length,l=R.parseAxisParam(s,a.shape),d=l,c=W.getAxesPermutation(d,o),f=c!=null,m=i.shouldExecuteOnCPU([a]),x=[],y=a;if(f){if(m){let C=i.texData.get(y.dataId).values,E=new Array(o);for(let A=0;A<E.length;A++)E[A]=a.shape[c[A]];let T=E4(C,a.shape,a.dtype,c,E);y=i.makeTensorInfo(E,a.dtype);let _=i.texData.get(y.dataId);_.values=T}else y=O2(a,c,i);x.push(y),d=W.getInnerMostAxes(d.length,o)}W.assertAxesAreInnerMostDims("sum",d,o);let[b,w]=W.computeOutAndReduceShapes(y.shape,d),S=b;r&&(S=W.expandShapeToKeepDim(b,l));let k=a3e(y,w,S,i);for(let C of x)i.disposeIntermediateTensorInfo(C);return k}};function s3e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=R.parseAxisParam(s,r.shape),d=l,c=W.getAxesPermutation(d,o),f=r;
vendor: 5,155 bytes, lines 3941-4058
3941c!=null&&(f=Ss({inputs:{x:r},backend:n,attrs:{perm:c}}),d=W.getInnerMostAxes(d.length,r.shape.length)),W.assertAxesAreInnerMostDims("min",d,o);let[m,x]=W.computeOutAndReduceShapes(f.shape,d),y=R.sizeFromShape(x),b=et({inputs:{x:f},backend:n,attrs:{shape:[-1,y]}}),w=vp(b,b.dtype,"min",n),S;if(i){let k=W.expandShapeToKeepDim(m,l);S=et({inputs:{x:w},backend:n,attrs:{shape:k}})}else S=et({inputs:{x:w},backend:n,attrs:{shape:m}});return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(w),c!=null&&n.disposeIntermediateTensorInfo(f),S}var i3e={kernelName:Rh,backendName:"webgl",kernelFunc:s3e},o3e=T4+`
3942  return min(a, b);
3943`,l3e=`
3944  vec4 result = vec4(min(a, b));
3945  bvec4 isNaNA = isnan(a);
3946  bvec4 isNaNB = isnan(b);
3947  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);
3948  `+bp+`
3949  return result;
3950`,u3e=Gr({opSnippet:o3e,packedOpSnippet:l3e,cpuKernelImpl:GCe}),c3e={kernelName:Mh,backendName:"webgl",kernelFunc:u3e},d3e=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((d,c)=>d[0]+e[c]+d[1]);let a=e.length,r=ea(a),s=t.map(d=>d[0]).join(","),i=t.map((d,c)=>d[0]+e[c]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l=n==="reflect"?0:1;if(a===1){this.userCode=`
3951        int start = ${s};
3952        int end = ${i};
3953
3954        void main() {
3955          int outC = getOutputCoords();
3956          if (outC < start) {
3957            outC = start * 2 - outC - ${l};
3958          } else if(outC >= end) {
3959            outC = (end - 1) * 2 - outC + ${l};
3960          }
3961          setOutput(getX(outC - start));
3962        }
3963      `;return}this.userCode=`
3964      ${r} start = ${r}(${s});
3965      ${r} end = ${r}(${i});
3966
3967      void main() {
3968        ${r} outC = getOutputCoords();
3969        for (int i = 0; i < ${a}; i++) {
3970          if (outC[i] < start[i]) {
3971            outC[i] = start[i] * 2 - outC[i] - ${l};
3972          } else if(outC[i] >= end[i]) {
3973            outC[i] = (end[i] - 1) * 2 - outC[i] + ${l};
3974          }
3975        }
3976        ${r} coords = outC - start;
3977        setOutput(getX(${o}));
3978      }
3979    `}},h3e=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((x,y)=>x[0]+e[y]+x[1]);let a=e.length,r=ea(a),s=t.map(x=>x[0]).join(","),i=t.map((x,y)=>x[0]+e[y]).join(","),o=xs("rc",a),l=xs("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,c=a===1?"source":`vec2(${l.slice(-2).join()})`,f=n==="reflect"?0:1,m="";if(a===1){let x=`
3980        ${r} source = rc;
3981        if (source < start) {
3982          source = start * 2 - source - ${f};
3983        } else if (source >= end) {
3984          source = (end - 1) * 2 - source + ${f};
3985        }
3986        source -= start;
3987      `;m=`
3988        ${r} rc = outputLoc;
3989        ${x}
3990        result[0] = getChannel(getX(${l.join()}), ${c});
3991        ${o[a-1]} += 1;
3992        if(${d}) {
3993          ${x}
3994          result[1] = getChannel(getX(${l.join()}), ${c});
3995        }
3996      `}else{let x=`
3997        ${r} source = rc;
3998        ${r} lt = ${r}(lessThan(source, start));
3999        ${r} gte = ${r}(greaterThanEqual(source, end));
4000        ${r} orig = 1 - (lt + gte);
4001        source = orig * source +
4002                lt * (start * 2 - source - ${f}) +
4003                gte * ((end - 1) * 2 - source + ${f});
4004        source -= start;
4005      `;m=`
4006        ${r} rc = outputLoc;
4007        ${x}
4008        result[0] = getChannel(getX(${l.join()}), ${c});
4009        ${o[a-1]} += 1;
4010        if(${d}) {
4011          ${x}
4012          result[1] = getChannel(getX(${l.join()}), ${c});
4013        }
4014        rc = outputLoc;
4015        ${o[a-2]} += 1;
4016        if(${o[a-2]} < ${this.outputShape[a-2]}) {
4017          ${x}
4018          result[2] = getChannel(getX(${l.join()}), ${c});
4019          ${o[a-1]} += 1;
4020          if(${d}) {
4021            ${x}
4022            result[3] = getChannel(getX(${l.join()}), ${c});
4023          }
4024        }
4025      `}this.userCode=`
4026      const ${r} start = ${r}(${s});
4027      const ${r} end = ${r}(${i});
4028
4029      void main() {
4030        ${r} outputLoc = getOutputCoords();
4031        vec4 result = vec4(0.);
4032        ${m}
4033        setOutput(result);
4034      }
4035    `}},p3e=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{paddings:r,mode:s}=n,i=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new h3e(a.shape,r,s):new d3e(a.shape,r,s);return t.runWebGLProgram(i,[a],a.dtype)},f3e={kernelName:$h,backendName:"webgl",kernelFunc:p3e},m3e=`if (b == 0.0) return NAN;
4036  return mod(a, b);`,g3e=`
4037  vec4 result = mod(a, b);
4038  bvec4 isNaN = equal(b, vec4(0.0));
4039  `+bp+`
4040  return result;
4041`,x3e=Gr({opSnippet:m3e,packedOpSnippet:g3e}),y3e={kernelName:Bh,backendName:"webgl",kernelFunc:x3e},b3e=class{constructor(e,t,n){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,n],this.userCode=`
4042      void main() {
4043        ivec2 coords = getOutputCoords();
4044        int batch = coords[0];
4045
4046        float r = random(seed);
4047        float cdf = 0.0;
4048
4049        for (int i = 0; i < ${t-1}; i++) {
4050          cdf += getProbs(batch, i);
4051
4052          if (r < cdf) {
4053            setOutput(float(i));
4054            return;
4055          }
4056        }
4057
4058        // If no other event happened, last event happened.
4059        setOutput(float(${t-1}));
4060      }
4061    `}},v3e=`
4062if (a == b) {
4063  return 1.0;
4064};
4065return a / b;`,w3e=`
4066  // vec4 one = vec4(equal(a, b));
4067  // return one + (vec4(1.0) - one) * a / b;
4068  vec4 result = a / b;
4069  if(a.x == b.x) {
4070    result.x = 1.;
4071  }
4072  if(a.y == b.y) {
4073    result.y = 1.;
4074  }
4075  if(a.z == b.z) {
4076    result.z = 1.;
4077  }
4078  if(a.w == b.w) {
4079    result.w = 1.;
4080  }
4081
4082  return result;
4083`,aW=Gr({opSnippet:v3e,packedOpSnippet:w3e,checkOutOfBounds:!0}),S3e={kernelName:hh,backendName:"webgl",kernelFunc:aW},cB="return a - b;",rW=Gr({opSnippet:cB,packedOpSnippet:cB,supportsComplex:!0,cpuKernelImpl:pEe}),k3e={kernelName:op,backendName:"webgl",kernelFunc:rW};function sW(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=R.parseAxisParam([s],r.shape),o=nW({inputs:{x:r},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=W.expandShapeToKeepDim(o.shape,i),d=et({inputs:{x:o},backend:n,attrs:{shape:l}}),c=rW({inputs:{a:r,b:d},backend:n}),f=Z9({inputs:{x:c},backend:n}),m=L2({inputs:{x:f},backend:n,attrs:{axis:i,keepDims:!1}}),x=et({inputs:{x:m},backend:n,attrs:{shape:l}}),y=aW({inputs:{a:f,b:x},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(x),y}var N3e={kernelName:sp,backendName:"webgl",kernelFunc:sW};function C3e(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a,l=o?r:sW({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),d=l.shape[0],c=l.shape[1],f=new b3e(d,c,s),m=[[i]],x=n.runWebGLProgram(f,[l],"int32",m);return o||n.disposeIntermediateTensorInfo(l),x}var E3e={kernelName:Um,backendName:"webgl",kernelFunc:C3e},I3e=ro+`
4084  return -x;
4085`,T3e=`
4086  vec4 result = -x;
4087  bvec4 isNaN = isnan(x);
4088
4089  result.r = isNaN.r ? x.r : result.r;
4090  result.g = isNaN.g ? x.g : result.g;
4091  result.b = isNaN.b ? x.b : result.b;
4092  result.a = isNaN.a ? x.a : result.a;
4093
4094  return result;
4095`;function A3e(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])){let s=n.texData.get(a.dataId),[i,o]=KCe(s.values,a.shape,a.dtype);return n.makeTensorInfo(o,a.dtype,i)}let r;return fe().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new zu(a.shape,T3e):r=new Yo(a.shape,I3e),n.runWebGLProgram(r,[a],a.dtype)}var _3e={kernelName:Wm,backendName:"webgl",kernelFunc:A3e},j3e=cl.nonMaxSuppressionV3Impl;function D3e(e){W.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a,d=n.readSync(r.dataId),c=n.readSync(s.dataId),{selectedIndices:f}=j3e(d,c,i,o,l);return n.makeTensorInfo([f.length],"int32",new Int32Array(f))}var R3e={kernelName:Hm,backendName:"webgl",kernelFunc:D3e},M3e=cl.nonMaxSuppressionV4Impl;function $3e(e){W.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:d}=a,c=n.readSync(r.dataId),f=n.readSync(s.dataId),{selectedIndices:m,validOutputs:x}=M3e(c,f,i,o,l,d);return[n.makeTensorInfo([m.length],"int32",new Int32Array(m)),n.makeTensorInfo([],"int32",new Int32Array([x]))]}var B3e={kernelName:Gm,backendName:"webgl",kernelFunc:$3e},F3e=cl.nonMaxSuppressionV5Impl;function O3e(e){W.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:d}=a,c=n.readSync(r.dataId),f=n.readSync(s.dataId),m=i,x=o,y=l,b=d,{selectedIndices:w,selectedScores:S}=F3e(c,f,m,x,y,b);return[n.makeTensorInfo([w.length],"int32",new Int32Array(w)),n.makeTensorInfo([S.length],"float32",new Float32Array(S))]}var L3e={kernelName:qm,backendName:"webgl",kernelFunc:O3e},P3e=class{constructor(e,t,n,a){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=`
4096      void main() {
4097        ivec2 coords = getOutputCoords();
4098        int index = round(getIndices(coords.x));
4099        setOutput(mix(float(${a}), float(${n}),
4100                      float(index == coords.y)));
4101      }
4102    `}},z3e=e=>{let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{dtype:s,depth:i,onValue:o,offValue:l}=a,d=R.sizeFromShape(r.shape),c=new P3e(d,i,o,l),f=et({inputs:{x:r},backend:n,attrs:{shape:[d]}}),m=n.runWebGLProgram(c,[f],s);n.disposeIntermediateTensorInfo(f);let x=[...r.shape,i],y=et({inputs:{x:m},backend:n,attrs:{shape:x}});return n.disposeIntermediateTensorInfo(m),y},U3e={kernelName:Oh,backendName:"webgl",kernelFunc:z3e};function Xv(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="complex64"){let r=t0({inputs:{input:a},backend:n}),s=Xv({inputs:{x:r},backend:n}),i=P2({inputs:{input:a},backend:n}),o=Xv({inputs:{x:i},backend:n}
vendor: 4,305 bytes, lines 4102-4158
4102),l=Sc({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return n0({attrs:{shape:a.shape,dtype:a.dtype,value:a.dtype==="string"?"":0},backend:n})}var W3e={kernelName:hg,backendName:"webgl",kernelFunc:Xv};function iW(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(a.dtype==="complex64"){let r=t0({inputs:{input:a},backend:n}),s=iW({inputs:{x:r},backend:n}),i=P2({inputs:{input:a},backend:n}),o=Xv({inputs:{x:i},backend:n}),l=Sc({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return n0({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:n})}var V3e={kernelName:Km,backendName:"webgl",kernelFunc:iW};function H3e(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return RE({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(c=>{R.assertShapesMatch(s,c.shape,"All tensors passed to stack must have matching shapes"),R.assert(i===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(c=>{let f=RE({inputs:{input:c},backend:n,attrs:{dim:r}});return o.push(f),f}),d=H9({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(c=>n.disposeIntermediateTensorInfo(c)),d}var G3e={kernelName:Xm,backendName:"webgl",kernelFunc:H3e},q3e=class{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((l,d)=>l[0]+e[d]+l[1]);let a=e.length,r=ea(a),s=t.map(l=>l[0]).join(","),i=t.map((l,d)=>l[0]+e[d]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);if(a===1){this.userCode=`
4103        int start = ${s};
4104        int end = ${i};
4105
4106        void main() {
4107          int outC = getOutputCoords();
4108          if (outC < start || outC >= end) {
4109            setOutput(value);
4110          } else {
4111            setOutput(getX(outC - start));
4112          }
4113        }
4114      `;return}this.userCode=`
4115      ${r} start = ${r}(${s});
4116      ${r} end = ${r}(${i});
4117
4118      void main() {
4119        ${r} outC = getOutputCoords();
4120        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {
4121          setOutput(value);
4122        } else {
4123          ${r} coords = outC - start;
4124          setOutput(getX(${o}));
4125        }
4126      }
4127    `}},K3e=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((y,b)=>y[0]+e[b]+y[1]);let a=e.length,r=ea(a),s=t.map(y=>y[0]).join(","),i=t.map((y,b)=>y[0]+e[b]).join(","),o=xs("rc",a),l=xs("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,c=a===1?"source":`vec2(${l.slice(-2).join()})`,f=[`${r} rc = outputLoc;`,`${o[a-1]} += 1;
4128       if(${d}) {
4129      `,a===1?"":`}
4130       rc = outputLoc;
4131       ${o[a-2]} += 1;
4132       if(${o[a-2]} < ${this.outputShape[a-2]}) {`,a===1?"":`  ${o[a-1]} += 1;
4133         if(${d}) {`],m=a===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",x="";for(let y=0,b=a===1?2:4;y<b;y++)x+=`
4134        ${f[y]}
4135        if (${m}) {
4136          result[${y}] = float(value);
4137        } else {
4138          ${r} source = rc - start;
4139          result[${y}] = getChannel(getX(${l.join()}), ${c});
4140        }
4141      `;x+=a===1?"} ":"}}",this.userCode=`
4142      const ${r} start = ${r}(${s});
4143      const ${r} end = ${r}(${i});
4144
4145      void main() {
4146        ${r} outputLoc = getOutputCoords();
4147        vec4 result = vec4(0.);
4148        ${x}
4149        setOutput(result);
4150      }
4151    `}},oW=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a;if(R.sizeFromShape(r.shape)===0){let d=s.map((c,f)=>c[0]+r.shape[f]+c[1]);return n0({backend:n,attrs:{shape:d,value:i,dtype:r.dtype}})}let o=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new K3e(r.shape,s,i):new q3e(r.shape,s,i),l=[[i]];return n.runWebGLProgram(o,[r],r.dtype,l)},X3e={kernelName:Lh,backendName:"webgl",kernelFunc:oW},Y3e=`
4152  if(a < 0.0 && floor(b) < b){
4153    return NAN;
4154  }
4155  if (b == 0.0) {
4156    return 1.0;
4157  }
4158  return (round(mod(b, 2.0)) != 1) ?
4159      pow(abs(a), b) : sign(a) * pow(abs(a), b);
4160`,J3e=`
4161  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
4162  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
4163  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
4164  vec4 result = multiplier * pow(abs(a), b);
4165
4166  // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
4167  bvec4 isExpZero = equal(b, vec4(0.0));
4168  result.r = isExpZero.r ? 1.0 : result.r;
4169  result.g = isExpZero.g ? 1.0 : result.g;
4170  result.b = isExpZero.b ? 1.0 : result.b;
4171  result.a = isExpZero.a ? 1.0 : result.a;
4172
4173  bvec4 isNaN1 = lessThan(a, vec4(0.0));
4174  bvec4 isNaN2 = lessThan(floor(b), b);
4175  bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);
4176  `+bp+`
4177  return result;
4178`,Q3e=Gr({opSnippet:Y3e,packedOpSnippet:J3e}),Z3e={kernelName:Ph,backendName:"webgl",kernelFunc:Q3e};function eje(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=[],d=R.parseAxisParam(s,r.shape),c=d,f=W.getAxesPermutation(c,o),m=r;f!=null&&(m=Ss({inputs:{x:r},backend:n,attrs:{perm:f}}),c=W.getInnerMostAxes(c.length,o),l.push(m)),W.assertAxesAreInnerMostDims("prod",c,o);let x;if(n.shouldExecuteOnCPU([m])){let y=n.texData.get(m.dataId).values,{outVals:b,outShape:w,outDtype:S}=YCe(m.shape,m.dtype,y,c);x=n.makeTensorInfo(w,S,b)}else{let[y,b]=W.computeOutAndReduceShapes(m.shape,c),w=R.sizeFromShape(b),S=et({inputs:{x:m},backend:n,attrs:{shape:[-1,w]}}),k=Dw(r.dtype),C=vp(S,k,"prod",n);x=et({inputs:{x:C},backend:n,attrs:{shape:y}}),l.push(S),l.push(C)}if(i){l.push(x);let y=W.expandShapeToKeepDim(x.shape,d);x=et({inputs:{x},backend:n,attrs:{shape:y}})}return l.forEach(y=>n.disposeIntermediateTensorInfo(y)),x}var tje={kernelName:Uh,backendName:"webgl",kernelFunc:eje};function nje(e){let{inputs:t,backend:n,attrs:a}=e,{paramsNestedSplits:r,paramsDenseValues:s,indices:i}=t,{outputRaggedRank:o}=a,l=r.map(S=>n.readSync(S.dataId)),d=r.map(S=>S.shape),c=n.readSync(s.dataId),f=n.readSync(i.dataId),[m,x,y]=JCe(l,d,c,s.shape,s.dtype,f,i.shape,o),b=m.map(S=>n.makeTensorInfo([S.length],"int32",S)),w=n.makeTensorInfo(y,s.dtype,x);return b.concat([w])}var aje={kernelName:Iw,backendName:"webgl",kernelFunc:nje};function rje(e){let{inputs:t,backend:n}=e,{starts:a,limits:r,deltas:s}=t,i=n.readSync(a.dataId),o=n.readSync(r.dataId),l=n.readSync(s.dataId),[d,c]=QCe(i,a.shape,a.dtype,o,r.shape,l,s.shape),f=n.makeTensorInfo([d.length],"int32",d),m=n.makeTensorInfo([c.length],a.dtype,c);return[f,m]}var sje={kernelName:Tw,backendName:"webgl",kernelFunc:rje};function ije(e){let{inputs:t,backend:n,attrs:a}=e,{shape:r,values:s,defaultValue:i,rowPartitionTensors:o}=t,{rowPartitionTypes:l}=a,d=n.readSync(r.dataId),c=n.readSync(s.dataId),f=n.readSync(i.dataId),m=o.map(w=>n.readSync(w.dataId)),x=o.map(w=>w.shape),[y,b]=ZCe(d,r.shape,c,s.shape,s.dtype,f,i.shape,m,x,l);return n.makeTensorInfo(y,s.dtype,b)}var oje={kernelName:Aw,backendName:"webgl",kernelFunc:ije},lW=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=eEe(a,r,s,i);return t.makeTensorInfo([o.length],i,o)},lje={kernelName:pb,backendName:"webgl",kernelFunc:lW},uje="return 1.0 / x;",cje=kn({opSnippet:uje}),dje={kernelName:Wh,backendName:"webgl",kernelFunc:cje},hje=ro+`
4179  return (x < 0.0) ? 0.0 : x;
4180`,pje=`
4181  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
4182  bvec4 isNaN = isnan(x);
4183
4184  result.r = isNaN.r ? x.r : result.r;
4185  result.g = isNaN.g ? x.g : result.g;
4186  result.b = isNaN.b ? x.b : result.b;
4187  result.a = isNaN.a ? x.a : result.a;
4188
4189  return result;
4190`,fje=kn({opSnippet:hje,packedOpSnippet:pje}),mje={kernelName:Vh,backendName:"webgl",kernelFunc:fje},gje=ro+`
4191  return (x < 0.0) ? 0.0 : min(6.0, x);
4192`,xje=`
4193  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
4194  bvec4 isNaN = isnan(x);
4195
4196  result.r = isNaN.r ? x.r : result.r;
4197  result.g = isNaN.g ? x.g : result.g;
4198  result.b = isNaN.b ? x.b : result.b;
4199  result.a = isNaN.a ? x.a : result.a;
4200
4201  return result;
4202`,yje=kn({opSnippet:gje,packedOpSnippet:xje}),bje={kernelName:qh,backendName:"webgl",kernelFunc:yje},vje=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],c=[a&&t>1?t-1:t,a&&n>1?n-1:n],f;r?f="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":f="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
4203      const vec2 effectiveInputOverOutputRatioRC = vec2(
4204          ${d[0]/c[0]},
4205          ${d[1]/c[1]});
4206      const vec2 inputShapeRC = vec2(${i}.0, ${o}.0);
4207
4208      void main() {
4209        ivec4 coords = getOutputCoords();
4210        int b = coords[0];
4211        int d = coords[3];
4212        ivec2 yRC = coords.yz;
4213
4214        // Fractional source index.
4215        vec2 sourceFracIndexRC = ${f};
4216
4217        // Compute the four integer indices.
4218        ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));
4219        ivec2 sourceCeilRC = ivec2(
4220          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
4221
4222        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);
4223        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);
4224        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);
4225        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);
4226
4227        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);
4228
4229        float top = topLeft + (topRight - topLeft) * fracRC.y;
4230        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;
4231        float newValue = top + (bottom - top) * fracRC.x;
4232
4233        setOutput(newValue);
4234      }
4235    `}},wje=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],c=[a&&t>1?t-1:t,a&&n>1?n-1:n],f;r?f="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":f="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
4236      const vec3 effectiveInputOverOutputRatioRC = vec3(
4237          ${d[0]/c[0]},
4238          ${d[1]/c[1]},
4239          ${d[1]/c[1]});
4240      const vec3 inputShapeRC = vec3(${i}.0, ${o}.0,
4241                                     ${o}.0);
4242
4243      float getAValue(int b, int r, int c, int d) {
4244        return getChannel(getA(b, r, c, d), vec2(c, d));
4245      }
4246
4247      void main() {
4248        ivec4 coords = getOutputCoords();
4249        int b = coords[0];
4250        int d = coords[3];
4251        // Calculate values for next column in yRC.z.
4252        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
4253
4254        // Fractional source index.
4255        vec3 sourceFracIndexRC = ${f};
4256
4257        // Compute the four integer indices.
4258        ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));
4259        ivec3 sourceCeilRC = ivec3(
4260          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
4261
4262        // Should we calculate next column and row elements in 2x2 packed cell.
4263        bool hasNextCol = d < ${l-1};
4264        bool hasNextRow = coords.z < ${n-1}
vendor: 2,018 bytes, lines 4264-4312
4264;
4265
4266        // In parallel, construct four corners for all four components in
4267        // packed 2x2 cell.
4268        vec4 topLeft = vec4(
4269          getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),
4270          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)
4271                     : 0.0,
4272          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)
4273                     : 0.0,
4274          (hasNextRow && hasNextCol) ?
4275            getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);
4276
4277        vec4 bottomLeft = vec4(
4278          getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),
4279          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)
4280                     : 0.0,
4281          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)
4282                     : 0.0,
4283          (hasNextRow && hasNextCol) ?
4284            getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);
4285
4286        vec4 topRight = vec4(
4287          getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),
4288          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)
4289                     : 0.0,
4290          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)
4291                     : 0.0,
4292          (hasNextRow && hasNextCol) ?
4293            getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);
4294
4295        vec4 bottomRight = vec4(
4296          getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),
4297          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)
4298                     : 0.0,
4299          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)
4300                     : 0.0,
4301          (hasNextRow && hasNextCol) ?
4302            getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);
4303
4304        vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);
4305
4306        vec4 top = mix(topLeft, topRight, fracRC.yyzz);
4307        vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);
4308        vec4 newValue = mix(top, bottom, fracRC.x);
4309
4310        setOutput(newValue);
4311      }
4312    `}
vendor: 5,907 bytes, lines 4312-4445
4312};function Sje(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,c=fe().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new wje(r.shape,l,d,s,i):new vje(r.shape,l,d,s,i);return n.runWebGLProgram(c,[r],"float32")}var kje={kernelName:Gh,backendName:"webgl",kernelFunc:Sje},Nje=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],c=o[1]/l[1],f=1/d,m=1/c,x=Math.ceil(f)*2+2,y=Math.ceil(m)*2+2;this.userCode=`
4313      void main() {
4314        ivec4 coords = getOutputCoords();
4315        int b = coords[0];
4316        int d = coords[3];
4317        int r = coords[1];
4318        int c = coords[2];
4319
4320        float accumulator = 0.0;
4321
4322        const float heightScale = float(${d});
4323        const float widthScale = float(${c});
4324
4325        const float invHeightScale = float(${f});
4326        const float invWidthScale = float(${m});
4327
4328        const int winHeight = int(${x});
4329        const int winWidth = int(${y});
4330
4331        // Compute bounds for where in dy we will look
4332        float startRLerp = floor(float(r) * invHeightScale);
4333        int startDyR = int(startRLerp - float(winHeight / 2));
4334
4335        float startCLerp = floor(float(c) * invWidthScale);
4336        int startDyC = int(startCLerp - float(winWidth / 2));
4337
4338        // Loop over dy
4339        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
4340          int dyR = dyROffset + startDyR;
4341
4342          // Guard against the window exceeding the bounds of dy
4343          if (dyR < 0 || dyR >= ${s}) {
4344            continue;
4345          }
4346
4347          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
4348            int dyC = dyCOffset + startDyC;
4349
4350            // Guard against the window exceeding the bounds of dy
4351            if (dyC < 0 || dyC >= ${i}) {
4352              continue;
4353            }
4354
4355            float dxR = float(dyR) * heightScale;
4356            int topDxRIndex = int(floor(dxR));
4357            int bottomDxRIndex = int(min(ceil(dxR), ${a-1}.0));
4358            float dxRLerp = dxR - float(topDxRIndex);
4359            float inverseDxRLerp = 1.0 - dxRLerp;
4360
4361            float dxC = float(dyC) * widthScale;
4362            int leftDxCIndex = int(floor(dxC));
4363            int rightDxCIndex = int(min(ceil(dxC), ${r-1}.0));
4364            float dxCLerp = dxC - float(leftDxCIndex);
4365            float inverseDxCLerp = 1.0 - dxCLerp;
4366
4367            if (r == topDxRIndex && c == leftDxCIndex) {
4368              // topLeft
4369              accumulator +=
4370                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;
4371            }
4372
4373            if (r == topDxRIndex && c == rightDxCIndex) {
4374              // topRight
4375              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;
4376            }
4377
4378            if (r == bottomDxRIndex && c == leftDxCIndex) {
4379              // bottomLeft
4380              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;
4381            }
4382
4383            if (r == bottomDxRIndex && c == rightDxCIndex) {
4384              // bottomRight
4385              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;
4386            }
4387          }
4388        }
4389        // End loop over dy
4390
4391        setOutput(accumulator);
4392      }
4393    `}};function Cje(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new Nje(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var Eje={kernelName:Qm,backendName:"webgl",kernelFunc:Cje},Ije=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],c=[a&&t>1?t-1:t,a&&n>1?n-1:n],f=a?"0.5":"0.0",m;r?m="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":m="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
4394      const vec2 effectiveInputOverOutputRatioRC = vec2(
4395          ${d[0]/c[0]},
4396          ${d[1]/c[1]});
4397      const vec2 inputShapeRC = vec2(${i}.0, ${o}.0);
4398
4399      void main() {
4400        ivec4 coords = getOutputCoords();
4401        int b = coords[0];
4402        int d = coords[3];
4403        ivec2 yRC = coords.yz;
4404
4405        // Fractional source index.
4406        vec2 sourceFracIndexRC = ${m};
4407
4408        // Compute the coordinators of nearest neighbor point.
4409        ivec2 sourceNearestRC = ivec2(
4410          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${f})));
4411        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);
4412
4413        setOutput(newValue);
4414      }
4415    `}},Tje=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],c=[a&&t>1?t-1:t,a&&n>1?n-1:n],f=a?"0.5":"0.0",m;r?m="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":m="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`
4416      const vec3 effectiveInputOverOutputRatioRC = vec3(
4417          ${d[0]/c[0]},
4418          ${d[1]/c[1]},
4419          ${d[1]/c[1]});
4420      const vec3 inputShapeRC = vec3(${i}.0, ${o}.0,
4421                                     ${o}.0);
4422
4423      float getAValue(int b, int r, int c, int d) {
4424        return getChannel(getA(b, r, c, d), vec2(c, d));
4425      }
4426
4427      void main() {
4428        ivec4 coords = getOutputCoords();
4429        int b = coords[0];
4430        int d = coords[3];
4431        // Calculate values for next column in yRC.z.
4432        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
4433
4434        // Fractional source index.
4435        vec3 sourceFracIndexRC = ${m};
4436
4437        // Compute the coordinators of nearest neighbor point.
4438        ivec3 sourceNearestRC = ivec3(
4439          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${f})));
4440
4441        // Should we calculate next column and row elements in 2x2 packed cell.
4442        bool hasNextCol = d < ${l-1};
4443        bool hasNextRow = coords.z < ${n-1};
4444
4445        vec4 newValue = vec4(
4446          getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),
4447          hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)
4448                     : 0.0,
4449          hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)
4450                     : 0.0,
4451          (hasNextRow && hasNextCol) ?
4452            getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);
4453
4454        setOutput(newValue);
4455      }
4456    `}};function Aje(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,c=fe().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new Tje(r.shape,l,d,s,i):new Ije(r.shape,l,d,s,i);return n.runWebGLProgram(c,[r],r.dtype)}var _je={kernelName:Hh,backendName:"webgl",kernelFunc:Aje},jje=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],c=o[1]/l[1],f=1/d,m=1/c,x=Math.ceil(f)*2+2,y=Math.ceil(m)*2+2;this.userCode=`
4457      void main() {
4458        ivec4 coords = getOutputCoords();
4459        int b = coords[0];
4460        int d = coords[3];
4461        int r = coords[1];
4462        int c = coords[2];
4463
4464        float accumulator = 0.0;
4465
4466        const float heightScale = float(${d});
4467        const float widthScale = float(${c});
4468
4469        const float invHeightScale = float(${f});
4470        const float invWidthScale = float(${m});
4471
4472        const int winHeight = int(${x});
4473        const int winWidth = int(${y});
4474
4475        // Compute bounds for where in dy we will look
4476        float startRLerp = floor(float(r) * invHeightScale);
4477        int startDyR = int(floor(startRLerp - float(winHeight / 2)));
4478
4479        float startCLerp = floor(float(c) * invWidthScale);
4480        int startDyC = int(floor(startCLerp - float(winWidth / 2)));
4481
4482        // Loop over dy
4483        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
4484          int dyR = dyROffset + startDyR;
4485
4486          // Guard against the window exceeding the bounds of dy
4487          if (dyR < 0 || dyR >= ${s}) {
4488            continue;
4489          }
4490
4491          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
4492            int dyC = dyCOffset + startDyC;
4493
4494            // Guard against the window exceeding the bounds of dy
4495            if (dyC < 0 || dyC >= ${i}) {
4496              continue;
4497            }
4498
4499            float sourceFracRow =
4500              float(${o[0]}) *
4501                (float(dyR) / float(${l[0]}));
4502
4503            float sourceFracCol =
4504                float(${o[1]}) *
4505                  (float(dyC) / float(${l[1]}));
4506
4507            int sourceNearestRow = int(min(
4508                float(int(${a}) - 1),
4509                ${n} ? float(round(sourceFracRow)) :
4510                                  float(floor(sourceFracRow))));
4511
4512            int sourceNearestCol = int(min(
4513                float(int(${r}) - 1),
4514                ${n} ? float(round(sourceFracCol)) :
4515                                  float(floor(sourceFracCol))));
4516
4517            if (r == sourceNearestRow && c == sourceNearestCol) {
4518              accumulator += getDy(b, dyR, dyC, d);
4519            }
4520          }
4521        }
4522        // End loop over dy
4523
4524        setOutput(accumulator);
4525      }
4526    `}};function Dje(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new jje(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var Rje={kernelName:Jm,backendName:"webgl",kernelFunc:Dje},Mje=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,n===1){this.userCode=`
4527        void main() {
4528          int coord = getOutputCoords();
4529          setOutput(getX(${e[0]} - coord - 1));
4530        }
4531      `;return}let a=i=>t.indexOf(i)!==-1&&e[i]!==1?`${e[i]} - coords[${i}] - 1`:`coords[${i}]`,r=e.map((i,o)=>a(o)).join(","),s=ea(n);this.userCode=`
4532      void main() {
4533        ${s} coords = getOutputCoords();
4534        setOutput(getX(${r}));
4535      }
4536    `}},$je=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;let a=xs("rc",n),r=`${a[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${a[n-2]} + 1 < ${this.outputShape[n-2]}`,i=ea(n);n===1?this.userCode=`
4537        void main(){
4538          int rc = getOutputCoords();
4539          vec4 result = vec4(0.);
4540          result.r = getChannel(getX(${e[0]} - rc - 1),
4541            ${e[0]} - rc - 1);
4542          if(${r}){
4543              result.g = getChannel(getX(${e[0]} - (rc  + 1) - 1),
4544                ${e[0]} - (rc  + 1) - 1);
4545          }
4546          setOutput(result);
4547        }
4548      `:this.userCode=`
4549        void main() {
4550          ${i} rc = getOutputCoords();
4551          vec4 result = vec4(0.);
4552          result.r = ${o(a.slice())};
4553          if(${r}){
4554            result.g = ${l(a.slice())};
4555          }
4556          if(${s}) {
4557            result.b = ${d(a.slice())};
4558            if(${r}) {
4559              result.a = ${c(a.slice())};
4560            }
4561          }
4562          setOutput(result);
4563        }
4564    `;function o(x){return f(x)}function l(x){return x[n-1]="("+x[n-1]+" + 1)",f(x)}function d(x){return x[n-2]="("+x[n-2]+" + 1)",f(x)}function c(x){return x[n-1]="("+x[n-1]+" + 1)",x[n-2]="("+x[n-2]+" + 1)",f(x)}function f(x){let y=e.map((S,k)=>m(k,x)),b=y.join(","),w=y.slice(-2).join(",");return`getChannel(getX(${b}), vec2(${w}))`}function m(x,y){return t.indexOf(x)!==-1&&e[x]!==1?`${e[x]} - ${y[x]} - 1`:`${y[x]}`}}};function Bje(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=r.shape.length,o=R.parseAxisParam(s,r.shape);if(i===0)return li({inputs:{x:r},backend:n});let l=fe().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new $je(r.shape,o):new Mje(r.shape,o);return n.runWebGLProgram(l,[r],r.dtype)}var Fje={kernelName:Kh,backendName:"webgl",kernelFunc:Bje},Oje=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];let n=e[1],a=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=`
4565        vec3 fill = vec3(${t.join(",")});
4566        float outputValue = fill[coords[3]];`,this.userCode=`
4567        void main() {
4568          ivec4 coords = getOutputCoords();
4569          int x = coords[2];
4570          int y = coords[1];
4571          float coordXFloat = (float(x) - params[0]) * params[3] -
4572            (float(y) - params[1]) * params[2];
4573          float coordYFloat = (float(x) - params[0]) * params[2] +
4574            (float(y) - params[1]) * params[3];
4575          int coordX = int(round(coordXFloat + params[0]));
4576          int coordY = int(round(coordYFloat + params[1]));
4577          ${r}
4578          if(coordX >= 0 && coordX < ${a} && coordY >= 0 && coordY < ${n}) {
4579            outputValue = getImage(coords[0], coordY, coordX, coords[3]);
4580          }
4581          setOutput(outputValue);
4582        }
4583    `}},Lje={kernelName:pg,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=new Oje(a.shape,s),[d,c]=W.getImageCenter(i,a.shape[1],a.shape[2]),f=[[d,c,Math.sin(r),Math.cos(r)]];return o.runWebGLProgram(l,[a],a.dtype,f)}},Pje=`
4584  // OpenGL ES does not support round function.
4585  // The algorithm is based on banker's rounding.
4586  float base = floor(x);
4587  if ((x - base) < 0.5) {
4588    return floor(x);
4589  } else if ((x - base) > 0.5) {
4590    return ceil(x);
4591  } else {
4592    if (mod(base, 2.0) == 0.0) {
4593      return base;
4594    } else {
4595      return base + 1.0;
4596    }
4597  }
4598`,zje=kn({opSnippet:Pje}),Uje={kernelName:Xh,backendName:"webgl",kernelFunc:zje},Wje="return inversesqrt(x);",Vje=kn({opSnippet:Wje,cpuKernelImpl:tEe}),Hje={kernelName:Yh,backendName:"webgl",kernelFunc:Vje},j4=class{constructor(e,t,n,a,r,s,i=!0,o=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let l=ea(r.length),d=ea(s.length),c="";n===1?c="i":n===2&&(c="i, j");let f=`getIndices(${c})`,m="";a===1?m="i":a===2&&(m="i, coords[1]");let x=`getUpdates(${m})`,y="";o&&(y="coords[0], coords[1]");let b=`getDefaultValue(${y})`,w=t>1?"strides[j]":"strides";this.userCode=`
4599        ${l} strides = ${l}(${r});
4600
4601        void main() {
4602          ${d} coords = getOutputCoords();
4603          float sum = 0.0;
4604          bool found = false;
4605          for (int i = 0; i < ${e}; i++) {
4606            int flattenedIndex = 0;
4607            for (int j = 0; j < ${t}; j++) {
4608              int index = round(${f});
4609              flattenedIndex += index * ${w};
4610            }
4611            if (flattenedIndex == coords[0]) {
4612              sum += ${x};
4613              found = true;
4614            }
4615          }
4616          setOutput(mix(${b}, sum, float(found)));
4617        }
4618      `}},Gje=class{constructor(e,t,n,a,r,s,i=!0,o=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=s;let l=ea(r.length),d=ea(s.length),c="";n===1?c="i":n===2&&(c="i, j");let f=`getIndices(${c})`,m="";a===1?m="i":a===2&&(m="i, coords[1]");let x=`getUpdates(${m})`,y="";o&&(y="coords[0], coords[1]");let b=`getDefaultValue(${y})`,w=t>1?"strides[j]":"strides",S=t>1?"strides[j + 1]":"strides";this.userCode=`
4619        ${l} strides = ${l}(${r});
4620
4621        void main() {
4622          ${d} coords = getOutputCoords();
4623          vec4 sum = vec4(0.);
4624          vec4 found = vec4(0.);
4625          for (int i = 0; i < ${e}; i+=2) {
4626            ivec2 flattenedIndex = ivec2(0);
4627            for (int j = 0; j < ${t}; j+=2) {
4628              ivec4 index = round(${f});
4629              flattenedIndex += index.xz * ${w};
4630              if (j + 1 < ${t}) {
4631                flattenedIndex += index.yw * ${S};
4632              }
4633            }
4634            if (flattenedIndex[0] == coords[0] || flattenedIndex[1] == coords[0] ||
4635                flattenedIndex[0] == coords[0] + 1 || flattenedIndex[1] == coords[0] + 1) {
4636              vec4 updVals = ${x};
4637              if (flattenedIndex[0] == coords[0]) {
4638                sum.xy += updVals.xy;
4639                found.xy = vec2(1.);
4640              } else if (flattenedIndex[0] == coords[0] + 1) {
4641                sum.zw += updVals.xy;
4642                found.zw = vec2(1.);
4643              }
4644              if (flattenedIndex[1] == coords[0]) {
4645                sum.xy += updVals.zw;
4646                found.xy = vec2(1.);
4647              } else if (flattenedIndex[1] == coords[0] + 1) {
4648                sum.zw += updVals.zw;
4649                found.zw = vec2(1.);
4650              }
4651            }
4652          }
4653          setOutput(mix(${b}, sum, found));
4654        }
4655      `}};function qje(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r,updates:s}=t,{shape:i}=a,{sliceRank:o,numUpdates:l,sliceSize:d,strides:c,outputSize:f}=W.calculateShapes(s,r,i),m=[f/d,d];if(f===0)return n.makeTensorInfo(i,r.dtype);let x=et({inputs:{x:r},backend:n,attrs:{shape:[l,o]}}),y=et({inputs:{x:s},backend:n,attrs:{shape:[l,d]}}),b=n.makeTensorInfo([],"float32",new Float32Array([0])),w;fe().getBool("WEBGL_PACK")?w=new Gje(l,o,x.shape.length,y.shape.length,c,m):w=new j4(l,o,x.shape.length,y.shape.length,c,m);
vendor: 13,015 bytes, lines 4655-4762
4655let S=n.runWebGLProgram(w,[y,x,b],y.dtype),k=et({inputs:{x:S},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(S),n.disposeIntermediateTensorInfo(b),k}var Kje={kernelName:Zm,backendName:"webgl",kernelFunc:qje},Xje=class{constructor(e,t,n,a){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,n];let r="while (left < right) {",s=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,i=fe().getNumber("WEBGL_VERSION")===2?r:s,o=a==="left"?"<":"<=";this.userCode=`
4656       int findBound(int batch, float value) {
4657         int left = 0;
4658         int right = numInputs;
4659         int mid;
4660         ${i}
4661           mid = (left + right) / 2;
4662           if (getSortedSequence(batch, mid) ${o} value) {
4663             left = mid + 1;
4664           } else {
4665             right = mid;
4666           }
4667         }
4668         return right;
4669       }
4670
4671       void main() {
4672         ivec2 coords = getOutputCoords();
4673         int batch = coords[0];
4674         int valueIndex = coords[1];
4675
4676         float value = getValues(batch, valueIndex);
4677
4678         setOutput(float(findBound(batch, value)));
4679       }
4680     `}};function Yje(e){let{inputs:t,backend:n,attrs:a}=e,{sortedSequence:r,values:s}=t,{side:i}=a,o=new Xje(r.shape[0],r.shape[1],s.shape[1],i),l=[[r.shape[1]]];return n.runWebGLProgram(o,[r,s],"int32",l)}var Jje={kernelName:tg,backendName:"webgl",kernelFunc:Yje},Qje=class{constructor(e,t,n){this.variableNames=["c","a","b"],this.outputShape=t;let a,r;if(n>4)throw Error(`Where for rank ${n} is not yet supported`);if(n===1)r="resRC",a="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let d=0;d<t.length;d++)l.push(`${i[d]}`),d<e&&o.push(`${i[d]}`);a=o.join(),r=l.join()}let s=ea(n);this.userCode=`
4681      void main() {
4682        ${s} resRC = getOutputCoords();
4683        float cVal = getC(${a});
4684        if (cVal >= 1.0) {
4685          setOutput(getA(${r}));
4686        } else {
4687          setOutput(getB(${r}));
4688        }
4689      }
4690    `}};function Zje(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=new Qje(a.shape.length,r.shape,r.shape.length);return n.runWebGLProgram(i,[a,r,s],Di(r.dtype,s.dtype))}var eDe={kernelName:ng,backendName:"webgl",kernelFunc:Zje},tDe=`
4691  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
4692  // see: https://arxiv.org/abs/1706.02515
4693  float scaleAlpha = ${W.SELU_SCALEALPHA};
4694  float scale = ${W.SELU_SCALE};
4695  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
4696`,nDe=kn({opSnippet:tDe}),aDe={kernelName:Jh,backendName:"webgl",kernelFunc:nDe},rDe=Dg+`
4697  return 1.0 / (1.0 + exp(-1.0 * x));
4698`,sDe=`
4699  vec4 result = 1.0 / (1.0 + exp(-1.0 * x));
4700  bvec4 isNaN = isnan(x);
4701
4702  result.r = isNaN.r ? x.r : result.r;
4703  result.g = isNaN.g ? x.g : result.g;
4704  result.b = isNaN.b ? x.b : result.b;
4705  result.a = isNaN.a ? x.a : result.a;
4706
4707  return result;
4708`,iDe=kn({opSnippet:rDe,packedOpSnippet:sDe,cpuKernelImpl:aEe}),oDe={kernelName:tp,backendName:"webgl",kernelFunc:iDe},lDe=`
4709  if (isnan(x)) { return 0.0; }
4710  return sign(x);
4711`,uDe=kn({opSnippet:lDe}),cDe={kernelName:ep,backendName:"webgl",kernelFunc:uDe},dDe=Dg+`
4712  return sin(x);
4713`,hDe=`
4714  vec4 result = sin(x);
4715  bvec4 isNaN = isnan(x);
4716  ${bp}
4717  return result;
4718`,pDe=kn({opSnippet:dDe,packedOpSnippet:hDe}),fDe={kernelName:Qh,backendName:"webgl",kernelFunc:pDe},mDe=`
4719  float e2x = exp(x);
4720  return (e2x - 1.0 / e2x) / 2.0;
4721`,gDe=kn({opSnippet:mDe}),xDe={kernelName:Zh,backendName:"webgl",kernelFunc:gDe},yDe=`
4722  float epsilon = 1.1920928955078125e-7;
4723  float threshold = log(epsilon) + 2.0;
4724
4725  bool too_large = x > -threshold;
4726  bool too_small = x < threshold;
4727
4728  float result;
4729  float exp_x = exp(x);
4730
4731  if (too_large){
4732    result = x;
4733  }
4734  else if (too_small){
4735    result = exp_x;
4736  }
4737  else{
4738    result = log(exp_x + 1.0);
4739  }
4740  return result;
4741`,bDe=kn({opSnippet:yDe}),vDe={kernelName:np,backendName:"webgl",kernelFunc:bDe},wDe=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;R.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((S,k)=>S*k),l=[[0,0]];l.push(...i);for(let S=1+s.length;S<r.shape.length;++S)l.push([0,0]);let d=[],c=oW({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),f=W.getReshaped(c.shape,s,o,!1),m=W.getPermuted(f.length,s.length,!1),x=W.getReshapedPermuted(c.shape,s,o,!1),y=et({inputs:{x:c},backend:n,attrs:{shape:f}}),b=Ss({inputs:{x:y},backend:n,attrs:{perm:m}}),w=et({inputs:{x:b},backend:n,attrs:{shape:x}});return d.push(c),d.push(y),d.push(b),d.forEach(S=>n.disposeIntermediateTensorInfo(S)),w},SDe={kernelName:rg,backendName:"webgl",kernelFunc:wDe};function kDe(e){let{inputs:t,backend:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=t;if(s.shape.length!==1)throw new Error(`Dense shape must be a vector, saw:
4742         ${s.shape}`);if(a.shape.length!==2)throw new Error(`Indices must be a matrix, saw:
4743         ${a.shape}`);if(r.shape.length!==1)throw new Error(`Values must be a vector, saw:
4744         ${r.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw:
4745        ${i.shape}`);let o=n.readSync(a.dataId),l=n.readSync(r.dataId),d=n.readSync(s.dataId),c=n.readSync(i.dataId)[0],[f,m,x,y,b]=sEe(o,a.shape,a.dtype,l,r.dtype,d,c);return[n.makeTensorInfo(m,a.dtype,f),n.makeTensorInfo([m[0]],r.dtype,x),n.makeTensorInfo([y.length],"bool",new Uint8Array(y.map(w=>Number(w)))),n.makeTensorInfo([b.length],a.dtype,new Int32Array(b))]}var NDe={kernelName:fb,backendName:"webgl",kernelFunc:kDe};function CDe(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.readSync(r.dataId)),o=n.readSync(a.dataId),l=Array.from(n.readSync(s.dataId)),[d,c,f]=iEe(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(c,a.dtype,d),n.makeTensorInfo([f.length],s.dtype,new Int32Array(f))]}var EDe={kernelName:ig,backendName:"webgl",kernelFunc:CDe};function IDe(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape
4746              ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
4747              ${s.shape}`);let i=n.readSync(a.dataId),o=n.readSync(r.dataId),l=n.readSync(s.dataId),[d,c]=_9(i,a.shape,a.dtype,o,l,!0);return n.makeTensorInfo(c,a.dtype,d)}var TDe={kernelName:mb,backendName:"webgl",kernelFunc:IDe};function ADe(e){let{inputs:t,backend:n}=e,{data:a,indices:r,segmentIds:s}=t;if(a.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(r.shape.length!==1)throw new Error(`Indices should be a vector but received shape
4748             ${r.shape}`);if(s.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
4749             ${s.shape}`);let i=n.readSync(a.dataId),o=n.readSync(r.dataId),l=n.readSync(s.dataId),[d,c]=_9(i,a.shape,a.dtype,o,l);return n.makeTensorInfo(c,a.dtype,d)}var _De={kernelName:gb,backendName:"webgl",kernelFunc:ADe};function jDe(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,sliceSize:c,strides:f,outputSize:m}=W.calculateShapes(s,r,o),x=!1;if(s.dtype==="string"){let S=n.bufferSync(r),k=n.bufferSync(s),C=R.decodeString(n.readSync(i.dataId)[0]),E=nEe(S,k,o,m,c,d,l,f,C,x);return n.makeTensorInfo(o,E.dtype,E.values)}let y=new j4(d,l,r.shape.length,s.shape.length,f,[m,1],x),b=n.runWebGLProgram(y,[s,r,i],s.dtype),w=et({inputs:{x:b},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(b),w}var DDe={kernelName:og,backendName:"webgl",kernelFunc:jDe};function RDe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=R.parseAxisParam(i,r.shape)[0],l=W.prepareSplitSize(r,s,o),d=r.shape.length,c=new Array(d).fill(0),f=r.shape.slice();return l.map(m=>{let x=[...f];x[o]=m;let y=Rg({inputs:{x:r},backend:n,attrs:{begin:c,size:x}});return c[o]+=m,y})}var MDe={kernelName:sg,backendName:"webgl",kernelFunc:RDe},dB="return sqrt(x);",$De=kn({opSnippet:dB,packedOpSnippet:dB,cpuKernelImpl:oEe}),BDe={kernelName:ap,backendName:"webgl",kernelFunc:$De},FDe="return x * x;",ODe=kn({opSnippet:FDe}),LDe={kernelName:xb,backendName:"webgl",kernelFunc:ODe},hB="return (a - b) * (a - b);",PDe=Gr({opSnippet:hB,packedOpSnippet:hB}),zDe={kernelName:ip,backendName:"webgl",kernelFunc:PDe};function UDe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;if(r.dtype!=="string")throw new Error("Input must be of datatype string");let s=n.readSync(r.dataId),i=W.fromUint8ToStringArray(s),o=lEe(i,"string",a);return n.makeTensorInfo(r.shape,"string",o)}var WDe={kernelName:yb,backendName:"webgl",kernelFunc:UDe};function VDe({inputs:e,attrs:t,backend:n}){let{x:a}=e,r=ro+`
4750    return x > 0.0 ? 1.0 : float(${t.alpha});
4751  `,s=new Yo(a.shape,r);return n.runWebGLProgram(s,[a],a.dtype)}var HDe={kernelName:mc,backendName:"webgl",kernelFunc:VDe},GDe=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let a=n.length,r=ea(n.length),s=ea(n.length),i="";if(a===1)i="coords * strides + begin";else{let o=0;i=n.map((l,d)=>(o++,n.length===1?`coords * strides[${d}] + begin[${d}]`:`coords[${o-1}] * strides[${d}] + begin[${d}]`)).join(",")}this.userCode=`
4752      ${r} begin = ${r}(${e});
4753      ${r} strides = ${r}(${t});
4754
4755      void main() {
4756        ${s} coords = getOutputCoords();
4757        setOutput(getX(${i}));
4758      }
4759    `}};function qDe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:c,newAxisMask:f,shrinkAxisMask:m}=a,{finalShapeSparse:x,finalShape:y,isIdentity:b,sliceDim0:w,isSimpleSlice:S,begin:k,end:C,strides:E}=vr.sliceInfo(r.shape,s,i,o,l,d,c,f,m),T;if(b)T=et({inputs:{x:r},backend:n,attrs:{shape:y}});else if(w||S){R.assert(r.shape.length>=1,()=>`Input must have rank at least 1, got: ${r.shape.length}`);let A=vr.computeOutShape(k,C,E),$=Rg({inputs:{x:r},backend:n,attrs:{begin:k,size:A}});T=et({inputs:{x:$},backend:n,attrs:{shape:y}}),n.disposeIntermediateTensorInfo($)}else if(n.shouldExecuteOnCPU([r])){let A=n.readSync(r.dataId),$=Zt(r.shape,r.dtype,A),O=uEe(x,$,E,k);T=n.makeTensorInfo(y,r.dtype,O.values)}else{let A=new GDe(k,E,x);T=n.runWebGLProgram(A,[r],r.dtype)}let _=et({inputs:{x:T},backend:n,attrs:{shape:y}});return n.disposeIntermediateTensorInfo(T),_}var KDe={kernelName:lg,backendName:"webgl",kernelFunc:qDe};function XDe(e){let{inputs:t,backend:n,attrs:a}=e,{separator:r,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:d}=a,{data:c,dataSplits:f}=t,m=n.readSync(c.dataId),x=n.readSync(f.dataId),[y,b]=cEe(m,x,r,s,i,o,l,d);return[n.makeTensorInfo([y.length],"string",y),n.makeTensorInfo(f.shape,"int32",b)]}var YDe={kernelName:bb,backendName:"webgl",kernelFunc:XDe};function JDe(e){let{inputs:t,backend:n,attrs:a}=e,{skipEmpty:r}=a,{input:s,delimiter:i}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(s.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);let o=n.readSync(s.dataId),l=n.readSync(i.dataId)[0],[d,c,f]=dEe(o,l,r),m=c.length;return[n.makeTensorInfo([m,2],"int32",d),n.makeTensorInfo([m],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(f))]}var QDe={kernelName:vb,backendName:"webgl",kernelFunc:JDe};function ZDe(e){let{inputs:t,backend:n,attrs:a}=e,{numBuckets:r}=a,{input:s}=t;if(s.dtype!=="string")throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");let i=n.readSync(s.dataId),o=hEe(i,r);return n.makeTensorInfo(s.shape,"int32",o)}var eRe={kernelName:wb,backendName:"webgl",kernelFunc:ZDe},tRe="return tan(x);",nRe=kn({opSnippet:tRe}),aRe={kernelName:lp,backendName:"webgl",kernelFunc:nRe},rRe=`
4760  float e2x = exp(-2.0 * abs(x));
4761  return sign(x) * (1.0 - e2x) / (1.0 + e2x);
4762`,sRe=kn({opSnippet:rRe}),iRe={kernelName:up,backendName:"webgl",kernelFunc:sRe};function oRe(e){let{inputs:t,backend:n,attrs:a}=e,{tensor:r,indices:s,updates:i}=t,{sliceRank:o,numUpdates:l,sliceSize:d,strides:c,outputSize:f}=W.calculateShapes(i,s,r.shape),m=[f/d,d];if(f===0)return n.makeTensorInfo(r.shape,s.dtype);let x=et({inputs:{x:s},backend:n,attrs:{shape:[l,o]}}),y=et({inputs:{x:i},backend:n,attrs:{shape:[l,d]}}),b=et({inputs:{x:r},backend:n,attrs:{shape:m}}),w=new j4(l,o,x.shape.length,y.shape.length,c,m,!1,!0),S=n.runWebGLProgram(w,[y,x,b],b.dtype),k=et({
vendor: 6,518 bytes, lines 4762-4841
4762inputs:{x:S},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(S),k}var lRe={kernelName:eg,backendName:"webgl",kernelFunc:oRe},uRe=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[s]*t[s];this.outputShape=n,this.rank=n.length;let a=ea(this.rank),r=cRe(e);this.userCode=`
4763      void main() {
4764        ${a} resRC = getOutputCoords();
4765        setOutput(getA(${r}));
4766      }
4767    `}};function cRe(e){let t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(t===1)return`imod(resRC, ${e[0]})`;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],a=[];for(let r=0;r<e.length;r++)a.push(`imod(${n[r]}, ${e[r]})`);return a.join()}function uW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;if(r.dtype==="string"||r.shape.length>5){let o=n.readSync(r.dataId),l=r.dtype==="string"?o.map(f=>R.decodeString(f)):o,d=Zt(r.shape,r.dtype,l),c=fEe(d,s);return n.makeTensorInfo(c.shape,c.dtype,c.values)}let i=new uRe(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}var dRe={kernelName:fc,backendName:"webgl",kernelFunc:uW},hRe=class{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=`
4768       void main() {
4769         ivec2 coords = getOutputCoords();
4770         int batch = coords[0];
4771         int elemIdx = coords[1];
4772
4773         // We compare elements pair-wise within a group of size 2 * inc.
4774         // The comparing rule for each group alternates between ascending
4775         // and descending. Within each group, we compare each pair at
4776         // positions i and i+inc. To decide whether an element at position i
4777         // is x0 or x1, we mod it by 2 * inc, if the result is smaller than
4778         // inc, it is in the first half of the group, we denote it as x0,
4779         // otherwise we denote it as x1.
4780         // For example, as shown in the Bitonic top K paper referenced above,
4781         // Figure5(a) shows that element[1] is in the
4782         // second half of the group when group size is 2, but it is in the
4783         // first half of the group when group size is 4.
4784
4785         bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;
4786         int i = isFirstInPair ? elemIdx : elemIdx - inc;
4787
4788         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
4789         int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));
4790         float x0 = i0 < n ? getX(batch, i0) : negativeInf;
4791         float x1 = i1 < n ? getX(batch, i1) : negativeInf;
4792
4793         // Denotes which direction indices are in (ascending or descending).
4794         bool reverse = imod(elemIdx, 2 * dir) >= dir;
4795         bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);
4796         if (reverse == isGreater) { // Elements in opposite order of direction
4797           int iTemp = i0;
4798           i0 = i1;
4799           i1 = iTemp;
4800         }
4801         if (isFirstInPair) {
4802            setOutput(float(i0));
4803         } else {
4804            setOutput(float(i1));
4805         }
4806       }
4807     `}},pRe=class{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=`
4808    void main() {
4809         // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...
4810         ivec2 coords = getOutputCoords();
4811         int batch = coords[0];
4812         int elemIdx = coords[1];
4813
4814         // The output size is half of the previous size.
4815         // If the previous sequence is | | | | _ _ _ _  | | | |  _ _ _ _ (k=4),
4816         // we only need to output the indices at positions |, the indices at
4817         // positions _ can be thrown away, see Figure5(b) After Phase 2
4818         // (Merge phase) in the Bitonic Top K paper referenced above.
4819         // For example, the paper shows we only need to output the orange bars.
4820         // The output sequence should look like this | | | | | | | |.
4821         // Because the sequence is halved, to map the output index back
4822         // to the previous sequence to find the corresponding value,
4823         // we need to double the index. When we double the index,
4824         // we basically interpolate a position, so 2i looks like
4825         // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position
4826         // of each 2k positions by - elemIdx % k. E.g. for output at
4827         // index 4,5,6,7, we want to get the corresponding element at
4828         // original index 8,9,10,11, for output at index 8,9,10,11,
4829         // we want to get the corresponding element at original index
4830         // 16,17,18,19, so on and so forth.
4831
4832         int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));
4833         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
4834         int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));
4835
4836         float x0 = getX(batch, i0);
4837         float x1 = i1 < n ? getX(batch, i1) : x0;
4838
4839         setOutput(x0 >= x1 ? float(i0) : float(i1));
4840       }
4841     `}};function Zc(e,t){t!==null&&e.disposeIntermediateTensorInfo(t)}function pB(e){let t=1;for(;t<e;)t*=2;return t}function fRe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a,o=fe().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),l=fe().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),d=r.shape,c=d[d.length-1];if(n.shouldExecuteOnCPU([r])||c<o||s>l){let O=n.readSync(r.dataId),[z,P]=mEe(O,d,r.dtype,s,i);return[n.makeTensorInfo(z.shape,z.dtype,z.values),n.makeTensorInfo(P.shape,P.dtype,P.values)]}if(s===0)return d[d.length-1]=0,[n.makeTensorInfo(d,r.dtype,[]),n.makeTensorInfo(d,"int32",[])];if(c===1)return[r,n0({attrs:{shape:d,dtype:"int32",value:0},backend:n})];let f=n.texData.get(r.dataId),m=f!==null&&f.isPacked,x=m?n.unpackTensor(r):r,y=R.sizeFromShape(d)/c,b=et({inputs:{x},attrs:{shape:[y,c]},backend:n});m&&Zc(n,x);let w=pB(s),S=pB(c),k=null,C=()=>k===null?[b,b]:[b,k],E=(O,z,P)=>{let j=C(),G=new hRe(P),X=[[c],[k===null?1:0],[Number.NEGATIVE_INFINITY],[O],[z]],J=k;k=n.runWebGLProgram(G,j,"int32",X),Zc(n,J)};for(let O=1;O<w;O*=2){let z=O*2;for(let P=O;P>=1;P/=2)E(z,P,[y,S])}for(let O=S;O>w;O/=2){let z=C(),P=new pRe([y,O/2]),j=[[c],[k===null?1:0],[w]],G=k;k=n.runWebGLProgram(P,z,"int32",j),Zc(n,G);let X=w/2,J=X*2;for(let V=X;V>=1;V/=2)E(J,V,k.shape)}let T=k;k=Rg({inputs:{x:k}
vendor: 4,087 bytes, lines 4841-4929
4841,backend:n,attrs:{begin:0,size:[y,s]}}),Zc(n,T);let _=tW({inputs:{x:b,indices:k},backend:n,attrs:{axis:1,batchDims:1}});Zc(n,b);let A=d.slice(0,-1);A.push(s),T=k,k=et({inputs:{x:k},attrs:{shape:A},backend:n}),Zc(n,T);let $=_;return _=et({inputs:{x:_},attrs:{shape:A},backend:n}),Zc(n,$),[_,k]}var mRe={kernelName:ug,backendName:"webgl",kernelFunc:fRe},gRe=class{constructor(e,t,n,a,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(a){case"constant":o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4;break;default:o=1;break}this.userCode=`
4842            float mapCoord(float outCoord, float len) {
4843              float inCoord = outCoord;
4844              if(${o} == 2) {
4845                if (inCoord < 0.0) {
4846                  if (len <= 1.0) {
4847                    inCoord = 0.0;
4848                  } else {
4849                    float sz2 = 2.0 * len;
4850                    if (inCoord < sz2) {
4851                      inCoord = sz2 * float(int(float(-inCoord / sz2))) +
4852                      inCoord;
4853                    }
4854                    inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;
4855                  }
4856                } else if (inCoord > len - 1.0) {
4857                  if (len <= 1.0) {
4858                    inCoord = 0.0;
4859                  } else {
4860                    float sz2 = 2.0 * len;
4861                    inCoord -= sz2 * float(int(float(inCoord / sz2)));
4862                    if (inCoord >= len) {
4863                      inCoord = sz2 - inCoord - 1.0;
4864                    }
4865                  }
4866                }
4867                return clamp(inCoord, 0.0, len - 1.0);
4868              } else if (${o} == 3) {
4869                if (inCoord < 0.0) {
4870                  if (len <= 1.0) {
4871                    inCoord = 0.0;
4872                  } else {
4873                    float sz = len - 1.0;
4874                    inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);
4875                  }
4876                } else if (inCoord > len - 1.0) {
4877                  if (len <= 1.0) {
4878                    inCoord = 0.0;
4879                  } else {
4880                    float sz = len - 1.0;
4881                    inCoord -= len * float(int(float(inCoord / sz)));
4882                  }
4883                }
4884                return clamp(inCoord, 0.0, len - 1.0);
4885              } else if (${o} == 4) {
4886                return clamp(outCoord, 0.0, len - 1.0);
4887              } else {
4888                return outCoord;
4889              }
4890            }
4891
4892            float readWithFillValue(int batch, int coordY, int coordX,
4893              int channel) {
4894              float outputValue;
4895              if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${t}) {
4896                  outputValue = getImage(batch, coordY, coordX, channel);
4897              } else {
4898                outputValue = float(${r});
4899              }
4900              return outputValue;
4901            }
4902
4903            void main() {
4904              ivec4 coords = getOutputCoords();
4905              float outputValue;
4906              int batch = coords[0];
4907              int x = coords[2];
4908              int y = coords[1];
4909              int channel = coords[3];
4910              float xf = float(x);
4911              float yf = float(y);
4912              float a1 = getTransforms(batch, 0);
4913              float a2 = getTransforms(batch, 1);
4914              float a3 = getTransforms(batch, 2);
4915              float b1 = getTransforms(batch, 3);
4916              float b2 = getTransforms(batch, 4);
4917              float b3 = getTransforms(batch, 5);
4918              float c1 = getTransforms(batch, 6);
4919              float c2 = getTransforms(batch, 7);
4920              float projection = c1 * xf + c2 * yf + 1.0;
4921              if (projection == 0.0) {
4922                outputValue = float(${r});
4923              } else {
4924                float inX = (a1 * xf + a2 * yf + a3) / projection;
4925                float inY = (b1 * xf + b2 * yf + b3) / projection;
4926                float mapX = mapCoord(inX, float(${t}));
4927                float mapY = mapCoord(inY, float(${e}));
4928
4929                if (${i} == 1) {
4930                  int coordY = int(round(mapY));
4931                  int coordX = int(round(mapX));
4932                  outputValue = readWithFillValue(batch, coordY, coordX,
4933                    channel);
4934                } else {
4935                  float yFloor = floor(mapY);
4936                  float xFloor = floor(mapX);
4937                  float yCeil = yFloor + 1.0;
4938                  float xCeil = xFloor + 1.0;
4939                  float valueYFloor = (xCeil - mapX) *
4940                  readWithFillValue(batch, int(yFloor), int(xFloor), channel) +
4941                  (mapX - xFloor) *
4942                  readWithFillValue(batch, int(yFloor), int(xCeil), channel);
4943                  float valueYCeil = (xCeil - mapX) *
4944                  readWithFillValue(batch, int(yCeil), int(xFloor), channel) +
4945                  (mapX - xFloor) *
4946                  readWithFillValue(batch, int(yCeil), int(xCeil), channel);
4947                  outputValue = (yCeil - mapY) * valueYFloor +
4948                  (mapY - yFloor) * valueYCeil;
4949                }
4950              }
4951              setOutput(outputValue);
4952            }
4953        `}};function xRe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[c,f,m,x]=r.shape,[y,b]=d??[f,m],w=[c,y,b,x],S=new gRe(f,m,i,o,l,w);return n.runWebGLProgram(S,[r,s],"float32")}var yRe={kernelName:cg,backendName:"webgl",kernelFunc:xRe};function bRe(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;Eg(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=a.readSync(s.dataId),{outputValues:o,outputShape:l,indices:d}=gEe(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([d.length],"int32",d)]}var vRe={kernelName:Sb,backendName:"webgl",kernelFunc:bRe};function wRe(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r,o=i.shape.length,l=r.shape[s],d=new Array(o-1),c=0;for(let b=0;b<o;b++)b!==s&&(d[c++]=i.shape[b]);let f=[],m=new Array(o).fill(0),x=i.shape.slice();x[s]=1;let y=new Array(l);for(let b=0;b<y.length;b++){m[s]=b;let w=Rg({inputs:{x:i},backend:n,attrs:{begin:m,size:x}}),S=et({inputs:{x:w},backend:n,attrs:{shape:d}});y[b]=S,f.push(w)}return f.forEach(b=>n.disposeIntermediateTensorInfo(b)),y}var SRe={kernelName:dg,backendName:"webgl",kernelFunc:wRe},kRe=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,a=e.batchSize,r=e.inSize,s=e.numSegments,i=s*Math.ceil(r/n);this.outputShape=[a,i];let o="0.0",l="sumValue",d=Math.floor(n/4)*4,c=n%4,f=`
4954        sumValue += dot(values, segFilter);
4955    `,m="";r%n>0&&(m=`
4956        if (inIdx < 0 || inIdx >= ${r}) {
4957          return initializationValue;
4958        }
4959      `);let x="";r%n>0&&(x=`
4960        if (inIdx < 0 || inIdx >= ${r}) {
4961          return -1.0;
4962        }
4963      `),this.userCode=`
4964      const float initializationValue = ${o};
4965
4966      float getValue(int batch, int inIdx) {
4967        ${m}
4968        return getX(batch, inIdx);
4969      }
4970
4971      float getSegmentIdAtIndex(int inIdx) {
4972        ${x}
4973        return getSegmentIds(inIdx);
4974      }
4975
4976      void main() {
4977        ivec2 coords = getOutputCoords();
4978        int batch = coords[0];
4979        int outIdx = coords[1];
4980        int inOffset = int(floor(float(outIdx) / float(
4981          ${s})) * float(${n}));
4982        int currentSeg = int(mod(float(outIdx), float(${s})));
4983
4984        float sumValue = 0.0;
4985
4986        for (int i = 0; i < ${d}; i += 4) {
4987          int inIdx = inOffset + i;
4988          vec4 values = vec4(
4989            getValue(batch, inIdx),
4990            getValue(batch, inIdx + 1),
4991            getValue(batch, inIdx + 2),
4992            getValue(batch, inIdx + 3)
4993          );
4994
4995          vec4 segFilter = vec4(
4996            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
4997            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
4998            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
4999            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0
5000          );
5001
5002          ${f}
5003        }
5004
5005        int inIdx = inOffset + ${d};
5006        if (${c===1}) {
5007          vec4 values = vec4(
5008            getValue(batch, inIdx),
5009            initializationValue,
5010            initializationValue,
5011            initializationValue
5012          );
5013
5014          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));
5015
5016          vec4 segFilter = vec4(
5017            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
5018            0,
5019            0,
5020            0
5021          );
5022
5023          ${f}
5024        } else if (${c===2}) {
5025          vec4 values = vec4(
5026            getValue(batch, inIdx),
5027            getValue(batch, inIdx + 1),
5028            initializationValue,
5029            initializationValue
5030          );
5031
5032          vec4 segFilter = vec4(
5033            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
5034            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
5035              0,
5036              0
5037          );
5038
5039          ${f}
5040        } else if (${c===3}) {
5041          vec4 values = vec4(
5042            getValue(batch, inIdx),
5043            getValue(batch, inIdx + 1),
5044            getValue(batch, inIdx + 2),
5045            initializationValue
5046          );
5047
5048          vec4 segFilter = vec4(
5049            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
5050            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
5051            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
5052            0
5053          );
5054
5055          ${f}
5056        }
5057        setOutput(${l});
5058      }
5059    `}};function NRe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a,o=r.shape.length,l=[],d=0,c=W.getAxesPermutation([d],o),f=r;
vendor: 73,287 bytes, lines 5059-5061
5059c!=null&&(f=Ss({inputs:{x:r},backend:n,attrs:{perm:c}}),l.push(f),d=W.getInnerMostAxes(1,o)[0]);let m=W.segment_util.computeOutShape(f.shape,d,i),x=R.sizeFromShape([f.shape[d]]),y=et({inputs:{x:f},backend:n,attrs:{shape:[-1,x]}});l.push(y);let b=Dw(r.dtype),w=(E,T,_,A,$)=>{let O=E.shape[0],z=E.shape[1],P=W.segment_util.segOpComputeOptimalWindowSize(z,$),j={windowSize:P,inSize:z,batchSize:O,numSegments:$},G=new kRe(j,T),X=n.compileAndRun(G,[E,_],A);if(l.push(X),X.shape[1]===$)return X;let J=lW({backend:n,attrs:{start:0,stop:$,step:1,dtype:"float32"}}),V=uW({inputs:{x:J},backend:n,attrs:{reps:[z/P]}});return l.push(J),l.push(V),w(X,T,V,A,$)},S=w(y,"unsortedSegmentSum",s,b,i),k=et({inputs:{x:S},backend:n,attrs:{shape:m}}),C=k;if(c!=null){l.push(k);let E=W.getUndoAxesPermutation(c);C=Ss({inputs:{x:C},backend:n,attrs:{perm:E}})}return l.forEach(E=>n.disposeIntermediateTensorInfo(E)),C}var CRe={kernelName:kb,backendName:"webgl",kernelFunc:NRe},ERe=[uIe,dIe,fIe,xIe,bIe,SIe,NIe,EIe,_Ie,DIe,$Ie,OIe,zIe,HIe,KIe,YIe,QIe,nTe,rTe,iTe,cTe,xTe,bTe,kTe,CTe,jTe,RTe,FTe,GEe,PTe,HTe,XTe,tAe,rAe,iAe,lAe,cAe,fAe,xAe,vAe,SAe,NAe,EAe,AAe,jAe,$Ae,FAe,PAe,WAe,HAe,XAe,ZAe,a_e,i_e,u_e,c_e,h_e,f_e,g_e,y_e,v_e,N_e,I_e,__e,D_e,$_e,O_e,U_e,G_e,HEe,K_e,WTe,J_e,e4e,a4e,KEe,o4e,d4e,p4e,x4e,v4e,N4e,I4e,j4e,$4e,O4e,P4e,V4e,G4e,K4e,Q4e,e3e,n3e,r3e,i3e,c3e,f3e,y3e,E3e,JEe,_3e,R3e,B3e,L3e,ITe,U3e,V3e,G3e,X3e,Z3e,YEe,tje,aje,sje,oje,lje,TTe,S3e,dje,mje,bje,ZEe,kje,Eje,_je,Rje,Fje,Lje,Uje,Hje,Kje,Jje,eDe,aDe,oDe,cDe,fDe,xDe,mTe,N3e,vDe,SDe,NDe,EDe,TDe,_De,DDe,MDe,BDe,LDe,zDe,WDe,HDe,KDe,YDe,QDe,eRe,k3e,iIe,aRe,iRe,lRe,dRe,mRe,yRe,oIe,vRe,SRe,CRe,W3e];for(let e of ERe)Nb(e);var In;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(In||(In={}));var qy;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid",e[e.elu=6]="elu"})(qy||(qy={}));var cW;function IRe(e){cW=e.wasm.cwrap(Nd,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function TRe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:d,activation:c,leakyreluAlpha:f}=a,m=n.dataIdMap.get(r.dataId).id,x=n.dataIdMap.get(s.dataId).id,y=0;if(i!=null){let $=n.dataIdMap.get(i.dataId);if($.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${$.shape.length}.`);y=$.id}let b=o==null?0:n.dataIdMap.get(o.dataId).id,w=qy[c];if(w==null)throw new Error(`${c} activation not yet supported for FusedConv2D in the wasm backend.`);let S=l?r.shape[2]:r.shape[1],k=d?s.shape[1]:s.shape[2],C=fg.assertAndGetBroadcastShape(r.shape.slice(0,-2),s.shape.slice(0,-2)),E=n.makeOutput([...C,S,k],r.dtype),T=n.dataIdMap.get(E.dataId).id,_=new Uint8Array(new Int32Array(r.shape).buffer),A=new Uint8Array(new Int32Array(s.shape).buffer);return cW(m,_,r.shape.length,x,A,s.shape.length,l,d,w,y,b,f||0,T),E}var ARe={kernelName:Nd,backendName:"wasm",setupFunc:IRe,kernelFunc:TRe};function yn(e,t){let n;function a(s){n=s.wasm.cwrap(e,null,["number","number","number"])}function r(s){let{backend:i,inputs:{x:o}}=s,l=i.dataIdMap.get(o.dataId).id,d=i.makeOutput(o.shape,t||o.dtype),c=i.dataIdMap.get(d.dataId).id;return R.sizeFromShape(d.shape)===0||n(l,In[o.dtype],c),d}return{kernelName:e,backendName:"wasm",setupFunc:a,kernelFunc:r}}var _Re=yn(hm),jRe=yn(Gd),DRe=yn(qd);function or(e,t,n){let a;function r(i){a=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:d,b:c}=l,f=o.dataIdMap.get(d.dataId).id,m=o.dataIdMap.get(c.dataId).id,x=n??d.dtype,y=W.assertAndGetBroadcastShape(d.shape,c.shape),b=o.makeOutput(y,x);if(R.sizeFromShape(y)===0)return b;let w=new Uint8Array(new Int32Array(d.shape).buffer),S=new Uint8Array(new Int32Array(c.shape).buffer),k=o.dataIdMap.get(b.dataId).id;return a(f,w,d.shape.length,m,S,c.shape.length,In[d.dtype],k),b}return{kernelName:e,backendName:"wasm",setupFunc:r,kernelFunc:s}}var RRe=or(hc),dW;function MRe(e){dW=e.wasm.cwrap(Kd,null,["array","number","number","number"])}function $Re(e){let{inputs:t,backend:n}=e,a=n.makeOutput(t[0].shape,t[0].dtype);if(R.sizeFromShape(a.shape)===0)return a;let r=t.map(o=>n.dataIdMap.get(o.dataId).id),s=new Uint8Array(new Int32Array(r).buffer),i=n.dataIdMap.get(a.dataId).id;return dW(s,r.length,In[a.dtype],i),a}var BRe={kernelName:Kd,backendName:"wasm",setupFunc:MRe,kernelFunc:$Re};function z2(e){let{inputs:{x:t},backend:n}=e;if(t.dtype==="string")return bs(n.readSync(t.dataId),t.shape,t.dtype);let a=n.makeOutput(t.shape,t.dtype),r=n.typedArrayFromHeap(t);return n.typedArrayFromHeap(a).set(r),a}var FRe={kernelName:wh,backendName:"wasm",kernelFunc:z2},hW;function ORe(e){hW=e.wasm.cwrap(Fl,null,["number","array","number","number","number","array","number"])}function oc(e){let{inputs:t,backend:n,attrs:a}=e,[r,s]=PRe(t.x.shape,a.perm),i=!0;for(let y=0;y<s.length;y++)s[y]!==y&&(i=!1);let o=LRe(t.x.shape,a.perm),l={dataId:t.x.dataId,shape:r,dtype:t.x.dtype};if(i){let y=z2({inputs:t,backend:n});return y.shape=o,y}let d=n.makeOutput(o,l.dtype),c=n.dataIdMap.get(l.dataId).id,f=n.dataIdMap.get(d.dataId).id,m=new Uint8Array(new Int32Array(s).buffer),x=new Uint8Array(new Int32Array(l.shape).buffer);return hW(c,x,l.shape.length,In[l.dtype],f,m,s.length),d}function LRe(e,t){let n=new Array(e.length);for(let a=0;a<n.length;a++)n[a]=e[t[a]];return n}function PRe(e,t){let n=[],a=[];for(let r=0;r<e.length;++r)e[r]!==1&&n.push(e[r]),e[t[r]]!==1&&a.push(t[r]);for(let r=0;r<a.length;++r){let s=-1;for(let i=0;i<a.length;++i)a[i]>=r&&(s===-1||a[s]>a[i])&&(s=i);a[s]=r}return[n,a]}var zRe={kernelName:Fl,backendName:"wasm",kernelFunc:oc,setupFunc:ORe};function kc(e,t,n){let a=e.shape,r=e.shape.length,s=R.parseAxisParam(t,a),i=s,o=W.getAxesPermutation(i,r),l=null,d=!1;if(o!=null){let c=new Array(r);for(let m=0;m<c.length;m++)c[m]=a[o[m]];i=W.getInnerMostAxes(i.length,r),l=oc({inputs:{x:e},attrs:{perm:o},backend:n});let f=n.dataIdMap.get(e.dataId).id;n.dataIdMap.get(l.dataId).id!==f&&(d=!0)}return{transposed:l,originalAxes:s,axes:i,inputWasTransposed:d}}var pW;function URe(e){pW=e.wasm.cwrap(pm,null,["number, number, number"])}function WRe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:d,axes:c,originalAxes:f,inputWasTransposed:m}=kc(i,r,t);if(m){let k=t.dataIdMap.get(d.dataId).id;l=d,o=k}let x=l.shape.length;W.assertAxesAreInnerMostDims("all",c,x);let[y,b]=W.computeOutAndReduceShapes(l.shape,c),w=R.sizeFromShape(b),S=t.makeOutput(y,i.dtype);if(R.sizeFromShape(l.shape)!==0){let k=t.dataIdMap.get(S.dataId).id;pW(o,w,k)}if(m&&t.disposeData(d.dataId),s){let k=W.expandShapeToKeepDim(S.shape,f);S.shape=k}return S}var VRe={kernelName:pm,backendName:"wasm",setupFunc:URe,kernelFunc:WRe},fW;function HRe(e){fW=e.wasm.cwrap(fm,null,["number, number, number"])}function GRe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:d,axes:c,originalAxes:f,inputWasTransposed:m}=kc(i,r,t);if(m){let k=t.dataIdMap.get(d.dataId).id;l=d,o=k}let x=l.shape.length;W.assertAxesAreInnerMostDims("any",c,x);let[y,b]=W.computeOutAndReduceShapes(l.shape,c),w=R.sizeFromShape(b),S=t.makeOutput(y,i.dtype);if(R.sizeFromShape(l.shape)!==0){let k=t.dataIdMap.get(S.dataId).id;fW(o,w,k)}if(m&&t.disposeData(d.dataId),s){let k=W.expandShapeToKeepDim(S.shape,f);S.shape=k}return S}var qRe={kernelName:fm,backendName:"wasm",setupFunc:HRe,kernelFunc:GRe};function mW(e){let t;function n(r){t=r.wasm.cwrap(e,null,["number","number","number","number","number"])}function a(r){let{backend:s,inputs:i,attrs:o}=r,{axis:l}=o,{x:d}=i,c=s.dataIdMap.get(d.dataId).id,f=c,m=d,{transposed:x,axes:y,inputWasTransposed:b}=kc(d,l,s);if(b){let T=s.dataIdMap.get(x.dataId).id;T!==c&&(m=x,f=T)}let w=m.shape.slice(0,-1),S=s.makeOutput(w,"int32"),k=s.dataIdMap.get(S.dataId).id,C=R.sizeFromShape(S.shape),E=m.shape[y[0]];return t(f,In[m.dtype],C,E,k),b&&s.disposeData(x.dataId),S}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var KRe=mW(mm),XRe=mW(gm),YRe=yn(Xd),JRe=yn(Yd),QRe=yn(Jd),ZRe=or(Zd),eMe=yn(Qd),gW;function tMe(e){gW=e.wasm.cwrap(eh,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function nMe(e){let{inputs:t,attrs:n,backend:a}=e,r=t.x,s=a.dataIdMap.get(r.dataId).id,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=n,c=W.computePool2DInfo(r.shape,i,o,1,l,d),f=c.filterHeight,m=c.filterWidth,x=c.padInfo.top,y=c.padInfo.right,b=c.padInfo.bottom,w=c.padInfo.left,S=c.strideHeight,k=c.strideWidth,C=c.inChannels;if(c.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${c.dataFormat}'. Please use 'channelsLast'.`);if(c.dilationWidth!==1||c.dilationHeight!==1)throw new Error(`was backend only supports average pooling with dilation = [1, 1], got [${c.dilationHeight}, ${c.dilationWidth}].`);let E=a.makeOutput(c.outShape,"float32"),T=a.dataIdMap.get(E.dataId).id;return gW(s,r.shape[0],r.shape[1],r.shape[2],f,m,x,y,b,w,S,k,C,T),E}var aMe={kernelName:eh,backendName:"wasm",setupFunc:tMe,kernelFunc:nMe},xW;function rMe(e){xW=e.wasm.cwrap("AvgPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function sMe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,c=W.computePool3DInfo(r.shape,s,i,1,o,l,d),f=n.makeOutput(c.outShape,r.dtype);return xW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),f}var iMe={kernelName:xm,backendName:"wasm",setupFunc:rMe,kernelFunc:sMe},yW;function oMe(e){yW=e.wasm.cwrap("AvgPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function lMe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a,c=W.computePool3DInfo(s.shape,i,o,1,l,d),f=n.makeOutput(s.shape,s.dtype);return yW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left,c.filterDepth,c.filterHeight,c.filterWidth),f}var uMe={kernelName:rb,backendName:"wasm",setupFunc:oMe,kernelFunc:lMe},bW;function cMe(e){bW=e.wasm.cwrap("AvgPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function dMe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l}=a,d=W.computePool2DInfo(s.shape,i,o,1,l),c=n.makeOutput(s.shape,s.dtype);return bW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(c.dataId).id,d.batchSize,d.inChannels,d.inHeight,d.inWidth,d.outHeight,d.outWidth,d.strideHeight,d.strideWidth,d.dilationHeight,d.dilationWidth,d.effectiveFilterHeight,d.effectiveFilterWidth,d.padInfo.top,d.padInfo.left,d.filterHeight,d.filterWidth),c}var hMe={kernelName:ab,backendName:"wasm",setupFunc:cMe,kernelFunc:dMe};function Fs(e){let{inputs:t,attrs:n}=e,{x:a}=t,{shape:r}=n,s=R.sizeFromShape(a.shape),i=R.inferFromImplicitShape(r,s);return R.assert(s===R.sizeFromShape(i),()=>`new shape: ${i}, old shape: ${a.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(a.dataId),{dataId:a.dataId,shape:i,dtype:a.dtype}}var pMe={kernelName:Ym,backendName:"wasm",kernelFunc:Fs},vW;function fMe(e){vW=e.wasm.cwrap(th,null,["number","array","number","number","array","number","number","number","number"])}function mMe(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let l=r.shape.length,d=s.shape.length,c=i?r.shape[l-2]:r.shape[l-1],f=o?s.shape[d-1]:s.shape[d-2],m=i?r.shape[l-1]:r.shape[l-2],x=o?s.shape[d-2]:s.shape[d-1],y=r.shape.slice(0,-2),b=s.shape.slice(0,-2),w=R.sizeFromShape(y),S=R.sizeFromShape(b),k=fg.assertAndGetBroadcastShape(r.shape.slice(0,-2),s.shape.slice(0,-2)).concat([m,x]);R.assert(c===f,()=>`Error in matMul: inner shapes (${c}) and (${f}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let C=i?[w,c,m]:[w,m,c],E=o?[S,x,f]:[S,f,x],T=Fs({inputs:{x:r},backend:n,attrs:{shape:C}}),_=Fs({inputs:{x:s},backend:n,attrs:{shape:E}}),A=n.dataIdMap.get(T.dataId).id,$=n.dataIdMap.get(_.dataId).id,O=i?T.shape[2]:T.shape[1],z=o?_.shape[1]:_.shape[2],P=Math.max(w,S),j=n.makeOutput([P,O,z],T.dtype),G=n.dataIdMap.get(j.dataId).id,X=new Uint8Array(new Int32Array(T.shape).buffer),J=new Uint8Array(new Int32Array(_.shape).buffer);return vW(A,X,T.shape.length,$,J,_.shape.length,i,o,G),n.disposeData(T.dataId),n.disposeData(_.dataId),j.shape=k,j}var gMe={kernelName:th,backendName:"wasm",setupFunc:fMe,kernelFunc:mMe};function Ud(e){let{inputs:{x:t},attrs:{begin:n,size:a},backend:r}=e,[s,i]=vr.parseSliceParams(t,n,a),o=vr.isSliceContinous(t.shape,s,i),l=r.readSync(t.dataId),d=r.makeOutput(i,t.dtype),c=R.computeStrides(t.shape),f=r.dataIdMap.get(d.dataId);if(o){let y=vr.computeFlatOffset(s,c);return t.dtype==="string"?f.stringBytes=l.slice(y,y+R.sizeFromShape(i)):r.typedArrayFromHeap(d).set(l.subarray(y,y+R.sizeFromShape(i))),d}if(t.dtype==="string"){let y=Wv(l,s,i,t.shape,t.dtype);return f.stringBytes=y,d}let m=r.typedArrayFromHeap(d),x=t.shape.length;if(x===2)xMe(l,c[0],m,s,i);else if(x===3)yMe(l,c[0],c[1],m,s,i);else if(x===4)bMe(l,c[0],c[1],c[2],m,s,i);else{let y=Wv(l,s,i,t.shape,t.dtype);m.set(y)}return d}function xMe(e,t,n,a,r){let s=0,i=a[0],o=a[1],l=i+r[0];for(let d=i;d<l;d++){let c=d*t+o;n.set(e.subarray(c,c+r[1]),s),s+=r[1]}}function yMe(e,t,n,a,r,s){let i=0,o=r[0],l=r[1],d=r[2],c=o+s[0],f=l+s[1];for(let m=o;m<c;m++)for(let x=l;x<f;x++){let y=m*t+x*n+d;a.set(e.subarray(y,y+s[2]),i),i+=s[2]}}function bMe(e,t,n,a,r,s,i){let o=0,l=s[0],d=s[1],c=s[2],f=l+i[0],m=d+i[1],x=c+i[2],y=s[3];for(let b=l;b<f;b++)for(let w=d;w<m;w++)for(let S=c;S<x;S++){let k=b*t+w*n+S*a+y;r.set(e.subarray(k,k+i[3]),o),o+=i[3]}}var vMe={kernelName:ag,backendName:"wasm",kernelFunc:Ud};function wMe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a,o=s.reduce((S,k)=>S*k),l=W.getReshaped(r.shape,s,o),d=W.getPermuted(l.length,s.length),c=W.getReshapedPermuted(r.shape,s,o),f=W.getSliceBeginCoords(i,s.length),m=W.getSliceSize(c,i,s.length),x=Fs({inputs:{x:r},backend:n,attrs:{shape:l}}),y=oc({inputs:{x},backend:n,attrs:{perm:d}}),b=Fs({inputs:{x:y},backend:n,attrs:{shape:c}}),w=Ud({inputs:{x:b},backend:n,attrs:{begin:f,size:m}});return n.disposeData(x.dataId),n.disposeData(y.dataId),n.disposeData(b.dataId),w}var SMe={kernelName:ym,backendName:"wasm",kernelFunc:wMe},wW;function kMe(e){wW=e.wasm.cwrap(bm,null,["number","number","boolean","number","number","number"])}function NMe(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,weights:s}=n,{size:i}=a,o=s.shape.reduce((f,m)=>f*m,1)!==0,l=r.shape.length===1?[i]:[r.shape[0],i],d=t.makeOutput(l,s.dtype);function c(f){return t.dataIdMap.get(f.dataId).id}return wW(c(r),i,o,c(s),In[s.dtype],c(d)),d}var CMe={kernelName:bm,backendName:"wasm",setupFunc:kMe,kernelFunc:NMe},EMe=or(vm);function IMe(e){let{inputs:t,backend:n}=e,{s0:a,s1:r}=t,s=n.typedArrayFromHeap(a),i=n.typedArrayFromHeap(r),o=W.assertAndGetBroadcastShape(Array.from(s),Array.from(i));return n.makeOutput([o.length],"int32",void 0,new Int32Array(o))}var TMe={kernelName:sb,backendName:"wasm",kernelFunc:IMe};function Nc(e){let{inputs:{x:t},attrs:{dtype:n},backend:a}=e,r=a.makeOutput(t.shape,n),s=a.typedArrayFromHeap(t);return a.typedArrayFromHeap(r).set(s),r}var AMe={kernelName:nh,backendName:"wasm",kernelFunc:Nc},_Me=yn(ah),SW;function jMe(e){SW=e.wasm.cwrap(pc,null,["number","number","number","number"])}function DMe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o=n.dataIdMap.get(r.dataId).id,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(l.dataId).id;return SW(o,s,i,d),l}var RMe={kernelName:pc,backendName:"wasm",setupFunc:jMe,kernelFunc:DMe};function kW(e){let{inputs:t,backend:n}=e,a=R.parseAxisParam(e.attrs.axis,t[0].shape)[0],r=t.map(x=>x.shape);W.assertParamsConsistent(r,a);let s=W.computeOutShape(t.map(x=>x.shape),a),i=t.filter(x=>R.sizeFromShape(x.shape)>0);if(i.length===1)return z2({inputs:{x:i[0]},backend:n});let o=n.makeOutput(s,t[0].dtype);if(R.sizeFromShape(s)===0)return o;if(i[0].dtype==="string"){let x=i.map(C=>{let E=[-1,R.sizeFromShape(C.shape.slice(a))];return Fs({inputs:{x:C},backend:n,attrs:{shape:E}})}),y=x.map(C=>({vals:n.readSync(C.dataId),shape:C.shape}));s=W.computeOutShape(x.map(C=>C.shape),1);let b=x[0].shape[0]===1,w=a4(y,s,t[0].dtype,b),S=W.computeOutShape(i.map(C=>C.shape),a);o.shape=S;let k=n.dataIdMap.get(o.dataId);return k.stringBytes=W.fromStringArrayToUint8(w),x.forEach(C=>n.disposeData(C.dataId)),o}let l=R.sizeFromShape(i[0].shape.slice(0,a)),d=0,c=i.map(x=>{let y=R.sizeFromShape(x.shape.slice(a));return d+=y,y}),f=i.map(x=>n.typedArrayFromHeap(x)),m=n.typedArrayFromHeap(o);for(let x=0;x<l;x++){let y=x*d;for(let b=0;b<f.length;b++){let w=c[b],S=x*w,k=f[b].subarray(S,S+w);m.set(k,y),y+=w}}return o}var MMe={kernelName:wm,backendName:"wasm",kernelFunc:kW},NW;function $Me(e){NW=e.wasm.cwrap(rh,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function BMe(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s}=t,i=a.dataIdMap.get(r.dataId).id,o=a.dataIdMap.get(s.dataId).id,{strides:l,dilations:d,pad:c,dimRoundingMode:f,dataFormat:m}=n,x=W.convertConv2DDataFormat(m),y=W.computeConv2DInfo(r.shape,s.shape,l,d,c,f,!1,x),b=y.filterHeight,w=y.filterWidth,S=y.padInfo.top,k=y.padInfo.right,C=y.padInfo.bottom,E=y.padInfo.left,T=y.dilationHeight,_=y.dilationWidth,A=y.strideHeight,$=y.strideWidth,O=y.inChannels,z=y.outChannels,P=y.padInfo.type==="SAME"?1:0;if(y.dataFormat!=="channelsLast")throw new Error(`wasm backend Conv2D does not support dataFormat:'${y.dataFormat}'. Please use 'channelsLast'.`);let j=a.makeOutput(y.outShape,"float32"),G=a.dataIdMap.get(j.dataId).id;return NW(i,r.shape[0],r.shape[1],r.shape[2],o,b,w,S,k,C,E,P,T,_,A,$,O,z,G),j}var FMe={kernelName:rh,backendName:"wasm",setupFunc:$Me,kernelFunc:BMe},CW;function OMe(e){CW=e.wasm.cwrap(sh,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function LMe(e){let{backend:t,inputs:n,attrs:a}=e,{dy:r,filter:s}=n,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,inputShape:c}=a,f=1,m=W.convertConv2DDataFormat(l),x=W.computeConv2DInfo(c,s.shape,i,f,o,d,!1,m),{batchSize:y,filterHeight:b,filterWidth:w,inChannels:S,inHeight:k,inWidth:C,outChannels:E,outHeight:T,outWidth:_,strideHeight:A,strideWidth:$}=x,O=b-1-x.padInfo.top,z=w-1-x.padInfo.left,P=x.dataFormat==="channelsLast",j=R.computeStrides(x.inShape),G=R.computeStrides(r.shape),[X,J,V]=R.computeStrides(s.shape),Q=j[0],F=P?j[1]:j[2],H=P?j[2]:1,B=P?1:j[1],Y=G[0],ne=P?G[1]:G[2],ee=P?G[2]:1,U=P?1:G[1],oe=t.makeOutput(x.inShape,"float32"),pe=t.dataIdMap.get(oe.dataId).id,he=t.dataIdMap.get(r.dataId).id,xe=t.dataIdMap.get(s.dataId).id;return CW(he,xe,y,b,w,k,C,S,T,_,E,A,$,O,z,X,J,V,Q,F,H,B,Y,ne,ee,U,pe),oe}var PMe={kernelName:sh,backendName:"wasm",setupFunc:OMe,kernelFunc:LMe},EW;function zMe(e){EW=e.wasm.cwrap(ih,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function UMe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a;if(r.dtype!=="float32")throw new Error(`Tensor x must have dtype float32, got ${r.dtype}`);if(s.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${s.dtype}`);let d=W.computeConv3DInfo(r.shape,s.shape,i,l,o),c=n.makeOutput(d.outShape,r.dtype);return EW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(c.dataId).id,d.batchSize,d.inDepth,d.inHeight,d.inWidth,d.inChannels,d.outDepth,d.outHeight,d.outWidth,d.outChannels,d.strideDepth,d.strideHeight,d.strideWidth,d.dilationDepth,d.dilationHeight,d.dilationWidth,d.filterDepth,d.filterHeight,d.filterWidth,d.padInfo.front,d.padInfo.top,d.padInfo.left),c}var WMe={kernelName:ih,backendName:"wasm",setupFunc:zMe,kernelFunc:UMe},IW;function VMe(e){IW=e.wasm.cwrap(Sm,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function HMe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a;if(r.dtype!=="float32")throw new Error(`Tensor dy must have dtype float32, got ${r.dtype}`);if(s.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${s.dtype}`);let d=W.computeConv3DInfo(r.shape,l,i,1,o),c=n.makeOutput(d.filterShape,s.dtype);return IW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(c.dataId).id,d.batchSize,d.inDepth,d.inHeight,d.inWidth,d.inChannels,d.outDepth,d.outHeight,d.outWidth,d.outChannels,d.strideDepth,d.strideHeight,d.strideWidth,d.dilationDepth,d.dilationHeight,d.dilationWidth,d.filterDepth,d.filterHeight,d.filterWidth,d.padInfo.front,d.padInfo.top,d.padInfo.left),c}var GMe={kernelName:Sm,backendName:"wasm",setupFunc:VMe,kernelFunc:HMe},TW;function qMe(e){TW=e.wasm.cwrap(km,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function KMe(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a;if(r.dtype!=="float32")throw new Error(`Tensor dy must have dtype float32, got ${r.dtype}`);if(s.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${s.dtype}`);let d=W.computeConv3DInfo(l,s.shape,o,1,i),c=n.makeOutput(d.inShape,r.dtype);return TW(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(c.dataId).id,d.batchSize,d.inDepth,d.inHeight,d.inWidth,d.inChannels,d.outDepth,d.outHeight,d.outWidth,d.outChannels,d.strideDepth,d.strideHeight,d.strideWidth,d.dilationDepth,d.dilationHeight,d.dilationWidth,d.filterDepth,d.filterHeight,d.filterWidth,d.padInfo.front,d.padInfo.top,d.padInfo.left),c}var XMe={kernelName:km,backendName:"wasm",setupFunc:qMe,kernelFunc:KMe},YMe=yn(oh),JMe=yn(lh),ME;(function(e){e[e.bilinear=0]="bilinear",e[e.nearest=1]="nearest"})(ME||(ME={}));var AW;function QMe(e){AW=e.wasm.cwrap(Cm,null,["number","number","number","number","array","number","number","number","number","number"])}function ZMe(e){let{backend:t,inputs:n,attrs:a}=e,{method:r,extrapolationValue:s,cropSize:i}=a,{image:o,boxes:l,boxInd:d}=n,c=l.shape[0],[f,m]=i,x=[c,f,m,o.shape[3]],y=t.dataIdMap.get(o.dataId),b;o.dtype!=="float32"&&(b=Nc({backend:t,inputs:{x:o},attrs:{dtype:"float32"}}),y=t.dataIdMap.get(b.dataId));let w=y.id,S=t.dataIdMap.get(l.dataId).id,k=t.dataIdMap.get(d.dataId).id,C=t.makeOutput(x,"float32"),E=t.dataIdMap.get(C.dataId).id,T=new Uint8Array(new Int32Array(o.shape).buffer);return AW(w,S,k,c,T,f,m,ME[r],s,E),b!=null&&t.disposeData(b.dataId),C}var e5e={kernelName:Cm,backendName:"wasm",setupFunc:QMe,kernelFunc:ZMe},_W;function t5e(e){_W=e.wasm.cwrap(Nm,null,["number","number","number","number","number","number"])}function n5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length;R.assert(r.dtype==="float32"||r.dtype==="int32",()=>`cumprod does not support ${r.dtype} tensors in the WASM backend`);let d=W.getAxesPermutation([s],l),c=r;d!==null&&(c=oc({inputs:{x:r},attrs:{perm:d},backend:n}));let f=W.getInnerMostAxes(1,l)[0];W.assertAxesAreInnerMostDims("cumprod",[f],l);let m=n.makeOutput(c.shape,c.dtype),x=c.shape[f],y=n.dataIdMap.get(c.dataId).id,b=n.dataIdMap.get(m.dataId).id;_W(y,i?1:0,o?1:0,x,b,In[r.dtype]);let w=m;if(d!==null){let S=W.getUndoAxesPermutation(d);w=oc({inputs:{x:m},attrs:{perm:S},backend:n}),n.disposeData(c.dataId),n.disposeData(m.dataId)}return w}var a5e={kernelName:Nm,backendName:"wasm",setupFunc:t5e,kernelFunc:n5e},jW;function r5e(e){jW=e.wasm.cwrap(uh,null,["number","number","number","number","number","number"])}function s5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length;R.assert(r.dtype==="float32"||r.dtype==="int32",()=>`cumsum does not support ${r.dtype} tensors in the WASM backend`);let d=W.getAxesPermutation([s],l),c=r;d!==null&&(c=oc({inputs:{x:r},attrs:{perm:d},backend:n}));let f=W.getInnerMostAxes(1,l)[0];W.assertAxesAreInnerMostDims("cumsum",[f],l);let m=n.makeOutput(c.shape,c.dtype),x=c.shape[f],y=n.dataIdMap.get(c.dataId).id,b=n.dataIdMap.get(m.dataId).id;jW(y,i?1:0,o?1:0,x,b,In[r.dtype]);let w=m;if(d!==null){let S=W.getUndoAxesPermutation(d);w=oc({inputs:{x:m},attrs:{perm:S},backend:n}),n.disposeData(c.dataId),n.disposeData(m.dataId)}return w}var i5e={kernelName:uh,backendName:"wasm",setupFunc:r5e,kernelFunc:s5e},DW;function o5e(e){DW=e.wasm.cwrap("DenseBincount",null,["number","array","number","number","boolean","number","number","boolean","number"])}function l5e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,weights:s}=n,{size:i,binaryOutput:o}=a,l=s.shape.reduce((m,x)=>m*x,1)!==0,d=r.shape.length===1?[i]:[r.shape[0],i],c=t.makeOutput(d,s.dtype);function f(m){return t.dataIdMap.get(m.dataId).id}return DW(f(r),new Uint8Array(new Int32Array(r.shape).buffer),r.shape.length,i,l,f(s),In[s.dtype],o,f(c)),c}var u5e={kernelName:ob,backendName:"wasm",setupFunc:o5e,kernelFunc:l5e},RW;function c5e(e){RW=e.wasm.cwrap(Em,null,["number","number","number","array","number","array","array","number","number"])}function d5e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{blockSize:s,dataFormat:i}=a,o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],c=i==="NHWC"?r.shape[3]:r.shape[1],f=l*s,m=d*s,x=c/(s*s),y=i==="NHWC"?[o,f,m,x]:[o,x,f,m],b=t.makeOutput(y,"float32"),w=t.dataIdMap.get(r.dataId).id,S=new Uint8Array(new Int32Array(R.computeStrides(r.shape)).buffer),k=new Uint8Array(new Int32Array(y).buffer),C=new Uint8Array(new Int32Array(R.computeStrides(y)).buffer),E=t.dataIdMap.get(b.dataId).id;return RW(w,s,i==="NHWC"?1:0,S,r.shape.length-1,k,C,y.length,E),b}var h5e={kernelName:Em,backendName:"wasm",setupFunc:c5e,kernelFunc:d5e},MW;function p5e(e){MW=e.wasm.cwrap(ch,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function f5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s}=t,i=a.dataIdMap.get(r.dataId).id,o=a.dataIdMap.get(s.dataId).id,{strides:l,dilations:d,pad:c,dimRoundingMode:f}=n,m=d??[1,1],x=W.computeConv2DInfo(r.shape,s.shape,l,m,c,f,!0),y=x.filterHeight,b=x.filterWidth,w=x.padInfo.top,S=x.padInfo.right,k=x.padInfo.bottom,C=x.padInfo.left,E=x.dilationHeight,T=x.dilationWidth,_=x.strideHeight,A=x.strideWidth,$=x.inChannels,O=x.outChannels,z=x.padInfo.type==="SAME"?1:0;if(x.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${x.dataFormat}'. Please use 'channelsLast'.`);let P=a.makeOutput(x.outShape,"float32"),j=a.dataIdMap.get(P.dataId).id;return MW(i,r.shape[0],r.shape[1],r.shape[2],o,y,b,w,S,k,C,z,E,T,_,A,$,O,j),P}var m5e={kernelName:ch,backendName:"wasm",setupFunc:p5e,kernelFunc:f5e},$W;function g5e(e){$W=e.wasm.cwrap("Diag",null,["number","number","number","number"])}function x5e(e){let{inputs:t,backend:n}=e,{x:a}=t,r=R.sizeFromShape(a.shape),s=n.makeOutput([...a.shape,...a.shape],a.dtype);return $W(n.dataIdMap.get(a.dataId).id,In[a.dtype],r,n.dataIdMap.get(s.dataId).id),s}var y5e={kernelName:lb,backendName:"wasm",setupFunc:g5e,kernelFunc:x5e},BW;function b5e(e){BW=e.wasm.cwrap(dh,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function v5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a;if(r.dtype!==s.dtype)throw new Error(`Dilation2D error: x must have the same dtype as filter. Got ${r.dtype} and ${s.dtype}`);let d=W.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),c=n.makeOutput(d.outShape,r.dtype);return BW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(c.dataId).id,In[r.dtype],d.batchSize,d.inChannels,d.inHeight,d.inWidth,d.outHeight,d.outWidth,d.strideHeight,d.strideWidth,d.dilationHeight,d.dilationWidth,d.filterHeight,d.filterWidth,d.padInfo.top,d.padInfo.left),c}var w5e={kernelName:dh,backendName:"wasm",setupFunc:b5e,kernelFunc:v5e},FW;function S5e(e){FW=e.wasm.cwrap(Uf,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function k5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,dy:i}=t,{strides:o,pad:l,dilations:d}=a;if(r.dtype!==s.dtype||r.dtype!==i.dtype)throw new Error(`Dilation2DBackpropFilter error: x must have the same dtype as filter and dy. Got ${r.dtype}, ${s.dtype}, and ${i.dtype}`);let c=W.computeDilation2DInfo(r.shape,s.shape,o,l,"NHWC",d),f=n.makeOutput(s.shape,s.dtype);return FW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(i.dataId).id,n.dataIdMap.get(f.dataId).id,In[r.dtype],c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.filterHeight,c.filterWidth,c.padInfo.top,c.padInfo.left),f}var N5e={kernelName:Uf,backendName:"wasm",setupFunc:S5e,kernelFunc:k5e},OW;function C5e(e){OW=e.wasm.cwrap(zf,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function E5e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,dy:i}=t,{strides:o,pad:l,dilations:d}=a;if(r.dtype!==s.dtype||r.dtype!==i.dtype)throw new Error(`Dilation2DBackpropInput error: x must have the same dtype as filter and dy. Got ${r.dtype}, ${s.dtype}, and ${i.dtype}`);let c=W.computeDilation2DInfo(r.shape,s.shape,o,l,"NHWC",d),f=n.makeOutput(r.shape,r.dtype);return OW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(i.dataId).id,n.dataIdMap.get(f.dataId).id,In[r.dtype],c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.filterHeight,c.filterWidth,c.padInfo.top,c.padInfo.left),f}var I5e={kernelName:zf,backendName:"wasm",setupFunc:C5e,kernelFunc:E5e},T5e=yn(ph),LW;function A5e(e){LW=e.wasm.cwrap(Im,null,["number","number","number"])}function _5e(e){let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=n.makeOutput(r.shape,"float32"),i=o=>n.dataIdMap.get(o.dataId).id;return LW(i(r),i(a),i(s)),s}var j5e={kernelName:Im,backendName:"wasm",setupFunc:A5e,kernelFunc:_5e},D5e=!1,R5e=or(Tm,D5e,"bool"),M5e=yn(fh),$5e=yn(mh,"float32");function $E(e){let{inputs:t,attrs:n,backend:a}=e,{input:r}=t,{dim:s}=n,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(R.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),Fs({inputs:{x:r},backend:a,attrs:{shape:o}})}var B5e={kernelName:Am,backendName:"wasm",kernelFunc:$E},F5e=yn(gh,"float32");function PW(e){let{attrs:{shape:t,value:n},backend:a}=e,{attrs:{dtype:r}}=e;r=r||R.inferDtype(n);let s=a.makeOutput(t,r);return a.typedArrayFromHeap(s).fill(n),s}var O5e={kernelName:ub,backendName:"wasm",kernelFunc:PW},zW;function L5e(e){zW=e.wasm.cwrap(_m,null,["number","number","number","number","number","number"])}function P5e(e){let{inputs:t,backend:n}=e,{image:a}=t,r=n.makeOutput(a.shape,a.dtype),s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,[o,l,d,c]=a.shape;return zW(s,o,l,d,c,i),r}var z5e={kernelName:_m,backendName:"wasm",kernelFunc:P5e,setupFunc:L5e},U5e=yn(xh),W5e=or(yh),UW;function V5e(e){UW=e.wasm.cwrap(bh,null,["number","number","number","number","number","number","number"])}function H5e(e){let{backend:t,inputs:n,attrs:a}=e,{varianceEpsilon:r}=a,{x:s,mean:i,variance:o,offset:l,scale:d}=n,c=t.dataIdMap.get(s.dataId).id,f=t.dataIdMap.get(i.dataId).id,m=t.dataIdMap.get(o.dataId).id,x=l!=null?t.dataIdMap.get(l.dataId).id:0,y=d!=null?t.dataIdMap.get(d.dataId).id:0,b=t.makeOutput(s.shape,s.dtype);if(R.sizeFromShape(s.shape)===0)return b;let w=t.dataIdMap.get(b.dataId).id;return UW(c,f,m,x,y,r,w),b}var G5e={kernelName:bh,backendName:"wasm",setupFunc:V5e,kernelFunc:H5e},WW;function q5e(e){WW=e.wasm.cwrap(Cd,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function K5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:c,dataFormat:f,dimRoundingMode:m,activation:x,leakyreluAlpha:y}=n,b=W.computeConv2DInfo(r.shape,s.shape,l,c,d,m),w=qy[x];if(w==null)throw new Error(`${x} activation not yet supported for FusedConv2D in the wasm backend.`);let S=a.dataIdMap.get(r.dataId).id,k=a.dataIdMap.get(s.dataId).id,C=b.outChannels,E=0;if(i!=null){let ee=a.dataIdMap.get(i.dataId);if(ee.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${ee.shape.length}.`);if(ee.shape[0]!==C)throw new Error(`FusedConv2D bias shape (${ee.shape}) does not match the number of output channels (${C})`);E=ee.id}let T=b.filterHeight,_=b.filterWidth,A=b.padInfo.top,$=b.padInfo.right,O=b.padInfo.bottom,z=b.padInfo.left,P=b.dilationHeight,j=b.dilationWidth,G=b.strideHeight,X=b.strideWidth,J=b.inChannels,V=b.padInfo.type==="SAME"?1:0,Q=b.batchSize,F=b.inHeight,H=b.inWidth;if(f!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${f}'. Please use 'NHWC'.`);let B=a.makeOutput(b.outShape,"float32"),Y=a.dataIdMap.get(B.dataId).id,ne=o==null?0:a.dataIdMap.get(o.dataId).id;return WW(S,Q,F,H,k,T,_,E,A,$,O,z,V,P,j,G,X,J,C,w,ne,y||0,Y),B}var X5e={kernelName:Cd,backendName:"wasm",setupFunc:q5e,kernelFunc:K5e},VW;function Y5e(e){VW=e.wasm.cwrap(Ed,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function J5e(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:c,dataFormat:f,dimRoundingMode:m,activation:x,leakyreluAlpha:y}=n,b=W.computeConv2DInfo(r.shape,s.shape,l,c,d,m,!0),w=qy[x];if(w==null)throw new Error(`${x} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let S=a.dataIdMap.get(r.dataId).id,k=a.dataIdMap.get(s.dataId).id,C=b.outChannels,E=0;if(i!=null){let ee=a.dataIdMap.get(i.dataId);if(ee.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${ee.shape.length}.`);if(ee.shape[0]!==C)throw new Error(`FusedDepthwiseConv2D bias shape (${ee.shape}) does not match the number of output channels (${C})`);E=ee.id}let T=b.filterHeight,_=b.filterWidth,A=b.padInfo.top,$=b.padInfo.right,O=b.padInfo.bottom,z=b.padInfo.left,P=b.dilationHeight,j=b.dilationWidth,G=b.strideHeight,X=b.strideWidth,J=b.inChannels,V=b.padInfo.type==="SAME"?1:0,Q=b.batchSize,F=b.inHeight,H=b.inWidth;if(f!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${f}'. Please use 'NHWC'.`);let B=a.makeOutput(b.outShape,"float32"),Y=a.dataIdMap.get(B.dataId).id,ne=o==null?0:a.dataIdMap.get(o.dataId).id;return VW(S,Q,F,H,k,T,_,E,A,$,O,z,V,P,j,G,X,J,C,w,ne,y||0,Y),B}var Q5e={kernelName:Ed,backendName:"wasm",setupFunc:Y5e,kernelFunc:J5e},HW;function Z5e(e){HW=e.wasm.cwrap(Dm,null,["number","number","number","number","number","number","array","number"])}function e$e(e){let{backend:t,inputs:n}=e,{params:a,indices:r}=n,[s,i,o,l]=mA.prepareAndValidate(a,r),d=t.makeOutput(s,a.dtype);if(i===0)return d;let c=r.shape,f=c[c.length-1],m=t.dataIdMap.get(a.dataId).id,x=t.dataIdMap.get(r.dataId).id,y=new Uint8Array(new Int32Array(l).buffer),b=t.dataIdMap.get(d.dataId).id;return HW(m,In[a.dtype],x,i,f,o,y,b),d}var t$e={kernelName:Dm,backendName:"wasm",setupFunc:Z5e,kernelFunc:e$e},GW;function n$e(e){GW=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function a$e(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,indices:s}=n,{axis:i,batchDims:o}=a,l=R.parseAxisParam(i,r.shape)[0],d=t.readSync(s.dataId),c=r.shape[l];for(let A=0;A<d.length;++A){let $=d[A];R.assert($<=c-1&&$>=0,()=>`GatherV2: the index value ${$} is not in [0, ${c-1}]`)}let f=W.segment_util.collectGatherOpShapeInfo(r,s,l,o),m=Fs({inputs:{x:r},attrs:{shape:[f.batchSize,f.outerSize,f.dimSize,f.sliceSize]},backend:t}),x=R.sizeFromShape(s.shape),y=Fs({inputs:{x:s},attrs:{shape:[f.batchSize,x/f.batchSize]},backend:t}),b=[f.batchSize,f.outerSize,x/f.batchSize,f.sliceSize],w=t.makeOutput(b,r.dtype);if(R.sizeFromShape(r.shape)===0)return w;let S=m.shape.length-1,k=t.dataIdMap.get(m.dataId).id,C=t.dataIdMap.get(y.dataId).id,E=t.dataIdMap.get(w.dataId).id,T=new Uint8Array(new Int32Array(R.computeStrides(m.shape)).buffer),_=new Uint8Array(new Int32Array(R.computeStrides(b)).buffer);return GW(k,In[r.dtype],T,S,C,f.batchSize,_,E),t.disposeData(m.dataId),t.disposeData(y.dataId),w.shape=f.outputShape,w}var r$e={kernelName:jm,backendName:"wasm",setupFunc:n$e,kernelFunc:a$e},s$e=!1,i$e=or(Rm,s$e,"bool"),o$e=!1,l$e=or(vh,o$e,"bool"),u$e=yn(Sh,"bool"),c$e=yn(kh,"bool"),d$e=yn(Nh,"bool"),qW;function h$e(e){qW=e.wasm.cwrap(Ch,null,["number","number","number","number"])}function p$e(e){let{inputs:{x:t},attrs:{alpha:n},backend:a}=e,r=a.dataIdMap.get(t.dataId).id,s=a.makeOutput(t.shape,"float32");if(R.sizeFromShape(t.shape)!==0){let i=a.dataIdMap.get(s.dataId).id;qW(r,In[t.dtype],n,i)}return s}var f$e={kernelName:Ch,backendName:"wasm",setupFunc:h$e,kernelFunc:p$e},m$e=!1,g$e=or(Mm,m$e,"bool"),x$e=!1,y$e=or($m,x$e,"bool"),KW;function b$e(e){KW=e.wasm.cwrap(Bm,null,["number","number","number","number"])}function v$e(e){let{attrs:t,backend:n}=e,{start:a,stop:r,num:s}=t,i=Math.floor(s),o=n.makeOutput([i],"float32");return KW(n.dataIdMap.get(o.dataId).id,a,r,i),o}var w$e={kernelName:Bm,backendName:"wasm",setupFunc:b$e,kernelFunc:v$e},S$e=yn(Eh),k$e=yn(Ih),N$e=!1,C$e=or(Fm,N$e,"bool"),E$e=yn(Om),I$e=!1,T$e=or(Lm,I$e,"bool"),A$e=!1,_$e=or(q8,A$e,"bool"),XW;function j$e(e){XW=e.wasm.cwrap(Th,null,["number","number","number","number","number","number","number"])}function D$e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a;if(r.dtype!=="float32")throw new Error("LRN error: x must have dtype float32");let d=n.makeOutput(r.shape,r.dtype);return XW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(d.dataId).id,r.shape[3],s,i,o,l),d}var R$e={kernelName:Th,backendName:"wasm",setupFunc:j$e,kernelFunc:D$e},YW;function M$e(e){YW=e.wasm.cwrap(Pm,null,["number","number","number","number","number","number","number","number","number"])}function $$e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:c}=a;if(r.dtype!=="float32"||s.dtype!=="float32"||i.dtype!=="float32")throw new Error("LRNGrad error: x, y, and dy must have dtype float32");let f=n.makeOutput(r.shape,r.dtype);return YW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(i.dataId).id,n.dataIdMap.get(f.dataId).id,i.shape[3],o,l,d,c),f}var B$e={kernelName:Pm,backendName:"wasm",setupFunc:M$e,kernelFunc:$$e},JW;function F$e(e){JW=e.wasm.cwrap(Ah,null,["number","number","number","number"])}function O$e(e){let{backend:t,inputs:n,attrs:a}=e,{reductionIndices:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:d,axes:c,originalAxes:f,inputWasTransposed:m}=kc(i,r,t);if(m){let k=t.dataIdMap.get(d.dataId).id;l=d,o=k}let x=l.shape.length;W.assertAxesAreInnerMostDims("max",c,x);let[y,b]=W.computeOutAndReduceShapes(l.shape,c),w=R.sizeFromShape(b),S=t.makeOutput(y,i.dtype);if(R.sizeFromShape(l.shape)!==0){let k=t.dataIdMap.get(S.dataId).id;JW(o,In[i.dtype],w,k)}if(m&&t.disposeData(d.dataId),s){let k=W.expandShapeToKeepDim(S.shape,f);S.shape=k}return S}var L$e={kernelName:Ah,backendName:"wasm",setupFunc:F$e,kernelFunc:O$e},P$e=or(_h),QW;function z$e(e){QW=e.wasm.cwrap(jh,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function U$e(e){let{inputs:t,attrs:n,backend:a}=e,r=t.x,s=a.dataIdMap.get(r.dataId).id;R.assert(r.dtype==="float32",()=>`Error in MaxPool: only float32 input is supported. Got ${r.dtype}.`);let{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=n,c=W.computePool2DInfo(r.shape,i,o,1,l,d),f=c.filterHeight,m=c.filterWidth,x=c.padInfo.top,y=c.padInfo.right,b=c.padInfo.bottom,w=c.padInfo.left,S=c.dilationHeight,k=c.dilationWidth,C=c.strideHeight,E=c.strideWidth,T=c.inChannels,_=c.outChannels;if(c.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${c.dataFormat}'. Please use 'channelsLast'.`);let A=a.makeOutput(c.outShape,"float32"),$=a.dataIdMap.get(A.dataId).id;return QW(s,r.shape[0],r.shape[1],r.shape[2],f,m,x,y,b,w,S,k,C,E,T,_,$),A}var W$e={kernelName:jh,backendName:"wasm",setupFunc:z$e,kernelFunc:U$e},ZW;function V$e(e){ZW=e.wasm.cwrap("MaxPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function H$e(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,c=W.computePool3DInfo(r.shape,s,i,1,o,l,d),f=n.makeOutput(c.outShape,r.dtype);return ZW(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),f}var G$e={kernelName:zm,backendName:"wasm",setupFunc:V$e,kernelFunc:H$e},eV;function q$e(e){eV=e.wasm.cwrap("MaxPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function K$e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a,c=W.computePool3DInfo(s.shape,i,o,1,l,d),f=n.makeOutput(s.shape,s.dtype);return eV(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),f}var X$e={kernelName:db,backendName:"wasm",setupFunc:q$e,kernelFunc:K$e},tV;function Y$e(e){tV=e.wasm.cwrap("MaxPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function J$e(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a,c=W.computePool2DInfo(s.shape,i,o,1,l,d),f=n.makeOutput(s.shape,s.dtype);return tV(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.top,c.padInfo.left),f}var Q$e={kernelName:cb,backendName:"wasm",setupFunc:Y$e,kernelFunc:J$e},nV;function Z$e(e){nV=e.wasm.cwrap("MaxPoolWithArgmax",null,["number","number","number","number","boolean","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function eBe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,includeBatchInIndex:l}=a;R.assert(r.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`);let d=[1,1];R.assert(W.eitherStridesOrDilationsAreOne(i,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let c=W.computePool2DInfo(r.shape,s,i,[1,1],o),f=n.makeOutput(c.outShape,r.dtype),m=n.makeOutput(c.outShape,"int32");return nV(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(f.dataId).id,n.dataIdMap.get(m.dataId).id,In[r.dtype],l,c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.top,c.padInfo.left),[f,m]}var tBe={kernelName:hb,backendName:"wasm",setupFunc:Z$e,kernelFunc:eBe},aV;function nBe(e){aV=e.wasm.cwrap(Dh,null,["number, number, number"])}function aBe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:c,axes:f,originalAxes:m,inputWasTransposed:x}=kc(i,r,t),y=f;if(x){let E=t.dataIdMap.get(c.dataId).id;E!==o&&(d=c,l=E,y=W.getInnerMostAxes(y.length,d.shape.length))}W.assertAxesAreInnerMostDims("mean",y,d.shape.length);let[b,w]=W.computeOutAndReduceShapes(d.shape,y),S=R.sizeFromShape(w),k=d;d.dtype!=="float32"&&(k=Nc({backend:t,inputs:{x:d},attrs:{dtype:"float32"}}),l=t.dataIdMap.get(k.dataId).id);let C=t.makeOutput(b,"float32");if(R.sizeFromShape(d.shape)!==0){let E=t.dataIdMap.get(C.dataId).id;aV(l,S,E)}if(x&&t.disposeData(c.dataId),s){let E=W.expandShapeToKeepDim(C.shape,m);C.shape=E}return d.dtype!=="float32"&&t.disposeData(k.dataId),C}var rBe={kernelName:Dh,backendName:"wasm",setupFunc:nBe,kernelFunc:aBe},rV;function sBe(e){rV=e.wasm.cwrap(Rh,null,["number","number","number","number"])}function iBe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:c,axes:f,originalAxes:m,inputWasTransposed:x}=kc(i,r,t);if(x){let C=t.dataIdMap.get(c.dataId).id;C!==o&&(d=c,l=C)}let y=d.shape.length;W.assertAxesAreInnerMostDims("min",f,y);let[b,w]=W.computeOutAndReduceShapes(d.shape,f),S=R.sizeFromShape(w),k=t.makeOutput(b,d.dtype);if(R.sizeFromShape(d.shape)!==0){let C=t.dataIdMap.get(k.dataId).id;rV(l,In[i.dtype],S,C)}if(x&&t.disposeData(c.dataId),s){let C=W.expandShapeToKeepDim(k.shape,m);k.shape=C}return k}var oBe={kernelName:Rh,backendName:"wasm",setupFunc:sBe,kernelFunc:iBe},lBe=or(Mh),BE;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(BE||(BE={}));var sV;function uBe(e){sV=e.wasm.cwrap($h,null,["number","array","number","number","array","array","number","number"])}function cBe(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,mode:r}}=e,s=a.map((y,b)=>y[0]+t.shape[b]+y[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),c=a.map(y=>y[0]),f=a.map(y=>y[1]),m=new Uint8Array(new Int32Array(c).buffer),x=new Uint8Array(new Int32Array(f).buffer);return sV(i,d,t.shape.length,In[t.dtype],m,x,BE[r],l),o}var dBe={kernelName:$h,backendName:"wasm",kernelFunc:cBe,setupFunc:uBe},iV;function hBe(e){iV=e.wasm.cwrap(sp,null,["number","number","number","number"])}function oV(e){let{backend:t,inputs:{logits:n},attrs:{dim:a}}=e,r=t.dataIdMap.get(n.dataId).id,s=t.makeOutput(n.shape,n.dtype),i=t.dataIdMap.get(s.dataId).id,o=n.shape[a],l=R.sizeFromShape(n.shape)/o;return R.sizeFromShape(s.shape)===0||iV(r,i,o,l),s}var pBe={kernelName:sp,backendName:"wasm",setupFunc:hBe,kernelFunc:oV},lV;function fBe(e){lV=e.wasm.cwrap(Um,null,["number","number","number","number","number","number"])}function mBe(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a;if(r.dtype!=="float32")throw new Error(`Tensor logits must have dtype float32, got ${r.dtype}`);let l=o?r:oV({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),[d,c]=l.shape,f=n.makeOutput([d,s],"int32");return lV(n.dataIdMap.get(l.dataId).id,d,c,s,i,n.dataIdMap.get(f.dataId).id),o||n.disposeData(l.dataId),f}var gBe={kernelName:Um,backendName:"wasm",setupFunc:fBe,kernelFunc:mBe},xBe=or(Bh),yBe=or(Fh),bBe=yn(Wm);function D4(e,t){let n=new Int32Array(e.wasm.HEAPU8.buffer,t,4),a=n[0],r=n[1],s=n[2],i=n[3];return e.wasm._free(t),{pSelectedIndices:a,selectedSize:r,pSelectedScores:s,pValidOutputs:i}}var uV;function vBe(e){uV=e.wasm.cwrap(Hm,"number",["number","number","number","number","number"])}function wBe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i}=a,{boxes:o,scores:l}=n,d=t.dataIdMap.get(o.dataId).id,c=t.dataIdMap.get(l.dataId).id,f=uV(d,c,s,r,i),{pSelectedIndices:m,selectedSize:x,pSelectedScores:y,pValidOutputs:b}=D4(t,f);return t.wasm._free(y),t.wasm._free(b),t.makeOutput([x],"int32",m)}var SBe={kernelName:Hm,backendName:"wasm",setupFunc:vBe,kernelFunc:wBe},cV;function kBe(e){cV=e.wasm.cwrap(Gm,"number",["number","number","number","number","number","bool"])}function NBe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,padToMaxOutputSize:o}=a,{boxes:l,scores:d}=n,c=t.dataIdMap.get(l.dataId).id,f=t.dataIdMap.get(d.dataId).id,m=cV(c,f,s,r,i,o),{pSelectedIndices:x,selectedSize:y,pSelectedScores:b,pValidOutputs:w}=D4(t,m);t.wasm._free(b);let S=t.makeOutput([y],"int32",x),k=t.makeOutput([],"int32",w);return[S,k]}var CBe={kernelName:Gm,backendName:"wasm",setupFunc:kBe,kernelFunc:NBe},dV;function EBe(e){dV=e.wasm.cwrap(qm,"number",["number","number","number","number","number","number"])}function IBe(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,softNmsSigma:o}=a,{boxes:l,scores:d}=n,c=t.dataIdMap.get(l.dataId).id,f=t.dataIdMap.get(d.dataId).id,m=dV(c,f,s,r,i,o),{pSelectedIndices:x,selectedSize:y,pSelectedScores:b,pValidOutputs:w}=D4(t,m);t.wasm._free(w);let S=t.makeOutput([y],"int32",x),k=t.makeOutput([y],"float32",b);return[S,k]}var TBe={kernelName:qm,backendName:"wasm",setupFunc:EBe,kernelFunc:IBe},ABe=!1,_Be=or(Vm,ABe,"bool"),hV;function jBe(e){hV=e.wasm.cwrap(Oh,null,["number","number","number","number","number"])}function DBe(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{dtype:s,depth:i,onValue:o,offValue:l}=a,d=n.makeOutput([...r.shape,i],s),c=n.dataIdMap.get(d.dataId).id,f=n.dataIdMap.get(r.dataId).id;return hV(f,i,o,l,c),d}var RBe={kernelName:Oh,backendName:"wasm",setupFunc:jBe,kernelFunc:DBe};function MBe(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(1),a}var $Be={kernelName:Km,backendName:"wasm",kernelFunc:MBe};function BBe(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return $E({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(c=>{R.assertShapesMatch(s,c.shape,"All tensors passed to stack must have matching shapes"),R.assert(i===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(c=>{let f=$E({inputs:{input:c},backend:n,attrs:{dim:r}});return o.push(f),f}),d=kW({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(c=>n.disposeData(c.dataId)),d}var FBe={kernelName:Xm,backendName:"wasm",kernelFunc:BBe},pV;function OBe(e){pV=e.wasm.cwrap(Lh,null,["number","array","number","number","array","array","number","number"])}function LBe(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,constantValue:r}}=e,s=a.map((y,b)=>y[0]+t.shape[b]+y[1]);if(R.sizeFromShape(t.shape)===0)return PW({backend:n,attrs:{shape:s,value:r,dtype:t.dtype}});let i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),c=a.map(y=>y[0]),f=a.map(y=>y[1]),m=new Uint8Array(new Int32Array(c).buffer),x=new Uint8Array(new Int32Array(f).buffer);return pV(i,d,t.shape.length,In[t.dtype],m,x,r,l),o}var fV={kernelName:Lh,backendName:"wasm",kernelFunc:LBe,setupFunc:OBe},PBe=or(Ph),mV;function zBe(e){mV=e.wasm.cwrap(zh,null,["number","number","number"])}function UBe(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,o=s,l=a,d=l;l.dtype!=="float32"&&(d=Nc({backend:n,inputs:{x:a},attrs:{dtype:"float32"}}),o=n.dataIdMap.get(d.dataId).id);let c=n.makeOutput(a.shape,"float32"),f=n.dataIdMap.get(c.dataId).id;return mV(o,i,f),l.dtype!=="float32"&&n.disposeData(d.dataId),c}var WBe={kernelName:zh,backendName:"wasm",setupFunc:zBe,kernelFunc:UBe},gV;function VBe(e){gV=e.wasm.cwrap(Uh,null,["number","number","number","number"])}function HBe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:c,axes:f,originalAxes:m,inputWasTransposed:x}=kc(i,r,t),y=f;if(x){let C=t.dataIdMap.get(c.dataId).id;C!==o&&(d=c,l=C,y=W.getInnerMostAxes(y.length,d.shape.length))}W.assertAxesAreInnerMostDims("prod",y,d.shape.length);let[b,w]=W.computeOutAndReduceShapes(d.shape,y),S=R.sizeFromShape(w),k=t.makeOutput(b,d.dtype);if(R.sizeFromShape(d.shape)!==0){let C=t.dataIdMap.get(k.dataId).id;gV(l,S,In[k.dtype],C)}if(x&&t.disposeData(c.dataId),s){let C=W.expandShapeToKeepDim(k.shape,m);k.shape=C}return k}var GBe={kernelName:Uh,backendName:"wasm",setupFunc:VBe,kernelFunc:HBe},qBe=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=i4(a,r,s,i),l=t.makeOutput([o.length],i);return t.typedArrayFromHeap(l).set(o),l},KBe={kernelName:pb,backendName:"wasm",kernelFunc:qBe},XBe=or(hh),YBe=yn(Wh),JBe=yn(Vh),QBe=yn(qh),xV;function ZBe(e){xV=e.wasm.cwrap(Gh,null,["number","number","number","number","number","number","number","number","number","number"])}function eFe(e){let{backend:t,inputs:n,attrs:a}=e,{images:r}=n,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,[c,f,m,x]=r.shape,y=[c,l,d,x],b=t.dataIdMap.get(r.dataId),w;b.dtype!=="float32"&&(w=Nc({backend:t,inputs:{x:r},attrs:{dtype:"float32"}}),b=t.dataIdMap.get(w.dataId));let S=b.id,k=t.makeOutput(y,"float32");if(R.sizeFromShape(r.shape)===0)return k;let C=t.dataIdMap.get(k.dataId).id;return xV(S,c,f,m,x,l,d,s?1:0,i?1:0,C),w!=null&&t.disposeData(w.dataId),k}var tFe={kernelName:Gh,backendName:"wasm",setupFunc:ZBe,kernelFunc:eFe},yV;function nFe(e){yV=e.wasm.cwrap(Qm,null,["number","number","number","array","array","boolean"])}function aFe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=n.makeOutput(r.shape,"float32"),l=n.dataIdMap.get(r.dataId),d;return l.dtype!=="float32"&&(d=Nc({backend:n,inputs:{x:r},attrs:{dtype:"float32"}}),l=n.dataIdMap.get(d.dataId)),yV(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(o.dataId).id,new Uint8Array(new Int32Array(r.shape).buffer),new Uint8Array(new Int32Array(s.shape).buffer),i),d!=null&&n.disposeData(d.dataId),o}var rFe={kernelName:Qm,backendName:"wasm",setupFunc:nFe,kernelFunc:aFe},bV;function sFe(e){bV=e.wasm.cwrap(Hh,null,["number","number","number","number","number","number","number","number","number","number"])}function iFe(e){let{backend:t,inputs:n,attrs:a}=e,{images:r}=n,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,[c,f,m,x]=r.shape,y=[c,l,d,x],b=t.makeOutput(y,"float32");if(R.sizeFromShape(r.shape)===0)return b;let w=t.dataIdMap.get(r.dataId),S;w.dtype!=="float32"&&(S=Nc({backend:t,inputs:{x:r},attrs:{dtype:"float32"}}),w=t.dataIdMap.get(S.dataId));let k=w.id,C=t.dataIdMap.get(b.dataId).id;return bV(k,c,f,m,x,l,d,s?1:0,i?1:0,C),S!=null&&t.disposeData(S.dataId),b}var oFe={kernelName:Hh,backendName:"wasm",setupFunc:sFe,kernelFunc:iFe},vV;function lFe(e){vV=e.wasm.cwrap(Jm,null,["number","number","number","array","array","boolean"])}function uFe(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=n.makeOutput(r.shape,"float32"),l=n.dataIdMap.get(r.dataId),d;return l.dtype!=="float32"&&(d=Nc({backend:n,inputs:{x:r},attrs:{dtype:"float32"}}),l=n.dataIdMap.get(d.dataId)),vV(n.dataIdMap.get(r.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(o.dataId).id,new Uint8Array(new Int32Array(r.shape).buffer),new Uint8Array(new Int32Array(s.shape).buffer),i),d!=null&&n.disposeData(d.dataId),o}var cFe={kernelName:Jm,backendName:"wasm",setupFunc:lFe,kernelFunc:uFe},wV;function dFe(e){wV=e.wasm.cwrap(Kh,null,["number","array","number","array","number","number"])}function hFe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=R.parseAxisParam(s,r.shape);if(r.shape.length===0)return z2({inputs:{x:r},backend:n});let o=n.makeOutput(r.shape,r.dtype),l=n.dataIdMap.get(r.dataId).id,d=n.dataIdMap.get(o.dataId).id,c=new Uint8Array(new Int32Array(i).buffer),f=new Uint8Array(new Int32Array(r.shape).buffer);wV(l,c,i.length,f,r.shape.length,d);let m=Fs({inputs:{x:o},attrs:{shape:r.shape},backend:n});return n.disposeData(o.dataId),m}var pFe={kernelName:Kh,backendName:"wasm",kernelFunc:hFe,setupFunc:dFe},SV;function fFe(e){SV=e.wasm.cwrap(pg,null,["number","number","number","number","number","number","number","number","array","number","number"])}function mFe(e){let{inputs:t,backend:n,attrs:a}=e,{image:r}=t,{radians:s,fillValue:i,center:o}=a,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(r.dataId).id,c=n.dataIdMap.get(l.dataId).id,[f,m,x,y]=r.shape,[b,w]=W.getImageCenter(o,m,x),S=i===0,k=255,C=typeof i=="number"?[i,i,i,S?0:k]:[...i,k],E=new Uint8Array(new Int32Array(C).buffer);return SV(d,f,m,x,y,s,b,w,E,C.length,c),l}var gFe={kernelName:pg,backendName:"wasm",kernelFunc:mFe,setupFunc:fFe},xFe=yn(Xh),yFe=yn(Yh),kV;function bFe(e){kV=e.wasm.cwrap(Zm,null,["number","number","number","number","number","number","array","number","number"])}function vFe(e){let{backend:t,inputs:n,attrs:a}=e,{indices:r,updates:s}=n,{shape:i}=a,o=t.makeOutput(i,s.dtype);if(R.sizeFromShape(i)===0)return o;let{sliceRank:l,numUpdates:d,sliceSize:c,strides:f,outputSize:m}=a2.calculateShapes(s,r,i),x=t.dataIdMap.get(r.dataId).id,y=t.dataIdMap.get(s.dataId).id,b=new Uint8Array(new Int32Array(f).buffer),w=t.dataIdMap.get(o.dataId).id;return kV(x,y,In[s.dtype],l,d,c,b,m,w),o}var wFe={kernelName:Zm,backendName:"wasm",setupFunc:bFe,kernelFunc:vFe},NV;function SFe(e){NV=e.wasm.cwrap(tg,null,["number","number","number","number","number","number","bool","number"])}function kFe(e){let{inputs:t,backend:n,attrs:a}=e,{sortedSequence:r,values:s}=t,{side:i}=a;if(r.dtype!==s.dtype)throw new Error(`SearchSorted error: sorted_sequence must have the same dtype as values. Got ${r.dtype} and ${s.dtype}`);let o=n.makeOutput(s.shape,"int32");function l(d){return n.dataIdMap.get(d.dataId).id}return NV(l(r),l(s),r.shape[0],r.shape[1],s.shape[1],In[r.dtype],i==="left",l(o)),o}var NFe={kernelName:tg,backendName:"wasm",setupFunc:SFe,kernelFunc:kFe},CV;function CFe(e){CV=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function EFe(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=n.dataIdMap.get(a.dataId).id,o=n.dataIdMap.get(r.dataId).id,l=n.dataIdMap.get(s.dataId).id,d=n.makeOutput(r.shape,r.dtype),c=n.dataIdMap.get(d.dataId).id,f=a.shape.length,m=r.shape.length,x=f===0||f>1||m===1?1:R.sizeFromShape(r.shape.slice(1));return CV(i,o,l,x,c),d}var IFe={kernelName:ng,backendName:"wasm",kernelFunc:EFe,setupFunc:CFe},TFe=yn(Jh),EV;function AFe(e){EV=e.wasm.cwrap(tp,null,["number","number"])}function _Fe(e){let{backend:t,inputs:{x:n}}=e,a=t.dataIdMap.get(n.dataId).id,r=t.makeOutput(n.shape,n.dtype),s=t.dataIdMap.get(r.dataId).id;return R.sizeFromShape(r.shape)===0||EV(a,s),r}var jFe={kernelName:"Sigmoid",backendName:"wasm",setupFunc:AFe,kernelFunc:_Fe},DFe=yn(ep),RFe=yn(Qh),MFe=yn(Zh),$Fe=yn(np);function BFe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a,o=R.sizeFromShape(s),l=[[0,0]];l.push(...i);for(let w=1+s.length;w<r.shape.length;++w)l.push([0,0]);let d=fV.kernelFunc({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),c=W.getReshaped(d.shape,s,o,!1),f=W.getPermuted(c.length,s.length,!1),m=W.getReshapedPermuted(d.shape,s,o,!1),x=Fs({inputs:{x:d},backend:n,attrs:{shape:c}}),y=oc({inputs:{x},backend:n,attrs:{perm:f}}),b=Fs({inputs:{x:y},backend:n,attrs:{shape:m}});return n.disposeData(d.dataId),n.disposeData(x.dataId),n.disposeData(y.dataId),b}var FFe={kernelName:rg,backendName:"wasm",kernelFunc:BFe},IV;function OFe(e){IV=e.wasm.cwrap("SparseFillEmptyRows","number",["number","number","number","number","number","number","number","number","number","number","number","number"])}function LFe(e){let{backend:t,inputs:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=n,o=a.shape[0],l=a.shape[1],d=t.readSync(s.dataId)[0],c=[o+d,l],f=t.dataIdMap.get(a.dataId).id,m=t.dataIdMap.get(r.dataId).id,x=t.dataIdMap.get(i.dataId).id,y=t.makeOutput(c,a.dtype),b=t.dataIdMap.get(y.dataId).id,w=t.makeOutput(c.slice(0,1),r.dtype),S=t.dataIdMap.get(w.dataId).id,k=t.makeOutput([d],"bool"),C=t.dataIdMap.get(k.dataId).id,E=t.makeOutput([o],a.dtype),T=t.dataIdMap.get(E.dataId).id,_=t.makeOutput([4],"int32"),A=t.dataIdMap.get(_.dataId).id,$=IV(f,m,In[r.dtype],o,d,l,x,b,S,C,T,A),O=t.readSync(_.dataId),z;switch(O[0]){case 1:{z=W.getSparseFillEmptyRowsIndicesDenseShapeMismatch(O[1]);break}case 2:{z=W.getSparseFillEmptyRowsNegativeIndexErrorMessage(O[1],O[2]);break}case 3:z=W.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(O[1],O[2],O[3]);break;default:z=""}if(t.disposeData(_.dataId),z)throw t.disposeData(y.dataId),t.disposeData(w.dataId),t.disposeData(k.dataId),t.disposeData(E.dataId),new Error(z);let P=y,j=w;return $!==c[0]&&(P=Ud({inputs:{x:y},attrs:{begin:0,size:[$,l]},backend:t}),j=Ud({inputs:{x:w},attrs:{begin:0,size:$},backend:t}),t.disposeData(y.dataId),t.disposeData(w.dataId)),[P,j,k,E]}var PFe={kernelName:fb,backendName:"wasm",setupFunc:OFe,kernelFunc:LFe},TV;function zFe(e){TV=e.wasm.cwrap(ig,null,["number","number","number","number","number","number","number"])}function UFe(e){let{backend:t,inputs:n}=e,{inputIndices:a,inputShape:r,newShape:s}=n;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape
5060        ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape
5061        ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=t.dataIdMap.get(a.dataId).id,o=t.dataIdMap.get(r.dataId).id,l=t.dataIdMap.get(s.dataId).id,d=a.shape[0],c=R.sizeFromShape(s.shape),f=t.makeOutput([d,c],a.dtype),m=t.dataIdMap.get(f.dataId).id,x=t.makeOutput([c],s.dtype),y=t.dataIdMap.get(x.dataId).id,b=t.makeOutput([3],"int32"),w=t.dataIdMap.get(b.dataId).id;TV(i,o,l,d,m,y,w);let S=t.readSync(b.dataId),k;switch(S[0]){case 0:{k=W.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(S[1],S[2]);break}case 1:{k=W.getSparseReshapeNegativeOutputDimErrorMessage(S[1],S[2]);break}case 2:k=W.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage();break;case 3:{let C=Array.from(t.readSync(r.dataId)),E=Array.from(t.readSync(x.dataId));k=W.getSparseReshapeInputOutputMultipleErrorMessage(C,E);break}case 4:{let C=Array.from(t.readSync(r.dataId)),E=Array.from(t.readSync(x.dataId));k=W.getSparseReshapeInputOutputMismatchErrorMessage(C,E);break}default:k=""}if(t.disposeData(b.dataId),k)throw t.disposeData(f.dataId),t.disposeData(x.dataId),new Error(k);return[f,x]}var WFe={kernelName:ig,backendName:"wasm",setupFunc:zFe,kernelFunc:UFe},AV;function _V(e){AV=e.wasm.cwrap("SparseSegmentReduction",null,["number","number","number","number","number","number","number","number","number"])}function jV(e,t){let{backend:n,inputs:a}=e,{data:r,indices:s,segmentIds:i}=a,o=s.shape[0],l=n.readSync(i.dataId,o-1,o)[0],d=o>0?l+1:0;if(d<0)throw new Error(W.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let c=r.shape.slice();c[0]=d;let f=n.dataIdMap.get(r.dataId).id,m=n.dataIdMap.get(s.dataId).id,x=n.dataIdMap.get(i.dataId).id,y=n.makeOutput(c,r.dtype),b=n.dataIdMap.get(y.dataId).id,w=n.makeOutput([4],"int32"),S=n.dataIdMap.get(w.dataId).id;AV(f,In[r.dtype],r.shape[0],m,x,b,S,t,0);let k=n.readSync(w.dataId),C;switch(k[0]){case 0:{C=W.getSparseSegmentReductionNegativeSegmentIdsErrorMessage();break}case 1:{C=W.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage();break}case 2:C=W.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(k[1],k[2]);break;case 3:C=W.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(k[1],k[2],k[3]);break;default:C=""}if(n.disposeData(w.dataId),C)throw n.disposeData(y.dataId),new Error(C);return y}function VFe(e){return jV(e,!0)}var HFe={kernelName:mb,backendName:"wasm",setupFunc:_V,kernelFunc:VFe};function GFe(e){return jV(e,!1)}var qFe={kernelName:gb,backendName:"wasm",setupFunc:_V,kernelFunc:GFe},DV;function KFe(e){DV=e.wasm.cwrap(og,null,["number","number","number","number","number","number","number","number","array","number","number"])}function XFe(e){let{backend:t,inputs:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=n,{outputShape:o}=a,l=t.makeOutput(o,i.dtype);if(R.sizeFromShape(o)===0)return l;let{sliceRank:d,numUpdates:c,sliceSize:f,strides:m,outputSize:x}=W.calculateShapes(s,r,o),y=t.dataIdMap.get(r.dataId).id,b=t.dataIdMap.get(s.dataId).id,w=t.dataIdMap.get(i.dataId).id,S=new Uint8Array(new Int32Array(m).buffer),k=t.dataIdMap.get(l.dataId).id;return DV(y,b,s.shape.length,w,In[i.dtype],d,c,f,S,x,k),l}var YFe={kernelName:og,backendName:"wasm",setupFunc:KFe,kernelFunc:XFe};function JFe(e){let{inputs:t,attrs:n,backend:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=n,o=R.parseAxisParam(i,r.shape)[0],l=W.prepareSplitSize(r,s,o),d=new Array(r.shape.length).fill(0),c=r.shape.slice();return l.map(f=>{let m=[...c];m[o]=f;let x=Ud({inputs:{x:r},attrs:{begin:d,size:m},backend:a});return d[o]+=f,x})}var QFe={kernelName:sg,backendName:"wasm",kernelFunc:JFe},ZFe=yn(ap),eOe=yn(xb),tOe=or(ip),RV;function nOe(e){RV=e.wasm.cwrap(mc,null,["number","number","number","number"])}function aOe(e){let{backend:t,inputs:n,attrs:a}=e,{alpha:r}=a,{x:s}=n,i=t.dataIdMap.get(s.dataId).id,o=t.makeOutput(s.shape,s.dtype),l=t.dataIdMap.get(o.dataId).id;return RV(i,r,In[s.dtype],l),o}var rOe={kernelName:mc,backendName:"wasm",setupFunc:nOe,kernelFunc:aOe},MV;function sOe(e){MV=e.wasm.cwrap(lg,null,["number","array","number","array","array","array","array","array","number","number"])}function iOe(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:c,newAxisMask:f,shrinkAxisMask:m}=a,{finalShapeSparse:x,finalShape:y,isIdentity:b,sliceDim0:w,isSimpleSlice:S,begin:k,end:C,strides:E}=vr.sliceInfo(r.shape,s,i,o,l,d,c,f,m),T;if(b)T=Fs({inputs:{x:r},backend:t,attrs:{shape:y}});else if(w||S){R.assert(r.shape.length>=1,()=>`Input must have rank at least 1, got: ${r.shape.length}`);let _=vr.computeOutShape(k,C,E),A=Ud({inputs:{x:r},backend:t,attrs:{begin:k,size:_}});T=Fs({inputs:{x:A},backend:t,attrs:{shape:y}}),t.disposeData(A.dataId)}else{let _=t.makeOutput(x,"float32"),A=t.dataIdMap.get(r.dataId).id,$=new Uint8Array(new Int32Array(R.computeStrides(r.shape)).buffer),O=new Uint8Array(new Int32Array(k).buffer),z=new Uint8Array(new Int32Array(C).buffer),P=new Uint8Array(new Int32Array(E).buffer),j=new Uint8Array(new Int32Array(x).buffer),G=new Uint8Array(new Int32Array(R.computeStrides(x)).buffer),X=t.dataIdMap.get(_.dataId).id;MV(A,$,r.shape.length,O,z,P,j,G,x.length,X),T=Fs({inputs:{x:_},backend:t,attrs:{shape:y}}),t.disposeData(_.dataId)}return T}var oOe={kernelName:lg,backendName:"wasm",setupFunc:sOe,kernelFunc:iOe};function lOe(e){let{backend:t,inputs:n,attrs:a}=e,{data:r,dataSplits:s}=n,{separator:i,nGramWidths:o,leftPad:l,rightPad:d,padWidth:c,preserveShortSequences:f}=a,m=t.readSync(r.dataId),x=t.readSync(s.dataId),[y,b]=l4(m,x,i,o,l,d,c,f),w=t.makeOutput([y.length],"string"),S=t.dataIdMap.get(w.dataId);S.stringBytes=y;let k=t.makeOutput(s.shape,"int32");return t.typedArrayFromHeap(k).set(b),[w,k]}var uOe={kernelName:bb,backendName:"wasm",kernelFunc:lOe};function cOe(e){let{backend:t,inputs:n,attrs:a}=e,{input:r,delimiter:s}=n,{skipEmpty:i}=a,o=t.readSync(r.dataId),l=t.readSync(s.dataId),[d,c,f]=u4(o,l[0],i),m=c.length,x=t.makeOutput([m,2],"int32");t.typedArrayFromHeap(x).set(d);let y=t.makeOutput([m],"string"),b=t.dataIdMap.get(y.dataId);b.stringBytes=c;let w=t.makeOutput([2],"int32");return t.typedArrayFromHeap(w).set(f),[x,y,w]}var dOe={kernelName:vb,backendName:"wasm",kernelFunc:cOe};function hOe(e){let{backend:t,inputs:n,attrs:a}=e,{input:r}=n,{numBuckets:s}=a,i=t.readSync(r.dataId),o=c4(i,s),l=t.makeOutput(r.shape,"int32");return t.typedArrayFromHeap(l).set(o),l}var pOe={kernelName:wb,backendName:"wasm",kernelFunc:hOe},fOe=or(op),$V;function mOe(e){$V=e.wasm.cwrap(rp,null,["number","number","number","number"])}function gOe(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:c,axes:f,originalAxes:m,inputWasTransposed:x}=kc(i,r,t),y=f;if(x){let C=t.dataIdMap.get(c.dataId).id;C!==o&&(d=c,l=C,y=W.getInnerMostAxes(y.length,d.shape.length))}W.assertAxesAreInnerMostDims("sum",y,d.shape.length);let[b,w]=W.computeOutAndReduceShapes(d.shape,y),S=R.sizeFromShape(w),k=t.makeOutput(b,d.dtype);if(R.sizeFromShape(d.shape)!==0){let C=t.dataIdMap.get(k.dataId).id;$V(l,S,In[k.dtype],C)}if(x&&t.disposeData(c.dataId),s){let C=W.expandShapeToKeepDim(k.shape,m);k.shape=C}return k}var xOe={kernelName:rp,backendName:"wasm",setupFunc:mOe,kernelFunc:gOe},yOe=yn(lp),bOe=yn(up),BV;function vOe(e){BV=e.wasm.cwrap(eg,null,["number","number","number","number","number","number","array","number","number","number"])}function wOe(e){let{backend:t,inputs:n,attrs:a}=e,{tensor:r,indices:s,updates:i}=n,o=t.makeOutput(r.shape,r.dtype);if(R.sizeFromShape(r.shape)===0)return o;let{sliceRank:l,numUpdates:d,sliceSize:c,strides:f,outputSize:m}=a2.calculateShapes(i,s,r.shape),x=t.dataIdMap.get(s.dataId).id,y=t.dataIdMap.get(i.dataId).id,b=t.dataIdMap.get(r.dataId).id,w=new Uint8Array(new Int32Array(f).buffer),S=t.dataIdMap.get(o.dataId).id;return BV(x,y,In[i.dtype],l,d,c,w,m,S,b),o}var SOe={kernelName:eg,backendName:"wasm",setupFunc:vOe,kernelFunc:wOe},FV;function kOe(e){FV=e.wasm.cwrap(fc,null,["number","array","number","array","number","number"])}function NOe(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,s=n.dataIdMap.get(r.dataId).id,{reps:i}=a,o=new Array(r.shape.length);for(let m=0;m<o.length;m++)o[m]=r.shape[m]*i[m];let l=new Uint8Array(new Int32Array(r.shape).buffer),d=new Uint8Array(new Int32Array(o).buffer),c=n.makeOutput(o,r.dtype),f=n.dataIdMap.get(c.dataId).id;return FV(s,l,r.shape.length,d,o.length,In[c.dtype],f),c}var COe={kernelName:fc,backendName:"wasm",setupFunc:kOe,kernelFunc:NOe},OV;function EOe(e){OV=e.wasm.cwrap(ug,null,["number","array","number","number","number","bool","number","number"])}var IOe=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{k:r,sorted:s}=n,i=t.dataIdMap.get(a.dataId).id,o=new Uint8Array(new Int32Array(a.shape).buffer),l=a.shape.slice();l[l.length-1]=r;let d=t.makeOutput(l,a.dtype),c=t.dataIdMap.get(d.dataId).id,f=t.makeOutput(l,"int32"),m=t.dataIdMap.get(f.dataId).id;return OV(i,o,a.shape.length,In[a.dtype],r,s,c,m),[d,f]},TOe={kernelName:ug,backendName:"wasm",setupFunc:EOe,kernelFunc:IOe},LV;function AOe(e){LV=e.wasm.cwrap(cg,null,["number","number","bool","number","number","number","number","number","number","array","number","array","number","number","number","number","number"])}function _Oe(e){let{backend:t,inputs:n,attrs:a}=e,{image:r,transforms:s}=n,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}
vendor: 5,289 bytes, line 5061
5061=a,[c,f,m,x]=r.shape,[y,b]=d??[f,m],w=[c,y,b,x],S=new Uint8Array(new Int32Array(R.computeStrides(r.shape)).buffer),k=new Uint8Array(new Int32Array(R.computeStrides(w)).buffer),C=t.makeOutput(w,r.dtype),E=t.dataIdMap.get(C.dataId).id,T=t.dataIdMap.get(r.dataId).id,_=t.dataIdMap.get(s.dataId).id,A=i==="nearest"?1:2,$;switch(o){case"constant":$=1;break;case"reflect":$=2;break;case"wrap":$=3;break;case"nearest":$=4;break;default:$=1;break}return LV(T,_,s.shape[0]>1,c,y,b,x,m,f,S,r.shape.length-1,k,w.length-1,A,$,l,E),C}var jOe={kernelName:cg,backendName:"wasm",setupFunc:AOe,kernelFunc:_Oe};function DOe(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t,{outputValues:i,outputShape:o,indices:l}=h4(a.readSync(s.dataId),r,s.shape,s.dtype);return[a.makeOutput(o,s.dtype,void 0,i),a.makeOutput([l.length],"int32",void 0,l)]}var ROe={kernelName:Sb,backendName:"wasm",kernelFunc:DOe};function MOe(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r.shape[s],o=r.shape.length,l=new Array(o-1),d=0;for(let x=0;x<o;x++)x!==s&&(l[d++]=r.shape[x]);let c=new Array(i),f=new Array(o).fill(0),m=r.shape.slice();m[s]=1;for(let x=0;x<c.length;x++)f[s]=x,c[x]=Ud({inputs:{x:r},attrs:{begin:f,size:m},backend:n});return c.map(({dataId:x,dtype:y})=>({dataId:x,dtype:y,shape:l}))}var $Oe={kernelName:dg,backendName:"wasm",kernelFunc:MOe};function BOe(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(0),a}var FOe={kernelName:hg,backendName:"wasm",kernelFunc:BOe},OOe=[ARe,_Re,jRe,DRe,RRe,BRe,VRe,qRe,KRe,XRe,YRe,JRe,QRe,ZRe,eMe,aMe,hMe,iMe,uMe,gMe,SMe,CMe,EMe,TMe,AMe,_Me,RMe,MMe,FMe,PMe,WMe,GMe,XMe,YMe,JMe,e5e,a5e,i5e,u5e,h5e,m5e,y5e,w5e,N5e,I5e,T5e,j5e,R5e,M5e,$5e,B5e,F5e,O5e,z5e,U5e,W5e,G5e,X5e,Q5e,t$e,r$e,i$e,l$e,FRe,u$e,c$e,d$e,f$e,g$e,y$e,w$e,k$e,S$e,C$e,E$e,T$e,_$e,R$e,B$e,L$e,P$e,W$e,G$e,X$e,Q$e,tBe,rBe,oBe,lBe,dBe,gBe,xBe,yBe,bBe,SBe,CBe,TBe,_Be,RBe,$Be,FBe,fV,PBe,WBe,GBe,KBe,XBe,YBe,JBe,QBe,pMe,tFe,rFe,oFe,cFe,pFe,gFe,xFe,yFe,wFe,NFe,IFe,TFe,jFe,DFe,RFe,MFe,vMe,pBe,$Fe,FFe,PFe,WFe,HFe,qFe,YFe,QFe,ZFe,eOe,tOe,rOe,oOe,uOe,dOe,pOe,fOe,xOe,yOe,bOe,SOe,COe,TOe,jOe,zRe,ROe,$Oe,FOe];for(let e of OOe)Nb(e);var FE=fe();FE.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>{try{return WebAssembly.validate(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]))}catch{return!1}});FE.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(FE.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}});var fB=dc(bae()),LOe=dc(vae()),mB=dc(wae()),gB=fB.default||fB,POe=mB.default||mB,PV=class extends tb{constructor(e){super(),this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.initWithThreadsCount(zV),OE=this.wasm.tfjs.getThreadsCount(),this.dataIdMap=new mw(this,Ji())}write(e,t,n){let a={id:this.dataIdNextNumber++};return this.move(a,e,t,n,1),a}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){let t=R.now();return e(),{kernelMs:R.now()-t}}move(e,t,n,a,r){let s=this.dataIdNextNumber++;if(a==="string"){let d=t;this.dataIdMap.set(e,{id:s,stringBytes:d,shape:n,dtype:a,memoryOffset:null,refCount:r});return}let i=R.sizeFromShape(n),o=i*R.bytesPerElement(a),l=this.wasm._malloc(o)>>>0;this.dataIdMap.set(e,{id:s,memoryOffset:l,shape:n,dtype:a,refCount:r}),this.wasm.tfjs.registerTensor(s,i,l),t!=null&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,o),l)}async read(e){return this.readSync(e)}readSync(e,t,n){let{memoryOffset:a,dtype:r,shape:s,stringBytes:i}=this.dataIdMap.get(e);if(r==="string")return(t==null||t===0)&&(n==null||n>=i.length)?i:i.slice(t,n);t=t||0,n=n||R.sizeFromShape(s);let o=R.bytesPerElement(r),l=this.wasm.HEAPU8.slice(a+t*o,a+n*o);return WOe(l.buffer,r)}disposeData(e,t=!1){if(this.dataIdMap.has(e)){let n=this.dataIdMap.get(e);if(n.refCount--,!t&&n.refCount>0)return!1;this.wasm._free(n.memoryOffset),this.wasm.tfjs.disposeData(n.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){let t=this.dataIdMap.get(e);t!=null&&t.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,t,n,a){let r;if(n==null)r=this.write(a??null,e,t);else{let s=this.dataIdNextNumber++;r={id:s},this.dataIdMap.set(r,{id:s,memoryOffset:n,shape:e,dtype:t,refCount:1});let i=R.sizeFromShape(e);this.wasm.tfjs.registerTensor(s,i,n)}return{dataId:r,shape:e,dtype:t}}typedArrayFromHeap({shape:e,dtype:t,dataId:n}){let a=this.wasm.HEAPU8.buffer,{memoryOffset:r}=this.dataIdMap.get(n),s=R.sizeFromShape(e);switch(t){case"float32":return new Float32Array(a,r,s);case"int32":return new Int32Array(a,r,s);case"bool":return new Uint8Array(a,r,s);default:throw new Error(`Unknown dtype ${t}`)}}};function zOe(e){return(t,n)=>(R.fetch(e,{credentials:"same-origin"}).then(a=>{a.ok||t.env.a(`failed to load wasm binary file at '${e}'`),a.arrayBuffer().then(r=>{WebAssembly.instantiate(r,t).then(s=>
vendor: 33,189 bytes, line 5061
5061{n(s.instance,s.module)})})}),{})}function xB(e,t,n){if(Yv!=null)return Yv;let a="tfjs-backend-wasm.wasm";return e&&t?a="tfjs-backend-wasm-threaded-simd.wasm":e&&(a="tfjs-backend-wasm-simd.wasm"),uy!=null&&uy[a]!=null?uy[a]:n+a}async function UOe(){let[e,t]=await Promise.all([fe().getAsync("WASM_HAS_SIMD_SUPPORT"),fe().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,a)=>{let r={};r.locateFile=(o,l)=>{if(o.endsWith(".worker.js")){let d=LOe.wasmWorkerContents.replace(/\n/g,"\\n"),c=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(c)}return o.endsWith(".wasm")?xB(e,t,Jx??l):l+o},R4&&(r.instantiateWasm=zOe(xB(e,t,Jx??"")));let s=!1;r.onAbort=()=>{s||cy||(cy=!0,a({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"}))};let i;t&&e&&Yv==null?(r.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+gB.toString()],{type:"text/javascript"}),i=gB(r)):i=POe(r),i.then(o=>{s=!0,cy=!1;let l=null;o.tfjs={init:o.cwrap("init",null,[]),initWithThreadsCount:o.cwrap("init_with_threads_count",null,["number"]),getThreadsCount:o.cwrap("get_threads_count","number",[]),registerTensor:o.cwrap("register_tensor",null,["number","number","number"]),disposeData:o.cwrap("dispose_data",l,["number"]),dispose:o.cwrap("dispose",l,[])},n({wasm:o})}).catch(a)})}function WOe(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var VOe=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],Yv=null,Jx=null,uy={},cy=!1,R4=!1;function HOe(e,t=!1){if(lL("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),cy)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");Yv=e,R4=t}function GOe(e,t=!1){if(cy)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")Jx=e;else{uy=e;let n=VOe.filter(a=>uy[a]==null);if(n.length>0)throw new Error(`There were no entries found for the following binaries: ${n.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}R4=t}var zV=-1,OE=-1;function qOe(e){zV=e}function KOe(){if(OE===-1)throw new Error("WASM backend not initialized.");return OE}var XOe="4.22.0",YOe=2;Rw("wasm",async()=>{let{wasm:e}=await UOe();return new PV(e)},YOe);var yB="4.22.0",JOe="4.22.0",QOe="4.22.0",ZOe="4.22.0",e8e="4.22.0",t8e={tfjs:yB,"tfjs-core":yB,"tfjs-converter":JOe,"tfjs-backend-cpu":QOe,"tfjs-backend-webgl":ZOe,"tfjs-backend-wasm":e8e},n8e={};zI(n8e,{AnchorPosition:()=>nH,DrawBox:()=>sH,DrawBoxOptions:()=>rH,DrawFaceLandmarks:()=>SH,DrawFaceLandmarksOptions:()=>wH,DrawTextField:()=>P4,DrawTextFieldOptions:()=>L4,drawContour:()=>_u,drawDetections:()=>g8e,drawFaceExpressions:()=>_8e,drawFaceLandmarks:()=>R8e});function _u(e,t,n=!1){if(e.beginPath(),t.slice(1).forEach(({x:a,y:r},s)=>{let i=t[s];e.moveTo(i.x,i.y),e.lineTo(a,r)}),n){let a=t[t.length-1],r=t[0];if(!a||!r)return;e.moveTo(a.x,a.y),e.lineTo(r.x,r.y)}e.stroke()}var a8e={};zI(a8e,{computeReshapedDimensions:()=>HV,getCenterPoint:()=>$4,isDimensions:()=>PE,isEven:()=>LE,isFloat:()=>VV,isTensor:()=>Mg,isTensor1D:()=>r8e,isTensor2D:()=>WV,isTensor3D:()=>a0,isTensor4D:()=>Ll,isValidNumber:()=>kd,isValidProbablitiy:()=>s8e,range:()=>am,round:()=>M4});var Ff=class UV{constructor(t,n){if(!kd(t)||!kd(n))throw new Error(`Dimensions.constructor - expected width and height to be valid numbers, instead have ${JSON.stringify({width:t,height:n})}`);this._width=t,this._height=n}get width(){return this._width}get height(){return this._height}reverse(){return new UV(1/this.width,1/this.height)}};function Mg(e,t){return e instanceof en&&e.shape.length===t}function r8e(e){return Mg(e,1)}function WV(e){return Mg(e,2)}function a0(e){return Mg(e,3)}function Ll(e){return Mg(e,4)}function VV(e){return e%1!==0}function LE(e){return e%2===0}function M4(e,t=2){let n=10**t;return Math.floor(e*n)/n}function PE(e){return e&&e.width&&e.height}function HV({width:e,height:t},n){let a=n/Math.max(t,e);return new Ff(Math.round(e*a),Math.round(t*a))}function $4(e){return e.reduce((t,n)=>t.add(n),new Yn(0,0)).div(new Yn(e.length,e.length))}function am(e,t,n){return Array(e).fill(0).map((a,r)=>t+r*n)}function kd(e){return!!e&&e!==1/0&&e!==-1/0&&!Number.isNaN(e)||e===0}function s8e(e){return kd(e)&&e>=0&&e<=1}var Yn=class sd{constructor(t,n){this._x=t,this._y=n}get x(){return this._x}get y(){return this._y}add(t){return new sd(this.x+t.x,this.y+t.y)}sub(t){return new sd(this.x-t.x,this.y-t.y)}mul(t){return new sd(this.x*t.x,this.y*t.y)}div(t){return new sd(this.x/t.x,this.y/t.y)}abs(){return new sd(Math.abs(this.x),Math.abs(this.y))}magnitude(){return Math.sqrt(this.x**2+this.y**2)}floor(){return new sd(Math.floor(this.x),Math.floor(this.y))}},Wd=class bo{static isRect(t){return!!t&&[t.x,t.y,t.width,t.height].every(kd)}static assertIsValidBox(t,n,a=!1){if(!bo.isRect(t))throw new Error(`${n} - invalid box: ${JSON.stringify(t)}, expected object with properties x, y, width, height`);if(!a&&(t.width<0||t.height<0))throw new Error(`${n} - width (${t.width}) and height (${t.height}) must be positive numbers`)}constructor(t,n=!0){let a=t||{},r=[a.left,a.top,a.right,a.bottom].every(kd),s=[a.x,a.y,a.width,a.height].every(kd);if(!s&&!r)throw new Error(`Box.constructor - expected box to be IBoundingBox | IRect, instead have ${JSON.stringify(a)}`);let[i,o,l,d]=s?[a.x,a.y,a.width,a.height]:[a.left,a.top,a.right-a.left,a.bottom-a.top];bo.assertIsValidBox({x:i,y:o,width:l,height:d},"Box.constructor",n),this._x=i,this._y=o,this._width=l,this._height=d}get x(){return this._x}get y(){return this._y}get width(){return this._width}get height(){return this._height}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new Yn(this.left,this.top)}get topRight(){return new Yn(this.right,this.top)}get bottomLeft(){return new Yn(this.left,this.bottom)}get bottomRight(){return new Yn(this.right,this.bottom)}round(){let[t,n,a,r]=[this.x,this.y,this.width,this.height].map(s=>Math.round(s));return new bo({x:t,y:n,width:a,height:r})}floor(){let[t,n,a,r]=[this.x,this.y,this.width,this.height].map(s=>Math.floor(s));return new bo({x:t,y:n,width:a,height:r})}toSquare(){let{x:t,y:n,width:a,height:r}=this,s=Math.abs(a-r);return a<r&&(t-=s/2,a+=s),r<a&&(n-=s/2,r+=s),new bo({x:t,y:n,width:a,height:r})}rescale(t){let n=PE(t)?t.width:t,a=PE(t)?t.height:t;return new bo({x:this.x*n,y:this.y*a,width:this.width*n,height:this.height*a})}pad(t,n){let[a,r,s,i]=[this.x-t/2,this.y-n/2,this.width+t,this.height+n];return new bo({x:a,y:r,width:s,height:i})}clipAtImageBorders(t,n){let{x:a,y:r,right:s,bottom:i}=this,o=Math.max(a,0),l=Math.max(r,0),d=s-o,c=i-l,f=Math.min(d,t-o),m=Math.min(c,n-l);return new bo({x:o,y:l,width:f,height:m}).floor()}shift(t,n){let{width:a,height:r}=this,s=this.x+t,i=this.y+n;return new bo({x:s,y:i,width:a,height:r})}padAtBorders(t,n){let a=this.width+1,r=this.height+1,s=1,i=1,o=a,l=r,d=this.left,c=this.top,f=this.right,m=this.bottom;return f>n&&(o=-f+n+a,f=n),m>t&&(l=-m+t+r,m=t),d<1&&(l=2-d,d=1),c<1&&(l=2-c,c=1),{dy:i,edy:l,dx:s,edx:o,y:c,ey:m,x:d,ex:f,w:a,h:r}}calibrate(t){return new bo({left:this.left+t.left*this.width,top:this.top+t.top*this.height,right:this.right+t.right*this.width,bottom:this.bottom+t.bottom*this.height}).toSquare().round()}},GV=class extends Wd{constructor(e,t,n,a,r=!1){super({left:e,top:t,right:n,bottom:a},r)}},qV=class KV{constructor(t,n,a,r,s){this._imageDims=new Ff(s.width,s.height),this._score=t,this._classScore=n,this._className=a,this._box=new Wd(r).rescale(this._imageDims)}get score(){return this._score}get classScore(){return this._classScore}get className(){return this._className}get box(){return this._box}get imageDims(){return this._imageDims}get imageWidth(){return this.imageDims.width}get imageHeight(){return this.imageDims.height}get relativeBox(){return new Wd(this._box).rescale(this.imageDims.reverse())}forSize(t,n){return new KV(this.score,this.classScore,this.className,this.relativeBox,{width:t,height:n})}},Do=class XV extends qV{constructor(t,n,a){super(t,t,"",n,a)}forSize(t,n){let{score:a,relativeBox:r,imageDims:s}=super.forSize(t,n);return new XV(a,r,s)}};function i8e(e,t,n=!0){let a=Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left)),r=Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)),s=a*r;return n?s/(e.area+t.area-s):s/Math.min(e.area,t.area)}function o8e(e){let t=e.map(o=>o.x),n=e.map(o=>o.y),a=t.reduce((o,l)=>l<o?l:o,1/0),r=n.reduce((o,l)=>l<o?l:o,1/0),s=t.reduce((o,l)=>o<l?l:o,0),i=n.reduce((o,l)=>o<l?l:o,0);return new GV(a,r,s,i)}function l8e(e,t,n,a=!0){let r=t.map((i,o)=>({score:i,boxIndex:o})).sort((i,o)=>i.score-o.score).map(i=>i.boxIndex),s=[];for(;r.length>0;){let i=r.pop();s.push(i);let o=r,l=[];for(let d=0;d<o.length;d++){let c=o[d],f=e[i],m=e[c];l.push(i8e(f,m,a))}r=r.filter((d,c)=>l[c]<=n)}return s}function r0(e,t){return ue(()=>{let[n,a,r]=t,s=ri([...e.shape.slice(0,3),1],n,"float32"),i=ri([...e.shape.slice(0,3),1],a,"float32"),o=ri([...e.shape.slice(0,3),1],r,"float32"),l=Qn([s,i,o],3);return st(e,l)})}function u8e(e,t=!1){return ue(()=>{let[n,a]=e.shape.slice(1);if(n===a)return e;let r=Math.abs(n-a),s=Math.round(r*(t?.5:1)),i=n>a?2:1,o=f=>{let m=e.shape.slice();return m[i]=f,ri(m,0,"float32")},l=o(s),d=r-l.shape[i],c=[t&&d?o(d):null,e,l].filter(f=>!!f).map(f=>He(f,"float32"));return Qn(c,i)})}function ON(e){return 1/(1+Math.exp(-e))}var YV=class extends Wd{constructor(e,t,n,a,r=!1){super({x:e,y:t,width:n,height:a},r)}},c8e=.5,d8e=.43,h8e=.45,Jv=class{constructor(e,t,n=new Yn(0,0)){let{width:a,height:r}=t;this._imgDims=new Ff(a,r),this._shift=n,this._positions=e.map(s=>s.mul(new Yn(a,r)).add(n))}get shift(){return new Yn(this._shift.x,this._shift.y)}get imageWidth(){return this._imgDims.width}get imageHeight(){return this._imgDims.height}get positions(){return this._positions}get relativePositions(){return this._positions.map(e=>e.sub(this._shift).div(new Yn(this.imageWidth,this.imageHeight)))}forSize(e,t){return new this.constructor(this.relativePositions,{width:e,height:t})}shiftBy(e,t){return new this.constructor(this.relativePositions,this._imgDims,new Yn(e,t))}shiftByPoint(e){return this.shiftBy(e.x,e.y)}align(e,t={}){if(e){let r=e instanceof Do?e.box.floor():new Wd(e);return this.shiftBy(r.x,r.y).align(null,t)}let{useDlibAlignment:n,minBoxPadding:a}={useDlibAlignment:!1,minBoxPadding:.2,...t};return n?this.alignDlib():this.alignMinBbox(a)}alignDlib(){let e=this.getRefPointsForAlignment(),[t,n,a]=e,r=c=>a.sub(c).magnitude(),s=(r(t)+r(n))/2,i=Math.floor(s/h8e),o=$4(e),l=Math.floor(Math.max(0,o.x-c8e*i)),d=Math.floor(Math.max(0,o.y-d8e*i));return new YV(l,d,Math.min(i,this.imageWidth+l),Math.min(i,this.imageHeight+d))}alignMinBbox(e){let t=o8e(this.positions);return t.pad(t.width*e,t.height*e)}getRefPointsForAlignment(){throw new Error("getRefPointsForAlignment not implemented by base class")}},JV=class extends Jv{getJawOutline(){return this.positions.slice(0,17)}getLeftEyeBrow(){return this.positions.slice(17,22)}getRightEyeBrow(){return this.positions.slice(22,27)}getNose(){return this.positions.slice(27,36)}getLeftEye(){return this.positions.slice(36,42)}getRightEye(){return this.positions.slice(42,48)}getMouth(){return this.positions.slice(48,68)}getRefPointsForAlignment(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map($4)}};function Qv(e){return e.detection instanceof Do}function p8e(e,t){return{...e,detection:t}}function QV(){let e=window.fetch;if(!e)throw new Error("fetch - missing fetch implementation for browser environment");return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D,Image:HTMLImageElement,ImageData,Video:HTMLVideoElement,createCanvasElement:()=>document.createElement("canvas"),createImageElement:()=>document.createElement("img"),createVideoElement:()=>document.createElement("video"),fetch:e,readFile:()=>{throw new Error("readFile - filesystem not available for browser environment")}}}function B4(){return typeof global=="object"&&typeof process<"u"&&process.versions!=null&&process.versions.node!=null}function ZV(e){let t="";if(!e&&B4())try{e=Jne("fs")}catch(n){t=n.toString()}return{readFile:e?n=>new Promise((a,r)=>{e.readFile(n,(s,i)=>s?r(s):a(i))}):()=>{throw new Error(`readFile - failed to require fs in nodejs environment with error: ${t}`)}}}function eH(){let e=global.Canvas||global.HTMLCanvasElement,t=global.Image||global.HTMLImageElement,n=global.Video||global.HTMLVideoElement,a=()=>{if(e)return new e;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},r=()=>{if(t)return new t;throw new Error("createImageElement - missing Image implementation for nodejs environment")},s=()=>{if(n)return new n;throw new Error("createVideoElement - missing Video implementation for nodejs environment")},i=global.fetch,o=ZV();return{Canvas:e||class{},CanvasRenderingContext2D:global.CanvasRenderingContext2D||class{},Image:t||class{},ImageData:global.ImageData||class{},Video:global.HTMLVideoElement||class{},createCanvasElement:a,createImageElement:r,createVideoElement:s,fetch:i,...o}}function tH(){return typeof window=="object"&&typeof document<"u"&&typeof HTMLImageElement<"u"&&typeof HTMLCanvasElement<"u"&&typeof HTMLVideoElement<"u"&&typeof ImageData<"u"&&typeof CanvasRenderingContext2D<"u"}var Tr;function f8e(){if(!Tr)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return Tr}function zE(e){Tr=e}function F4(){return tH()?zE(QV()):B4()?zE(eH()):null}function m8e(e){if(Tr||F4(),!Tr)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");let{Canvas:t=Tr.Canvas,Image:n=Tr.Image}=e;Tr.Canvas=t,Tr.Image=n,Tr.createCanvasElement=e.createCanvasElement||(()=>new t),Tr.createImageElement=e.createImageElement||(()=>new n),Tr.ImageData=e.ImageData||Tr.ImageData,Tr.Video=e.Video||Tr.Video,Tr.fetch=e.fetch||Tr.fetch,Tr.readFile=e.readFile||Tr.readFile}var zs={getEnv:f8e,setEnv:zE,initialize:F4,createBrowserEnv:QV,createFileSystem:ZV,createNodejsEnv:eH,monkeyPatch:m8e,isBrowser:tH,isNodejs:B4};F4();function O4(e){return!zs.isNodejs()&&typeof e=="string"?document.getElementById(e):e}function lc(e){let{Canvas:t,CanvasRenderingContext2D:n}=zs.getEnv();if(e instanceof n)return e;let a=O4(e);if(!(a instanceof t))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");let r=a.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("resolveContext2d - canvas 2d context is null");return r}var nH=(e=>(e.TOP_LEFT="TOP_LEFT",e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e.BOTTOM_RIGHT="BOTTOM_RIGHT",e))(nH||{}),L4=class{constructor(e={}){let{anchorPosition:t,backgroundColor:n,fontColor:a,fontSize:r,fontStyle:s,padding:i}=e;this.anchorPosition=t||"TOP_LEFT",this.backgroundColor=n||"rgba(0, 0, 0, 0.5)",this.fontColor=a||"rgba(255, 255, 255, 1)",this.fontSize=r||14,this.fontStyle=s||"Georgia",this.padding=i||4}},P4=class aH{constructor(t,n,a={}){this.text=typeof t=="string"?[t]:t instanceof aH?t.text:t,this.anchor=n,this.options=new L4(a)}measureWidth(t){let{padding:n}=this.options;return this.text.map(a=>t.measureText(a).width).reduce((a,r)=>a<r?r:a,0)+2*n}measureHeight(){let{fontSize:t,padding:n}=this.options;return this.text.length*t+2*n}getUpperLeft(t,n){let{anchorPosition:a}=this.options,r=a==="BOTTOM_RIGHT"||a==="TOP_RIGHT",s=a==="BOTTOM_LEFT"||a==="BOTTOM_RIGHT",i=this.measureWidth(t),o=this.measureHeight(),l=r?this.anchor.x-i:this.anchor.x,d=s?this.anchor.y-o:this.anchor.y;if(n){let{width:c,height:f}=n,m=Math.max(Math.min(l,c-i),0),x=Math.max(Math.min(d,f-o),0);return{x:m,y:x}}return{x:l,y:d}}draw(t){let n=O4(t),a=lc(n),{backgroundColor:r,fontColor:s,fontSize:i,fontStyle:o,padding:l}=this.options;a.font=`${i}px ${o}`;let d=this.measureWidth(a),c=this.measureHeight();a.fillStyle=r;let f=this.getUpperLeft(a,n);a.fillRect(f.x,f.y,d,c),a.fillStyle=s,this.text.forEach((m,x)=>{let y=l+f.x,b=l+f.y+(x+1)*i;a.fillText(m,y,b)})}},rH=class{constructor(e={}){let{boxColor:t,lineWidth:n,label:a,drawLabelOptions:r}=e;this.boxColor=t||"rgba(0, 0, 255, 1)",this.lineWidth=n||2,this.label=a;let s={anchorPosition:"BOTTOM_LEFT",backgroundColor:this.boxColor};this.drawLabelOptions=new L4({...s,...r})}},sH=class{constructor(e,t={}){this.box=new Wd(e),this.options=new rH(t)}draw(e){let t=lc(e),{boxColor:n,lineWidth:a}=this.options,{x:r,y:s,width:i,height:o}=this.box;t.strokeStyle=n,t.lineWidth=a,t.strokeRect(r,s,i,o);let{label:l}=this.options;l&&new P4([l],{x:r-a/2,y:s},this.options.drawLabelOptions).draw(e)}};function g8e(e,t){(Array.isArray(t)?t:[t]).forEach(n=>{let a=n instanceof Do?n.score:Qv(n)?n.detection.score:void 0,r=n instanceof Do?n.box:Qv(n)?n.detection.box:new Wd(n),s=a?`${M4(a)}`:void 0;new sH(r,{label:s}).draw(e)})}function iH(e){let{Image:t,Video:n}=zs.getEnv();return e instanceof t&&e.complete||e instanceof n&&e.readyState>=3}function x8e(e){return new Promise((t,n)=>{if(e instanceof zs.getEnv().Canvas||iH(e)){t(null);return}function a(s){s.currentTarget&&(s.currentTarget.removeEventListener("load",r),s.currentTarget.removeEventListener("error",a),n(s))}function r(s){s.currentTarget&&(s.currentTarget.removeEventListener("load",r),s.currentTarget.removeEventListener("error",a),t(s))}e.addEventListener("load",r),e.addEventListener("error",a)})}function oH(e){let{Image:t,Video:n}=zs.getEnv();return e instanceof t?new Ff(e.naturalWidth,e.naturalHeight):e instanceof n?new Ff(e.videoWidth,e.videoHeight):new Ff(e.width,e.height)}function Zv({width:e,height:t}){let{createCanvasElement:n}=zs.getEnv(),a=n();return a.width=e,a.height=t,a}function lH(e,t){let{ImageData:n}=zs.getEnv();if(!(e instanceof n)&&!iH(e))throw new Error("createCanvasFromMedia - media has not finished loading yet");let{width:a,height:r}=oH(e),s=Zv({width:a,height:r});return e instanceof n?lc(s).putImageData(e,0,0):lc(s).drawImage(e,0,0,a,r),s}async function y8e(e,t){let n=t||zs.getEnv().createCanvasElement(),[a,r,s]=e.shape.slice(Ll(e)?1:0),i=ue(()=>e.as3D(a,r,s).toInt());return await Wb.toPixels(i,n),i.dispose(),n}function bB(e){let{Image:t,Canvas:n,Video:a}=zs.getEnv();return e instanceof t||e instanceof n||e instanceof a}function b8e(e,t,n=!1){let{Image:a,Canvas:r}=zs.getEnv();if(!(e instanceof a||e instanceof r))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");if(t<=0)return Zv({width:1,height:1});let s=oH(e),i=t/Math.max(s.height,s.width),o=i*s.width,l=i*s.height,d=Zv({width:t,height:t}),c=e instanceof r?e:lH(e),f=Math.abs(o-l)/2,m=n&&o<l?f:0,x=n&&l<o?f:0;return c.width>0&&c.height>0&&lc(d).drawImage(c,m,x,o,l),d}var ew=class{constructor(e,t=!1){if(this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],this._inputSize=0,!Array.isArray(e))throw new Error(`NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have ${e}`);this._treatAsBatchInput=t,this._batchSize=e.length,e.forEach((n,a)=>{if(a0(n)){this._imageTensors[a]=n,this._inputDimensions[a]=n.shape;return}if(Ll(n)){let s=n.shape[0];if(s!==1)throw new Error(`NetInput - tf.Tensor4D with batchSize ${s} passed, but not supported in input array`);this._imageTensors[a]=n,this._inputDimensions[a]=n.shape.slice(1);return}let r=n instanceof zs.getEnv().Canvas?n:lH(n);this._canvases[a]=r,this._inputDimensions[a]=[r.height,r.width,3]})}get imageTensors(){return this._imageTensors}get canvases(){return this._canvases}get isBatchInput(){return this.batchSize>1||this._treatAsBatchInput}get batchSize(){return this._batchSize}get inputDimensions(){return this._inputDimensions}get inputSize(){return this._inputSize}get reshapedInputDimensions(){return am(this.batchSize,0,1).map((e,t)=>this.getReshapedInputDimensions(t))}getInput(e){return this.canvases[e]||this.imageTensors[e]}getInputDimensions(e){return this._inputDimensions[e]}getInputHeight(e){return this._inputDimensions[e][0]}getInputWidth(e){return this._inputDimensions[e][1]}getReshapedInputDimensions(e){if(typeof this.inputSize!="number")throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");let t=this.getInputWidth(e),n=this.getInputHeight(e);return HV({width:t,height:n},this.inputSize)}toBatchTensor(e,t=!0){return this._inputSize=e,ue(()=>{let n=am(this.batchSize,0,1).map(a=>{let r=this.getInput(a);if(r instanceof en){let s=Ll(r)?r:Dr(r);return s=u8e(s,t),(s.shape[1]!==e||s.shape[2]!==e)&&(s=Ii.resizeBilinear(s,[e,e],!1,!1)),s.as3D(e,e,3)}if(r instanceof zs.getEnv().Canvas)return Wb.fromPixels(b8e(r,e,t));throw new Error(`toBatchTensor - at batchIdx ${a}, expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have ${r}`)});return rr(n.map(a=>He(a,"float32"))).as4D(this.batchSize,e,e,3)})}};async function ks(e){if(e instanceof ew)return e;let t=Array.isArray(e)?e:[e];if(!t.length)throw new Error("toNetInput - empty array passed as input");let n=r=>Array.isArray(e)?` at input index ${r}:`:"",a=t.map(O4);return a.forEach((r,s)=>{if(!bB(r)&&!a0(r)&&!Ll(r))throw typeof t[s]=="string"?new Error(`toNetInput -${n(s)} string passed, but could not resolve HTMLElement for element id ${t[s]}`):new Error(`toNetInput -${n(s)} expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id`);if(Ll(r)){let i=r.shape[0];if(i!==1)throw new Error(`toNetInput -${n(s)} tf.Tensor4D with batchSize ${i} passed, but not supported in input array`)}}),await Promise.all(a.map(r=>bB(r)&&x8e(r))),new ew(a,Array.isArray(e))}async function uH(e,t){let{Canvas:n}=zs.getEnv(),a=e;if(!(e instanceof n)){let s=await ks(e);if(s.batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");let i=s.getInput(0);a=i instanceof n?i:await y8e(i)}let r=lc(a);return t.map(s=>s instanceof Do?s.forSize(a.width,a.height).box.floor():s).map(s=>s.clipAtImageBorders(a.width,a.height)).map(({x:s,y:i,width:o,height:l})=>{let d=Zv({width:o,height:l});return o>0&&l>0&&lc(d).putImageData(r.getImageData(s,i,o,l),0,0),d})}async function cH(e,t){if(!a0(e)&&!Ll(e))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(Ll(e)&&e.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return ue(()=>{let[n,a,r]=e.shape.slice(Ll(e)?1:0);return t.map(s=>s instanceof Do?s.forSize(a,n).box:s).map(s=>s.clipAtImageBorders(a,n)).filter(s=>s.width>0&&s.height>0).map(({x:s,y:i,width:o,height:l})=>vg(e.as3D(n,a,r),[i,s,0],[l,o,r]))})}async function v8e(e,t){let{fetch:n}=zs.getEnv(),a=await n(e,t);if(!(a.status<400))throw new Error(`failed to fetch: (${a.status}) ${a.statusText}, from url: ${a.url}`);return a}async function w8e(e){return(await v8e(e)).json()}function dH(e,t){let n=`${t}-weights_manifest.json`;if(!e)return{modelBaseUri:"",manifestUri:n};if(e==="/")return{modelBaseUri:"/",manifestUri:`/${n}`};let a=e.startsWith("http://")?"http://":e.startsWith("https://")?"https://":"";e=e.replace(a,"");let r=e.split("/").filter(o=>o),s=e.endsWith(".json")?r[r.length-1]:n,i=a+(e.endsWith(".json")?r.slice(0,r.length-1):r).join("/");return i=e.startsWith("/")?`/${i}`:i,{modelBaseUri:i,manifestUri:i==="/"?`/${s}`:`${i}/${s}`}}async function S8e(e,t){let{manifestUri:n,modelBaseUri:a}=dH(e,t),r=await w8e(n);return Hr.loadWeights(r,a)}var Cc=class{constructor(e){this._params=void 0,this._paramMappings=[],this._name=e}get params(){return this._params}get paramMappings(){return this._paramMappings}get isLoaded(){return!!this.params}getParamFromPath(e){let{obj:t,objProp:n}=this.traversePropertyPath(e);return t[n]}reassignParamFromPath(e,t){let{obj:n,objProp:a}=this.traversePropertyPath(e);n[a].dispose(),n[a]=t}getParamList(){return this._paramMappings.map(({paramPath:e})=>({path:e,tensor:this.getParamFromPath(e)}))}getTrainableParams(){return this.getParamList().filter(e=>e.tensor instanceof Id)}getFrozenParams(){return this.getParamList().filter(e=>!(e.tensor instanceof Id))}variable(){this.getFrozenParams().forEach(({path:e,tensor:t})=>{this.reassignParamFromPath(e,t.variable())})}freeze(){this.getTrainableParams().forEach(({path:e,tensor:t})=>{let n=bs(t.dataSync());t.dispose(),this.reassignParamFromPath(e,n)})}dispose(e=!0){this.getParamList().forEach(t=>{if(e&&t.tensor.isDisposed)throw new Error(`param tensor has already been disposed for path ${t.path}`);t.tensor.dispose()}),this._params=void 0}serializeParams(){return new Float32Array(this.getParamList().map(({tensor:e})=>Array.from(e.dataSync())).reduce((e,t)=>e.concat(t)))}async load(e){if(e instanceof Float32Array){this.extractWeights(e);return}await this.loadFromUri(e)}async loadFromUri(e){if(e&&typeof e!="string")throw new Error(`${this._name}.loadFromUri - expected model uri`);let t=await S8e(e,this.getDefaultModelName());this.loadFromWeightMap(t)}async loadFromDisk(e){if(e&&typeof e!="string")throw new Error(`${this._name}.loadFromDisk - expected model file path`);let{readFile:t}=zs.getEnv(),{manifestUri:n,modelBaseUri:a}=dH(e,this.getDefaultModelName()),r=l=>Promise.all(l.map(d=>t(d).then(c=>typeof c=="string"?Buffer.from(c):c.buffer))),s=Hr.weightsLoaderFactory(r),i=JSON.parse((await t(n)).toString()),o=await s(i,a);this.loadFromWeightMap(o)}loadFromWeightMap(e){let{paramMappings:t,params:n}=this.extractParamsFromWeightMap(e);this._paramMappings=t,this._params=n}extractWeights(e){let{paramMappings:t,params:n}=this.extractParams(e);this._paramMappings=t,this._params=n}traversePropertyPath(e){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");let t=e.split("/").reduce((r,s)=>{if(!r.nextObj.hasOwnProperty(s))throw new Error(`traversePropertyPath - object does not have property ${s}, for path ${e}`);return{obj:r.nextObj,objProp:s,nextObj:r.nextObj[s]}},{nextObj:this.params}),{obj:n,objProp:a}=t;if(!n||!a||!(n[a]instanceof en))throw new Error(`traversePropertyPath - parameter is not a tensor, for path ${e}`);return{obj:n,objProp:a}}};function _i(e,t,n){return ue(()=>{let a=bg(e,t.depthwise_filter,t.pointwise_filter,n,"same");return a=ke(a,t.bias),a})}function LN(e,t,n=!1){return ue(()=>{let a=Vn(n?ke(ws(e,t.conv0.filters,[2,2],"same"),t.conv0.bias):_i(e,t.conv0,[2,2])),r=_i(a,t.conv1,[1,1]),s=Vn(ke(a,r)),i=_i(s,t.conv2,[1,1]);return Vn(ke(a,ke(r,i)))})}function W1(e,t,n=!1,a=!0){return ue(()=>{let r=Vn(n?ke(ws(e,t.conv0.filters,a?[2,2]:[1,1],"same"),t.conv0.bias):_i(e,t.conv0,a?[2,2]:[1,1])),s=_i(r,t.conv1,[1,1]),i=Vn(ke(r,s)),o=_i(i,t.conv2,[1,1]),l=Vn(ke(r,ke(s,o))),d=_i(l,t.conv3,[1,1]);return Vn(ke(r,ke(s,ke(o,d))))})}function dy(e,t,n="same",a=!1){return ue(()=>{let r=ke(ws(e,t.filters,[1,1],n),t.bias);return a?Vn(r):r})}function Ec(e,t){Object.keys(e).forEach(n=>{t.some(a=>a.originalPath===n)||e[n].dispose()})}function z4(e,t){return(n,a,r,s)=>{let i=tc(e(n*a*r*r),[r,r,n,a]),o=Ln(e(a));return t.push({paramPath:`${s}/filters`},{paramPath:`${s}/bias`}),{filters:i,bias:o}}}function hH(e,t){return(n,a,r)=>{let s=nl(e(n*a),[n,a]),i=Ln(e(a));return t.push({paramPath:`${r}/weights`},{paramPath:`${r}/bias`}),{weights:s,bias:i}}}var pH=class{constructor(e,t,n){this.depthwise_filter=e,this.pointwise_filter=t,this.bias=n}};function U4(e,t){return(n,a,r)=>{let s=tc(e(9*n),[3,3,n,1]),i=tc(e(n*a),[1,1,n,a]),o=Ln(e(a));return t.push({paramPath:`${r}/depthwise_filter`},{paramPath:`${r}/pointwise_filter`},{paramPath:`${r}/bias`}),new pH(s,i,o)}}function W4(e){return t=>{let n=e(`${t}/depthwise_filter`,4),a=e(`${t}/pointwise_filter`,4),r=e(`${t}/bias`,1);return new pH(n,a,r)}}function wp(e,t){return(n,a,r)=>{let s=e[n];if(!Mg(s,a))throw new Error(`expected weightMap[${n}] to be a Tensor${a}D, instead have ${s}`);return t.push({originalPath:n,paramPath:r||n}),s}}function Ic(e){let t=e;function n(r){let s=t.slice(0,r);return t=t.slice(r),s}function a(){return t}return{extractWeights:n,getRemainingWeights:a}}function fH(e,t){let n=z4(e,t),a=U4(e,t);function r(i,o,l,d=!1){let c=d?n(i,o,3,`${l}/conv0`):a(i,o,`${l}/conv0`),f=a(o,o,`${l}/conv1`),m=a(o,o,`${l}/conv2`);return{conv0:c,conv1:f,conv2:m}}function s(i,o,l,d=!1){let{conv0:c,conv1:f,conv2:m}=r(i,o,l,d),x=a(o,o,`${l}/conv3`);return{conv0:c,conv1:f,conv2:m,conv3:x}}return{extractDenseBlock3Params:r,extractDenseBlock4Params:s}}function k8e(e){let t=[],{extractWeights:n,getRemainingWeights:a}=Ic(e),{extractDenseBlock4Params:r}=fH(n,t),s=r(3,32,"dense0",!0),i=r(32,64,"dense1"),o=r(64,128,"dense2"),l=r(128,256,"dense3");if(a().length!==0)throw new Error(`weights remaing after extract: ${a().length}`);return{paramMappings:t,params:{dense0:s,dense1:i,dense2:o,dense3:l}}}function mH(e){return t=>{let n=e(`${t}/filters`,4),a=e(`${t}/bias`,1);return{filters:n,bias:a}}}function gH(e,t){let n=wp(e,t),a=mH(n),r=W4(n);function s(o,l=!1){let d=l?a(`${o}/conv0`):r(`${o}/conv0`),c=r(`${o}/conv1`),f=r(`${o}/conv2`);return{conv0:d,conv1:c,conv2:f}}function i(o,l=!1){let d=l?a(`${o}/conv0`):r(`${o}/conv0`),c=r(`${o}/conv1`),f=r(`${o}/conv2`),m=r(`${o}/conv3`);return{conv0:d,conv1:c,conv2:f,conv3:m}}return{extractDenseBlock3Params:s,extractDenseBlock4Params:i}}function N8e(e){let t=[],{extractDenseBlock4Params:n}=gH(e,t),a={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2"),dense3:n("dense3")};return Ec(e,t),{params:a,paramMappings:t}}var xH=class extends Cc{constructor(){super("FaceFeatureExtractor")}forwardInput(e){let{params:t}=this;if(!t)throw new Error("FaceFeatureExtractor - load model before inference");return ue(()=>{let n=He(e.toBatchTensor(112,!0),"float32"),a=r0(n,[122.782,117.001,104.298]).div(255),r=W1(a,t.dense0,!0);return r=W1(r,t.dense1),r=W1(r,t.dense2),r=W1(r,t.dense3),r=Kl(r,[7,7],[2,2],"valid"),r})}async forward(e){return this.forwardInput(await ks(e))}getDefaultModelName(){return"face_feature_extractor_model"}extractParamsFromWeightMap(e){return N8e(e)}extractParams(e){return k8e(e)}};function UE(e,t){return ue(()=>ke(Jt(e,t.weights),t.bias))}function C8e(e,t,n){let a=[],{extractWeights:r,getRemainingWeights:s}=Ic(e),i=hH(r,a)(t,n,"fc");if(s().length!==0)throw new Error(`weights remaing after extract: ${s().length}`);return{paramMappings:a,params:{fc:i}}}function E8e(e){let t=[],n=wp(e,t);function a(s){let i=n(`${s}/weights`,2),o=n(`${s}/bias`,1);return{weights:i,bias:o}}let r={fc:a("fc")};return Ec(e,t),{params:r,paramMappings:t}}function yH(e){let t={},n={};return Object.keys(e).forEach(a=>{let r=a.startsWith("fc")?n:t;r[a]=e[a]}),{featureExtractorMap:t,classifierMap:n}}var bH=class extends Cc{constructor(e,t){super(e),this._faceFeatureExtractor=t}get faceFeatureExtractor(){return this._faceFeatureExtractor}runNet(e){let{params:t}=this;if(!t)throw new Error(`${this._name} - load model before inference`);return ue(()=>{let n=e instanceof ew?this.faceFeatureExtractor.forwardInput(e):e;return UE(n.as2D(n.shape[0],-1),t.fc)})}dispose(e=!0){this.faceFeatureExtractor.dispose(e),super.dispose(e)}loadClassifierParams(e){let{params:t,paramMappings:n}=this.extractClassifierParams(e);this._params=t,this._paramMappings=n}extractClassifierParams(e){return C8e(e,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())}extractParamsFromWeightMap(e){let{featureExtractorMap:t,classifierMap:n}=yH(e);return this.faceFeatureExtractor.loadFromWeightMap(t),E8e(n)}extractParams(e){let t=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),a=n*t+n,r=e.slice(0,e.length-a),s=e.slice(e.length-a);return this.faceFeatureExtractor.extractWeights(r),this.extractClassifierParams(s)}},vB=["neutral","happy","sad","angry","fearful","disgusted","surprised"],V4=class{constructor(e){if(this.neutral=0,this.happy=0,this.sad=0,this.angry=0,this.fearful=0,this.disgusted=0,this.surprised=0,e.length!==7)throw new Error(`FaceExpressions.constructor - expected probabilities.length to be 7, have: ${e.length}`);vB.forEach((t,n)=>{this[t]=e[n]})}asSortedArray(){return vB.map(e=>({expression:e,probability:this[e]})).sort((e,t)=>t.probability-e.probability)}},I8e=class extends bH{constructor(e=new xH){super("FaceExpressionNet",e)}forwardInput(e){return ue(()=>bc(this.runNet(e)))}async forward(e){return this.forwardInput(await ks(e))}async predictExpressions(e){let t=await ks(e),n=await this.forwardInput(t),a=await Promise.all($a(n).map(async s=>{let i=s.dataSync();return s.dispose(),i}));n.dispose();let r=a.map(s=>new V4(s));return t.isBatchInput?r:r[0]}getDefaultModelName(){return"face_expression_model"}getClassifierChannelsIn(){return 256}getClassifierChannelsOut(){return 7}};function T8e(e){return e.expressions instanceof V4}function A8e(e,t){return{...e,expressions:t}}
vendor: 4,637 bytes, line 5061
5061function _8e(e,t,n=.1,a){(Array.isArray(t)?t:[t]).forEach(r=>{let s=r instanceof V4?r:T8e(r)?r.expressions:void 0;if(!s)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");let i=s.asSortedArray().filter(l=>l.probability>n),o=Qv(r)?r.detection.box.bottomLeft:a||new Yn(0,0);new P4(i.map(l=>`${l.expression} (${M4(l.probability)})`),o).draw(e)})}function vH(e){return Qv(e)&&e.landmarks instanceof Jv&&e.unshiftedLandmarks instanceof Jv&&e.alignedRect instanceof Do}function j8e(e){let t=l=>l*180/Math.PI,n=(l,d)=>Math.sqrt((l.x-d.x)**2+(l.y-d.y)**2),a={roll:void 0,pitch:void 0,yaw:void 0},r=(l,d,c)=>{let f=Math.floor(l.x-d.x),m=Math.floor(d.x-c.x);return f-m},s=(l,d)=>{let c=Math.hypot(d.x-l.x,d.y-l.y),f=d.y-l.y,m=Math.asin(f/c),x=t(m),y=Math.floor(90-x),b=d.x-l.x<0?-1:1;return y*b},i=(l,d,c)=>{let f=n(l,c),m=new Yn((l.x+c.x)/2,(l.y+c.y)/2),x=n(d,m),y=Math.atan(x/f),b=Math.floor(t(y)),w=m.y-d.y<0?-1:1;return b*w};if(!e||!e.positions||e.positions.length!==68)return a;let o=e.positions;return a.roll=s(o[27],o[66]),a.pitch=i(o[14],o[30],o[2]),a.yaw=r(o[14],o[33],o[2]),a}function D8e(e,t){let{box:n}=e.detection,a=t.shiftBy(n.x,n.y),r=a.align(),{imageDims:s}=e.detection,i=new Do(e.detection.score,r.rescale(s.reverse()),s),o=j8e(t);return{...e,landmarks:a,unshiftedLandmarks:t,alignedRect:i,angle:o}}var wH=class{constructor(e={}){let{drawLines:t=!0,drawPoints:n=!0,lineWidth:a,lineColor:r,pointSize:s,pointColor:i}=e;this.drawLines=t,this.drawPoints=n,this.lineWidth=a||1,this.pointSize=s||2,this.lineColor=r||"rgba(0, 255, 255, 1)",this.pointColor=i||"rgba(255, 0, 255, 1)"}},SH=class{constructor(e,t={}){this.faceLandmarks=e,this.options=new wH(t)}draw(e){let t=lc(e),{drawLines:n,drawPoints:a,lineWidth:r,lineColor:s,pointSize:i,pointColor:o}=this.options;if(n&&this.faceLandmarks instanceof JV&&(t.strokeStyle=s,t.lineWidth=r,_u(t,this.faceLandmarks.getJawOutline()),_u(t,this.faceLandmarks.getLeftEyeBrow()),_u(t,this.faceLandmarks.getRightEyeBrow()),_u(t,this.faceLandmarks.getNose()),_u(t,this.faceLandmarks.getLeftEye(),!0),_u(t,this.faceLandmarks.getRightEye(),!0),_u(t,this.faceLandmarks.getMouth(),!0)),a){t.strokeStyle=o,t.fillStyle=o;let l=d=>{t.beginPath(),t.arc(d.x,d.y,i,0,2*Math.PI),t.fill()};this.faceLandmarks.positions.forEach(l)}}};function R8e(e,t){(Array.isArray(t)?t:[t]).forEach(n=>{let a=n instanceof Jv?n:vH(n)?n.landmarks:void 0;if(!a)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new SH(a).draw(e)})}function M8e(e,t){let n=z4(e,t),a=U4(e,t);function r(i,o,l){let d=a(i,o,`${l}/separable_conv0`),c=a(o,o,`${l}/separable_conv1`),f=n(i,o,1,`${l}/expansion_conv`);return{separable_conv0:d,separable_conv1:c,expansion_conv:f}}function s(i,o){let l=a(i,i,`${o}/separable_conv0`),d=a(i,i,`${o}/separable_conv1`),c=a(i,i,`${o}/separable_conv2`);return{separable_conv0:l,separable_conv1:d,separable_conv2:c}}return{extractConvParams:n,extractSeparableConvParams:a,extractReductionBlockParams:r,extractMainBlockParams:s}}function $8e(e,t){let n=[],{extractWeights:a,getRemainingWeights:r}=Ic(e),{extractConvParams:s,extractSeparableConvParams:i,extractReductionBlockParams:o,extractMainBlockParams:l}=M8e(a,n),d=s(3,32,3,"entry_flow/conv_in"),c=o(32,64,"entry_flow/reduction_block_0"),f=o(64,128,"entry_flow/reduction_block_1"),m={conv_in:d,reduction_block_0:c,reduction_block_1:f},x={};am(t,0,1).forEach(S=>{x[`main_block_${S}`]=l(128,`middle_flow/main_block_${S}`)});let y=o(128,256,"exit_flow/reduction_block"),b=i(256,512,"exit_flow/separable_conv"),w={reduction_block:y,separable_conv:b};if(r().length!==0)throw new Error(`weights remaing after extract: ${r().length}`);return{paramMappings:n,params:{entry_flow:m,middle_flow:x,exit_flow:w}}}function B8e(e,t){let n=wp(e,t),a=mH(n),r=W4(n);function s(o){let l=r(`${o}/separable_conv0`),d=r(`${o}/separable_conv1`),c=a(`${o}/expansion_conv`);return{separable_conv0:l,separable_conv1:d,expansion_conv:c}}function i(o){let l=r(`${o}/separable_conv0`),d=r(`${o}/separable_conv1`),c=r(`${o}/separable_conv2`);return{separable_conv0:l,separable_conv1:d,separable_conv2:c}}return{extractConvParams:a,extractSeparableConvParams:r,extractReductionBlockParams:s,extractMainBlockParams:i}}function F8e(e,t){let n=[],{extractConvParams:a,extractSeparableConvParams:r,extractReductionBlockParams:s,extractMainBlockParams:i}=B8e(e,n),o=a("entry_flow/conv_in"),l=s("entry_flow/reduction_block_0"),d=s("entry_flow/reduction_block_1"),c={conv_in:o,reduction_block_0:l,reduction_block_1:d},f={};
vendor: 33,473 bytes, line 5061
5061am(t,0,1).forEach(b=>{f[`main_block_${b}`]=i(`middle_flow/main_block_${b}`)});let m=s("exit_flow/reduction_block"),x=r("exit_flow/separable_conv"),y={reduction_block:m,separable_conv:x};return Ec(e,n),{params:{entry_flow:c,middle_flow:f,exit_flow:y},paramMappings:n}}function kH(e,t,n){return ke(ws(e,t.filters,n,"same"),t.bias)}function PN(e,t,n=!0){let a=n?Vn(e):e;return a=_i(a,t.separable_conv0,[1,1]),a=_i(Vn(a),t.separable_conv1,[1,1]),a=Ar(a,[3,3],[2,2],"same"),a=ke(a,kH(e,t.expansion_conv,[2,2])),a}function O8e(e,t){let n=_i(Vn(e),t.separable_conv0,[1,1]);return n=_i(Vn(n),t.separable_conv1,[1,1]),n=_i(Vn(n),t.separable_conv2,[1,1]),n=ke(n,e),n}var L8e=class extends Cc{constructor(e){super("TinyXception"),this._numMainBlocks=e}forwardInput(e){let{params:t}=this;if(!t)throw new Error("TinyXception - load model before inference");return ue(()=>{let n=He(e.toBatchTensor(112,!0),"float32"),a=r0(n,[122.782,117.001,104.298]).div(255),r=Vn(kH(a,t.entry_flow.conv_in,[2,2]));return r=PN(r,t.entry_flow.reduction_block_0,!1),r=PN(r,t.entry_flow.reduction_block_1),am(this._numMainBlocks,0,1).forEach(s=>{r=O8e(r,t.middle_flow[`main_block_${s}`])}),r=PN(r,t.exit_flow.reduction_block),r=Vn(_i(r,t.exit_flow.separable_conv,[1,1])),r})}async forward(e){return this.forwardInput(await ks(e))}getDefaultModelName(){return"tiny_xception_model"}extractParamsFromWeightMap(e){return F8e(e,this._numMainBlocks)}extractParams(e){return $8e(e,this._numMainBlocks)}};function P8e(e){let t=[],{extractWeights:n,getRemainingWeights:a}=Ic(e),r=hH(n,t),s=r(512,1,"fc/age"),i=r(512,2,"fc/gender");if(a().length!==0)throw new Error(`weights remaing after extract: ${a().length}`);return{paramMappings:t,params:{fc:{age:s,gender:i}}}}function z8e(e){let t=[],n=wp(e,t);function a(s){let i=n(`${s}/weights`,2),o=n(`${s}/bias`,1);return{weights:i,bias:o}}let r={fc:{age:a("fc/age"),gender:a("fc/gender")}};return Ec(e,t),{params:r,paramMappings:t}}var U8e=(e=>(e.FEMALE="female",e.MALE="male",e))(U8e||{}),W8e=class extends Cc{constructor(e=new L8e(2)){super("AgeGenderNet"),this._faceFeatureExtractor=e}get faceFeatureExtractor(){return this._faceFeatureExtractor}runNet(e){let{params:t}=this;if(!t)throw new Error(`${this._name} - load model before inference`);return ue(()=>{let n=e instanceof ew?this.faceFeatureExtractor.forwardInput(e):e,a=Kl(n,[7,7],[2,2],"valid").as2D(n.shape[0],-1),r=UE(a,t.fc.age).as1D(),s=UE(a,t.fc.gender);return{age:r,gender:s}})}forwardInput(e){return ue(()=>{let{age:t,gender:n}=this.runNet(e);return{age:t,gender:bc(n)}})}async forward(e){return this.forwardInput(await ks(e))}async predictAgeAndGender(e){let t=await ks(e),n=await this.forwardInput(t),a=$a(n.age),r=$a(n.gender),s=a.map((o,l)=>({ageTensor:o,genderTensor:r[l]})),i=await Promise.all(s.map(async({ageTensor:o,genderTensor:l})=>{let d=o.dataSync()[0],c=l.dataSync()[0],f=c>.5,m=f?"male":"female",x=f?c:1-c;return o.dispose(),l.dispose(),{age:d,gender:m,genderProbability:x}}));return n.age.dispose(),n.gender.dispose(),t.isBatchInput?i:i[0]}getDefaultModelName(){return"age_gender_model"}dispose(e=!0){this.faceFeatureExtractor.dispose(e),super.dispose(e)}loadClassifierParams(e){let{params:t,paramMappings:n}=this.extractClassifierParams(e);this._params=t,this._paramMappings=n}extractClassifierParams(e){return P8e(e)}extractParamsFromWeightMap(e){let{featureExtractorMap:t,classifierMap:n}=yH(e);return this.faceFeatureExtractor.loadFromWeightMap(t),z8e(n)}extractParams(e){let t=e.slice(0,e.length-1539),n=e.slice(e.length-1539);return this.faceFeatureExtractor.extractWeights(t),this.extractClassifierParams(n)}},NH=class extends bH{postProcess(e,t,n){let a=n.map(({width:s,height:i})=>{let o=t/Math.max(i,s);return{width:s*o,height:i*o}}),r=a.length;return ue(()=>{let s=(d,c)=>rr([ri([68],d,"float32"),ri([68],c,"float32")],1).as2D(1,136).as1D(),i=(d,c)=>{let{width:f,height:m}=a[d];return c(f,m)?Math.abs(f-m)/2:0},o=d=>i(d,(c,f)=>c<f),l=d=>i(d,(c,f)=>f<c);return e.mul(ri([r,136],t,"float32")).sub(rr(Array.from(Array(r),(d,c)=>s(o(c),l(c))))).div(rr(Array.from(Array(r),(d,c)=>s(a[c].width,a[c].height))))})}forwardInput(e){return ue(()=>{let t=this.runNet(e);return this.postProcess(t,e.inputSize,e.inputDimensions.map(([n,a])=>({height:n,width:a})))})}async forward(e){return this.forwardInput(await ks(e))}async detectLandmarks(e){let t=await ks(e),n=ue(()=>$a(this.forwardInput(t))),a=await Promise.all(n.map(async(r,s)=>{let i=Array.from(r.dataSync()),o=i.filter((d,c)=>LE(c)),l=i.filter((d,c)=>!LE(c));return new JV(Array(68).fill(0).map((d,c)=>new Yn(o[c],l[c])),{height:t.getInputHeight(s),width:t.getInputWidth(s)})}));return n.forEach(r=>r.dispose()),t.isBatchInput?a:a[0]}getClassifierChannelsOut(){return 136}},V8e=class extends NH{constructor(e=new xH){super("FaceLandmark68Net",e)}getDefaultModelName(){return"face_landmark_68_model"}getClassifierChannelsIn(){return 256}};function H8e(e){let t=[],{extractDenseBlock3Params:n}=gH(e,t),a={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2")};return Ec(e,t),{params:a,paramMappings:t}}function G8e(e){let t=[],{extractWeights:n,getRemainingWeights:a}=Ic(e),{extractDenseBlock3Params:r}=fH(n,t),s=r(3,32,"dense0",!0),i=r(32,64,"dense1"),o=r(64,128,"dense2");if(a().length!==0)throw new Error(`weights remaing after extract: ${a().length}`);return{paramMappings:t,params:{dense0:s,dense1:i,dense2:o}}}var q8e=class extends Cc{constructor(){super("TinyFaceFeatureExtractor")}forwardInput(e){let{params:t}=this;if(!t)throw new Error("TinyFaceFeatureExtractor - load model before inference");return ue(()=>{let n=He(e.toBatchTensor(112,!0),"float32"),a=r0(n,[122.782,117.001,104.298]).div(255),r=LN(a,t.dense0,!0);return r=LN(r,t.dense1),r=LN(r,t.dense2),r=Kl(r,[14,14],[2,2],"valid"),r})}async forward(e){return this.forwardInput(await ks(e))}getDefaultModelName(){return"face_feature_extractor_tiny_model"}extractParamsFromWeightMap(e){return H8e(e)}extractParams(e){return G8e(e)}},K8e=class extends NH{constructor(e=new q8e){super("FaceLandmark68TinyNet",e)}getDefaultModelName(){return"face_landmark_68_tiny_model"}getClassifierChannelsIn(){return 128}};function X8e(e,t){return ke(ie(e,t.weights),t.biases)}function H4(e,t,n,a,r="same"){let{filters:s,bias:i}=t.conv,o=ws(e,s,n,r);return o=ke(o,i),o=X8e(o,t.scale),a?Vn(o):o}function Y8e(e,t){return H4(e,t,[1,1],!0)}function CH(e,t){return H4(e,t,[1,1],!1)}function EH(e,t){return H4(e,t,[2,2],!0,"valid")}function J8e(e,t){function n(o,l,d){let c=e(o),f=c.length/(l*d*d);if(VV(f))throw new Error(`depth has to be an integer: ${f}, weights.length: ${c.length}, numFilters: ${l}, filterSize: ${d}`);return ue(()=>Qt(tc(c,[l,f,d,d]),[2,3,1,0]))}function a(o,l,d,c){let f=n(o,l,d),m=Ln(e(l));return t.push({paramPath:`${c}/filters`},{paramPath:`${c}/bias`}),{filters:f,bias:m}}function r(o,l){let d=Ln(e(o)),c=Ln(e(o));return t.push({paramPath:`${l}/weights`},{paramPath:`${l}/biases`}),{weights:d,biases:c}}function s(o,l,d,c){let f=a(o,l,d,`${c}/conv`),m=r(l,`${c}/scale`);return{conv:f,scale:m}}function i(o,l,d,c,f=!1){let m=s((f?.5:1)*o,l,d,`${c}/conv1`),x=s(o,l,d,`${c}/conv2`);return{conv1:m,conv2:x}}return{extractConvLayerParams:s,extractResidualLayerParams:i}}function Q8e(e){let{extractWeights:t,getRemainingWeights:n}=Ic(e),a=[],{extractConvLayerParams:r,extractResidualLayerParams:s}=J8e(t,a),i=r(4704,32,7,"conv32_down"),o=s(9216,32,3,"conv32_1"),l=s(9216,32,3,"conv32_2"),d=s(9216,32,3,"conv32_3"),c=s(36864,64,3,"conv64_down",!0),f=s(36864,64,3,"conv64_1"),m=s(36864,64,3,"conv64_2"),x=s(36864,64,3,"conv64_3"),y=s(147456,128,3,"conv128_down",!0),b=s(147456,128,3,"conv128_1"),w=s(147456,128,3,"conv128_2"),S=s(589824,256,3,"conv256_down",!0),k=s(589824,256,3,"conv256_1"),C=s(589824,256,3,"conv256_2"),E=s(589824,256,3,"conv256_down_out"),T=ue(()=>Qt(nl(t(256*128),[128,256]),[1,0]));if(a.push({paramPath:"fc"}),n().length!==0)throw new Error(`weights remaing after extract: ${n().length}`);return{params:{conv32_down:i,conv32_1:o,conv32_2:l,conv32_3:d,conv64_down:c,conv64_1:f,conv64_2:m,conv64_3:x,conv128_down:y,conv128_1:b,conv128_2:w,conv256_down:S,conv256_1:k,conv256_2:C,conv256_down_out:E,fc:T},paramMappings:a}}function Z8e(e,t){let n=wp(e,t);function a(i){let o=n(`${i}/scale/weights`,1),l=n(`${i}/scale/biases`,1);return{weights:o,biases:l}}function r(i){let o=n(`${i}/conv/filters`,4),l=n(`${i}/conv/bias`,1),d=a(i);return{conv:{filters:o,bias:l},scale:d}}function s(i){return{conv1:r(`${i}/conv1`),conv2:r(`${i}/conv2`)}}return{extractConvLayerParams:r,extractResidualLayerParams:s}}function eLe(e){let t=[],{extractConvLayerParams:n,extractResidualLayerParams:a}=Z8e(e,t),r=n("conv32_down"),s=a("conv32_1"),i=a("conv32_2"),o=a("conv32_3"),l=a("conv64_down"),d=a("conv64_1"),c=a("conv64_2"),f=a("conv64_3"),m=a("conv128_down"),x=a("conv128_1"),y=a("conv128_2"),b=a("conv256_down"),w=a("conv256_1"),S=a("conv256_2"),k=a("conv256_down_out"),{fc:C}=e;if(t.push({originalPath:"fc",paramPath:"fc"}),!WV(C))throw new Error(`expected weightMap[fc] to be a Tensor2D, instead have ${C}`);let E={conv32_down:r,conv32_1:s,conv32_2:i,conv32_3:o,conv64_down:l,conv64_1:d,conv64_2:c,conv64_3:f,conv128_down:m,conv128_1:x,conv128_2:y,conv256_down:b,conv256_1:w,conv256_2:S,conv256_down_out:k,fc:C};return Ec(e,t),{params:E,paramMappings:t}}function Uo(e,t){let n=Y8e(e,t.conv1);return n=CH(n,t.conv2),n=ke(n,e),n=Vn(n),n}function V1(e,t){let n=EH(e,t.conv1);n=CH(n,t.conv2);let a=Kl(e,2,2,"valid"),r=va(a.shape),s=a.shape[3]!==n.shape[3];if(a.shape[1]!==n.shape[1]||a.shape[2]!==n.shape[2]){let i=[...n.shape];i[1]=1;let o=va(i);n=Qn([n,o],1);let l=[...n.shape];l[2]=1;let d=va(l);n=Qn([n,d],2)}return a=s?Qn([a,r],3):a,n=ke(a,n),n=Vn(n),n}var tLe=class extends Cc{constructor(){super("FaceRecognitionNet")}forwardInput(e){let{params:t}=this;if(!t)throw new Error("FaceRecognitionNet - load model before inference");return ue(()=>{let n=He(e.toBatchTensor(150,!0),"float32"),a=r0(n,[122.782,117.001,104.298]).div(255),r=EH(a,t.conv32_down);r=Ar(r,3,2,"valid"),r=Uo(r,t.conv32_1),r=Uo(r,t.conv32_2),r=Uo(r,t.conv32_3),r=V1(r,t.conv64_down),r=Uo(r,t.conv64_1),r=Uo(r,t.conv64_2),r=Uo(r,t.conv64_3),r=V1(r,t.conv128_down),r=Uo(r,t.conv128_1),r=Uo(r,t.conv128_2),r=V1(r,t.conv256_down),r=Uo(r,t.conv256_1),r=Uo(r,t.conv256_2),r=V1(r,t.conv256_down_out);let s=r.mean([1,2]);return Jt(s,t.fc)})}async forward(e){return this.forwardInput(await ks(e))}async computeFaceDescriptor(e){var t;if((t=e?.shape)!=null&&t.some(s=>s<=0))return new Float32Array(128);let n=await ks(e),a=ue(()=>$a(this.forwardInput(n))),r=await Promise.all(a.map(s=>s.data()));return a.forEach(s=>s.dispose()),n.isBatchInput?r:r[0]}getDefaultModelName(){return"face_recognition_model"}extractParamsFromWeightMap(e){return eLe(e)}extractParams(e){return Q8e(e)}};function nLe(e,t){return{...e,descriptor:t}}function aLe(e,t){return{...e,age:t}}function rLe(e,t,n){return{...e,gender:t,genderProbability:n}}function sLe(e,t){function n(l,d){let c=tc(e(9*l),[3,3,l,1]),f=Ln(e(l)),m=Ln(e(l)),x=Ln(e(l)),y=Ln(e(l));return t.push({paramPath:`${d}/filters`},{paramPath:`${d}/batch_norm_scale`},{paramPath:`${d}/batch_norm_offset`},{paramPath:`${d}/batch_norm_mean`},{paramPath:`${d}/batch_norm_variance`}),{filters:c,batch_norm_scale:f,batch_norm_offset:m,batch_norm_mean:x,batch_norm_variance:y}}function a(l,d,c,f,m){let x=tc(e(l*d*c*c),[c,c,l,d]),y=Ln(e(d));return t.push({paramPath:`${f}/filters`},{paramPath:`${f}/${m?"batch_norm_offset":"bias"}`}),{filters:x,bias:y}}function r(l,d,c,f){let{filters:m,bias:x}=a(l,d,c,f,!0);return{filters:m,batch_norm_offset:x}}function s(l,d,c){let f=n(l,`${c}/depthwise_conv`),m=r(l,d,1,`${c}/pointwise_conv`);return{depthwise_conv:f,pointwise_conv:m}}function i(){let l=r(3,32,3,"mobilenetv1/conv_0"),d=s(32,64,"mobilenetv1/conv_1"),c=s(64,128,"mobilenetv1/conv_2"),f=s(128,128,"mobilenetv1/conv_3"),m=s(128,256,"mobilenetv1/conv_4"),x=s(256,256,"mobilenetv1/conv_5"),y=s(256,512,"mobilenetv1/conv_6"),b=s(512,512,"mobilenetv1/conv_7"),w=s(512,512,"mobilenetv1/conv_8"),S=s(512,512,"mobilenetv1/conv_9"),k=s(512,512,"mobilenetv1/conv_10"),C=s(512,512,"mobilenetv1/conv_11"),E=s(512,1024,"mobilenetv1/conv_12"),T=s(1024,1024,"mobilenetv1/conv_13");return{conv_0:l,conv_1:d,conv_2:c,conv_3:f,conv_4:m,conv_5:x,conv_6:y,conv_7:b,conv_8:w,conv_9:S,conv_10:k,conv_11:C,conv_12:E,conv_13:T}}function o(){let l=r(1024,256,1,"prediction_layer/conv_0"),d=r(256,512,3,"prediction_layer/conv_1"),c=r(512,128,1,"prediction_layer/conv_2"),f=r(128,256,3,"prediction_layer/conv_3"),m=r(256,128,1,"prediction_layer/conv_4"),x=r(128,256,3,"prediction_layer/conv_5"),y=r(256,64,1,"prediction_layer/conv_6"),b=r(64,128,3,"prediction_layer/conv_7"),w=a(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),S=a(512,9,1,"prediction_layer/box_predictor_0/class_predictor"),k=a(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),C=a(1024,18,1,"prediction_layer/box_predictor_1/class_predictor"),E=a(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),T=a(512,18,1,"prediction_layer/box_predictor_2/class_predictor"),_=a(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),A=a(256,18,1,"prediction_layer/box_predictor_3/class_predictor"),$=a(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),O=a(256,18,1,"prediction_layer/box_predictor_4/class_predictor"),z=a(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),P=a(128,18,1,"prediction_layer/box_predictor_5/class_predictor");return{conv_0:l,conv_1:d,conv_2:c,conv_3:f,conv_4:m,conv_5:x,conv_6:y,conv_7:b,box_predictor_0:{box_encoding_predictor:w,class_predictor:S},box_predictor_1:{box_encoding_predictor:k,class_predictor:C},box_predictor_2:{box_encoding_predictor:E,class_predictor:T},box_predictor_3:{box_encoding_predictor:_,class_predictor:A},box_predictor_4:{box_encoding_predictor:$,class_predictor:O},box_predictor_5:{box_encoding_predictor:z,class_predictor:P}}}return{extractMobilenetV1Params:i,extractPredictionLayerParams:o}}function iLe(e){let t=[],{extractWeights:n,getRemainingWeights:a}=Ic(e),{extractMobilenetV1Params:r,extractPredictionLayerParams:s}=sLe(n,t),i=r(),o=s(),l={extra_dim:n2(n(5118*4),[1,5118,4])};if(t.push({paramPath:"output_layer/extra_dim"}),a().length!==0)throw new Error(`weights remaing after extract: ${a().length}`);return{params:{mobilenetv1:i,prediction_layer:o,output_layer:l},paramMappings:t}}function oLe(e,t){let n=wp(e,t);function a(d,c,f){let m=n(`${d}/Conv2d_${c}_pointwise/weights`,4,`${f}/filters`),x=n(`${d}/Conv2d_${c}_pointwise/convolution_bn_offset`,1,`${f}/batch_norm_offset`);return{filters:m,batch_norm_offset:x}}function r(d){let c=`mobilenetv1/conv_${d}`,f=`MobilenetV1/Conv2d_${d}_depthwise`,m=`${c}/depthwise_conv`,x=`${c}/pointwise_conv`,y=n(`${f}/depthwise_weights`,4,`${m}/filters`),b=n(`${f}/BatchNorm/gamma`,1,`${m}/batch_norm_scale`),w=n(`${f}/BatchNorm/beta`,1,`${m}/batch_norm_offset`),S=n(`${f}/BatchNorm/moving_mean`,1,`${m}/batch_norm_mean`),k=n(`${f}/BatchNorm/moving_variance`,1,`${m}/batch_norm_variance`);return{depthwise_conv:{filters:y,batch_norm_scale:b,batch_norm_offset:w,batch_norm_mean:S,batch_norm_variance:k},pointwise_conv:a("MobilenetV1",d,x)}}function s(){return{conv_0:a("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:r(1),conv_2:r(2),conv_3:r(3),conv_4:r(4),conv_5:r(5),conv_6:r(6),conv_7:r(7),conv_8:r(8),conv_9:r(9),conv_10:r(10),conv_11:r(11),conv_12:r(12),conv_13:r(13)}}function i(d,c){let f=n(`${d}/weights`,4,`${c}/filters`),m=n(`${d}/biases`,1,`${c}/bias`);return{filters:f,bias:m}}function o(d){let c=i(`Prediction/BoxPredictor_${d}/BoxEncodingPredictor`,`prediction_layer/box_predictor_${d}/box_encoding_predictor`),f=i(`Prediction/BoxPredictor_${d}/ClassPredictor`,`prediction_layer/box_predictor_${d}/class_predictor`);return{box_encoding_predictor:c,class_predictor:f}}function l(){return{conv_0:a("Prediction",0,"prediction_layer/conv_0"),conv_1:a("Prediction",1,"prediction_layer/conv_1"),conv_2:a("Prediction",2,"prediction_layer/conv_2"),conv_3:a("Prediction",3,"prediction_layer/conv_3"),conv_4:a("Prediction",4,"prediction_layer/conv_4"),conv_5:a("Prediction",5,"prediction_layer/conv_5"),conv_6:a("Prediction",6,"prediction_layer/conv_6"),conv_7:a("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:o(0),box_predictor_1:o(1),box_predictor_2:o(2),box_predictor_3:o(3),box_predictor_4:o(4),box_predictor_5:o(5)}}return{extractMobilenetV1Params:s,extractPredictionLayerParams:l}}function lLe(e){let t=[],{extractMobilenetV1Params:n,extractPredictionLayerParams:a}=oLe(e,t),r=e["Output/extra_dim"];if(t.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!a0(r))throw new Error(`expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have ${r}`);let s={mobilenetv1:n(),prediction_layer:a(),output_layer:{extra_dim:r}};return Ec(e,t),{params:s,paramMappings:t}}function Ho(e,t,n){return ue(()=>{let a=ws(e,t.filters,n,"same");return a=ke(a,t.batch_norm_offset),ns(a,0,6)})}var uLe=.0010000000474974513;function cLe(e,t,n){return ue(()=>{let a=dp(e,t.filters,n,"same");return a=cp(a,t.batch_norm_mean,t.batch_norm_variance,t.batch_norm_offset,t.batch_norm_scale,uLe),ns(a,0,6)})}function dLe(e){return[2,4,6,12].some(t=>t===e)?[2,2]:[1,1]}function hLe(e,t){return ue(()=>{let n,a=Ho(e,t.conv_0,[2,2]);if([t.conv_1,t.conv_2,t.conv_3,t.conv_4,t.conv_5,t.conv_6,t.conv_7,t.conv_8,t.conv_9,t.conv_10,t.conv_11,t.conv_12,t.conv_13].forEach((r,s)=>{let i=s+1,o=dLe(i);a=cLe(a,r.depthwise_conv,o),a=Ho(a,r.pointwise_conv,[1,1]),i===11&&(n=a)}),n===null)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:a,conv11:n}})}function pLe(e,t,n){let a=e.arraySync(),r=Math.min(a[t][0],a[t][2]),s=Math.min(a[t][1],a[t][3]),i=Math.max(a[t][0],a[t][2]),o=Math.max(a[t][1],a[t][3]),l=Math.min(a[n][0],a[n][2]),d=Math.min(a[n][1],a[n][3]),c=Math.max(a[n][0],a[n][2]),f=Math.max(a[n][1],a[n][3]),m=(i-r)*(o-s),x=(c-l)*(f-d);if(m<=0||x<=0)return 0;let y=Math.max(r,l),b=Math.max(s,d),w=Math.min(i,c),S=Math.min(o,f),k=Math.max(w-y,0)*Math.max(S-b,0);return k/(m+x-k)}function fLe(e,t,n,a,r){let s=e.shape[0],i=Math.min(n,s),o=t.map((c,f)=>({score:c,boxIndex:f})).filter(c=>c.score>r).sort((c,f)=>f.score-c.score),l=c=>c<=a?1:0,d=[];return o.forEach(c=>{if(d.length>=i)return;let f=c.score;for(let m=d.length-1;m>=0;--m){let x=pLe(e,c.boxIndex,d[m]);if(x!==0&&(c.score*=l(x),c.score<=r))break}f===c.score&&d.push(c.boxIndex)}),d}function mLe(e){let t=$a(Qt(e,[1,0])),n=[st(t[2],t[0]),st(t[3],t[1])],a=[ke(t[0],ht(n[0],2)),ke(t[1],ht(n[1],2))];return{sizes:n,centers:a}}function gLe(e,t){let{sizes:n,centers:a}=mLe(e),r=$a(Qt(t,[1,0])),s=ht(ie(as(ht(r[2],5)),n[0]),2),i=ke(ie(ht(r[0],10),n[0]),a[0]),o=ht(ie(as(ht(r[3],5)),n[1]),2),l=ke(ie(ht(r[1],10),n[1]),a[1]);return Qt(rr([st(i,s),st(l,o),ke(i,s),ke(l,o)]),[1,0])}function xLe(e,t,n){return ue(()=>{let a=e.shape[0],r=gLe(le(ai(n.extra_dim,[a,1,1]),[-1,4]),le(e,[-1,4]));r=le(r,[a,r.shape[0]/a,4]);let s=eo(un(t,[0,0,1],[-1,-1,-1])),i=un(s,[0,0,0],[-1,-1,1]);i=le(i,[a,i.shape[1]]);let o=$a(r),l=$a(i);return{boxes:o,scores:l}})}function df(e,t){return ue(()=>{let n=e.shape[0],a=le(dy(e,t.box_encoding_predictor),[n,-1,1,4]),r=le(dy(e,t.class_predictor),[n,-1,3]);return{boxPredictionEncoding:a,classPrediction:r}})}function yLe(e,t,n){return ue(()=>{let a=Ho(e,n.conv_0,[1,1]),r=Ho(a,n.conv_1,[2,2]),s=Ho(r,n.conv_2,[1,1]),i=Ho(s,n.conv_3,[2,2]),o=Ho(i,n.conv_4,[1,1]),l=Ho(o,n.conv_5,[2,2]),d=Ho(l,n.conv_6,[1,1]),c=Ho(d,n.conv_7,[2,2]),f=df(t,n.box_predictor_0),m=df(e,n.box_predictor_1),x=df(r,n.box_predictor_2),y=df(i,n.box_predictor_3),b=df(l,n.box_predictor_4),w=df(c,n.box_predictor_5),S=Qn([f.boxPredictionEncoding,m.boxPredictionEncoding,x.boxPredictionEncoding,y.boxPredictionEncoding,b.boxPredictionEncoding,w.boxPredictionEncoding],1),k=Qn([f.classPrediction,m.classPrediction,x.classPrediction,y.classPrediction,b.classPrediction,w.classPrediction],1);return{boxPredictions:S,classPredictions:k}})}var U2=class{constructor({minConfidence:e,maxResults:t}={}){if(this._name="SsdMobilenetv1Options",this._minConfidence=e||.5,this._maxResults=t||100,typeof this._minConfidence!="number"||this._minConfidence<=0||this._minConfidence>=1)throw new Error(`${this._name} - expected minConfidence to be a number between 0 and 1`);if(typeof this._maxResults!="number")throw new Error(`${this._name} - expected maxResults to be a number`)}get minConfidence(){return this._minConfidence}get maxResults(){return this._maxResults}},bLe=class extends Cc{constructor(){super("SsdMobilenetv1")}forwardInput(e){let{params:t}=this;if(!t)throw new Error("SsdMobilenetv1 - load model before inference");return ue(()=>{let n=He(e.toBatchTensor(512,!1),"float32"),a=st(ht(n,127.5),1),r=hLe(a,t.mobilenetv1),{boxPredictions:s,classPredictions:i}=yLe(r.out,r.conv11,t.prediction_layer);return xLe(s,i,t.output_layer)})}async forward(e){return this.forwardInput(await ks(e))}async locateFaces(e,t={}){let{maxResults:n,minConfidence:a}=new U2(t),r=await ks(e),{boxes:s,scores:i}=this.forwardInput(r),o=s[0],l=i[0];for(let S=1;S<s.length;S++)s[S].dispose(),i[S].dispose();let d=Array.from(l.dataSync()),c=fLe(o,d,n,.5,a),f=r.getReshapedInputDimensions(0),m=r.inputSize,x=m/f.width,y=m/f.height,b=o.arraySync(),w=c.map(S=>{let[k,C]=[Math.max(0,b[S][0]),Math.min(1,b[S][2])].map(_=>_*y),[E,T]=[Math.max(0,b[S][1]),Math.min(1,b[S][3])].map(_=>_*x);return new Do(d[S],new YV(E,k,T-E,C-k),{height:r.getInputHeight(0),width:r.getInputWidth(0)})});return o.dispose(),l.dispose(),w}getDefaultModelName(){return"ssd_mobilenetv1_model"}extractParamsFromWeightMap(e){return lLe(e)}extractParams(e){return iLe(e)}},vLe=.4,wLe=[new Yn(.738768,.874946),new Yn(2.42204,2.65704),new Yn(4.30971,7.04493),new Yn(10.246,4.59428),new Yn(12.6868,11.8741)],SLe=[new Yn(1.603231,2.094468),new Yn(6.041143,7.080126),new Yn(2.882459,3.518061),new Yn(4.266906,5.178857),new Yn(9.041765,10.66308)],kLe=[117.001,114.697,97.404],NLe="tiny_yolov2_model",CLe="tiny_yolov2_separable_conv_model",H1=e=>typeof e=="number";function ELe(e){if(!e)throw new Error(`invalid config: ${e}`);if(typeof e.withSeparableConvs!="boolean")throw new Error(`config.withSeparableConvs has to be a boolean, have: ${e.withSeparableConvs}`);if(!H1(e.iouThreshold)||e.iouThreshold<0||e.iouThreshold>1)throw new Error(`config.iouThreshold has to be a number between [0, 1], have: ${e.iouThreshold}`);if(!Array.isArray(e.classes)||!e.classes.length||!e.classes.every(t=>typeof t=="string"))throw new Error(`config.classes has to be an array class names: string[], have: ${JSON.stringify(e.classes)}`);if(!Array.isArray(e.anchors)||!e.anchors.length||!e.anchors.map(t=>t||{}).every(t=>H1(t.x)&&H1(t.y)))throw new Error(`config.anchors has to be an array of { x: number, y: number }, have: ${JSON.stringify(e.anchors)}`);if(e.meanRgb&&(!Array.isArray(e.meanRgb)||e.meanRgb.length!==3||!e.meanRgb.every(H1)))throw new Error(`config.meanRgb has to be an array of shape [number, number, number], have: ${JSON.stringify(e.meanRgb)}`)}function G4(e){return ue(()=>{let t=ie(e,Et(.10000000149011612));return ke(Vn(st(e,t)),t)})}function Nu(e,t){return ue(()=>{let n=Ro(e,[[0,0],[1,1],[1,1],[0,0]]);return n=ws(n,t.conv.filters,[1,1],"valid"),n=st(n,t.bn.sub),n=ie(n,t.bn.truediv),n=ke(n,t.conv.bias),G4(n)})}function Cu(e,t){return ue(()=>{let n=Ro(e,[[0,0],[1,1],[1,1],[0,0]]);return n=bg(n,t.depthwise_filter,t.pointwise_filter,[1,1],"valid"),n=ke(n,t.bias),G4(n)})}function ILe(e,t){let n=z4(e,t);function a(i,o){let l=Ln(e(i)),d=Ln(e(i));return t.push({paramPath:`${o}/sub`},{paramPath:`${o}/truediv`}),{sub:l,truediv:d}}function r(i,o,l){let d=n(i,o,3,`${l}/conv`),c=a(o,`${l}/bn`);return{conv:d,bn:c}}let s=U4(e,t);return{extractConvParams:n,extractConvWithBatchNormParams:r,extractSeparableConvParams:s}}function TLe(e,t,n,a){let{extractWeights:r,getRemainingWeights:s}=Ic(e),i=[],{extractConvParams:o,extractConvWithBatchNormParams:l,extractSeparableConvParams:d}=ILe(r,i),c;if(t.withSeparableConvs){let[f,m,x,y,b,w,S,k,C]=a,E=t.isFirstLayerConv2d?o(f,m,3,"conv0"):d(f,m,"conv0"),T=d(m,x,"conv1"),_=d(x,y,"conv2"),A=d(y,b,"conv3"),$=d(b,w,"conv4"),O=d(w,S,"conv5"),z=k?d(S,k,"conv6"):void 0,P=C?d(k,C,"conv7"):void 0,j=o(C||k||S,5*n,1,"conv8");c={conv0:E,conv1:T,conv2:_,conv3:A,conv4:$,conv5:O,conv6:z,conv7:P,conv8:j}}else{let[f,m,x,y,b,w,S,k,C]=a,E=l(f,m,"conv0"),T=l(m,x,"conv1"),_=l(x,y,"conv2"),A=l(y,b,"conv3"),$=l(b,w,"conv4"),O=l(w,S,"conv5"),z=l(S,k,"conv6"),P=l(k,C,"conv7"),j=o(C,5*n,1,"conv8");c={conv0:E,conv1:T,conv2:_,conv3:A,conv4:$,conv5:O,conv6:z,conv7:P,conv8:j}}if(s().length!==0)throw new Error(`weights remaing after extract: ${s().length}`);return{params:c,paramMappings:i}}function ALe(e,t){let n=wp(e,t);function a(o){let l=n(`${o}/sub`,1),d=n(`${o}/truediv`,1);return{sub:l,truediv:d}}function r(o){let l=n(`${o}/filters`,4),d=n(`${o}/bias`,1);return{filters:l,bias:d}}function s(o){let l=r(`${o}/conv`),d=a(`${o}/bn`);return{conv:l,bn:d}}let i=W4(n);return{extractConvParams:r,extractConvWithBatchNormParams:s,extractSeparableConvParams:i}}function _Le(e,t){let n=[],{extractConvParams:a,extractConvWithBatchNormParams:r,extractSeparableConvParams:s}=ALe(e,n),i;if(t.withSeparableConvs){let o=t.filterSizes&&t.filterSizes.length||9;i={conv0:t.isFirstLayerConv2d?a("conv0"):s("conv0"),conv1:s("conv1"),conv2:s("conv2"),conv3:s("conv3"),conv4:s("conv4"),conv5:s("conv5"),conv6:o>7?s("conv6"):void 0,conv7:o>8?s("conv7"):void 0,conv8:a("conv8")}}else i={conv0:r("conv0"),conv1:r("conv1"),conv2:r("conv2"),conv3:r("conv3"),conv4:r("conv4"),conv5:r("conv5"),conv6:r("conv6"),conv7:r("conv7"),conv8:a("conv8")};return Ec(e,n),{params:i,paramMappings:n}}var q4=class{constructor({inputSize:e,scoreThreshold:t}={}){if(this._name="TinyYolov2Options",this._inputSize=e||416,this._scoreThreshold=t||.5,typeof this._inputSize!="number"||this._inputSize%32!==0)throw new Error(`${this._name} - expected inputSize to be a number divisible by 32`);if(typeof this._scoreThreshold!="number"||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(`${this._name} - expected scoreThreshold to be a number between 0 and 1`)}get inputSize(){return this._inputSize}get scoreThreshold(){return this._scoreThreshold}},IH=class TH extends Cc{constructor(t){super("TinyYolov2"),ELe(t),this._config=t}get config(){return this._config}get withClassScores(){return this.config.withClassScores||this.config.classes.length>1}get boxEncodingSize(){return 5+(this.withClassScores?this.config.classes.length:0)}runTinyYolov2(t,n){let a=Nu(t,n.conv0);return a=Ar(a,[2,2],[2,2],"same"),a=Nu(a,n.conv1),a=Ar(a,[2,2],[2,2],"same"),a=Nu(a,n.conv2),a=Ar(a,[2,2],[2,2],"same"),a=Nu(a,n.conv3),a=Ar(a,[2,2],[2,2],"same"),a=Nu(a,n.conv4),a=Ar(a,[2,2],[2,2],"same"),a=Nu(a,n.conv5),a=Ar(a,[2,2],[1,1],"same"),a=Nu(a,n.conv6),a=Nu(a,n.conv7),dy(a,n.conv8,"valid",!1)}runMobilenet(t,n){let a=this.config.isFirstLayerConv2d?G4(dy(t,n.conv0,"valid",!1)):Cu(t,n.conv0);return a=Ar(a,[2,2],[2,2],"same"),a=Cu(a,n.conv1),a=Ar(a,[2,2],[2,2],"same"),a=Cu(a,n.conv2),a=Ar(a,[2,2],[2,2],"same"),a=Cu(a,n.conv3),a=Ar(a,[2,2],[2,2],"same"),a=Cu(a,n.conv4),a=Ar(a,[2,2],[2,2],"same"),a=Cu(a,n.conv5),a=Ar(a,[2,2],[1,1],"same"),a=n.conv6?Cu(a,n.conv6):a,a=n.conv7?Cu(a,n.conv7):a,dy(a,n.conv8,"valid",!1)}forwardInput(t,n){let{params:a}=this;if(!a)throw new Error("TinyYolov2 - load model before inference");return ue(()=>{let r=He(t.toBatchTensor(n,!1),"float32");return r=this.config.meanRgb?r0(r,this.config.meanRgb):r,r=r.div(255),this.config.withSeparableConvs?this.runMobilenet(r,a):this.runTinyYolov2(r,a)})}async forward(t,n){return this.forwardInput(await ks(t),n)}async detect(t,n={}){let{inputSize:a,scoreThreshold:r}=new q4(n),s=await ks(t),i=await this.forwardInput(s,a),o=ue(()=>$a(i)[0].expandDims()),l={width:s.getInputWidth(0),height:s.getInputHeight(0)},d=await this.extractBoxes(o,s.getReshapedInputDimensions(0),r);i.dispose(),o.dispose();let c=d.map(y=>y.box),f=d.map(y=>y.score),m=d.map(y=>y.classScore),x=d.map(y=>this.config.classes[y.label]);return l8e(c.map(y=>y.rescale(a)),f,this.config.iouThreshold,!0).map(y=>new qV(f[y],m[y],x[y],c[y],l))}getDefaultModelName(){return""}extractParamsFromWeightMap(t){return _Le(t,this.config)}extractParams(t){let n=this.config.filterSizes||TH.DEFAULT_FILTER_SIZES,a=n?n.length:void 0;if(a!==7&&a!==8&&a!==9)throw new Error(`TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found ${a} filterSizes in config`);return TLe(t,this.config,this.boxEncodingSize,n)}async extractBoxes(t,n,a){let{width:r,height:s}=n,i=Math.max(r,s),o=i/r,l=i/s,d=t.shape[1],c=this.config.anchors.length,[f,m,x]=ue(()=>{let S=t.reshape([d,d,c,this.boxEncodingSize]),k=S.slice([0,0,0,0],[d,d,c,4]),C=S.slice([0,0,0,4],[d,d,c,1]),E=this.withClassScores?bc(S.slice([0,0,0,5],[d,d,c,this.config.classes.length]),3):Et(0);return[k,C,E]}),y=[],b=await m.array(),w=await f.array();for(let S=0;S<d;S++)for(let k=0;k<d;k++)for(let C=0;C<c;C++){let E=ON(b[S][k][C][0]);if(!a||E>a){let T=(k+ON(w[S][k][C][0]))/d*o,_=(S+ON(w[S][k][C][1]))/d*l,A=Math.exp(w[S][k][C][2])*this.config.anchors[C].x/d*o,$=Math.exp(w[S][k][C][3])*this.config.anchors[C].y/d*l,O=T-A/2,z=_-$/2,P={row:S,col:k,anchor:C},{classScore:j,label:G}=this.withClassScores?await this.extractPredictedClass(x,P):{classScore:1,label:0};y.push({box:new GV(O,z,O+A,z+$),score:E,classScore:E*j,label:G,...P})}}return f.dispose(),m.dispose(),x.dispose(),y}async extractPredictedClass(t,n){let{row:a,col:r,anchor:s}=n,i=await t.array();return Array(this.config.classes.length).fill(0).map((o,l)=>i[a][r][s][l]).map((o,l)=>({classScore:o,label:l})).reduce((o,l)=>o.classScore>l.classScore?o:l)}};IH.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024];var AH=IH,jLe=class extends AH{constructor(e=!0){let t={withSeparableConvs:e,iouThreshold:vLe,classes:["face"],...e?{anchors:SLe,meanRgb:kLe}:{anchors:wLe,withClassScores:!0}};super(t)}get withSeparableConvs(){return this.config.withSeparableConvs}get anchors(){return this.config.anchors}async locateFaces(e,t){return(await this.detect(e,t)).map(n=>new Do(n.score,n.relativeBox,{width:n.imageWidth,height:n.imageHeight}))}getDefaultModelName(){return this.withSeparableConvs?CLe:NLe}extractParamsFromWeightMap(e){return super.extractParamsFromWeightMap(e)}},tw=class extends q4{constructor(){super(...arguments),this._name="TinyFaceDetectorOptions"}},s0=class{async then(e){return e(await this.run())}async run(){throw new Error("ComposableTask - run is not implemented")}};async function K4(e,t,n,a,r=({alignedRect:s})=>s){let s=e.map(l=>vH(l)?r(l):l.detection),i=a||(t instanceof en?await cH(t,s):await uH(t,s)),o=await n(i);return i.forEach(l=>l instanceof en&&l.dispose()),o}var DLe=.4,RLe=[new Yn(1.603231,2.094468),new Yn(6.041143,7.080126),new Yn(2.882459,3.518061),new Yn(4.266906,5.178857),new Yn(9.041765,10.66308)],MLe=[117.001,114.697,97.404],$Le=class extends AH{constructor(){let e={withSeparableConvs:!0,iouThreshold:DLe,classes:["face"],anchors:RLe,meanRgb:MLe,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};super(e)}get anchors(){return this.config.anchors}async locateFaces(e,t){return(await this.detect(e,t)).map(n=>new Do(n.score,n.relativeBox,{width:n.imageWidth,height:n.imageHeight}))}getDefaultModelName(){return"tiny_face_detector_model"}extractParamsFromWeightMap(e){return super.extractParamsFromWeightMap(e)}},fs={ssdMobilenetv1:new bLe,tinyFaceDetector:new $Le,tinyYolov2:new jLe,faceLandmark68Net:new V8e,faceLandmark68TinyNet:new K8e,faceRecognitionNet:new tLe,faceExpressionNet:new I8e,ageGenderNet:new W8e},BLe=class extends s0{constructor(e,t,n){super(),this.parentTask=e,this.input=t,this.extractedFaces=n}},X4=class extends BLe{async run(){let e=await this.parentTask,t=await K4(e,this.input,async n=>Promise.all(n.map(a=>fs.faceExpressionNet.predictExpressions(a))),this.extractedFaces);return e.map((n,a)=>A8e(n,t[a]))}withAgeAndGender(){return new J4(this,this.input)}},Y4=class extends X4{withAgeAndGender(){return new Q4(this,this.input)}withFaceDescriptors(){return new Z4(this,this.input)}},FLe=class extends s0{constructor(e,t,n){super(),this.parentTask=e,this.input=t,this.extractedFaces=n}},J4=class extends FLe{async run(){let e=await this.parentTask,t=await K4(e,this.input,async n=>Promise.all(n.map(a=>fs.ageGenderNet.predictAgeAndGender(a))),this.extractedFaces);return e.map((n,a)=>{let{age:r,gender:s,genderProbability:i}=t[a];return aLe(rLe(n,s,i),r)})}withFaceExpressions(){return new X4(this,this.input)}},Q4=class extends J4{withFaceExpressions(){return new Y4(this,this.input)}withFaceDescriptors(){return new Z4(this,this.input)}},OLe=class extends s0{constructor(e,t){super(),this.parentTask=e,this.input=t}},Z4=class extends OLe{async run(){let e=await this.parentTask;return(await K4(e,this.input,t=>Promise.all(t.map(n=>fs.faceRecognitionNet.computeFaceDescriptor(n))),null,t=>t.landmarks.align(null,{useDlibAlignment:!0}))).map((t,n)=>nLe(e[n],t))}withFaceExpressions(){return new Y4(this,this.input)}withAgeAndGender(){return new Q4(this,this.input)}},LLe=class extends s0{constructor(e,t,n){super(),this.parentTask=e,this.input=t,this.useTinyLandmarkNet=n}get landmarkNet(){return this.useTinyLandmarkNet?fs.faceLandmark68TinyNet:fs.faceLandmark68Net}},PLe=class extends LLe{async run(){let e=await this.parentTask,t=e.map(r=>r.detection),n=this.input instanceof en?await cH(this.input,t):await uH(this.input,t),a=await Promise.all(n.map(r=>this.landmarkNet.detectLandmarks(r)));
5061return n.forEach(r=>r instanceof en&&r.dispose()),e.filter((r,s)=>a[s]).map((r,s)=>D8e(r,a[s]))}withFaceExpressions(){return new Y4(this,this.input)}withAgeAndGender(){return new Q4(this,this.input)}withFaceDescriptors(){return new Z4(this,this.input)}},zLe=class extends s0{constructor(e,t=new U2){super(),this.input=e,this.options=t}},ULe=class extends zLe{async run(){let{input:e,options:t}=this,n;if(t instanceof tw)n=fs.tinyFaceDetector.locateFaces(e,t);else if(t instanceof U2)n=fs.ssdMobilenetv1.locateFaces(e,t);else if(t instanceof q4)n=fs.tinyYolov2.locateFaces(e,t);else throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | TinyYolov2Options");return n}runAndExtendWithFaceDetections(){return new Promise((e,t)=>{this.run().then(n=>e(n.map(a=>p8e({},a)))).catch(n=>t(n))})}withFaceLandmarks(e=!1){return new PLe(this.runAndExtendWithFaceDetections(),this.input,e)}withFaceExpressions(){return new X4(this.runAndExtendWithFaceDetections(),this.input)}withAgeAndGender(){return new J4(this.runAndExtendWithFaceDetections(),this.input)}};function WE(e,t=new U2){return new ULe(e,t)}const WLe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),VLe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),wB=e=>{const t=VLe(e);return t.charAt(0).toUpperCase()+t.slice(1)},_H=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),HLe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var GLe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const qLe=D.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:s,iconNode:i,...o},l)=>D.createElement("svg",{ref:l,...GLe,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:_H("lucide",r),...!s&&!HLe(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,c])=>D.createElement(d,c)),...Array.isArray(s)?s:[s]]));const KLe=(e,t)=>{const n=D.forwardRef(({className:a,...r},s)=>D.createElement(qLe,{ref:s,iconNode:t,className:_H(`lucide-${WLe(wB(e))}`,`lucide-${e}`,a),...r}));return n.displayName=wB(e),n};const XLe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],YLe=KLe("x",XLe),JLe="modulepreload",QLe=function(e){return"/"+e},SB={},jH=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),o=i?.nonce||i?.getAttribute("nonce");r=l(n.map(d=>{if(d=QLe(d),d in SB)return;SB[d]=!0;const c=d.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${f}`))return;const m=document.createElement("link");if(m.rel=c?"stylesheet":JLe,c||(m.as="script"),m.crossOrigin="",m.href=d,o&&m.setAttribute("nonce",o),document.head.appendChild(m),c)return new Promise((x,y)=>{m.addEventListener("load",x),m.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=i,window.dispatchEvent(o),!o.defaultPrevented)throw i}return r.then(i=>{for(const o of i||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})},DH=()=>{try{const e=localStorage.getItem("soltaai_mvp_access");return e?!!JSON.parse(e).email:!1}catch(e){return console.error("Error checking authentication:",e),!1}},ti=()=>{try{const e=localStorage.getItem("soltaai_mvp_access");return e&&JSON.parse(e).email||null}catch(e){return console.error("Error getting user email:",e),null}},Wa=()=>{try{const e=localStorage.getItem("soltaai_mvp_access");return e&&JSON.parse(e).userId||null}catch(e){return console.error("Error getting user ID:",e),null}},zN=()=>{try{const e=localStorage.getItem("soltaai_mvp_access");return e&&JSON.parse(e).displayName||null}catch(e){return console.error("Error getting user name:",e),null}},kB=e=>{try{const t=localStorage.getItem("soltaai_mvp_access");if(t){const n=JSON.parse(t);n.displayName=e,localStorage.setItem("soltaai_mvp_access",JSON.stringify(n))}}catch(t){console.error("Error updating user name:",t)}},ZLe=async()=>
5061{if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){localStorage.removeItem("soltaai_mvp_access"),localStorage.removeItem("solta_localhost_bls_set_count"),localStorage.removeItem("solta_subscription_choice"),sessionStorage.setItem("solta_localhost_signed_out","true"),window.location.href="/";return}const{supabase:t}=await jH(async()=>{const{supabase:n}=await Promise.resolve().then(()=>Lne);return{supabase:n}},void 0);await t.auth.signOut(),localStorage.removeItem("soltaai_mvp_access"),localStorage.removeItem("solta_subscription_choice"),sessionStorage.removeItem("pending_signup"),window.location.href="/"},ePe={individual:{monthly:"price_1TcE4MR86I9lbHp1uqUU6YRJ",yearly:"price_1TcE4MR86I9lbHp1XwgrAYSk"},enterprise:{monthly:"price_1TcEGBR86I9lbHp17KBYRH6C",yearly:"price_1TcEKGR86I9lbHp1rHvYcjaM"}},i0=(e,t)=>ePe[e]?.[t],o0=10,_l=2,RH={monthly:[{upTo:1,unit:8},{upTo:49,unit:6},{upTo:199,unit:5},{upTo:499,unit:4},{upTo:1/0,unit:3}],yearly:[{upTo:1,unit:72},{upTo:9,unit:64},{upTo:49,unit:54},{upTo:199,unit:45},{upTo:499,unit:36},{upTo:1/0,unit:27}]};function MH(e,t){const n=RH[t]||[];for(const a of n)if(e<=a.upTo)return a.unit;return n[n.length-1]?.unit??0}function l0(e,t){return MH(e,t)*e}function W2({value:e,onChange:t,compact:n=!1}){return u.jsxs("div",{className:`inline-flex rounded-lg border border-gray-200 bg-white p-1 ${n?"":"w-full max-w-xs mx-auto"}`,children:[u.jsx("button",{type:"button",onClick:()=>t("individual"),className:`flex-1 rounded-md px-4 ${n?"py-1.5 text-sm":"py-2"} font-medium transition-colors ${e==="individual"?"bg-[#7C9885] text-white shadow-sm":"text-[#1B4D1B]/70 hover:text-[#1B4D1B]"}`,children:"Individual"}),u.jsx("button",{type:"button",onClick:()=>t("enterprise"),className:`flex-1 rounded-md px-4 ${n?"py-1.5 text-sm":"py-2"} font-medium transition-colors ${e==="enterprise"?"bg-[#7C9885] text-white shadow-sm":"text-[#1B4D1B]/70 hover:text-[#1B4D1B]"}`,children:"Organization"})]})}function u0({onCodeValidated:e,onCodeChange:t}){const{t:n}=Ws(),[a,r]=D.useState(!1),[s,i]=D.useState(""),[o,l]=D.useState(!1),[d,c]=D.useState(null),[f,m]=D.useState(""),x=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),y=async()=>{if(s.trim()){if(l(!0),m(""),c(null),x){c({valid:!0,kind:"enterprise",accountName:"Test Organization (localhost)"}),e?.(s.trim(),"Test Organization (localhost)","enterprise"),l(!1);return}try{const w=await(await fetch("/.netlify/functions/validate-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:s.trim()})})).json();w.success&&w.valid?(c({valid:!0,kind:w.kind||"enterprise",accountName:w.accountName}),e?.(s.trim(),w.accountName,w.kind||"enterprise")):(c({valid:!1}),m(n("enterprise.error.invalid")))}catch{m(n("enterprise.error.tryAgain"))}finally{l(!1)}}};return a?u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsx(el,{type:"text",placeholder:n("enterprise.placeholder"),value:s,onChange:b=>{const w=b.target.value;i(w),c(null),m(""),t?.(w.trim())},className:"flex-1",maxLength:20}),u.jsx("button",{type:"button",onClick:y,disabled:o||!s.trim()||d?.valid,className:"px-4 py-2 bg-[#7C9885] hover:bg-[#6B8572] text-white rounded-lg text-sm disabled:opacity-50 transition-colors",children:o?"...":n("enterprise.apply")})]}),d?.valid&&u.jsxs("p",{className:"text-sm text-[#7C9885] flex items-center gap-1",children:[u.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),d.kind==="referral"?n("enterprise.referredByFriend"):d.kind==="access"?n("enterprise.affiliateApplied"):d.accountName]}),f&&u.jsx("p",{className:"text-sm text-red-500",children:f})]}):u.jsx("button",{type:"button",onClick:()=>r(!0),className:"text-sm text-[#7C9885] hover:text-[#6B8572] underline",children:n("enterprise.haveCode")})}const tPe={monthly:"/month",yearly:"/year"},NB={monthly:"mo",yearly:"yr"};function nPe(e,t){const n=t?t.upTo+1:1,a=e.upTo;return a===1/0?`${n}+`:n===a?`${n}`:`${n}–${a}`}function V2({billingCycle:e="monthly",seats:t,onSeatsChange:n,className:a=""}){const r=D.useId(),s=RH[e]||[],i=Number.isFinite(t)&&t>=_l?t:_l,o=MH(i,e),l=l0(i,e),[d,c]=D.useState(String(i));D.useEffect(()=>{c(String(i))},[i]);const f=()=>n(Math.max(_l,i-1)),m=()=>n(i+1),x=b=>{const w=b.target.value;c(w);const S=parseInt(w,10);Number.isFinite(S)&&S>=_l&&n(S)},y=()=>{const b=parseInt(d,10),w=Number.isFinite(b)?Math.max(_l,b):_l;n(w),c(String(w))};return u.jsxs("div",{className:`bg-white rounded-xl p-4 border border-[#7C9885]/25 shadow-sm ${a}`,children:[u.jsxs("div",{className:"flex items-center justify-center gap-2 mb-3",children:[u.jsx("button",{type:"button",onClick:f,disabled:i<=_l,"aria-label":"Fewer seats",className:"w-9 h-9 rounded-lg bg-[#FAF3E8] hover:bg-[#7C9885]/15 active:bg-[#7C9885]/25 disabled:opacity-40 disabled:cursor-not-allowed text-[#1B4D1B] text-xl font-semibold flex items-center justify-center transition-colors",children:"−"}),u.jsx("input",{id:r,type:"number",inputMode:"numeric",min:_l,value:d,onChange:x,onBlur:y,className:"w-20 h-9 text-center text-lg font-bold text-[#1B4D1B] bg-[#FAF3E8] rounded-lg border border-transparent focus:border-[#7C9885] focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":"Number of seats"}),u.jsx("button",{type:"button",onClick:m,"aria-label":"More seats",className:"w-9 h-9 rounded-lg bg-[#FAF3E8] hover:bg-[#7C9885]/15 active:bg-[#7C9885]/25 text-[#1B4D1B] text-xl font-semibold flex items-center justify-center transition-colors",children:"+"}),u.jsx("label",{htmlFor:r,className:"text-sm text-[#1B4D1B]/70 ml-1",children:"seats"})]}),u.jsxs("div",{className:"text-center mb-4",children:[u.jsxs("div",{className:"flex items-baseline justify-center gap-1",children:[u.jsxs("span",{className:"text-3xl font-bold text-[#1B4D1B]",children:["$",l]}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:tPe[e]})]}),u.jsxs("p",{className:"text-xs text-[#1B4D1B]/60 mt-1",children:[i," ",i===1?"seat":"seats"," × $",o,"/seat/",NB[e]]})]}),u.jsxs("div",{className:"border-t border-[#7C9885]/20 pt-3",children:[u.jsx("p",{className:"text-[10px] uppercase tracking-wide text-[#1B4D1B]/60 font-semibold mb-2 text-center",children:"Volume pricing"}),u.jsx("div",{className:"space-y-0.5",children:s.map((b,w)=>{const S=w>0?s[w-1]:null,k=i<=b.upTo&&(!S||i>S.upTo);return u.jsxs("div",{className:`flex justify-between items-center text-xs px-2.5 py-1.5 rounded-md transition-colors ${k?"bg-[#F4A28C]/20 text-[#1B4D1B] font-semibold":"text-[#1B4D1B]/75"}`,children:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[k&&u.jsx("span",{"aria-hidden":"true",className:"w-1.5 h-1.5 rounded-full bg-[#F4A28C]"}),nPe(b,S)," seats"]}),u.jsxs("span",{children:["$",b.unit,"/seat/",NB[e]]})]},b.upTo)})})]})]})}const aPe={hidden:{opacity:0}
5061,visible:{opacity:1}},rPe={hidden:{opacity:0,scale:.95,y:20},visible:{opacity:1,scale:1,y:0,transition:{duration:.3,ease:"easeOut"}},exit:{opacity:0,scale:.95,y:20,transition:{duration:.2}}},CB={monthly:{amount:"$8",label:"/mo"},yearly:{amount:"$72",label:"/yr"}},sPe={monthly:"/mo",yearly:"/yr"};function iPe({isOpen:e,onClose:t,sessionCount:n=2}){const[a,r]=D.useState(!1),[s,i]=D.useState(""),[o,l]=D.useState("monthly"),[d,c]=D.useState("individual"),[f,m]=D.useState(o0),x=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),y=k=>d==="enterprise"?`$${l0(f,k)}`:CB[k].amount,b=k=>d==="enterprise"?sPe[k]:CB[k].label,w=async k=>{const C=Wa();if(C){if(x){alert(`Localhost: Organization code "${k}" applied!`),t();return}try{await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:C,code:k})}),t()}catch{}}},S=async()=>{if(r(!0),i(""),x){localStorage.removeItem("solta_localhost_bls_set_count"),alert(`Localhost: ${d} subscription simulated! Session count reset.`),t(),r(!1);return}try{const k=Wa(),C=ti();if(!C){i("Please log in to subscribe"),r(!1);return}const E=await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:C,userId:k,priceId:i0(d,o),accountType:d,...d==="enterprise"&&{seats:f}})}),T=await E.json();E.ok&&T.url?window.location.href=T.url:i(T.error||"Something went wrong. Please try again.")}catch{i("An error occurred. Please try again.")}finally{r(!1)}};return e?u.jsx(CI,{children:e&&u.jsxs(qe.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-4",initial:"hidden",animate:"visible",exit:"hidden",children:[u.jsx(qe.div,{variants:aPe,className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),u.jsxs(qe.div,{variants:rPe,className:"relative bg-[#FAF3E8] rounded-2xl shadow-2xl max-w-lg w-full px-8 py-6 z-10 max-h-[90vh] overflow-y-auto",children:[u.jsx("button",{onClick:t,className:"absolute top-4 right-4 text-[#1B4D1B]/60 hover:text-[#1B4D1B] transition-colors","aria-label":"Close",children:u.jsx(YLe,{className:"w-6 h-6"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-[#7C9885]/20 rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-7 h-7 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})}),u.jsx("h2",{className:"font-serif text-3xl text-[#1B4D1B] mb-2",children:"Ready to continue your journey?"}),u.jsxs("p",{className:"text-[#1B4D1B]/80 mb-4",children:["You've completed ",n," free session",n!==1?"s":"",". Subscribe to unlock unlimited sessions and continue your healing journey."]}),u.jsx("div",{className:"flex justify-center mb-4",children:u.jsx(W2,{value:d,onChange:c,compact:!0})}),d==="enterprise"&&u.jsx("div",{className:"mb-4",children:u.jsx(V2,{billingCycle:o,seats:f,onSeatsChange:m})}),u.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[u.jsxs("button",{onClick:()=>l("monthly"),className:`relative bg-white rounded-xl p-4 border-2 transition-all ${o==="monthly"?"border-[#7C9885] shadow-md":"border-gray-200 hover:border-gray-300"}`,children:[u.jsxs("div",{className:"text-left",children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-1",children:"Monthly"}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:y("monthly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:b("monthly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-1",children:"7 days free"})]}),o==="monthly"&&u.jsx("div",{className:"absolute top-2 right-2",children:u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]}),u.jsxs("button",{onClick:()=>l("yearly"),className:`relative bg-white rounded-xl p-4 border-2 transition-all ${o==="yearly"?"border-[#7C9885] shadow-md":"border-gray-200 hover:border-gray-300"}`,children:[u.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2",children:u.jsx("span",{className:"bg-[#F4A28C] text-white text-xs font-medium px-2 py-0.5 rounded-full",children:"Best Value"})}),u.jsxs("div",{className:"text-left",children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-1",children:"Yearly"}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:y("yearly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:b("yearly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-1",children:"7 days free"})]}),o==="yearly"&&u.jsx("div",{className:"absolute top-2 right-2",children:u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]})]}),o==="yearly"&&u.jsxs("div",{className:"bg-[#F4A28C]/10 border border-[#F4A28C]/30 rounded-lg p-3 mb-4",children:[u.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-[#1B4D1B]",children:[u.jsx("svg",{className:"w-4 h-4 text-[#F4A28C]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),u.jsx("span",{className:"font-medium",children:"Best value — save 25%"})]}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/70 mt-1",children:"Like getting 3 months free vs. paying monthly."})]}),u.jsx("div",{className:"bg-white rounded-xl p-4 mb-4",children:u.jsxs("ul",{className:"space-y-2 text-sm text-[#1B4D1B]/80",children:[u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Unlimited BLS sessions"]}),u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"AI-adaptive speed control"]}),u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Emotion tracking & insights"]}),d==="enterprise"&&u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),f," ",f===1?"member":"members"," — full access for each"]})]})}),d==="individual"&&u.jsx("div",{className:"mb-4",children:u.jsx(u0,{onCodeValidated:w})}),s&&u.jsx("p",{className:"text-sm text-red-500 mb-4",children:s}),u.jsx("div",{className:"space-y-3",children:u.jsx(Rs,{onClick:S,disabled:a,className:"w-full bg-[#7C9885] hover:bg-[#6
5061B8572] text-white py-6 text-lg",children:a?"Processing...":o==="monthly"?"Start Free Trial":"Subscribe Yearly"})}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/50 mt-4",children:"Cancel anytime. No commitment required."})]})]})]})}):null}const oPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}},oa=25,Ur=80,EB=50,lPe="rgb(124, 152, 133)",uPe=["Take a slow breath","Notice how you're feeling right now","Let your shoulders drop","You're doing great — stay with it","Is the feeling shifting? Just notice."],cPe=[{keyword:"initial",prompt:"First set of the session (no preceding rest prompt)"},{keyword:"breath_slow",prompt:"Take a slow breath"},{keyword:"breath_simple",prompt:"Take a breath"},{keyword:"feeling_now",prompt:"Notice how you're feeling right now"},{keyword:"feeling_check",prompt:"Notice how you feel"},{keyword:"shoulders",prompt:"Let your shoulders drop"},{keyword:"encouragement",prompt:"You're doing great — stay with it"},{keyword:"shift_question",prompt:"Is the feeling shifting? Just notice."},{keyword:"shift_notice",prompt:"Notice any shift in how you feel"},{keyword:"body",prompt:"What do you notice in your body?"},{keyword:"observe",prompt:"Just observe, no need to change anything"}],dPe=new Map(cPe.map(e=>[e.prompt,e.keyword])),hPe=e=>!e||typeof e!="string"?null:dPe.get(e.trim())??null,Qx={calm_down:{id:"calm_down",name:"Calm Down",description:"Quick stress reset",icon:"🌊",color:"#5BA3B5",initialBpm:45,bpmRange:[35,55],sets:{count:6,durationSeconds:30,restSeconds:15,restPrompts:["Notice how you feel"]},entry:"What's on your mind right now?",exit:"Notice how you feel. You're ready."},evening_unwind:{id:"evening_unwind",name:"Evening Unwind",description:"End-of-day decompression",icon:"🌙",color:"#9B82A8",initialBpm:50,bpmRange:[45,65],sets:{count:10,durationSeconds:30,restSeconds:20,restPrompts:[]},entry:"What's lingering from today?",exit:"body_scan_rating"},recharge:{id:"recharge",name:"Recharge",description:"Midday energy recovery",icon:"⚡",color:"#F4A28C",initialBpm:65,bpmRange:[55,75],sets:{count:8,durationSeconds:30,restSeconds:10,restPrompts:[]},entry:"brief_prompt",exit:"energizing_close"},emotional_balance:{id:"emotional_balance",name:"Emotional Reset",description:"Overwhelm, deeper regulation",icon:"🧘",color:"#E9B949",initialBpm:45,bpmRange:[35,55],sets:{count:10,durationSeconds:30,restSeconds:20,restPrompts:["What do you notice in your body?","Just observe, no need to change anything","Notice any shift in how you feel","Take a breath"]},entry:"noticing_prompt",exit:"resource_installation",safetyGuardrail:!0},focus:{id:"focus",name:"Focus",description:"Deep work, energy, task initiation",icon:"🎯",color:"#7C9885",initialBpm:67,bpmRange:[60,80],sets:{count:12,durationSeconds:30,restSeconds:10,restPrompts:[]},entry:"none",exit:"ready_prompt"}},$l={count:4,durationSeconds:45,restSeconds:15},pPe=["calm_down","recharge","emotional_balance","focus","evening_unwind"],hy={neutral:"#9CA3AF",happy:"#FBBF24",sad:"#60A5FA",angry:"#EF4444",fearful:"#8B5CF6",disgusted:"#10B981",surprised:"#F97316"},VE="affiliate",IB="Test User",TB=!0,fPe=1,mPe=20;async function $H(){if(typeof navigator>"u")return null;const e=navigator.userAgent||"",t=/iPhone|iPad|iPod/i.test(e),n=!t&&/Android/i.test(e);if(!t&&!n)return null;const a=async()=>{try{if(navigator.brave&&typeof navigator.brave.isBrave=="function")return await navigator.brave.isBrave()}catch{}return!1};if(t){let s;return/CriOS/i.test(e)?s="Chrome":/FxiOS/i.test(e)?s="Firefox":/EdgiOS/i.test(e)?s="Edge":/OPiOS|OPT\//i.test(e)?s="Opera":/DuckDuckGo/i.test(e)?s="DuckDuckGo":/YaBrowser/i.test(e)?s="Yandex":await a()?s="Brave":s="Safari",{platform:"ios",browser:s}}let r;return/SamsungBrowser/i.test(e)?r="Samsung Internet":/EdgA\//i.test(e)?r="Edge":/OPR\//i.test(e)?r="Opera":/Firefox\//i.test(e)?r="Firefox":/DuckDuckGo/i.test(e)?r="DuckDuckGo":/YaBrowser/i.test(e)?r="Yandex":await a()?r="Brave":r="Chrome",{platform:"android",browser:r}}const gPe="2026-05-11";function AB({onAccept:e,onClose:t,isReview:n=!1}){const[a,r]=D.useState(!1),[s,i]=D.useState(!1),o=D.useRef(null),l=D.useRef(null);D.useEffect(()=>{const c=o.current,f=l.current;if(!c||!f)return;const m=()=>r(!0),x=()=>{const b=c.getBoundingClientRect();f.getBoundingClientRect().bottom<=b.bottom+8&&m()};c.addEventListener("scroll",x,{passive:!0});const y=new IntersectionObserver(([b])=>{b&&b.intersectionRatio>=.95&&m()},{root:c,threshold:[.95,1]});return y.observe(f),x(),()=>{c.removeEventListener("scroll",x),y.disconnect()}},[]);const d=()=>{localStorage.setItem("solta-bls-safety-acknowledged",JSON.stringify({acknowledged:!0,timestamp:new Date().toISOString(),disclaimerVersion:gPe})),e()};return u.jsx(qe.div,{initial:{opacity:0}
5061,animate:{opacity:1},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:u.jsxs(qe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"bg-[#FAF8F5] rounded-2xl shadow-2xl w-[95vw] max-w-[1400px] max-h-[90vh] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"px-6 pt-6 pb-4 border-b border-[#2F3E38]/10 flex items-center justify-between",children:[u.jsx("h2",{className:"font-serif text-2xl md:text-3xl text-[#2F3E38]",children:"Before you begin"}),n&&u.jsx("button",{onClick:t,className:"text-[#2F3E38]/40 hover:text-[#2F3E38] transition-colors",children:u.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),u.jsxs("div",{ref:o,className:"flex-1 overflow-y-auto px-6 py-5 space-y-5 text-[#2F3E38] text-left",children:[u.jsx("p",{className:"text-base leading-relaxed font-medium",children:"Solta AI uses bilateral stimulation — gentle, alternating sensory patterns — to help you manage stress, improve sleep, and support emotional balance. It is not therapy and does not replace professional mental health care."}),u.jsxs("div",{className:"bg-[#F4A28C]/15 border border-[#F4A28C]/30 rounded-xl p-4",children:[u.jsx("p",{className:"text-sm font-semibold text-[#2F3E38] mb-1",children:"If you are in crisis"}),u.jsxs("p",{className:"text-sm text-[#2F3E38]/80",children:["Contact the ",u.jsx("strong",{children:"988 Suicide & Crisis Lifeline"})," — call or text"," ",u.jsx("a",{href:"tel:988",className:"font-bold text-[#2F3E38] underline underline-offset-2",children:"988"}),"."," ","This tool is not designed for crisis intervention."]})]}),u.jsx("p",{className:"text-xs text-[#2F3E38]/60 leading-relaxed",children:"Solta AI does not provide emergency services and cannot connect you to emergency responders."}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-base mb-3",children:"Please do not use this tool if you:"}),u.jsxs("ul",{className:"space-y-3",children:[u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🚨"}),u.jsx("strong",{children:"Are currently experiencing a mental health crisis, active suicidal thoughts, or psychosis"})," — This tool is not designed for crisis intervention. If you are in crisis, please contact the 988 Suicide & Crisis Lifeline (call or text 988) or go to your nearest emergency room."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🧠"}),u.jsx("strong",{children:"Have a dissociative disorder (e.g., Dissociative Identity Disorder)"})," — Bilateral stimulation may cause unexpected or intense emotional responses in individuals with dissociative disorders. Please work with a licensed therapist before using any BLS tool."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🩹"}),u.jsx("strong",{children:"Have experienced a recent traumatic brain injury or concussion"})," — Your brain may be hypersensitive to sensory stimulation during recovery. Wait until cleared by your healthcare provider."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🔞"}),u.jsx("strong",{children:"Are under 18"})," — Solta AI is designed for adults only. If you are under 18, please do not use this tool. We are not able to provide appropriate safeguards for minors at this time."]})]})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-base mb-3",children:"Please use with caution if you:"}),u.jsxs("ul",{className:"space-y-3",children:[u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"⚡"}),u.jsx("strong",{children:"Have epilepsy or a seizure disorder"})," — If your epilepsy is triggered by visual stimuli (photosensitive epilepsy), do not use visual mode. Auditory and haptic modes do not involve visual stimuli and may be suitable alternatives. If you're unsure, consult your neurologist before using visual mode."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🌀"}),u.jsx("strong",{children:"Have severe motion sickness or vestibular disorders"})," — Visual bilateral stimulation involves a moving stimulus that may cause discomfort. Consider using auditory or haptic modes instead."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"💛"}),u.jsx("strong",{children:"Have a history of trauma and are not currently working with a therapist"})," — While Solta AI's wellness modes are designed for stress and emotional regulation (not trauma processing), bilateral stimulation may sometimes surface difficult emotions or memories. If this happens, pause the session and consider speaking with a licensed therapist. You are responsible for monitoring your own comfort during use."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"🤰"}),u.jsx("strong",{children:"Are pregnant"})," — Consult your healthcare provider before using bilateral stimulation during pregnancy."]}),u.jsxs("li",{className:"text-sm leading-relaxed",children:[u.jsx("span",{className:"mr-2",children:"💊"}),u.jsx("strong",{children:"Are taking psychiatric medication"})," — If you are currently prescribed medication for a mental health condition (e.g., antidepressants, anti-anxiety medication, antipsychotics), consult your prescriber before use, as bilateral stimulation may interact with your emotional regulation."]})]})]}),u.jsxs("div",{ref:l,className:"mt-2 p-4 bg-[#2F3E38]/[0.04] border border-[#2F3E38]/15 rounded-xl",children:[u.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-[#2F3E38]/70 mb
5061-2",children:"Acknowledgment"}),u.jsx("p",{className:"text-sm text-[#2F3E38] leading-relaxed",children:"By continuing, you confirm that you have read and understood this information. You acknowledge that Solta AI is a wellness tool, not a medical device. It does not diagnose, treat, cure, or prevent any disease or condition. Solta AI is not a substitute for professional mental health care, and you assume responsibility for determining whether this tool is appropriate for you. If you have questions about whether BLS is appropriate for you, consult your healthcare provider."})]})]}),u.jsx("div",{className:"px-6 py-4 border-t border-[#2F3E38]/10 space-y-3",children:n?u.jsx("button",{onClick:t,className:"w-full bg-[#7C9885] text-white py-3 rounded-full font-medium text-base hover:bg-[#6b8a74] transition-colors",children:"Close"}):u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer select-none",children:[u.jsx("input",{type:"checkbox",checked:s,onChange:c=>i(c.target.checked),className:"mt-0.5 w-4 h-4 rounded border-[#2F3E38]/30 text-[#7C9885] focus:ring-[#7C9885] cursor-pointer"}),u.jsx("span",{className:"text-sm text-[#2F3E38] leading-relaxed",children:"I have read and understood the above information."})]}),u.jsx("button",{onClick:d,disabled:!a||!s,className:"w-full bg-[#7C9885] text-white py-3 rounded-full font-medium text-base hover:bg-[#6b8a74] transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-[#7C9885]",children:"I Understand — Continue"})]})})]})})}const xPe="/assets/settings_app-BMdRvi4G.webp",UN=1,WN="solta_pending_session_start",yPe=600*1e3,bPe={calm_down:u.jsxs("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,"aria-hidden":"true",children:[u.jsx("path",{className:"preset-anim-wave preset-anim-wave-1",strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8c1.5-1.8 3-1.8 4.5 0s3 1.8 4.5 0 3-1.8 4.5 0 3 1.8 4.5 0",opacity:"0.55"}),u.jsx("path",{className:"preset-anim-wave preset-anim-wave-2",strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13c1.5-1.8 3-1.8 4.5 0s3 1.8 4.5 0 3-1.8 4.5 0 3 1.8 4.5 0"}),u.jsx("path",{className:"preset-anim-wave preset-anim-wave-3",strokeLinecap:"round",strokeLinejoin:"round",d:"M3 18c1.5-1.8 3-1.8 4.5 0s3 1.8 4.5 0 3-1.8 4.5 0 3 1.8 4.5 0",opacity:"0.55"})]}),recharge:u.jsx("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{className:"preset-anim-bolt",d:"M13.5 2.25a.75.75 0 0 1 .67 1.085L11.213 9.25H17a.75.75 0 0 1 .574 1.234l-8.25 9.75a.75.75 0 0 1-1.32-.65l1.61-6.084H4.5a.75.75 0 0 1-.611-1.184l9-12.75a.75.75 0 0 1 .611-.316Z"})}),emotional_balance:u.jsxs("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.8,"aria-hidden":"true",children:[u.jsx("path",{className:"preset-anim-sparkle preset-anim-sparkle-1",strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"}),u.jsx("path",{className:"preset-anim-sparkle preset-anim-sparkle-2",strokeLinecap:"round",strokeLinejoin:"round",d:"M18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.456-2.456L14.25 6l1.035-.259a3.375 3.375 0 0 0 2.456-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456Z"})]}),focus:u.jsxs("svg",{className:"w-4 h-4 md:w-5 md:h-5 overflow-visible",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,"aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"5"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),u.jsxs("g",{className:"preset-anim-arrow",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"4",y1:"4",x2:"11",y2:"11"}),u.jsx("polyline",{points:"11,7.5 11,11 7.5,11",fill:"none"})]})]}),evening_unwind:u.jsxs("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M21.752 15.002A9.718 9.718 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}),u.jsx("circle",{className:"preset-anim-moon-star preset-anim-moon-star-1",cx:"6",cy:"4",r:"0.9"}),u.jsx("circle",{className:"preset-anim-moon-star preset-anim-moon-star-2",cx:"20",cy:"9",r:"0.7"}),u.jsx("circle",{className:"preset-anim-moon-star preset-anim-moon-star-3",cx:"15",cy:"2.5",r:"0.65"})]})};function vPe({cameraAccess:e,cameraError:t,setCameraError:n,microphoneAccess:a,microphoneError:r,setMicrophoneError:s,requestCamera:i,requestMicrophone:o,requestCameraAndMicrophone:l,modelsLoaded:d,videoRef:c,videoContainerRef:f,audioStreamRef:m,sessionDuration:x,setSessionDuration:y,sessionDurationUnit:b,setSessionDurationUnit:w,bpm:S,setBpm:k,minBpm:C,setMinBpm:E,maxBpm:T,setMaxBpm:_,numberOfSets:A,setNumberOfSets:$,setDurationSeconds:O,setSetDurationSeconds:z,restDurationSeconds:P,
5061setRestDurationSeconds:j,setRestPrompts:G,isFullscreen:X,toggleFullscreen:J,isAuthenticated:V,onShowIntro:Q,isMobile:F,onStartSession:H,selectedPreset:B,setSelectedPreset:Y}){const ne=Us(),[ee,U]=D.useState(O>120?"minutes":"seconds"),[oe,pe]=D.useState(!1),[he,xe]=D.useState(!0),[Ie,_e]=D.useState(null),[Oe,Ye]=D.useState(null),[ft,ze]=D.useState(!1),[ct,ot]=D.useState(!1),[tt,Tt]=D.useState(0),[bn,Ut]=D.useState(!1),[Tn,Nn]=D.useState(!1),[Pn,sa]=D.useState(!1),[pa,Be]=D.useState(!1),[lt,$e]=D.useState(null),[Ue,dt]=D.useState(null),[Qe,An]=D.useState(null);D.useEffect(()=>{let Ee=!1;return $H().then(Le=>{Ee||An(Le)}),()=>{Ee=!0}},[]);const[Bn,Ga]=D.useState(()=>{if(typeof window>"u")return!1;const Ee=localStorage.getItem("solta_show_config_settings");return Ee===null?!1:Ee==="true"}),_n=D.useRef(null),[di,qr]=D.useState(null),hi=D.useRef(null),pi=Ee=>{qr(Ee),hi.current&&clearTimeout(hi.current),hi.current=setTimeout(()=>qr(null),1200)};D.useEffect(()=>()=>{hi.current&&clearTimeout(hi.current)},[]),D.useEffect(()=>{try{localStorage.setItem("solta_show_config_settings",String(Bn))}catch{}},[Bn]);const qa=D.useCallback((Ee={action:"start"})=>{try{sessionStorage.setItem(WN,JSON.stringify({action:Ee.action||"start",presetId:Ee.presetId??B,ts:Date.now()}))}catch{}ne("/login?returnUrl=/bls")},[B,ne]);D.useEffect(()=>{if(!V){Ut(!1),Be(!0);return}if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){Ut(VE!=="none"),Be(!0);return}const Le=Wa(),Ke=ti();Le&&(Be(!1),fetch("/.netlify/functions/get-session-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Le,email:Ke})}).then(Je=>Je.json()).then(Je=>{Je.success&&(Ut(!!Je.hasSubscription),typeof Je.sessionCount=="number"&&Tt(Je.sessionCount))}).catch(()=>{}).finally(()=>Be(!0)))},[V]),D.useEffect(()=>{if(!V)return;let Ee;try{Ee=sessionStorage.getItem(WN)}catch{return}if(!Ee)return;try{sessionStorage.removeItem(WN)}catch{}let Le;try{Le=JSON.parse(Ee)}catch{return}!Le||Le.ts&&Date.now()-Le.ts>yPe||$e(Le)},[V]);const is=D.useRef(!1);D.useEffect(()=>{if(!lt||!pa||is.current)return;is.current=!0;const Ee=lt;if($e(null),(Ee.action||"start")==="custom"){Ca("custom");return}const Ke=Ee.presetId;Ke&&Qx[Ke]&&Ca(Ke),setTimeout(()=>{us()},100)},[lt,pa]);const Kr=D.useRef(!1);D.useEffect(()=>{Kr.current||(Kr.current=!0,B&&Qx[B]&&Ca(B))},[]);const lr=D.useRef(null),Ba=D.useRef(null),fi=D.useRef(!1),we=D.useRef(null),Fe=D.useRef(null),xt=D.useRef(null),Xe=D.useRef(null),qt=D.useRef(null),$t=D.useRef(null),It=D.useRef(null),vt=D.useRef(null),vn=D.useRef(null),Na=D.useRef(!1),Fa=D.useRef(!1),Xr=D.useRef(null),fa=D.useRef(null),os=D.useRef(null),sn=5,wn=D.useCallback(Ee=>{const Le=fa.current;if(!Le)return null;const Ke=Le.getBoundingClientRect(),Je=Math.max(0,Math.min(1,(Ee-Ke.left)/Ke.width));return Math.round(oa+Je*(Ur-oa))},[]),Ka=D.useCallback(Ee=>{const Le=Ee.touches?Ee.touches[0].clientX:Ee.clientX;let Je=Ee.target.closest("[data-handle]")?.dataset?.handle||null;if(!Je){const mt=wn(Le);if(mt===null)return;const Yt=Math.abs(mt-C),Wt=Math.abs(mt-S),fn=Math.abs(mt-T),Dt=Math.min(Yt,Wt,fn);Dt===Wt?Je="bpm":Dt===Yt?Je="min":Je="max"}os.current=Je;const Ze=mt=>{const Yt=mt.touches?mt.touches[0].clientX:mt.clientX,Wt=wn(Yt);if(Wt===null)return;const fn=os.current;if(fn==="min"){const Dt=Math.min(Wt,T-sn);E(Math.max(oa,Dt)),S<Math.max(oa,Dt)&&k(Math.max(oa,Dt))}else if(fn==="max"){const Dt=Math.max(Wt,C+sn);_(Math.min(Ur,Dt)),S>Math.min(Ur,Dt)&&k(Math.min(Ur,Dt))}else fn==="bpm"&&k(Math.max(C,Math.min(T,Wt)));B&&Y(null)},ut=()=>{os.current=null,window.removeEventListener("mousemove",Ze),window.removeEventListener("mouseup",ut),window.removeEventListener("touchmove",Ze),window.removeEventListener("touchend",ut)};Ze(Ee),window.addEventListener("mousemove",Ze),window.addEventListener("mouseup",ut),window.addEventListener("touchmove",Ze,{passive:!1}),window.addEventListener("touchend",ut)},[S,C,T,B,wn,k,E,_,Y]),Ca=Ee=>{if(Ee==="custom"){if(!(typeof window<"u"&&sessionStorage.getItem("solta_investor_preview")==="true")&&!bn){if(!V){qa({action:"custom"});return}ot(!0);return}if(B===null){Ga(ut=>!ut);return}Y(null),k(60),E(oa),_(Ur),$($l.count),z($l.durationSeconds),U("seconds"),j($l.restSeconds),G([]),Ga(!0);return}const Le=Qx[Ee];if(!Le)return;Ga(!1),Y(Ee),k(Le.initialBpm),Le.bpmRange&&(E(Le.bpmRange[0]),_(Le.bpmRange[1]));const Ke=Le.sets;$(Ke?Ke.count:null);const Je=Ke?Ke.durationSeconds:null;if(z(Je),U(Je&&Je>120?"minutes":"seconds"),j(Ke?Ke.restSeconds:0),G(Ke?Ke.restPrompts||[]:[]),Ke&&Ke.durationSeconds){const Ze=Ke.count*Ke.durationSeconds+Math.max(0,Ke.count-1)*(Ke.restSeconds||0);Ze>=60&&Ze%60===0?(y(Ze/60),w("minutes")):(y(Ze),w("seconds"))}},Rn=Ee=>{const Le=Math.round(Ee/60);return Le>=1?`${Le} min`:`${Ee}s`},Or=()=>{try{return JSON.parse(localStorage.getItem("solta-bls-safety-acknowledged"))?.acknowledged===!0}catch{return!1}},ls=Ee=>{Or()?H(Ee):(_n.current=Ee,Nn(!0))},Hs=()=>{Nn(!1),_n.current&&(H(_n.current),_n.current=null)},ur=()=>new Promise(Ee=>{if(vn.current){Ee(Na.current);return}if(Fa.current){const Ke=setInterval(()=>{Fa.current||(clearInterval(Ke),Ee(Na.current))},100);return}Fa.current=!0;const Le=new Worker(new URL("/assets/voiceEmotionWorker-Bt97yA9B.js",import.meta.url),{type:"module"});vn.current=Le,Le.onmessage=Ke=>{const{type:Je,emotions:Ze,error:ut,noSpeech:mt}=Ke.data;Je==="loading"||(Je==="loaded"?(Na.current=!0,Fa.current=!1,Ee(!0)):Je==="load-error"?(console.error("[VOICE] Worker: model load failed:",ut),Na.current=!1,Fa.current=!1,Ee(!1)):Je==="result"&&Xr.current&&(Xr.current(Ze,ut,mt),Xr.current=null))},Le.onerror=Ke=>{console.error("[VOICE] Worker error:",Ke),Fa.current=!1,Ee(!1)},Le.postMessage({type:"load"})}),cr=(Ee,Le=48e3)=>new Promise(Ke=>{if(!vn.current||!Na.current){Ke(null);return}Xr.current=(Ze,ut,mt)=>{ut?(console.error("[VOICE] Worker inference error:",ut),Ke(null)):Ke(mt?"no-speech":Ze)};const Je=new Float32Array(Ee);vn.current.postMessage({type:"infer",audioData:Je,sampleRate:Le},[Je.buffer])}),us=async()=>{const Ee=typeof window<"u"&&sessionStorage.getItem("solta_investor_preview")==="true";if(B===null&&!bn&&!Ee){if(!V){qa();return}ot(!0);return}if(!V&&!Ee){qa();return}const Le=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";if(Ee&&!Le){const Ze=parseInt(localStorage.getItem("solta_investor_sessions")||"0",10);if(Ze>=1){sessionStorage.removeItem("solta_investor_preview"),qa();return}localStorage.setItem("solta_investor_sessions",(Ze+1).toString()),ls({sessionId:null,
5061setId:null});return}if(Le){const Ze=parseInt(localStorage.getItem("solta_localhost_session_count")||"0",10);if(Tt(Ze),Ze>=UN&&!bn){ot(!0);return}localStorage.setItem("solta_localhost_session_count",(Ze+1).toString()),ls({sessionId:null,setId:null});return}const Ke=Wa(),Je=ti();if(Ke){ze(!0);try{const ut=await(await fetch("/.netlify/functions/get-session-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Ke,email:Je})})).json();if(ut.success){if(Tt(ut.sessionCount),Ut(ut.hasSubscription),ut.sessionCount>=UN&&!ut.hasSubscription){ot(!0),ze(!1);return}}else console.error("[SESSION] get-session-status failed:",ut.error,ut.details);const Wt=await(await fetch("/.netlify/functions/create-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Ke,blsSpeedBpm:S,blsType:"visual",sessionType:B||"custom",customConfigs:B?null:{initial_speed:S,min_speed:C,max_speed:T,set_amount:A,set_duration_seconds:O,rest_duration_seconds:P}})})).json();let fn=null,Dt=null;Wt.success?(fn=Wt.sessionId||null,Dt=Wt.setId||null):console.error("[SESSION] create-session failed:",Wt.error,Wt.details),ze(!1),ls({sessionId:fn,setId:Dt})}catch(Ze){console.error("[SESSION] Error checking/creating session:",Ze),ze(!1),ls({sessionId:null,
5061setId:null})}}};D.useEffect(()=>{if(!d||!e||!c.current){we.current&&(clearInterval(we.current),we.current=null);return}xe(!0),clearTimeout(Ba.current),Ba.current=setTimeout(()=>{xe(!1),Ba.current=null},4e3);const Ee=async()=>{if(!(!c.current||c.current.readyState!==4))try{const Le=await WE(c.current,new tw).withFaceExpressions(),Ke=Le.length>0;if(Ke?(clearTimeout(lr.current),lr.current=null,clearTimeout(Ba.current),Ba.current=null,xe(!1),fi.current=!0,pe(!0)):fi.current&&(lr.current||(lr.current=setTimeout(()=>{pe(!1),lr.current=null},3e3))),Ke){const Je=Le[0],Ze=Je.detection.box,ut=Je.expressions,mt=Object.entries(ut).sort((fn,Dt)=>Dt[1]-fn[1]);let Yt=mt[0][0],Wt=mt[0][1];Yt==="neutral"&&Wt<.99&&mt.length>1&&(Yt=mt[1][0],Wt=mt[1][1]),_e({box:{x:Ze.x,y:Ze.y,width:Ze.width,height:Ze.height},emotion:Yt,confidence:Wt,videoWidth:c.current.videoWidth,videoHeight:c.current.videoHeight})}else _e(null)}catch{pe(!1),_e(null)}};return Ee(),we.current=setInterval(Ee,500),()=>{we.current&&(clearInterval(we.current),we.current=null),clearTimeout(lr.current),lr.current=null,clearTimeout(Ba.current),Ba.current=null}},[d,e]),D.useEffect(()=>{if(!a||!m.current){qt.current&&(cancelAnimationFrame(qt.current),qt.current=null),Xe.current&&(Xe.current.close().catch(()=>{}),Xe.current=null),xt.current=null;const ut=Fe.current;if(ut){const mt=ut.getContext("2d"),Yt=window.devicePixelRatio||1,Wt=ut.getBoundingClientRect();if(Wt.width>0&&Wt.height>0){ut.width=Wt.width*Yt,ut.height=Wt.height*Yt,mt.scale(Yt,Yt);const fn=Wt.width,Dt=Wt.height,Sn=32,qn=2,Ea=(fn-qn*(Sn-1))/Sn;for(let Ia=0;Ia<Sn;Ia++){const mn=2+Math.random()*4,Mn=Ia*(Ea+qn),jn=(Dt-mn)/2;mt.fillStyle="#9CA3AF",mt.beginPath(),mt.roundRect(Mn,jn,Ea,mn,1.5),mt.fill()}}}return}const Ee=new(window.AudioContext||window.webkitAudioContext),Le=Ee.createAnalyser();Le.fftSize=256,Le.smoothingTimeConstant=.8;const Ke=Ee.createMediaStreamSource(m.current);Ke.connect(Le),Xe.current=Ee,xt.current=Le;const Je=new Uint8Array(Le.fftSize),Ze=()=>{qt.current=requestAnimationFrame(Ze);const ut=Fe.current;if(!ut||!xt.current)return;const mt=ut.getContext("2d"),Yt=window.devicePixelRatio||1,Wt=ut.getBoundingClientRect();(ut.width!==Wt.width*Yt||ut.height!==Wt.height*Yt)&&(ut.width=Wt.width*Yt,ut.height=Wt.height*Yt,mt.scale(Yt,Yt));const fn=Wt.width,Dt=Wt.height;xt.current.getByteTimeDomainData(Je),mt.clearRect(0,0,fn,Dt);const Sn=32,qn=2,Ea=Dt>fn,Ia=Math.floor(Je.length/Sn);if(Ea){const mn=(Dt-qn*(Sn-1))/Sn;for(let Mn=0;Mn<Sn;Mn++){const jn=Je[Mn*Ia],Ta=Math.abs(jn-128)/128,cs=Math.max(2,Ta*fn*1.8),Ts=(fn-cs)/2,Oa=Mn*(mn+qn);mt.fillStyle=Ta>.15?"#7C9885":Ta>.03?"#7C988880":"#7C988830",mt.beginPath(),mt.roundRect(Ts,Oa,cs,mn,1.5),mt.fill()}}else{const mn=(fn-qn*(Sn-1))/Sn;for(let Mn=0;Mn<Sn;Mn++){const jn=Je[Mn*Ia],Ta=Math.abs(jn-128)/128,cs=Math.max(2,Ta*Dt*1.8),Ts=Mn*(mn+qn),Oa=(Dt-cs)/2;mt.fillStyle=Ta>.15?"#7C9885":Ta>.03?"#7C988880":"#7C988830",mt.beginPath(),mt.roundRect(Ts,Oa,mn,cs,1.5),mt.fill()}}};return Ze(),()=>{qt.current&&(cancelAnimationFrame(qt.current),qt.current=null),Ke.disconnect(),Ee.close().catch(()=>{}),Xe.current=null,xt.current=null}},[a]),D.useEffect(()=>{if(!a||!m.current){Ye(null),vt.current&&(vt.current.disconnect(),vt.current=null);return}let Ee=!1,Le=null;return(async()=>{if(!await ur()||Ee)return;if(!$t.current){$t.current=new(window.AudioContext||window.webkitAudioContext);const Sn=$t.current.createAnalyser();Sn.fftSize=8192,It.current=Sn}const Ze=$t.current,ut=It.current;Ze.state==="suspended"&&await Ze.resume().catch(()=>{}),vt.current&&vt.current.disconnect();const mt=Ze.createMediaStreamSource(m.current);mt.connect(ut),vt.current=mt;const Yt=Ze.sampleRate||48e3,Wt=Math.floor(Yt*1),fn=new Float32Array(ut.fftSize);let Dt=!1;Le=setInterval(async()=>{if(Dt||Ee)return;Ze.state==="suspended"&&Ze.resume().catch(()=>{}),ut.getFloatTimeDomainData(fn);let Sn=!1;for(let qn=0;qn<fn.length;qn+=64)if(Math.abs(fn[qn])>.01){Sn=!0;break}if(!Sn){Ye(null);return}Dt=!0;try{const qn=new Float32Array(Wt);ut.getFloatTimeDomainData(qn);const Ea=await cr(qn,Yt);if(Ee)return;if(Ea&&Ea!=="no-speech"){const Ia=Object.entries(Ea).sort((Mn,jn)=>jn[1]-Mn[1]);let mn=Ia[0];if(mn[0]==="neutral"){const Mn=Ia.find(([jn])=>jn!=="neutral");Mn&&Mn[1]>.2&&(mn=Mn)}Ye({emotion:mn[0],confidence:mn[1]})}else Ye(null)}catch{}finally{Dt=!1}},2e3)})(),()=>{Ee=!0,Le&&clearInterval(Le),vt.current&&(vt.current.disconnect(),vt.current=null)}},[a]),D.useEffect(()=>()=>{vt.current&&(vt.current.disconnect(),vt.current=null),$t.current&&($t.current.close().catch(()=>{}),$t.current=null),It.current=null,vn.current&&(vn.current.terminate(),vn.current=null,Na.current=!1,Fa.current=!1)},[]),D.useEffect(()=>{const Ee=()=>{if(document.visibilityState!=="visible")return;const Le=[Xe.current,$t.current];for(const Ke of Le)Ke&&Ke.state==="suspended"&&Ke.resume().catch(()=>{})};return document.addEventListener("visibilitychange",Ee),()=>document.removeEventListener("visibilitychange",Ee)},[]),D.useEffect(()=>{if(!V)return;if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){const Je=parseInt(localStorage.getItem("solta_localhost_session_count")||"0",10);Tt(Je),Ut(VE!=="none");return}const Le=Wa(),Ke=ti();Le&&fetch("/.netlify/functions/get-session-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Le,email:Ke})}).then(Je=>Je.json()).then(Je=>{Je.success&&(Tt(Je.sessionCount),Ut(Je.hasSubscription))}).catch(()=>{})},[V]),D.useEffect(()=>{if(!c.current||!e)return;const Le=setTimeout(async()=>
5061{if(c.current&&c.current.paused)try{await c.current.play()}catch(Ke){console.error("[VIDEO] Error playing video:",Ke)}},100);return()=>clearTimeout(Le)},[e]),D.useEffect(()=>{if(!e){dt(null);return}const Ee=c.current,Le=f.current;if(!Ee||!Le)return;let Ke=null;const Je=()=>{const mt=Ee.getBoundingClientRect(),Yt=Le.getBoundingClientRect();!mt.width||!mt.height||dt({left:mt.left-Yt.left,top:mt.top-Yt.top,right:Yt.right-mt.right,bottom:Yt.bottom-mt.bottom,width:mt.width,height:mt.height})},Ze=()=>{Ke&&cancelAnimationFrame(Ke),Ke=requestAnimationFrame(Je)};Ze();const ut=new ResizeObserver(Ze);return ut.observe(Ee),ut.observe(Le),Ee.addEventListener("loadedmetadata",Ze),window.addEventListener("resize",Ze),()=>{ut.disconnect(),Ee.removeEventListener("loadedmetadata",Ze),window.removeEventListener("resize",Ze),Ke&&cancelAnimationFrame(Ke)}},[e,Bn]);const Xa=typeof window<"u"&&sessionStorage.getItem("solta_investor_preview")==="true",Bi=!bn&&!Xa;return u.jsxs(u.Fragment,{children:[!X&&u.jsx(u.Fragment,{children:u.jsx("div",{className:"max-w-7xl mx-auto space-y-3",children:F&&u.jsxs("div",{className:"bg-[#F4A28C]/10 border border-[#F4A28C]/30 p-3 rounded-xl text-left inline-flex items-start gap-2",children:[u.jsx("svg",{className:"w-5 h-5 text-[#F4A28C] flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M10.5 1.5H8.25A2.25 2.25 0 006 3.75v16.5a2.25 2.25 0 002.25 2.25h7.5A2.25 2.25 0 0018 20.25V3.75a2.25 2.25 0 00-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"})}),u.jsxs("p",{className:"text-sm text-[#1B4D1B]",children:[u.jsx("span",{className:"font-semibold",children:"For best results, use a larger screen."})," ","Phone screens are narrow for bilateral eye movement."]})]})})}),u.jsx("div",{className:`bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg border border-[#7C9885]/15 p-5 md:p-8 mx-auto mt-3 md:mt-0 mb-4 max-w-[95vw] flex flex-col ${X?"w-full justify-center h-[calc(100vh-2rem)]":"h-auto md:h-[calc(100vh-8rem)]"}`,children:u.jsxs("div",{className:`flex flex-col md:flex-row gap-6 w-full flex-1 min-h-0 ${X?"self-center":""}`,children:[u.jsx("div",{className:"flex flex-col gap-2 min-h-0 md:w-[14%]",children:u.jsxs("div",{className:"grid grid-cols-3 md:flex md:flex-1 md:min-h-0 md:flex-col gap-2",children:[pPe.map(Ee=>{const Le=Qx[Ee],Ke=B===Ee,Je=Le.color||"#7C9885";return u.jsxs("button",{onClick:()=>{pi(Ee),Ca(Ee)},"aria-label":`${Le.name} — ${Le.description}`,style:Ke?{borderColor:Je,backgroundColor:`${Je}1A`,boxShadow:`0 4px 14px -6px ${Je}66`}:void 0,className:`group ${di===Ee?"preset-anim-trigger":""} relative flex-1 min-h-0 min-w-0 px-1.5 py-3 md:px-4 md:py-4 rounded-xl border-2 flex flex-col items-center gap-1.5 text-center md:flex-row md:items-center md:gap-3 md:text-left transition-all duration-200 ${Ke?"":"border-[#7C9885]/10 bg-white hover:border-[#7C9885]/30 hover:shadow-md hover:-translate-y-0.5"}`,children:[u.jsx("div",{className:"w-8 h-8 md:w-10 md:h-10 rounded-lg flex items-center justify-center flex-shrink-0 text-white shadow-sm transition-transform group-hover:scale-105",style:{backgroundColor:Je},children:bPe[Ee]}),u.jsxs("div",{className:"flex flex-col items-center md:items-start min-w-0 w-full",children:[u.jsx("span",{className:"text-[11px] md:text-sm font-semibold text-[#1B4D1B] leading-tight break-words md:group-hover:hidden",children:Le.name}),u.jsx("span",{className:"text-[10px] md:text-xs mt-0.5 font-medium whitespace-nowrap md:group-hover:hidden",style:{color:Je},children:Le.sets?.durationSeconds?Rn(Le.sets.count*Le.sets.durationSeconds+Math.max(0,Le.sets.count-1)*(Le.sets.restSeconds||0)):""}),u.jsx("span",{className:"hidden md:group-hover:block w-full text-center text-[10px] md:text-xs font-normal text-[#1B4D1B] leading-tight md:leading-snug",children:Le.description})]})]},Ee)}),(()=>{const Ee="#1B4D1B",Le=B===null;return u.jsxs("button",{onClick:()=>{pi("custom"),Ca("custom")},"aria-label":"Custom — set your own speed & duration",style:Le?{borderColor:Ee,backgroundColor:`${Ee}14`,boxShadow:`0 4px 14px -6px ${Ee}66`}:void 0,className:`group ${di==="custom"?"preset-anim-trigger":""} relative flex-1 min-h-0 min-w-0 px-1.5 py-3 md:px-4 md:py-4 rounded-xl border-2 flex flex-col items-center gap-1.5 text-center md:flex-row md:items-center md:gap-3 md:text-left transition-all duration-200 ${Le?"":"border-[#7C9885]/10 bg-white hover:border-[#7C9885]/30 hover:shadow-md hover:-translate-y-0.5"}`,children:[u.jsx("div",{className:"w-8 h-8 md:w-10 md:h-10 rounded-lg flex items-center justify-center flex-shrink-0 text-white shadow-sm transition-transform group-hover:scale-105",style:{backgroundColor:Ee},children:u.jsxs("svg",{className:"w-4 h-4 md:w-5 md:h-5 transition-transform duration-500 ease-in-out group-hover:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),u.jsxs("div",{className:"flex flex-col items-center md:items-start min-w-0 
5061w-full",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx("span",{className:"text-xs md:text-sm font-semibold text-[#1B4D1B] leading-tight",children:"Custom"}),!bn&&u.jsx("svg",{className:"w-3 h-3 text-[#1B4D1B]/60 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 00-4.5 4.5V9H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-.5V5.5A4.5 4.5 0 0010 1zm3 8V5.5a3 3 0 10-6 0V9h6z",clipRule:"evenodd"})})]}),u.jsx("span",{className:"text-[10px] md:text-xs mt-0.5 font-medium",style:{color:Ee},children:"Your settings"})]})]})})()]})}),Bn&&u.jsxs("div",{className:"relative flex flex-col min-h-0 md:w-[20%] md:min-w-[240px] md:max-w-[320px]",children:[u.jsxs("div",{className:`flex flex-col justify-center gap-3 min-h-0 overflow-y-auto ${Bi?"pointer-events-none select-none":""}`,"aria-hidden":Bi||void 0,...Bi?{inert:""}:{},children:[u.jsxs("div",{className:"bg-gradient-to-br from-[#7C9885]/5 to-white rounded-xl p-4 border border-[#7C9885]/10",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[u.jsx("div",{className:"w-7 h-7 bg-[#7C9885] rounded-lg flex items-center justify-center flex-shrink-0",children:u.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})})}),u.jsx("label",{htmlFor:"set-duration-main",className:"text-sm font-semibold text-[#1B4D1B]",children:"Set Duration"})]}),u.jsxs("div",{className:"flex items-stretch gap-2",children:[u.jsx("input",{id:"set-duration-main",type:"number",min:"1",value:ee==="minutes"?Math.round(O/60):O,onChange:Ee=>{const Le=parseInt(Ee.target.value)||1,Ke=ee==="minutes"?Le*60:Le;z(Math.max(10,Ke)),B&&Y(null)},className:"w-20 flex-shrink-0 px-3 py-2 border border-[#7C9885]/20 rounded-xl text-sm text-[#1B4D1B] bg-white focus:outline-none focus:ring-2 focus:ring-[#7C9885]/30 transition-shadow"}),u.jsxs("select",{value:ee,onChange:Ee=>U(Ee.target.value),className:"flex-1 min-w-0 px-3 py-2 border border-[#7C9885]/20 rounded-xl text-sm text-[#1B4D1B] bg-white focus:outline-none focus:ring-2 focus:ring-[#7C9885]/30 transition-shadow",children:[u.jsx("option",{value:"seconds",children:"Seconds"}),u.jsx("option",{value:"minutes",children:"Minutes"})]})]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#7C9885]/5 to-white rounded-xl p-4 border border-[#7C9885]/10",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[u.jsx("div",{className:"w-7 h-7 bg-[#7C9885] rounded-lg flex items-center justify-center flex-shrink-0",children:u.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),u.jsx("label",{htmlFor:"sets-select",className:"text-sm font-semibold text-[#1B4D1B]",children:"Sets"})]}),u.jsxs("select",{id:"sets-select",value:A??"",onChange:Ee=>{const Le=Ee.target.value;$(Le===""?null:parseInt(Le)),B&&Y(null)},className:"w-full px-3 py-2 border border-[#7C9885]/20 rounded-xl text-sm text-[#1B4D1B] bg-white focus:outline-none focus:ring-2 focus:ring-[#7C9885]/30 transition-shadow",children:[u.jsx("option",{value:"",children:"Indefinite"}),[1,2,3,4,5,6,7,8,9,10].map(Ee=>u.jsx("option",{value:Ee,children:Ee},Ee))]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#7C9885]/5 to-white rounded-xl p-4 border border-[#7C9885]/10",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[u.jsx("div",{className:"w-7 h-7 bg-[#7C9885] rounded-lg flex items-center justify-center flex-shrink-0",children:u.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.75 5.25v13.5m-7.5-13.5v13.5"})})}),u.jsx("label",{htmlFor:"rest-duration",className:"text-sm font-semibold text-[#1B4D1B] leading-tight",children:"Rest Between Sets"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{id:"rest-duration",type:"number",min:"0",max:"60",value:P,onChange:Ee=>{j(Math.max(0,Math.min(60,parseInt(Ee.target.value)||0))),B&&Y(null)},className:"w-20 flex-shrink-0 px-3 py-2 border border-[#7C9885]/20 rounded-xl text-sm text-[#1B4D1B] bg-white focus:outline-none focus:ring-2 focus:ring-[#7C9885]/30 transition-shadow text-center"}),u.jsx("span",{className:"text-xs text-[#1B4D1B]/60",children:"seconds"})]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#F4A28C]/5 to-white rounded-xl p-4 border border-[#F4A28C]/10",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx("div",{className:"w-7 h-7 bg-[#F4A28C] rounded-lg flex items-center justify-center flex-shrink-0",children:u.jsx("svg",{className:"w-4 h-4 text-white",f
5061ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"})})}),u.jsx("span",{className:"text-sm font-semibold text-[#1B4D1B]",children:"Speed"}),u.jsxs("span",{className:"ml-auto text-xs font-bold text-[#7C9885] bg-[#7C9885]/10 px-2.5 py-1 rounded-full whitespace-nowrap",children:[S," BPM"]})]}),u.jsxs("div",{className:"text-[10px] text-[#1B4D1B]/50 mb-3 px-0.5",children:["Range: ",C," – ",T," BPM"]}),u.jsxs("div",{ref:fa,className:"relative w-full h-10 cursor-pointer select-none touch-none",onMouseDown:Ka,onTouchStart:Ka,children:[u.jsx("div",{className:"absolute left-0 right-0 top-1/2 -translate-y-1/2 h-2 bg-[#7C9885]/10 rounded-full"}),u.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 h-2 bg-[#7C9885]/25 rounded-full",style:{left:`${(C-oa)/(Ur-oa)*100}%`,right:`${100-(T-oa)/(Ur-oa)*100}%`}}),u.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-3 h-7 rounded-[4px] bg-[#F4A28C] shadow-md cursor-grab active:cursor-grabbing hover:scale-110 transition-transform z-10 flex items-center justify-center",style:{left:`${(C-oa)/(Ur-oa)*100}%`},"data-handle":"min",children:u.jsx("div",{className:"w-[3px] h-3 rounded-full bg-white/60"})}),u.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-5 h-5 rounded-full bg-[#7C9885] shadow-lg cursor-grab active:cursor-grabbing hover:scale-110 transition-transform z-20 ring-2 ring-white",style:{left:`${(S-oa)/(Ur-oa)*100}%`},"data-handle":"bpm"}),u.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-3 h-7 rounded-[4px] bg-[#F4A28C] shadow-md cursor-grab active:cursor-grabbing hover:scale-110 transition-transform z-10 flex items-center justify-center",style:{left:`${(T-oa)/(Ur-oa)*100}%`},"data-handle":"max",children:u.jsx("div",{className:"w-[3px] h-3 rounded-full bg-white/60"})})]}),u.jsxs("div",{className:"flex justify-between text-[10px] text-[#1B4D1B]/40 mt-0.5 px-0.5",children:[u.jsx("span",{children:"Slow"}),u.jsx("span",{children:"Fast"})]})]})]}),Bi&&u.jsx("button",{type:"button","aria-label":"Subscribe to unlock custom settings",onClick:()=>ot(!0),onMouseDownCapture:()=>ot(!0),onTouchStartCapture:()=>ot(!0),className:"absolute inset-0 z-30 flex items-center justify-center bg-white/40 backdrop-blur-[1px] rounded-xl cursor-pointer group focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1B4D1B]/40",children:u.jsxs("span",{className:"px-3.5 py-2 rounded-full bg-[#1B4D1B] text-white text-xs font-semibold shadow-lg flex items-center gap-2 group-hover:scale-105 transition-transform",children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 00-4.5 4.5V9H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-.5V5.5A4.5 4.5 0 0010 1zm3 8V5.5a3 3 0 10-6 0V9h6z",clipRule:"evenodd"})}),"Subscribe to unlock"]})})]}),u.jsxs("div",{className:"relative flex flex-col flex-1 min-h-0 min-w-0 overflow-hidden",children:[u.jsxs("div",{className:"flex flex-col md:flex-row gap-3 flex-1 min-h-0",children:[u.jsxs("div",{className:"relative w-full aspect-[3/4] md:w-auto md:aspect-auto md:flex-1 min-w-0 min-h-0 overflow-hidden rounded-xl flex items-center justify-center",children:[u.jsxs("button",{type:"button",onClick:Ee=>{Ee.stopPropagation(),e||(n(""),i())},style:e&&Ue?{top:Ue.top+8,left:Ue.left+8}:{top:8,left:8},className:`absolute z-20 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border shadow-sm transition-colors ${e?"bg-white/85 backdrop-blur border-[#7C9885]/20 text-[#1B4D1B]":t?"bg-red-50 border-red-200 text-red-700 hover:bg-red-100 cursor-pointer":"bg-white/85 backdrop-blur border-gray-200 text-gray-500 hover:bg-white cursor-pointer"}`,children:[u.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]}),"Camera ",e?u.jsx("svg",{className:"w-3.5 h-3.5 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}):t?u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400"}):u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 animate-pulse"})]}),e&&u.jsxs("div",{style:Ue?{top:Ue.top+8,right:Ue.right+8}:{top:8,right:8},className:`absolute z-20 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border shadow-sm ${oe?"bg-white/85 backdrop-blur border-[#7C9885]/20 text-[#1B4D1B]":he?"bg-white/85 backdrop-blur border-gray-200 text-gray-500":"bg-red-50/90 backdrop-blur border-red-200 text-red-700"}`,children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15.182 15.182a4.5 4.5 0 01-6.364 0M21 12a9 9 0 11-18 0 9 9 0 0118 0zM9.75 9.75c0 .414-.168.75-.375.75S9 10.164 9 9.75 9.168 9 9.375 9s.375.336.375.75zm-.375 0h.008v.015h-.008V9.75zm5.625 0c0 .414-.168.75-.375.75s-.375-.336-.375-.75.168-.75.375-.75.375.336.375.75zm-.375 0h.008v.015h-.008V9.75z"})}),"Face ",oe?u.jsx("svg",{className:"w-3.5 h-3.5 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}):he?u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 animate-pulse"}):u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400"})]}),e?u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:f,className:"relative w-full h-full flex items-center justify-center overflow-hidden"}),Ie&&oe&&f.current&&(()=>{const Ee=f.current,Le=c.current;if(!Le||!Ee)return null;const Ke=Le.getBoundingClientRect(),Je=Ee.getBoundingClientRect(),Ze=Ke.width,ut=Ke.he
5061ight;if(!Ze||!ut)return null;const mt=Ke.left-Je.left,Yt=Ke.top-Je.top,{box:Wt,emotion:fn,confidence:Dt,videoWidth:Sn,videoHeight:qn}=Ie,mn=getComputedStyle(Le).objectFit==="cover"?Math.max(Ze/Sn,ut/qn):Math.min(Ze/Sn,ut/qn),Mn=Sn*mn,jn=qn*mn,Ta=(Ze-Mn)/2,cs=(ut-jn)/2,Ts=Wt.width*mn,Oa=Wt.height*mn,Ya=Wt.y*mn+cs+Yt,Fi=Ze-(Wt.x*mn+Ta)-Ts+mt,ds=hy[fn]||"#7C9885",io=fn.charAt(0).toUpperCase()+fn.slice(1),oo=Math.max(mt,Math.min(Fi,mt+Ze-8));return u.jsxs("div",{className:"absolute inset-0 pointer-events-none rounded-xl overflow-hidden",children:[u.jsx("div",{className:"absolute border-2 rounded-lg transition-all duration-300",style:{left:Fi,top:Ya,width:Ts,height:Oa,borderColor:ds}}),u.jsxs("div",{className:"absolute flex items-center gap-1.5 px-3 py-1 rounded-full text-white text-xs md:text-sm font-semibold shadow-md transition-all duration-300 max-w-[calc(100%-16px)] whitespace-nowrap",style:{left:oo,top:Math.max(0,Ya-32),backgroundColor:ds},children:[io," ",Math.round(Dt*100),"%"]})]})})(),!oe&&u.jsx("div",{className:"absolute rounded-xl bg-black/30 flex items-center justify-center",style:Ue?{left:Ue.left,top:Ue.top,width:Ue.width,height:Ue.height}:{inset:0},children:u.jsx("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl px-7 py-4 flex items-center gap-3 shadow-lg",children:he?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-7 h-7 text-[#7C9885] flex-shrink-0 face-search-anim",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.75,d:"M21 21l-4.35-4.35M10.5 18a7.5 7.5 0 100-15 7.5 7.5 0 000 15z"})}),u.jsx("p",{className:"text-base text-[#1B4D1B] font-medium",children:"Searching for face…"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("svg",{className:"w-7 h-7 text-[#F4A28C] flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),u.jsx("p",{className:"text-base text-[#1B4D1B] font-medium",children:"Face not detected — step into frame when you're ready"})]})})})]}):u.jsx("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-6 text-center rounded-xl bg-gray-50 border border-gray-200 min-h-[300px]",children:t?(()=>{const Ee=/blocked/i.test(t),Le=typeof navigator<"u"?navigator.userAgent:"",Ke=/iPhone|iPad|iPod/i.test(Le),Je=/Android/i.test(Le),Ze=Ke?['Tap the "AA" or settings icon next to the URL',"Choose Website Settings","Set Camera and Microphone to Allow","Reload this page"]:Je?["Tap the lock icon next to the URL","Open Permissions","Set Camera and Microphone to Allow","Reload this page"]:["Click the lock icon in your address bar","Set Camera and Microphone to Allow","Reload this page"];return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-14 h-14 bg-[#F4A28C]/10 rounded-2xl flex items-center justify-center",children:u.jsxs("svg",{className:"w-7 h-7 text-[#F4A28C]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"})]})}),u.jsxs("div",{className:"space-y-2 text-center max-w-md",children:[u.jsx("p",{className:"text-base font-semibold text-[#1B4D1B]",children:Ee?"Camera blocked":"Camera access required"}),Ee?u.jsx("ol",{className:"text-sm text-[#1B4D1B]/80 text-left space-y-1 pl-1 list-decimal list-inside",children:Ze.map((ut,mt)=>u.jsx("li",{children:ut},mt))}):u.jsx("p",{className:"text-sm text-[#1B4D1B]/60 px-4",children:t}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/70",children:"No video or audio is recorded or stored."})]}),u.jsx("button",{onClick:()=>
5061{if(Ee){window.location.reload();return}n(""),s(""),l()},className:"px-6 py-2.5 text-sm font-medium text-white bg-[#7C9885] hover:bg-[#6B8572] rounded-full shadow-sm transition-colors",children:Ee?"Reload page":"Grant permissions"})]})})():u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-10 h-10 border-2 border-[#7C9885] border-t-transparent rounded-full animate-spin"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/70",children:"Waiting for camera permission..."}),u.jsx("p",{className:"text-xs text-[#1B4D1B]",children:"No video or audio is recorded or stored"}),u.jsx("button",{onClick:()=>{n(""),s(""),l()},className:"px-6 py-2.5 text-sm font-medium text-white bg-[#7C9885] hover:bg-[#6B8572] rounded-full shadow-sm transition-colors",children:"Grant permissions"})]})})]}),u.jsxs("div",{className:`relative rounded-xl p-3 border transition-colors flex flex-row md:flex-col items-center md:items-stretch gap-2 md:gap-2 w-full h-20 md:w-28 md:h-auto flex-shrink-0 ${a?"bg-gradient-to-br from-[#7C9885]/5 to-white border-[#7C9885]/10":r&&/system level/i.test(r)?"bg-red-50 border-red-300 cursor-pointer":"bg-gray-50 border-gray-200 cursor-pointer"}`,onClick:()=>{a||(s(""),o())},role:a?void 0:"button",tabIndex:a?void 0:0,onKeyDown:a?void 0:Ee=>{(Ee.key==="Enter"||Ee.key===" ")&&(Ee.preventDefault(),s(""),o())},children:[!(r&&/system level/i.test(r))&&u.jsxs("button",{type:"button",onClick:Ee=>{Ee.stopPropagation(),a||(s(""),o())},className:`flex-shrink-0 inline-flex items-center justify-center gap-1.5 px-2 py-1 rounded-full text-[11px] font-medium border transition-colors ${a?"bg-[#7C9885]/10 border-[#7C9885]/20 text-[#1B4D1B]":r?"bg-red-50 border-red-200 text-red-700 hover:bg-red-100 cursor-pointer":"bg-gray-50 border-gray-200 text-gray-400 hover:bg-gray-100 cursor-pointer"}`,children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),"Mic ",a?u.jsx("svg",{className:"w-3.5 h-3.5 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}):r?u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400"}):u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 animate-pulse"})]}),u.jsx("div",{className:"relative flex-1 min-w-0 md:min-h-0 h-full md:h-auto",children:(()=>{const Ee=r&&/system level/i.test(r);return u.jsxs(u.Fragment,{children:[u.jsx("canvas",{ref:Fe,className:`w-full h-full rounded-lg ${a?"":Ee?"hidden":"opacity-30 grayscale"}`}),!a&&!Ee&&u.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 px-1 text-center",children:[u.jsx("span",{className:"text-xs text-gray-600 font-semibold leading-tight",children:"Allow mic access"}),u.jsx("span",{className:"text-[10px] text-gray-600 leading-tight",children:"Not recorded"})]}),!a&&Ee&&(()=>{const Ke=["Settings","Apps",Qe?.browser||"your browser","Microphone"];return u.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 px-3 py-1 md:py-2 text-red-700 text-center",children:[u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx("svg",{className:"w-4 h-4 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})}),u.jsx("span",{className:"text-xs md:text-sm font-semibold leading-tight text-left",children:"Allow mic access to detect voice emotion"})]}),u.jsxs("div",{className:"flex items-center flex-wrap justify-center gap-x-1.5 gap-y-0.5 text-[11px] md:text-xs leading-tight",children:[u.jsx("img",{src:xPe,alt:"Settings",className:"w-4 h-4 rounded-[5px] flex-shrink-0"}),Ke.map((Je,Ze)=>u.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Ze>0&&u.jsx("span",{className:"opacity-50",children:"›"}),u.jsx("span",{className:Ze===Ke.length-2?"font-semibold":"",children:Je})]},Ze))]})]})})()]})})()}),a&&Oe&&u.jsx("span",{className:"flex-shrink-0 text-[11px] font-semibold px-2 py-1 rounded-full text-white text-center transition-all duration-300 truncate",style:{backgroundColor:hy[Oe.emotion]||"#7C9885"},children:Oe.emotion.charAt(0).toUpperCase()+Oe.emotion.slice(1)})]})]}),u.jsxs("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-2 gap-3 items-start",children:[u.jsx("div",{children:u.jsx(Rs,{onClick:us,disabled:ft||!oe,className:"w-full bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] text-white px-6 py-4 text-base md:px-10 md:py-6 md:text-lg rounded-full shadow-md hover:shadow-lg transition-all disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-[#7C9885] disabled:hover:text-white",children:ft?"Checking...":!bn&&tt<UN?"Start Free Session":"Start Session"})}),u.jsxs("button",{onClick:J,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl border border-[#7C9885]/20 text-sm font-medium text-[#1B4D1B] bg-white hover:bg-[#7C9885]/5 transition-colors",children:[X?u.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})}):u.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M2
50610.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})}),X?"Exit Full Screen":"Full Screen"]})]})]})]})}),u.jsx("div",{className:"mx-auto px-4 mt-2 mb-6 max-w-[95vw]",children:u.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-1 md:gap-3",children:[u.jsxs("div",{className:"space-y-1 text-sm text-left text-[#1B4D1B]/70",children:[u.jsxs("p",{className:"flex items-start gap-2",children:[u.jsx("span",{"aria-hidden":"true",children:"⚠️"}),u.jsxs("span",{children:["This is a wellness tool, not a medical device or therapy. Crisis? Call/text ",u.jsx("a",{href:"tel:988",className:"underline hover:text-[#1B4D1B]",children:"988"})]})]}),u.jsxs("p",{className:"flex items-start gap-2",children:[u.jsx("span",{"aria-hidden":"true",children:"✋"}),u.jsx("span",{children:"Your camera and mic data stay on your device."})]})]}),u.jsxs("div",{className:"flex flex-col items-start md:items-end gap-1",children:[Q&&u.jsxs("button",{onClick:Q,className:"inline-flex items-center gap-2 text-sm text-[#7C9885] hover:text-[#1B4D1B] transition-colors",children:[u.jsx("span",{"aria-hidden":"true",className:"no-underline",children:"📚"}),u.jsx("span",{className:"underline underline-offset-2",children:"Learn more about bilateral stimulation"})]}),u.jsxs("button",{onClick:()=>sa(!0),className:"inline-flex items-center gap-2 text-sm text-[#7C9885] hover:text-[#1B4D1B] transition-colors",children:[u.jsx("span",{"aria-hidden":"true",className:"no-underline",children:"🛡️"}),u.jsx("span",{className:"underline underline-offset-2",children:"Safety information"})]})]})]})}),u.jsx(iPe,{isOpen:ct,onClose:()=>{ot(!1),(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&(localStorage.setItem("solta_localhost_session_count","0"),Tt(0))},sessionCount:tt}),Tn&&u.jsx(AB,{onAccept:Hs,onClose:()=>Nn(!1)}),Pn&&u.jsx(AB,{isReview:!0,onAccept:()=>sa(!1),onClose:()=>sa(!1)})]})}const G1={neutral:"#9CA3AF",happy:"#FBBF24",sad:"#60A5FA",angry:"#EF4444",fearful:"#8B5CF6",disgusted:"#10B981",surprised:"#F97316"},Ox=["fearful","angry","sad","disgusted","surprised","happy"];function wPe(e){const t=Math.round(e),n=Math.floor(t/60),a=t%60;return n===0?`${a}s`:a===0?`${n}:00`:`${n}:${a.toString().padStart(2,"0")}`}function _B(e){const t=Math.round(e/1e3),n=Math.floor(t/60),a=t%60;return n>0?`${n}:${a.toString().padStart(2,"0")}`:`${a}s`}function jB(e){return e<=65?"#7C9885":e<=90?"#C4B5A6":"#C9897A"}function SPe(e,t,n,a){const s=e.length,i=s>1?s-1:0,o=t.size,l=i*a,d=o*36,c=n-l-d,f=e.reduce((y,b,w)=>t.has(w)?y:y+b.durationSeconds,0),m=[];let x=0;for(let y=0;y<s;y++){const b=t.has(y),w=b?36:f>0?e[y].durationSeconds/f*c:0;m.push({index:y,startX:x,endX:x+w,width:w,isCollapsed:b,durationMs:e[y].durationSeconds*1e3,durationSeconds:e[y].durationSeconds,label:`Set ${y+1}`}),x+=w,y<s-1&&(x+=a)}return m}function DB({label:e,sets:t,timelineKey:n,showBpm:a,onToggleBpm:r,gradientId:s}){const[i,o]=D.useState(null),[l,d]=D.useState(new Set),c=U=>{const oe=t.length-l.size;!l.has(U)&&oe<=1||d(pe=>{const he=new Set(pe);return he.has(U)?he.delete(U):he.add(U),he})},f=U=>{const oe=new Set;for(let pe=0;pe<t.length;pe++)pe!==U&&oe.add(pe);d(oe)},m=t.some(U=>(U[n]||[]).length>=2),x=t.some(U=>(U.bpmHistory||[]).length>=2),y=m&&x,b=t.length>1;if(!m&&!x)return null;const w=1500,S=500,k=75,C=16,E=16,T=36,_=w-k-C,A=S-E-T,$=b?20:0,O=D.useMemo(()=>SPe(t,l,_,$),[t,l,_,$]),z=(U,oe)=>{const pe=O[U];if(pe.durationMs<=0||pe.width<=0)return k+pe.startX;const he=Math.max(0,Math.min(oe,pe.durationMs));return k+pe.startX+he/pe.durationMs*pe.width};let P=.15;if(m){for(let U=0;U<t.length;U++){if(l.has(U))continue;let oe=t[U][n]||[];for(const pe of oe){let he=0;for(const xe of Ox)he+=pe.scores?.[xe]||0;he>P&&(P=he)}}P=Math.max(.15,Math.ceil(P*10)/10)}const j=U=>E+A-U/P*A,G=m?Math.min(5,Math.max(2,Math.ceil(P/.05))):0,X=m?Array.from({length:G+1},(U,oe)=>Math.round(oe/G*P*100)):[],J=oa,V=Ur,Q=U=>E+A-(U-J)/(V-J)*A,F=x?[oa,40,60,80,Ur].filter((U,oe,pe)=>pe.indexOf(U)===oe):[],H=[];for(let U=0;U<t.length;U++){if(l.has(U))continue;const oe=t[U],pe=[];let he=null,xe=oe[n]||[];
5061if(xe.length>=2){if(xe.length>150){const Oe=Math.ceil(xe.length/150);xe=xe.filter((Ye,ft)=>ft%Oe===0||ft===(oe[n]||[]).length-1)}const _e=xe.map(Oe=>{const Ye=[0];let ft=0;for(const ze of Ox)ft+=Oe.scores?.[ze]||0,Ye.push(ft);return Ye});Ox.forEach((Oe,Ye)=>{let ft=`M ${z(U,xe[0].timestamp)} ${j(_e[0][Ye+1])}`;for(let ze=1;ze<xe.length;ze++)ft+=` L ${z(U,xe[ze].timestamp)} ${j(_e[ze][Ye+1])}`;for(let ze=xe.length-1;ze>=0;ze--)ft+=` L ${z(U,xe[ze].timestamp)} ${j(_e[ze][Ye])}`;ft+=" Z",pe.push({emotion:Oe,d:ft})})}const Ie=oe.bpmHistory||[];if(Ie.length>=2){let _e=`M ${z(U,Ie[0].time*1e3)} ${Q(Ie[0].bpm)}`;for(let Oe=1;Oe<Ie.length;Oe++)_e+=` L ${z(U,Ie[Oe].time*1e3)} ${Q(Ie[Oe-1].bpm)}`,_e+=` L ${z(U,Ie[Oe].time*1e3)} ${Q(Ie[Oe].bpm)}`;he=_e}H.push({si:U,areaPaths:pe,bpmPath:he})}const B=[],Y=O.filter(U=>!U.isCollapsed);for(let U=0;U<Y.length;U++){const oe=Y[U],pe=oe.index,he=Math.min(4,Math.max(1,Math.ceil(oe.durationSeconds/30)));for(let xe=0;xe<=he;xe++){if(xe===0&&U>0)continue;const Ie=xe/he*oe.durationMs;B.push({svgX:z(pe,Ie),label:_B(Ie)})}}const ne=U=>{const oe=U-k;for(let pe=0;pe<O.length;pe++)if(oe>=O[pe].startX&&oe<=O[pe].endX)return O[pe].isCollapsed?-1:pe;return-1},ee=22;return u.jsxs("div",{className:"mb-8",children:[u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsx("p",{className:"text-base md:text-lg text-[#1B4D1B] pl-[5%]",children:e}),x&&a!==void 0&&u.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[u.jsx("input",{type:"checkbox",checked:a,onChange:U=>r?.(U.target.checked),className:"w-4 h-4 accent-[#1B4D1B] cursor-pointer"}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/70",children:"Overlay Speed"})]})]}),u.jsxs("div",{className:"flex items-stretch gap-2",children:[u.jsxs("svg",{viewBox:`0 0 ${w} ${S}`,className:"flex-1 min-w-0",preserveAspectRatio:"xMidYMid meet",style:{overflow:"visible"},onMouseMove:U=>{const pe=U.currentTarget.getBoundingClientRect(),he=(U.clientX-pe.left)/pe.width*w,xe=(U.clientY-pe.top)/pe.height*S;if(he<k||he>w-C||xe<E||xe>E+A){o(null);return}const Ie=ne(he);if(Ie===-1){o(null);return}const _e=O[Ie],Oe=(he-k-_e.startX)/_e.width*_e.durationMs;let Ye=null;const ft=t[Ie][n]||[];if(ft.length>=2){let ot=1/0;for(const tt of ft){const Tt=Math.abs(tt.timestamp-Oe);Tt<ot&&(ot=Tt,Ye=tt)}}let ze=null;const ct=t[Ie].bpmHistory||[];if(ct.length>=2&&a){const ot=Oe/1e3;let tt=0;for(let Tt=ct.length-1;Tt>=0;Tt--)if(ct[Tt].time<=ot){tt=Tt;break}ze=ct[tt].bpm}o({svgX:he,localMs:Oe,emotionPt:Ye,activeBpm:ze,setIdx:Ie})},onMouseLeave:()=>o(null),children:[u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#7C9885",stopOpacity:"0.25"}),u.jsx("stop",{offset:"100%",stopColor:"#7C9885",stopOpacity:"0.03"})]}),O.map((U,oe)=>!U.isCollapsed&&u.jsx("clipPath",{id:`${s}-clip-${oe}`,children:u.jsx("rect",{x:k+U.startX,y:E,width:U.width,height:A})},`clip-${oe}`))]}),m?X.map(U=>u.jsx("line",{x1:k,y1:j(U/100),x2:w-C,y2:j(U/100),stroke:"#E8E4E0",strokeWidth:"1"},`eg-${U}`)):F.map(U=>u.jsx("line",{x1:k,y1:Q(U),x2:w-C,y2:Q(U),stroke:"#E8E4E0",strokeWidth:"1"},`bg-${U}`)),b&&O.slice(0,-1).map((U,oe)=>{const pe=k+U.endX;return u.jsx("rect",{x:pe,y:E,width:$,height:A,fill:"#FAF3E8",fillOpacity:"0.6"},`gap-${oe}`)}),O.filter(U=>U.isCollapsed).map(U=>u.jsxs("g",{children:[u.jsx("rect",{x:k+U.startX,y:E,width:U.width,height:A,fill:"#FAF3E8",fillOpacity:"0.9",rx:"4"}),u.jsx("text",{x:k+U.startX+U.width/2,y:E+A/2-30,textAnchor:"middle",fontSize:"12",fill:"#1B4D1B",opacity:"0.55",fontWeight:"600",transform:`rotate(-90, ${k+U.startX+U.width/2}, ${E+A/2-30})`,children:U.label}),u.jsxs("g",{style:{cursor:"pointer"},onClick:()=>c(U.index),children:[u.jsx("circle",{cx:k+U.startX+U.width/2,cy:E+A/2+30,r:ee/2+4,fill:"white",stroke:"#7C9885",strokeWidth:"1.5",strokeOpacity:"0.5"}),u.jsx("line",{x1:k+U.startX+U.width/2-5,y1:E+A/2+30,x2:k+U.startX+U.width/2+5,y2:E+A/2+30,stroke:"#7C9885",strokeWidth:"2",strokeLinecap:"round"}),u.jsx("line",{x1:k+U.startX+U.width/2,y1:E+A/2+30-5,x2:k+U.startX+U.width/2,y2:E+A/2+30+5,stroke:"#7C9885",strokeWidth:"2",strokeLinecap:"round"})]})]},`collapsed-${U.index}`)),b&&O.map((U,oe)=>U.isCollapsed?null:u.jsxs("g",{children:[oe>0&&u.jsx("line",{x1:k+U.startX,y1:E,x2:k+U.startX,y2:E+A,stroke:"#7C9885",strokeOpacity:"0.3",strokeWidth:"1.5",strokeDasharray:"6 4"}),u.jsx("text",{x:k+U.startX+12,y:E+16,textAnchor:"start",fontSize:"13",fill:"#1B4D1B",fontWeight:"600",opacity:"0.6",children:U.label})]},`set-${oe}`)),H.map(({si:U,areaPaths:oe,bpmPath:pe})=>u.jsxs("g",{clipPath:`url(#${s}-clip-${U})`,children:[oe.map(({emotion:he,d:xe},Ie)=>
5061u.jsx("path",{d:xe,fill:G1[he],fillOpacity:a?"0.45":"0.75",stroke:G1[he],strokeWidth:"0.5",strokeOpacity:"0.3"},`${he}-${Ie}`)),x&&a&&pe&&u.jsx("path",{d:pe,fill:"none",stroke:"#1B4D1B",strokeWidth:"2.5",strokeLinejoin:"round"})]},`data-${U}`)),b&&O.map((U,oe)=>U.isCollapsed?null:u.jsxs("g",{children:[t.length-l.size>1&&u.jsxs("g",{style:{cursor:"pointer"},onClick:()=>f(U.index),children:[u.jsx("circle",{cx:k+U.endX-60,cy:E+28,r:ee/2+2,fill:"white",stroke:"#7C9885",strokeWidth:"1.5"}),u.jsx("line",{x1:k+U.endX-60-5,y1:E+28,x2:k+U.endX-60+5,y2:E+28,stroke:"#7C9885",strokeWidth:"2",strokeLinecap:"round"}),u.jsx("line",{x1:k+U.endX-60,y1:E+28-5,x2:k+U.endX-60,y2:E+28+5,stroke:"#7C9885",strokeWidth:"2",strokeLinecap:"round"})]}),u.jsxs("g",{style:{cursor:"pointer"},onClick:()=>c(U.index),children:[u.jsx("circle",{cx:k+U.endX-28,cy:E+28,r:ee/2+2,fill:"white",stroke:"#7C9885",strokeWidth:"1.5"}),u.jsx("line",{x1:k+U.endX-28-5,y1:E+28,x2:k+U.endX-28+5,y2:E+28,stroke:"#7C9885",strokeWidth:"2",strokeLinecap:"round"})]})]},`btns-${oe}`)),m?X.map(U=>u.jsxs("text",{x:k-8,y:j(U/100)+4,textAnchor:"end",fontSize:"14",fill:"#1B4D1B",children:[U,"%"]},`el-${U}`)):F.map(U=>u.jsx("text",{x:k-8,y:Q(U)+4,textAnchor:"end",fontSize:"14",fill:"#1B4D1B",children:U},`bl-${U}`)),B.map((U,oe)=>u.jsx("text",{x:U.svgX,y:S-6,textAnchor:"middle",fontSize:"14",fill:"#1B4D1B",children:U.label},oe)),u.jsx("line",{x1:k,y1:E,x2:k,y2:E+A,stroke:"#1B4D1B",strokeOpacity:"0.15",strokeWidth:"1"}),u.jsx("line",{x1:k,y1:E+A,x2:w-C,y2:E+A,stroke:"#1B4D1B",strokeOpacity:"0.15",strokeWidth:"1"}),m?u.jsx("text",{x:"12",y:E+A/2,textAnchor:"middle",transform:`rotate(-90, 12, ${E+A/2})`,fontSize:"14",fill:"#1B4D1B",fontWeight:"600",children:"Emotions"}):u.jsx("text",{x:"12",y:E+A/2,textAnchor:"middle",transform:`rotate(-90, 12, ${E+A/2})`,fontSize:"14",fill:"#1B4D1B",fontWeight:"600",children:"Speed"}),i&&(()=>{const U=i.svgX,oe=i.activeBpm,pe=i.emotionPt,he=Ox.slice().reverse(),xe=oe!==null,Ie=pe!==null,_e=220,Oe=26,Ye=b?24:0,ft=Ye+30+(xe?30:0),ze=Ie?he.length*Oe:0,ct=12+ft+ze+8,tt=U>w-C-_e-12?U-_e-10:U+10,Tt=E,bn=Tt+12+ft;return u.jsxs("g",{pointerEvents:"none",children:[u.jsx("line",{x1:U,y1:E,x2:U,y2:E+A,stroke:"#1B4D1B",strokeOpacity:"0.25",strokeWidth:"1",strokeDasharray:"4 3"}),xe&&u.jsx("circle",{cx:U,cy:Q(oe),r:"6",fill:jB(oe),stroke:"white",strokeWidth:"2"}),u.jsx("rect",{x:tt,y:Tt,width:_e,height:ct,rx:"6",fill:"white",fillOpacity:"0.96",stroke:"#E8E4E0",strokeWidth:"1.5"}),b&&u.jsxs("text",{x:tt+_e/2,y:Tt+20,fontSize:"13",fill:"#7C9885",textAnchor:"middle",fontWeight:"600",children:["Set ",i.setIdx+1]}),u.jsx("text",{x:tt+_e/2,y:Tt+Ye+26,fontSize:"18",fill:"#1B4D1B",opacity:"0.6",textAnchor:"middle",fontWeight:"500",children:_B(i.localMs)}),xe&&u.jsxs("g",{children:[u.jsx("circle",{cx:tt+_e/2-38,cy:Tt+Ye+48,r:"6",fill:jB(oe)}),u.jsxs("text",{x:tt+_e/2-26,y:Tt+Ye+53,fontSize:"20",fill:"#1B4D1B",fontWeight:"700",children:[oe," Speed"]})]}),Ie&&he.map((Ut,Tn)=>{const Nn=pe.scores?.[Ut]||0,Pn=bn+Tn*Oe;return u.jsxs("g",{children:[u.jsx("rect",{x:tt+12,y:Pn,width:"14",height:"14",rx:"3",fill:G1[Ut]}),u.jsx("text",{x:tt+32,y:Pn+12,fontSize:"17",fill:"#1B4D1B",fontWeight:"500",children:Ut}),u.jsxs("text",{x:tt+_e-12,y:Pn+12,fontSize:"17",fill:"#1B4D1B",textAnchor:"end",fontWeight:"700",children:[(Nn*100).toFixed(1),"%"]})]},Ut)})]})})()]}),y&&a&&u.jsxs("div",{className:"relative flex-shrink-0 flex items-stretch",children:[u.jsx("div",{className:"relative w-7",children:F.map(U=>{const oe=Q(U)/S*100;return u.jsx("span",{className:"absolute right-0 text-xs text-[#1B4D1B] leading-none",style:{top:`${oe}%`,transform:"translateY(-50%)"},children:U},U)})}),u.jsx("span",{className:"text-xs font-semibold text-[#1B4D1B] self-center",style:{writingMode:"vertical-rl"},children:"Speed"})]})]}),u.jsxs("div",{className:"flex flex-wrap justify-center gap-x-4 gap-y-1 mt-3",children:[x&&a&&u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"w-5 h-[3px] rounded-full",style:{backgroundColor:"#1B4D1B"}}),u.jsx("span",{className:"text-xs text-[#1B4D1B]/60",children:"Speed"})]}),m&&Ox.slice().reverse().map(U=>u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:G1[U]}}),u.jsx("span",{className:"text-xs text-[#1B4D1B]/60 capitalize",children:U})]},U))]})]})}function kPe({sets:e,totalDurationSeconds:t,onRestart:n}){const[a,r]=D.useState(!0),s=e.some(l=>l.bpmHistory&&l.bpmHistory.length>=2),i=e.some(l=>l.emotionTimeline&&l.emotionTimeline.length>=2),o=e.some(l=>l.voiceEmotionTimeline&&l.voiceEmotionTimeline.length>=2);return u.jsxs(qe.div,{initial:{opacity:0,y:20}
5061,animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-white rounded-lg shadow-lg p-6 md:p-8 w-full mb-4",children:[u.jsxs("div",{className:"text-center mb-2",children:[u.jsx("h3",{className:"font-serif text-2xl md:text-4xl mb-2 text-[#1B4D1B]",children:"Session Summary"}),u.jsxs("p",{className:"text-base md:text-lg text-[#1B4D1B]/60",children:[e.length," ",e.length===1?"set":"sets"," · ",wPe(t)," total"]})]}),u.jsx("p",{className:"text-sm md:text-base text-[#1B4D1B]/65 text-center max-w-2xl mx-auto mt-4 mb-6 leading-relaxed",children:"Here's what we detected during your session. Most people see a shift from activated emotions (like stress or frustration) toward calmer states by the end."}),(i||s)&&u.jsx(DB,{label:"Facial Expression Overview",sets:e,timelineKey:"emotionTimeline",showBpm:a,onToggleBpm:r,gradientId:"bpmFillGrad"}),o?u.jsx(DB,{label:"Voice Emotion Overview",sets:e,timelineKey:"voiceEmotionTimeline",showBpm:a,onToggleBpm:r,gradientId:"voiceBpmFillGrad"}):u.jsxs("div",{className:"mb-8",children:[u.jsx("p",{className:"text-base md:text-lg text-[#1B4D1B]/60 text-center mb-4",children:"Voice Emotion Overview"}),u.jsxs("div",{className:"bg-[#FBBF24]/15 border border-[#FBBF24]/40 rounded-xl px-6 py-5 text-center",children:[u.jsx("p",{className:"text-[#1B4D1B] font-medium",children:"No voice was detected during this session"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/60 mt-1",children:"Make sure your microphone is enabled and speak during the session"})]})]}),u.jsx("div",{className:"border-t border-gray-200 pt-6 text-center mt-4",children:u.jsx(Rs,{onClick:n,className:"bg-[#7C9885] hover:bg-[#6B8572] text-white px-8 py-6 text-lg",children:"Start New Session"})})]})}function NPe({initialBpm:e,minBpm:t,maxBpm:n,numberOfSets:a,setDurationSeconds:r,restDurationSeconds:s,restPrompts:i=[],sessionDurationSeconds:o,cameraAccess:l,microphoneAccess:d,reacquireMedia:c,videoRef:f,audioStreamRef:m,mediaStreamRef:x,modelsLoaded:y,isFullscreen:b,toggleFullscreen:w,isMobile:S,initialSessionId:k,initialSetId:C,onRestart:E,onFullscreenChange:T,setCameraAccess:_,onStopMedia:A,presetName:$}){const O=t??oa,z=n??Ur,P=r||o,j=s??0,[G,X]=D.useState(!1),[J,V]=D.useState(!1),[Q,F]=D.useState("active"),[H,B]=D.useState(0),[Y,ne]=D.useState(""),ee=D.useRef(null),[U,oe]=D.useState(0),[pe,he]=D.useState(!0),[xe,Ie]=D.useState(0),[_e,Oe]=D.useState(!1),[Ye,ft]=D.useState(!1),[,ze]=D.use
5061State(null),[ct,ot]=D.useState(e),[tt,Tt]=D.useState(o),[bn,Ut]=D.useState(!1),[Tn,Nn]=D.useState([]),[Pn,sa]=D.useState(null),[pa,Be]=D.useState([]),[lt,$e]=D.useState(null),[Ue,dt]=D.useState(null),[Qe,An]=D.useState(null),[Bn,Ga]=D.useState(!0),[_n,di]=D.useState(!0),[qr,hi]=D.useState(!0),[pi,qa]=D.useState(!0),[is,Kr]=D.useState(!0),[lr,Ba]=D.useState(!0),[fi,we]=D.useState(!0),[Fe,xt]=D.useState(!1),[Xe,qt]=D.useState(0),[$t,It]=D.useState(k),[vt,vn]=D.useState(C),[Na,Fa]=D.useState(0),Xr=S?EB*.5:EB,fa=D.useRef(null),os=D.useRef(null),sn=D.useRef(null),wn=D.useRef([]),Ka=D.useRef([]),Ca=D.useRef(null),Rn=D.useRef(null),Or=D.useRef(e),ls=D.useRef(e),Hs=D.useRef(!1),ur=D.useRef(null),cr=D.useRef(null),us=D.useRef(null),Xa=D.useRef([]),Bi=D.useRef(null),Ee=D.useRef(!1),Le=D.useRef(null),Ke=D.useRef(null),Je=D.useRef(null),Ze=D.useRef(null),ut=D.useRef(null),mt=D.useRef(null),Yt=D.useRef(!1),Wt=D.useRef(!1),fn=D.useRef(null),Dt=D.useRef(null),Sn=D.useRef(0),qn=D.useRef(0),Ea=D.useRef(0),Ia=D.useRef(0),mn=D.useRef(null),Mn=D.useRef(null),jn=D.useRef(null),Ta=D.useRef(k),cs=D.useRef(C),Ts=D.useRef(!1),Oa=D.useRef(!1),Ya=D.useRef(null),Fi=D.useRef(0),ds=D.useRef([]),io=D.useRef(0),oo=D.useRef([]),hl=D.useRef(0),Oi=D.useRef(null),lo=D.useRef(null),uo=D.useRef(null),As=D.useRef(null),_s=D.useRef(null),co=D.useRef([]),mi=5e3,$o=.4,te=.6,ge=5e3,We=2e3,At=8e3,Rt=1,Ft=5,rt=6e4,gt=1e3,Dn=Ne=>{if(Ne>=60){const Pe=Math.floor(Ne/60),Ve=Ne%60;return{value:`${Pe}:${Ve.toString().padStart(2,"0")}`,unit:"min"}}return{value:Ne.toString(),unit:"sec"}},Ja=()=>{if(!Ue)return"neutral";const Ne=Object.entries(Ue).sort((Pe,Ve)=>Ve[1]-Pe[1]);return Ne[0][0]==="neutral"&&Ne[0][1]<.99&&Ne.length>1?Ne[1][0]:Ne[0][0]},Gs=(Ne,Pe="w-5 h-5")=>{const Ve=hy[Ne]||"#C9897A";switch(Ne){case"happy":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),u.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),u.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]});case"sad":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"}),u.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),u.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]});case"angry":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"}),u.jsx("path",{d:"M7.5 8L10 9.5"}),u.jsx("path",{d:"M16.5 8L14 9.5"}),u.jsx("line",{x1:"9",y1:"10",x2:"9.01",y2:"10"}),u.jsx("line",{x1:"15",y1:"10",x2:"15.01",y2:"10"})]});case"fearful":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("circle",{cx:"9",cy:"9",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"15",cy:"9",r:"1.5",fill:"currentColor"}),u.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"3"})]});case"surprised":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("circle",{cx:"9",cy:"9",r:"1.5"}),u.jsx("circle",{cx:"15",cy:"9",r:"1.5"}),u.jsx("circle",{cx:"12",cy:"15",r:"2"})]});case"disgusted":return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("path",{d:"M8 15s1-1 4-1 4 1 4 1"}),u.jsx("path",{d:"M9 9.5L7.5 8"}),u.jsx("path",{d:"M15 9.5L16.5 8"}),u.jsx("line",{x1:"9",y1:"10",x2:"9.01",y2:"10"}),u.jsx("line",{x1:"15",y1:"10",x2:"15.01",y2:"10"})]});default:return u.jsxs("svg",{className:Pe,style:{color:Ve},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"8",y1:"15",x2:"16",y2:"15"}),u.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),u.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})}},ho=(Ne,Pe,Ve,Ge=null)=>{if(!Ge){let Mt=0;return Ve<75?Mt=Math.min(3,75-Ve):Ve>95&&(Mt=Math.max(-3,95-Ve)),Math.max(O,Math.min(z,Math.round(Ve+Mt)))}if((Ge.neutral||0)>=.995){let Mt=0;return Ve<75?Mt=Math.min(3,75-Ve):Ve>95&&(Mt=Math.max(-3,95-Ve)),Math.max(O,Math.min(z,Math.round(Ve+Mt)))}const nt={happy:25,sad:-30,angry:-30,fearful:-40,disgusted:-35};let pt=0;for(const[Mt,Vt]of Object.entries(nt)){const gn=Ge[Mt]||0;if(gn>0){if(Mt==="happy"){const _a=Ge.sad||0,tn=Ge.angry||0;if(_a>.15||tn>.15)continue}pt+=Vt*Math.sqrt(gn)}}const it=Ge.surprised||0;if(it>0){const Mt=(Ge.sad||0)+(Ge.angry||0)+(Ge.fearful||0)+(Ge.disgusted||0),Vt=Ge.happy||0,gn=Mt>Vt?-20:15;pt+=gn*Math.sqrt(it)}return pt=Math.max(-20,Math.min(20,pt)),Math.max(O,Math.min(z,Math.round(Ve+pt)))},Bo=Ne=>{if(!Ne||(Ne.neutral||0)>=.995)return 0;const Ve={happy:25,sad:-30,angry:-30,fearful:-40,disgusted:-35};let Ge=0;for(const[nt,pt]of Object.entries(Ve)){const it=Ne[nt]||0;if(it>0){if(nt==="happy"){const Mt=Ne.sad||0,Vt=Ne.angry||0;if(Mt>
5061.15||Vt>.15)continue}Ge+=pt*Math.sqrt(it)}}const Ct=Ne.surprised||0;if(Ct>0){const nt=(Ne.sad||0)+(Ne.angry||0)+(Ne.fearful||0)+(Ne.disgusted||0),pt=Ne.happy||0,it=nt>pt?-20:15;Ge+=it*Math.sqrt(Ct)}return Math.max(-20,Math.min(20,Ge))},Tc=(Ne,Pe,Ve)=>{const Ge={trigger:Ne,bpmBefore:Pe,bpmAfter:Ve,emotion:Ja(),timestamp:Date.now()};co.current.push(Ge),console.log("[BLS] Set-transition BPM change",Ge)};Ke.current=()=>{const Ne=Or.current;let Pe;if(Ca.current){const{emotion:Ve,confidence:Ge,scores:Ct}=Ca.current,nt=ho(Ve,Ge,Ne,Ct),pt=nt-Ne,it=jn.current,Mt=Mn.current;if(it&&(!Mt||Date.now()-Mt<ge)){const gn=Bo(it),_a=te*pt+$o*gn;Pe=Math.max(O,Math.min(z,Math.round(Ne+_a)))}else Pe=nt}else(Rn.current?Date.now()-Rn.current:1/0)>mi?Pe=ho("neutral",1,Ne):Pe=Ne;if(Pe!==Ne&&(ls.current=Pe,Or.current=Pe,Bi.current&&clearTimeout(Bi.current),Bi.current=setTimeout(()=>ot(Pe),200),us.current)){const Ve=(Date.now()-us.current)/1e3;Xa.current.push({time:Ve,bpm:Pe})}};const zn=()=>{if(mn.current)return;const Ne=()=>{const Pe=Mn.current,Ve=jn.current;if(!Pe||!Ve){Aa();return}const Ge=Date.now()-Pe;if(Ge>=At){An(null),Aa();return}if(Ge<=We){mn.current=requestAnimationFrame(Ne);return}const Ct=Ge-We,nt=Math.exp(-.0015*Ct),pt={};let it=!0;for(const[Mt,Vt]of Object.entries(Ve)){const gn=Vt*nt;gn*100<Rt?pt[Mt]=0:(pt[Mt]=gn,it=!1)}it?(An(null),Aa()):(An(pt),mn.current=requestAnimationFrame(Ne))};mn.current=requestAnimationFrame(Ne)},Aa=()=>{mn.current&&(cancelAnimationFrame(mn.current),mn.current=null)},pl=Ne=>{Aa(),Mn.current=null,jn.current=Ne,An(Ne)},eu=()=>{Mn.current||(Mn.current=Date.now(),zn())},h0=()=>new Promise(Ne=>{if(mt.current&&Yt.current){Ne(!0);return}if(mt.current||Wt.current){const Ve=setInterval(()=>{Wt.current||(clearInterval(Ve),Ne(Yt.current))},100);return}Wt.current=!0;const Pe=new Worker(new URL("/assets/voiceEmotionWorker-Bt97yA9B.js",import.meta.url),{type:"module"});mt.current=Pe,Pe.onmessage=Ve=>{const{type:Ge,emotions:Ct,error:nt,noSpeech:pt}=Ve.data;Ge==="loading"||(Ge==="loaded"?(Yt.current=!0,Wt.current=!1,Ne(!0)):Ge==="load-error"?(console.error("[VOICE] Worker: model load failed:",nt),Yt.current=!1,Wt.current=!1,Ne(!1)):Ge==="result"&&fn.current&&(fn.current(Ct,nt,pt),fn.current=null))},Pe.onerror=Ve=>{console.error("[VOICE] Worker error:",Ve),Wt.current=!1,Ne(!1)},Pe.postMessage({type:"load"})}),Og=(Ne,Pe=48e3)=>new Promise(Ve=>{if(!mt.current||!Yt.current){Ve(null);return}fn.current=(Ct,nt,pt)=>{nt?(console.error("[VOICE] Worker inference error:",nt),Ve(null)):Ve(pt?"no-speech":Ct)};const Ge=new Float32Array(Ne);mt.current.postMessage({type:"infer",audioData:Ge,sampleRate:Pe},[Ge.buffer])}),Sp=()=>{he(!1),Oe(!1),X(!0),kp(),p0()},Ac=()=>{he(!1),!(/iPad|iPhone|iPod/i.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!document.fullscreenElement&&document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(()=>{}),Oe(!0)},kp=()=>{if(!f.current||!y||Oa.current)return;Oa.current=!0,Ut(!0),Nn([]),wn.current=[],Tt(P),sa(null);const Ne=Date.now();ur.current=Ne+P*1e3,cr.current=P,us.current=Ne,Xa.current=[{time:0,bpm:Or.current}],Ea.current=0,Ia.current=0;let Pe=0;sn.current=setInterval(async()=>{if(f.current&&f.current.readyState===4)try{const Ve=await WE(f.current,new tw).withFaceLandmarks().withFaceExpressions();if(Ea.current++,Ve.length>0){Pe=0;const nt=Ve[0].expressions;dt(nt);const pt=Object.entries(nt);pt.sort((Mt,Vt)=>Vt[1]-Mt[1]);const it=pt[0];Ca.current={emotion:it[0],confidence:it[1],scores:nt},Rn.current=Date.now(),Nn(Mt=>{const Vt=[...Mt,{emotion:it[0],score:it[1],scores:nt,timestamp:Date.now()-Ne}];return wn.current=Vt,Vt})}else Ia.current++,Pe++,dt(null),Ca.current=null;const Ge=Math.ceil((ur.current-Date.now())/1e3);if(Tt(Math.max(0,Ge)),Date.now()>=ur.current){if(clearInterval(sn.current),sn.current=null,Oa.current=!1,Ut(!1),dt(null),An(null),Aa(),Mn.current=null,jn.current=null,Ca.current=null,Rn.current=null,Dt.current&&(clearInterval(Dt.current),Dt.current=null),Je.current&&(Je.current.close().catch(it=>{console.error("[VOICE] Error closing audio context:",it)}),Je.current=null),Ze.current=null,ut.current=null,us.current){const it=(Date.now()-us.current)/1e3;Xa.current.push({time:it,bpm:Or.current})}const Ct=wn.current,nt=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",pt=cs.current;f0(()=>{const it=Fi.current+1;oe(it),!nt&&pt&&fetch("/.netlify/functions/complete-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({setId:pt,durationSeconds:cr.current,initialEmotion:Ct[0]||null,finalEmotion:Ct[Ct.length-1]||null})}).then(Mt=>Mt.json()).then(Mt=>{Mt.success&&Fa(Mt.newSessionCount)}).catch(Mt=>
5061{console.error("[SESSION] Error completing set:",Mt)}),a!=null&&it>=a?Cp():j>0?m0(it):(Lg(),zg())})}}catch(Ve){console.error("[EMOTION] Error detecting emotions:",Ve)}},500)},p0=async()=>{if(!m.current)return;let Ne;try{Ne=new(window.AudioContext||window.webkitAudioContext),Je.current=Ne;const tn=Ne.createAnalyser();tn.fftSize=8192,tn.smoothingTimeConstant=.8,Ze.current=tn;const Fn=Ne.createMediaStreamSource(m.current);Fn.connect(tn),ut.current=Fn}catch(tn){console.error("[VOICE] Error initializing audio context:",tn);return}if(!await h0()){console.error("[VOICE] Failed to initialize voice emotion worker"),Ne.close().catch(()=>{}),Je.current=null,Ze.current=null;return}Ne.state==="suspended"&&await Ne.resume().catch(()=>{}),Be([]),Ka.current=[],$e(null),Sn.current=0,qn.current=0;const Ve=Date.now();let Ge=!1;const Ct=Je.current.sampleRate||48e3,pt=Math.floor(Ct*1),it=new Float32Array(pt);let Mt=0;const Vt=new Float32Array(Ze.current.fftSize),gn=2;let _a=0;Dt.current=setInterval(async()=>{if(!Ze.current||!Je.current||Ge)return;Ze.current.getFloatTimeDomainData(Vt);let tn=!1;for(let Fn=0;Fn<Vt.length;Fn+=64)if(Math.abs(Vt[Fn])>.01){tn=!0;break}if(tn){const Fn=Math.min(Vt.length,pt-Mt);for(let ja=0;ja<Fn;ja++)it[Mt++]=Vt[ja];if(Mt>=pt*.6){Ge=!0;try{const ja=await Og(it,Ct);if(ja==="no-speech"){_a++,_a>gn&&(Sn.current++,qn.current++),eu(),Ge=!1;const xn=Math.floor(pt*.2);for(let Un=0;Un<xn;Un++)it[Un]=it[Mt-xn+Un];Mt=xn;return}if(!ja){Ge=!1;return}_a=0,Sn.current++,pl(ja);const fl=Object.entries(ja);fl.sort((xn,Un)=>Un[1]-xn[1]);const _c=fl[0];Be(xn=>{const Un=[...xn,{emotion:_c[0],score:_c[1],scores:ja,timestamp:Date.now()-Ve}];return Ka.current=Un,Un});const gi=Math.floor(pt*.2);for(let xn=0;xn<gi;xn++)it[xn]=it[pt-gi+xn];Mt=gi}catch(ja){console.error("[VOICE] Inference error:",ja)}finally{Ge=!1}}}else _a++,_a>gn&&(Sn.current++,qn.current++),eu()},500)},G2=(Ne=null,Pe=0,Ve=0)=>{const Ge=Ne||wn.current,Ct=["neutral","happy","sad","angry","fearful","disgusted","surprised"],nt=Ge.length,pt={};Ct.forEach(tn=>{pt[tn]=0}),Ge.forEach(tn=>{if(tn.scores)for(const[Fn,ja]of Object.entries(tn.scores))Fn in pt&&(pt[Fn]+=ja)});const it={},Mt=Pe>0?Pe:nt;Ct.forEach(tn=>{it[tn]=Mt>0?pt[tn]/Mt*100:0});const Vt=Pe>0?Ve/Pe*100:0,gn=Object.entries(pt).sort((tn,Fn)=>Fn[1]-tn[1])[0];if(Ge.length===0){sa({totalDetections:0,totalDetectionAttempts:Pe,noFaceDetections:Ve,noFacePercentage:Vt,dominantEmotion:null,dominantCount:0,emotionBreakdown:it,allEmotions:Ct,message:`Over the past ${o} seconds. No successful face detections were made.`});return}const _a={totalDetections:nt,totalDetectionAttempts:Pe,noFaceDetections:Ve,noFacePercentage:Vt,dominantEmotion:gn[0],dominantScore:it[gn[0]],emotionBreakdown:it,allEmotions:Ct,message:`Over the past ${o} seconds. ${nt} successful detections were made. The most prominent emotion was ${gn[0]} (${it[gn[0]].toFixed(1)}% of session time).`};sa(_a)},q2=(Ne=null,Pe=0,Ve=0)=>{const Ge=Ne||Ka.current,Ct=["neutral","happy","sad","angry","fearful","disgusted","surprised"],nt=Ge.length,pt={};Ct.forEach(tn=>{pt[tn]=0}),Ge.forEach(tn=>{if(tn.scores)for(const[Fn,ja]of Object.entries(tn.scores))Fn in pt&&(pt[Fn]+=ja)});const it={},Mt=Pe>0?Pe:nt;Ct.forEach(tn=>{it[tn]=Mt>0?pt[tn]/Mt*100:0});const Vt=Pe>0?Ve/Pe*100:0,gn=Object.entries(pt).sort((tn,Fn)=>Fn[1]-tn[1])[0];if(Ge.length===0){$e({totalDetections:0,totalDetectionAttempts:Pe,noVoiceDetections:Ve,noVoicePercentage:Vt,dominantEmotion:null,dominantCount:0,emotionBreakdown:it,allEmotions:Ct,message:`Over the past ${o} seconds. No successful voice detections were made.`});return}const _a={totalDetections:nt,totalDetectionAttempts:Pe,noVoiceDetections:Ve,noVoicePercentage:Vt,dominantEmotion:gn[0],dominantScore:it[gn[0]],emotionBreakdown:it,allEmotions:Ct,message:`Over the past ${o} seconds. ${nt} successful detections were made. The most prominent emotion was ${gn[0]} (${it[gn[0]].toFixed(1)}% of session time).`};$e(_a)},f0=Ne=>{Ee.current=!0,Le.current=Ne,setTimeout(()=>{Le.current&&(Ee.current=!1,Le.current(),Le.current=null)},3e3)},Np=()=>{if(sn.current&&(clearInterval(sn.current),sn.current=null),Oa.current=!1,Ut(!1),dt(null),An(null),Aa(),Mn.current=null,jn.current=null,Ca.current=null,Rn.current=null,Dt.current&&(clearInterval(Dt.current),Dt.current=null),Je.current&&(Je.current.close().catch(Ge=>{console.error("[VOICE] Error closing audio context:",Ge)}),Je.current=null),Ze.current=null,ut.current=null,us.current){const Ge=(Date.now()-us.current)/1e3;Xa.current.push({time:Ge,bpm:Or.current})}const Ne=wn.current,Pe=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",Ve=cs.current;f0(()=>{const Ge=Fi.current+1;if(oe(Ge),!Pe&&Ve){const Ct=cr.current-tt;fetch("/.netlify/functions/complete-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({setId:Ve,durationSeconds:Ct>0?Ct:cr.current,initialEmotion:Ne[0]||null,finalEmotion:Ne[Ne.length-1]||null})}).then(nt=>nt.json()).then(nt=>{nt.success&&Fa(nt.newSessionCount)}).catch(nt=>
5061{console.error("[SESSION] Error completing set (early stop):",nt)})}a!=null&&Ge>=a?Cp():j>0?m0(Ge):(Lg(),zg())})},Lg=()=>{const Ne=wn.current.length>0?wn.current[wn.current.length-1].timestamp/1e3:0,Pe=Xa.current.length>0?Xa.current[Xa.current.length-1].time:0,Ve=Math.max(Ne,Pe,1);ds.current.push({emotionTimeline:[...wn.current],voiceEmotionTimeline:[...Ka.current],bpmHistory:[...Xa.current],durationSeconds:Ve,faceDetectionCount:Ea.current,noFaceCount:Ia.current,voiceDetectionCount:Sn.current,voiceNoSpeechCount:qn.current}),io.current+=Ve,Nn([]),wn.current=[],Ea.current=0,Ia.current=0,sa(null),Be([]),Ka.current=[],$e(null),dt(null),An(null),Aa(),Mn.current=null,jn.current=null,Ca.current=null,Rn.current=null,Xa.current=[],us.current=null,Ee.current=!1,Le.current=null},K2=()=>{_s.current||!f.current||!y||(_s.current=setInterval(async()=>{if(!(!f.current||f.current.readyState!==4))try{const Ne=await WE(f.current,new tw).withFaceLandmarks().withFaceExpressions();if(Ne.length===0)return;const Pe=Ne[0].expressions;dt(Pe);const Ge=Object.entries(Pe).sort((gn,_a)=>_a[1]-gn[1])[0];Ca.current={emotion:Ge[0],confidence:Ge[1],scores:Pe},Rn.current=Date.now();const Ct=Or.current,nt=lo.current??Ct,pt=ho(Ge[0],Ge[1],Ct,Pe),it=Math.max(O,nt-Ft),Mt=Math.min(z,nt+Ft),Vt=Math.max(it,Math.min(Mt,pt));Vt!==Ct&&(Or.current=Vt,ls.current=Vt,ot(Vt),uo.current="ai_adaptation",As.current=Date.now(),Tc("ai_adaptation",Ct,Vt))}catch(Ne){console.error("[BLS] Rest-period emotion detection error:",Ne)}},gt))},Pg=()=>{_s.current&&(clearInterval(_s.current),_s.current=null)},m0=Ne=>{Lg(),F("resting"),Oi.current=Date.now(),lo.current=Or.current,uo.current=null,As.current=Date.now();const Pe=i.length>0?i:uPe;if(Pe.length>0){const Ge=Pe[(Ne-1)%Pe.length];ne(Ge),ee.current=hPe(Ge)}else ne(""),ee.current=null;B(j);const Ve=Date.now()+j*1e3;K2(),Ya.current=setInterval(()=>{const Ge=Math.ceil((Ve-Date.now())/1e3);B(Math.max(0,Ge)),Date.now()>=Ve&&(clearInterval(Ya.current),Ya.current=null,zg())},250)},zg=()=>{Pg();const Ne=Oi.current,Pe=As.current??Ne;if(Ne!=null&&Date.now()-Pe>rt){const Ge=Or.current,Ct=Math.max(O,Math.min(z,e));Ct!==Ge&&(Or.current=Ct,ls.current=Ct,ot(Ct),Tc("inactivity_reset",Ge,Ct))}Oi.current=null,lo.current=null,uo.current=null,As.current=null,F("active"),ne(""),fa.current&&(fa.current.style.animation="none"),Hs.current=!1,qt(Ge=>Ge+1),(async()=>{if(!(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&Ta.current)try{const Ct=Wa(),nt=ee.current;ee.current=null;const it=await(await fetch("/.netlify/functions/create-set",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ta.current,userId:Ct,blsSpeedBpm:Or.current,startingPrompt:nt})})).json();it.success&&it.setId&&(vn(it.setId),cs.current=it.setId)}catch(Ct){console.error("[SESSION] Error creating new set:",Ct)}await c(),Sp()})()},Cp=()=>{Ya.current&&(clearInterval(Ya.current),Ya.current=null),Pg(),F("active"),document.fullscreenElement&&document.exitFullscreen().catch(()=>{});const Ne=x.current||f.current&&f.current.srcObject;Ne&&Ne.getTracks().forEach(Vt=>Vt.stop()),f.current&&(f.current.srcObject=null),x.current=null;const Pe=m.current;Pe&&Pe.getTracks().forEach(Vt=>Vt.stop()),m.current=null,_(!1),V(!0),ft(!0);const Ve=wn.current.length>0?wn.current[wn.current.length-1].timestamp/1e3:0,Ge=Xa.current.length>0?Xa.current[Xa.current.length-1].time:0,Ct=Math.max(Ve,Ge,1),nt={emotionTimeline:[...wn.current],voiceEmotionTimeline:[...Ka.current],bpmHistory:[...Xa.current],durationSeconds:Ct,faceDetectionCount:Ea.current,noFaceCount:Ia.current,voiceDetectionCount:Sn.current,voiceNoSpeechCount:qn.current},pt=[...ds.current,nt],it=io.current+Ct;oo.current=pt,hl.current=it,!(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&Ta.current&&fetch("/.netlify/functions/end-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ta.current})}).catch(Vt=>console.error("[SESSION] Error ending session:",Vt)),setTimeout(()=>{G2(wn.current,Ea.current,Ia.current),q2(Ka.current,Sn.current,qn.current)},100)},X2=()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),Ts.current=!0,sn.current&&(clearInterval(sn.current),sn.current=null),Dt.current&&(clearInterval(Dt.current),Dt.current=null),Aa(),mt.current&&(mt.current.terminate(),mt.current=null,Yt.current=!1),Je.current&&(Je.current.close().catch(()=>{}),Je.current=null),Ze.current=null,ut.current=null;const Ne=x.current||f.current&&f.current.srcObject;
5061Ne&&Ne.getTracks().forEach(Ge=>Ge.stop()),f.current&&(f.current.srcObject=null),x.current=null;const Pe=m.current;Pe&&Pe.getTracks().forEach(Ge=>Ge.stop()),m.current=null,!(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&Ta.current&&fetch("/.netlify/functions/end-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ta.current})}).catch(Ge=>console.error("[SESSION] Error ending session:",Ge)),Ya.current&&(clearInterval(Ya.current),Ya.current=null),Pg(),F("active"),ds.current=[],io.current=0,oo.current=[],hl.current=0,co.current=[],Oi.current=null,lo.current=null,uo.current=null,As.current=null,Oe(!1),ft(!1),ze(null),E()};return D.useEffect(()=>()=>{Ya.current&&(clearInterval(Ya.current),Ya.current=null),_s.current&&(clearInterval(_s.current),_s.current=null)},[]),D.useEffect(()=>{ls.current=ct},[ct]),D.useEffect(()=>{Fi.current=U},[U]),D.useEffect(()=>{if(!pe||xe>=5)return;const Ne=setTimeout(()=>Ie(Pe=>Pe+1),2e3);return()=>clearTimeout(Ne)},[pe,xe]),D.useEffect(()=>{d&&m.current&&h0()},[d]),D.useEffect(()=>{if(!d||!m.current){if(ut.current){try{ut.current.disconnect()}catch{}ut.current=null}return}if(!(!Je.current||!Ze.current)){if(ut.current)try{ut.current.disconnect()}catch{}Je.current.state==="suspended"&&Je.current.resume().catch(()=>{});try{const Ne=Je.current.createMediaStreamSource(m.current);Ne.connect(Ze.current),ut.current=Ne}catch(Ne){console.error("[VOICE] Error rebinding audio source:",Ne)}}},[d]),D.useEffect(()=>{const Ne=()=>{const Pe=!!document.fullscreenElement;Pe&&(Kr(!1),Ba(!1),qa(!1),we(!1),xt(!1)),T?.(Pe)};return document.addEventListener("fullscreenchange",Ne),()=>document.removeEventListener("fullscreenchange",Ne)},[T]),D.useEffect(()=>{if(!os.current||!fa.current||!G||J){fa.current&&(fa.current.style.animation="none");return}const Ne=fa.current,Pe=os.current,Ve=Xr*2,Ge=Pe.offsetWidth-Ve;let Ct=document.getElementById("bls-dot-keyframes");Ct||(Ct=document.createElement("style"),Ct.id="bls-dot-keyframes",document.head.appendChild(Ct)),Ct.textContent=`
5062      @keyframes blsDotSwing {
5063        0%, 100% { transform: translateY(-50%) translateX(0); }
5064        50% { transform: translateY(-50%) translateX(${Ge}px); }
5065      }
5066    `;const nt=120/ls.current,pt=1500,it=6,Mt=2.2;let Vt=0;const gn=()=>{const xn=120/ls.current;if(Vt>=it)return xn;const Un=Vt/it;return xn*(Mt-(Mt-1)*Un)};Ne.style.animation="none",Ne.style.transform=`translateY(-50%) translateX(${Ge/2}px)`;let _a=null,tn=null;const Fn=xn=>{const Un=Ne.getAnimations()[0];if(Un){const Li=Un.effect.getTiming().duration,jc=Li>0?Un.currentTime/Li:0,Dc=xn*1e3;Un.effect.updateTiming({duration:Dc}),Un.currentTime=jc*Dc}else Ne.style.animationDuration=`${xn}s`},ja=()=>{Ee.current?(Ne.style.animation="none",Ne.style.transform=`translateY(-50%) translateX(${Ge/2}px)`,Ne.style.transition="opacity 0.5s ease-out",Ne.style.opacity="0",setTimeout(()=>{fa.current&&(fa.current.style.transition="",fa.current.style.opacity="1"),Ee.current=!1,Le.current?.(),Le.current=null},520)):(Vt++,Ke.current?.(),Fn(gn()))},fl=()=>{const xn=Ne.getAnimations()[0],Li=(xn?xn.effect.getTiming().duration:nt*1e3)/2;_a=setTimeout(()=>{Ee.current||(Vt++,Ke.current?.(),Fn(gn())),fl()},Li)};tn=setTimeout(()=>{const xn=nt*Mt;Ne.style.animationName="blsDotSwing",Ne.style.animationDuration=`${xn}s`,Ne.style.animationTimingFunction="ease-in-out",Ne.style.animationIterationCount="infinite",Ne.style.animationFillMode="both";const Un=Ne.getAnimations()[0];Un&&(Un.currentTime=xn*1e3*.25),Hs.current=!0,Ne.addEventListener("animationiteration",ja);const Li=xn/4*1e3;_a=setTimeout(()=>{Ee.current||(Vt++,Ke.current?.(),Fn(gn())),fl()},Li)},pt);const gi=new ResizeObserver(()=>{const xn=Pe.offsetWidth-Ve;Ct&&(Ct.textContent=`
5067          @keyframes blsDotSwing {
5068            0%, 100% { transform: translateY(-50%) translateX(0); }
5069            50% { transform: translateY(-50%) translateX(${xn}px); }
5070          }
5071        `)});return gi.observe(Pe),()=>{Ne.removeEventListener("animationiteration",ja),clearTimeout(tn),clearTimeout(_a),gi.disconnect(),Ne&&(Ne.style.animation="none")}},[G,J,Xr,Xe]),D.useEffect(()=>{if(!f.current||!l||!G)return;(async()=>
5071{if(f.current&&f.current.paused)try{await f.current.play()}catch(Ve){console.error("[VIDEO] Error playing video:",Ve)}})();const Pe=setInterval(()=>{f.current&&f.current.paused&&G&&f.current.play().catch(()=>{})},1e3);return()=>clearInterval(Pe)},[l,G]),D.useEffect(()=>{J&&(A?.(),sn.current&&(clearInterval(sn.current),sn.current=null))},[J]),u.jsxs(u.Fragment,{children:[Q==="resting"&&!J&&Dq.createPortal(u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:u.jsxs(qe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,ease:"easeOut"},className:"bg-white rounded-3xl shadow-2xl p-10 max-w-md mx-4 text-center space-y-5",children:[Y&&u.jsx("p",{className:"font-serif text-xl text-[#1B4D1B] leading-relaxed",children:Y}),u.jsxs("div",{children:[u.jsx("p",{className:"text-[#1B4D1B]/50 text-sm",children:a!=null?`Set ${U} of ${a} complete`:`Set ${U} complete`}),u.jsxs("p",{className:"text-[#7C9885] text-lg font-medium mt-2",children:["Next set in ",H,"s"]}),u.jsx("div",{className:"w-full h-1.5 bg-[#7C9885]/10 rounded-full mt-3 overflow-hidden",children:u.jsx(qe.div,{className:"h-full bg-[#7C9885] rounded-full",initial:{width:"100%"},animate:{width:"0%"},transition:{duration:j,ease:"linear"}})})]}),u.jsx(Rs,{onClick:Cp,className:"bg-white hover:bg-[#FAF3E8] text-[#1B4D1B] border border-[#1B4D1B]/20 px-6 py-3 text-sm rounded-full",children:"End Session"})]})}),document.body),J&&u.jsx(kPe,{sets:oo.current,totalDurationSeconds:hl.current,onRestart:X2}),G&&!J&&u.jsxs("div",{ref:os,className:`w-full relative ${b?"h-screen":"h-96 md:h-[500px]"}`,children:[u.jsxs("a",{href:"tel:988",className:`${b?"fixed":"absolute"} bottom-3 right-3 z-40 text-xs text-[#1B4D1B]/40 hover:text-[#1B4D1B]/70 transition-opacity`,children:["Need support? ",u.jsx("span",{className:"underline",children:"988"})]}),$&&u.jsx("div",{className:`${b?"fixed":"absolute"} top-3 left-3 z-40 px-3 py-1.5 rounded-full bg-white/80 backdrop-blur-sm border border-[#7C9885]/20 text-xs font-semibold text-[#1B4D1B]`,children:$}),qr&&b&&u.jsxs("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-40 w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm border border-[#7C9885]/20 shadow-sm flex items-center justify-center",children:[u.jsxs("svg",{className:"absolute inset-0 w-full h-full transform -rotate-90",viewBox:"0 0 100 100",children:[u.jsx("circle",{cx:"50",cy:"50",r:"42",fill:"none",stroke:"#E8E4E0",strokeWidth:"10"}),u.jsx("circle",{cx:"50",cy:"50",r:"42",fill:"none",stroke:"#4A90A4",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*42}`,strokeDashoffset:`${2*Math.PI*42*(1-tt/(cr.current||o))}`,className:"transition-all duration-500 ease-linear"})]}),u.jsx("span",{className:"relative text-[10px] font-bold text-[#1B4D1B] leading-none",children:Dn(tt).value})]}),u.jsxs("div",{className:`${b?"fixed":"absolute"} top-3 right-3 z-40 flex items-center gap-2`,children:[b&&u.jsxs("button",{onClick:()=>{Fe||(Kr(!1),Ba(!1),qa(!1),we(!1)),xt(Ne=>!Ne)},className:"flex items-center gap-2 px-4 py-2.5 rounded-full bg-[#F4A28C] hover:bg-[#e8927a] text-white font-semibold text-sm shadow-lg hover:shadow-xl transition-all",title:Fe?"Hide Modules":"Show Modules",children:[Fe?u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3.98 8.223A10.477 10.477 0 001.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}):u.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Fe?"Hide":"Show"," Modules"]}),u.jsx("button",{onClick:w,className:`flex items-center gap-2 px-4 py-2.5 rounded-full font-semibold text-sm shadow-lg hover:shadow-xl transition-all ${b?"bg-[#F4A28C] hover:bg-[#e8927a] text-white":"bg-white/60 hover:bg-white/90 text-[#1B4D1B]/50 hover:text-[#1B4D1B]"}`,title:b?"Exit Full Screen":"Full Screen",children:b?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})}),"Exit"]}):u.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M2
50710.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})})]}),u.jsx("div",{ref:fa,className:"absolute left-0 pointer-events-none",style:{top:b?"35%":"50%",transform:"translateY(-50%)",width:`${Xr*2}px`,height:`${Xr*2}px`,borderRadius:"50%",backgroundColor:lPe,zIndex:10}})]}),G&&!J&&_n&&(!b||Fe)&&(()=>{const Ne=is,Pe=lr,Ve=pi,Ge=fi,Ct=(qr?Ne:!0)&&Pe&&Ve;return u.jsxs("div",{className:`flex flex-col items-center ${b?"fixed bottom-4 left-0 right-0 z-30 max-h-[70vh] overflow-y-auto px-4":"gap-6"}`,children:[u.jsxs("div",{className:`flex justify-center gap-4 flex-wrap ${Ct?"items-stretch":"items-start"} ${b?"gap-3":""}`,children:[qr&&u.jsxs("div",{className:`bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl p-5 shadow-sm w-80 cursor-pointer transition-all duration-200 flex flex-col ${Ne?"min-h-[280px]":"min-h-[140px]"}`,onClick:nt=>{nt.target.closest("button")||Kr(!is)},children:[u.jsxs("div",{className:`flex items-center gap-2 ${Ne?"mb-5":"mb-4"}`,children:[u.jsxs("svg",{className:"w-5 h-5 text-[#4A90A4]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("polyline",{points:"12,6 12,12 16,14"})]}),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"SET TIMER"}),a!=null&&a>1&&u.jsxs("span",{className:"text-xs text-[#1B4D1B]/50",children:["Set ",U+1," of ",a]}),u.jsx("span",{className:"ml-auto text-xs px-2 py-1 rounded-full bg-[#7C9885]/20 text-[#7C9885]",children:"Active"}),u.jsx("svg",{className:`w-4 h-4 text-[#7C9885] transition-transform duration-200 ${Ne?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[!Ne&&u.jsxs("div",{className:"flex items-center justify-between gap-4",children:[u.jsxs("div",{className:"relative w-10 h-10 flex-shrink-0",children:[u.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 100 100",children:[u.jsx("circle",{cx:"50",cy:"50",r:"42",fill:"none",stroke:"#E8E4E0",strokeWidth:"12"}),u.jsx("circle",{cx:"50",cy:"50",r:"42",fill:"none",stroke:"#4A90A4",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*42}`,strokeDashoffset:`${2*Math.PI*42*(1-tt/(cr.current||o))}`,className:"transition-all duration-500 ease-linear"})]}),u.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:u.jsx("span",{className:"text-[10px] font-bold text-[#1B4D1B]",children:Dn(tt).value})})]}),u.jsx(Rs,{onClick:nt=>{nt.stopPropagation(),Np()},className:"flex-1 bg-[#C9897A] hover:bg-[#B87869] text-white",children:"Stop Set"})]}),Ne&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-center gap-6 mb-4",children:[u.jsx("div",{className:"relative w-20 h-28",children:u.jsxs("svg",{className:"w-full h-full",viewBox:"0 0 60 84",children:[u.jsx("path",{d:"M5 4 H55 V12 L30 42 L5 12 V4 Z",fill:"none",stroke:"#E8E4E0",strokeWidth:"3"}),u.jsx("path",{d:"M5 80 H55 V72 L30 42 L5 72 V80 Z",fill:"none",stroke:"#E8E4E0",strokeWidth:"3"}),u.jsx("clipPath",{id:"topClip",children:u.jsx("path",{d:"M8 7 H52 V12 L30 39 L8 12 V7 Z"})}),u.jsx("rect",{x:"8",y:7+32*(1-tt/(cr.current||o)),width:"44",height:32*(tt/(cr.current||o)),fill:"#4A90A4",clipPath:"url(#topClip)",className:"transition-all duration-500 ease-linear"}),u.jsx("clipPath",{id:"bottomClip",children:u.jsx("path",{d:"M8 77 H52 V72 L30 45 L8 72 V77 Z"})}),u.jsx("rect",{x:"8",y:77-32*(1-tt/(cr.current||o)),width:"44",height:32*(1-tt/(cr.current||o)),fill:"#4A90A4",clipPath:"url(#bottomClip)",className:"transition-all duration-500 ease-linear"}),tt>0&&tt<(cr.current||o)&&u.jsx("line",{x1:"30",y1:"39",x2:"30",y2:"45",stroke:"#4A90A4",strokeWidth:"2",className:"animate-pulse"})]})}),u.jsxs("div",{className:"text-left",children:[u.jsx("span",{className:"text-3xl font-bold text-[#1B4D1B]",children:Dn(tt).value}),u.jsx("span",{className:"text-sm text-[#7C9885] ml-1",children:Dn(tt).unit}),u.jsxs("div",{className:"text-lg font-semibold text-[#4A90A4]",children:[Math.round(tt/(cr.current||o)*100),"% remaining"]})]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(Rs,{onClick:nt=>{nt.stopPropagation(),ur.current=ur.current+3e4,cr.current=cr.current+30}
5071,className:"flex-1 bg-[#7C9885] hover:bg-[#6B8572] text-white",children:"+30s"}),u.jsx(Rs,{onClick:nt=>{nt.stopPropagation(),Np()},className:"flex-1 bg-[#C9897A] hover:bg-[#B87869] text-white",children:"Stop Set"})]})]})]})]}),u.jsxs("div",{className:`bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl p-5 shadow-sm w-80 cursor-pointer transition-all duration-200 flex flex-col ${Pe?"min-h-[280px]":"min-h-[140px]"}`,onClick:()=>Ba(!lr),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsxs("svg",{className:"w-5 h-5 text-[#1B4D1B]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("polyline",{points:"12,6 12,12 16,14"})]}),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"BLS SPEED"}),u.jsx("span",{className:"ml-auto text-xs text-[#7C9885] bg-[#7C9885]/10 px-2 py-1 rounded-full",children:"Auto-adjusting"}),u.jsx("svg",{className:`w-4 h-4 text-[#7C9885] transition-transform duration-200 ${Pe?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[u.jsxs("div",{className:Pe?"mb-4":"",children:[u.jsxs("div",{className:"flex justify-between mb-2",children:[u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Slow"}),u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Fast"})]}),u.jsx("div",{className:"flex gap-1.5",children:Array.from({length:10},(nt,pt)=>{const it=Math.max(1,Math.min(10,Math.round((ct-oa)/(Ur-oa)*9)+1)),Mt=pt<it,Vt=gn=>Mt?gn<3?"#7C9885":gn<5?"#C4B5A6":gn<7?"#D4A89A":"#C9897A":"#E8E4E0";return u.jsx("div",{className:"flex-1 h-2.5 rounded-full transition-all duration-300",style:{backgroundColor:Vt(pt)}},pt)})})]}),Pe&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"flex justify-center",children:u.jsxs("div",{className:"relative w-28 h-28",children:[u.jsx("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 100 100",children:(()=>{const gn=Math.max(1,Math.min(10,Math.round((ct-oa)/(Ur-oa)*9)+1)),_a=(tn,Fn)=>Fn?tn<3?"#7C9885":tn<5?"#C4B5A6":tn<7?"#D4A89A":"#C9897A":"#E8E4E0";return Array.from({length:10},(tn,Fn)=>{const ja=Fn*36,fl=ja+33,_c=Fn<gn,gi=ja*Math.PI/180,xn=fl*Math.PI/180,Un=42,Li=50,jc=50,Dc=Li+Un*Math.cos(gi),g0=jc+Un*Math.sin(gi),x0=Li+Un*Math.cos(xn),tu=jc+Un*Math.sin(xn);return u.jsx("path",{d:`M ${Dc} ${g0} A ${Un} ${Un} 0 0 1 ${x0} ${tu}`,fill:"none",stroke:_a(Fn,_c),strokeWidth:"8",strokeLinecap:"round"},Fn)})})()}),u.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[u.jsx("span",{className:"text-3xl font-bold text-[#1B4D1B]",children:Math.max(1,Math.min(10,Math.round((ct-oa)/(Ur-oa)*9)+1))}),u.jsx("span",{className:"text-xs text-[#7C9885]",children:ct<=65?"Slow":ct<=90?"Moderate":"Fast"})]})]})}),u.jsxs("p",{className:"text-center text-sm text-[#7C9885] mt-3",children:[ct," BPM"]})]})]})]}),u.jsxs("div",{className:`bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl shadow-sm w-80 cursor-pointer transition-all duration-200 p-5 flex flex-col ${Ve?"min-h-[280px]":"min-h-[140px]"}`,onClick:()=>qa(!pi),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[Gs(Ja(),"w-5 h-5"),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"FACIAL EXPRESSION"}),u.jsx("span",{className:`ml-auto text-xs px-2 py-1 rounded-full ${Ue?"bg-[#7C9885]/20 text-[#7C9885]":bn?"bg-red-100 text-red-400":"bg-[#C4B5A6]/20 text-[#C4B5A6]"}`,children:Ue?"Detecting":bn?"No Face":"Waiting"}),u.jsx("svg",{className:`w-4 h-4 text-[#7C9885] transition-transform duration-200 ${Ve?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[u.jsxs("div",{className:Ve?"mb-4":"",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Emotional Activation"}),u.jsx("span",{className:"text-sm font-medium text-[#1B4D1B]",children:Ue?(()=>{const nt=["happy","sad","angry","fearful","disgusted","surprised"].reduce((pt,it)=>pt+(Ue[it]||0),0);return`${Math.round(nt*100)}%`})():"0%"})]}),u.jsx("div",{className:"h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300 bg-[#C9897A]",style:{width:Ue?(()=>{const nt=["happy","sad","angry","fearful","disgusted","surprised"].reduce((pt,it)=>pt+(Ue[it]||0),0);return`${Math.round(nt*100)}%`})():"0%"}}
5071)})]}),Ve&&u.jsx(u.Fragment,{children:u.jsx("div",{className:"space-y-2",children:["neutral","happy","sad","angry","fearful","disgusted","surprised"].map(nt=>{const pt=Ue&&Ue[nt]||0,it=Math.round(pt*100);return u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-xs text-[#7C9885] w-16 capitalize",children:nt}),u.jsx("div",{className:"flex-1 h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${it}%`,backgroundColor:hy[nt]||"#9CA3AF"}})}),u.jsxs("span",{className:"text-xs text-[#1B4D1B] w-8 text-right",children:[it,"%"]})]},nt)})})})]})]})]}),u.jsxs("div",{className:"flex justify-center gap-4 flex-wrap",children:[u.jsxs("div",{className:`bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl shadow-sm w-80 cursor-pointer transition-all duration-200 p-5 ${Ge?"min-h-[280px]":"min-h-[140px]"}`,onClick:()=>we(!fi),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsxs("svg",{className:`w-5 h-5 transition-colors duration-300 ${Qe?"text-[#4A90A4]":"text-[#C4B5A6]"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z",fill:Qe?"currentColor":"none"}),u.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),u.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),u.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"VOICE EMOTION"}),u.jsx("span",{className:`ml-auto text-xs px-2 py-1 rounded-full ${Qe?"bg-[#4A90A4]/20 text-[#4A90A4]":"bg-[#C4B5A6]/20 text-[#C4B5A6]"}`,children:Qe?"Detecting":"Waiting"}),u.jsx("svg",{className:`w-4 h-4 text-[#7C9885] transition-transform duration-200 ${Ge?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u.jsxs("div",{className:Ge?"mb-4":"",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Emotional Activation"}),u.jsx("span",{className:"text-sm font-medium text-[#1B4D1B]",children:Qe?(()=>{const nt=["happy","sad","angry","fearful","disgusted","surprised"].reduce((pt,it)=>pt+(Qe[it]||0),0);return`${Math.round(nt*100)}%`})():"0%"})]}),u.jsx("div",{className:"h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300 bg-[#C9897A]",style:{width:Qe?(()=>{const nt=["happy","sad","angry","fearful","disgusted","surprised"].reduce((pt,it)=>pt+(Qe[it]||0),0);return`${Math.round(nt*100)}%`})():"0%"}})})]}),Ge&&u.jsx(u.Fragment,{children:u.jsx("div",{className:"space-y-2",children:["neutral","happy","sad","angry","fearful","disgusted","surprised"].map(nt=>{const pt=Qe&&Qe[nt]||0,it=Math.round(pt*100);return u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-xs text-[#7C9885] w-16 capitalize",children:nt}),u.jsx("div",{className:"flex-1 h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${it}%`,backgroundColor:hy[nt]||"#9CA3AF"}})}),u.jsxs("span",{className:"text-xs text-[#1B4D1B] w-8 text-right",children:[it,"%"]})]},nt)})})})]}),u.jsxs("div",{className:"relative bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl p-5 shadow-sm w-80 opacity-50",children:[u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#FDF7F3]/90 rounded-2xl z-10 backdrop-blur-sm",children:u.jsxs("div",{className:"text-center",children:[u.jsxs("svg",{className:"w-12 h-12 text-[#C9897A] mx-auto mb-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14,2 14,8 20,8"}),u.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),u.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),u.jsx("polyline",{points:"10,9 9,9 8,9"})]}),u.jsx("div",{className:"text-lg font-bold text-[#1B4D1B]",children:"Coming Soon"}),u.jsx("div",{className:"text-sm text-[#7C9885]",children:"Choice of words analysis"})]})}),u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsxs("svg",{className:"w-5 h-5 text-[#C9897A]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14,2 14,8 20,8"}),u.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),u.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"CHOICE OF WORDS"}),u.jsx("span",{className:"ml-auto text-xs px-2 py-1 rounded-full bg-[#C4B5A6]/20 text-[#C4B5A6]",children:"Disabled"})]}),u.jsxs("div",{className:"mb-4",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Word Sentiment"}),u.jsx("span",{className:"text-sm font-medium text-[#1B4D1B]",children:"0%"})]}),u.jsx("div",{className:"h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300 bg-[#C9897A]",style:{width:"0%"}})})]})]}),u.jsxs("div",{className:"relative bg-[#FDF7F3] border border-[#7C9885]/30 rounded-2xl p-5 shadow-sm w-80 opacity-50",children:[u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#FDF7F3]/90 rounded-2xl z-10 backdrop-blur-sm",children:u.jsxs("div",{className:"text-center",children:[u.jsxs("svg",{className:"w-12 h-12 text-[#8B5CF6] mx-auto mb-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("path",{d:"M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5z"}),u.jsx("path",{d:"m12 2 3.5 3.5L12 9 8.5 5.5 12 2z"}),u.jsx("path",{d:"M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5z"}),u.jsx("path",{d:"m12 15 3.5 3.5L12 22l-3.5-3.5L12 15z"})]}),u.jsx("div",{className:"text-lg font-bold text-[#1B4D1B]",children:"Coming Soon"}),u.jsx("div",{className:"text-sm text-[#7C9885]",children:"Body language detection"})]})}),u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsxs("svg",{className:"w-5 h-5 text-[#8B5CF6]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("path",{d:"M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5z"}),u.jsx("path",{d:"m12 2 3.5 3.5L12 9 8.5 5.5 12 2z"}),u.jsx("path",{d:"M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5z"}),u.jsx("path",{d:"m12 15 3.5 3.5L12 22l-3.5-3.5L12 15z"})]}),u.jsx("span",{className:"text-xs text-[#1B4D1B] font-semibold",children:"BODY LANGUAGE"}),u.jsx("span",{className:"ml-auto text-xs px-2 py-1 rounded-full bg-[#C4B5A6]/20 text-[#C4B5A6]",children:"Disabled"})]}),u.jsxs("div",{className:"mb-4",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-sm text-[#7C9885]",children:"Posture Analysis"}),u.jsx("span",{className:"text-sm font-medium text-[#1B4D1B]",children:"0%"})]}),u.jsx("div",{className:"h-2 bg-[#E8E4E0] rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-300 bg-[#8B5CF6]",style:{width:"0%"}})})]})]})]})]})})(),_e&&u.jsx(CPe,{onDismiss:Sp}),Ye&&u.jsx(EPe,{onSelect:Ne=>{ze(Ne),ft(!1);const Pe=Ta.current;try{localStorage.setItem(`bls_session_rating_${Pe||Date.now()}`,JSON.stringify({sessionId:Pe,emoji:Ne,timestamp:new Date().toISOString()}))}catch{}!(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&Pe&&fetch("/.netlify/functions/save-session-rating",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Pe,emoji:Ne,timestamp:new Date().toISOString()})}).catch(Ge=>console.error("[SESSION] Error saving rating:",Ge))},onSkip:()=>ft(!1)}),pe&&(()=>{const Ne=[{text:"Remove hair from your face so the camera can read your expressions clearly.",icon:u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15.182 15.182a4.5 4.5 0 01-6.364 0M21 12a9 9 0 11-18 0 9 9 0 0118 0zM9.75 9.75c0 .414-.168.75-.375.75S9 10.164 9 9.75 9.168 9 9.375 9s.375.336.375.75zm-.375 0h.008v.015h-.008V9.75zm5.625 0c0 .414-.168.75-.375.75s-.375-.336-.375-.75.168-.75.375-.75.375.336.375.75zm-.375 0h.008v.015h-.008V9.75z"})})},{text:"Remove glasses if possible — they can interfere with facial detection.",icon:u.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})},{text:"Center your face on your camera. Make sure the BLS dot is on the same screen as your camera.",icon:u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7.5 3.75H6A2.25 2.25 0 003.75 6v1.5M16.5 3.75H18A2.25 2.25 0 0120.25 6v1.5M20.25 16.5V18A2.25 2.25 0 0118 20.25h-1.5M3.75 16.5V18A2.25 2.25 0 006 20.25h1.5M12 9v.008M12 12v.008M12 15v.008"})})},{text:"Make sure you're in a well-lit room so your face is clearly visible.",icon:u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18v-5.25m0 0a6.01 6.01 0 001.5-.189m-1.5.189a6.01 6.01 0 01-1.5-.189m3.75 7.478a12.06 12.06 0 01-4.5 0m3.75 2.383a14.406 14.406 0 01-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 10-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})})},{text:"Don't be afraid to show your emotions — the more expressive you are, the better the session adapts to you.",icon:u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"})})}];return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-[#FAF3E8] p-4",children:u.jsxs("div",{className:"bg-white rounded-xl shadow-2xl px-6 py-6 md:px-10 md:py-10 w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[u.jsx("h3",{className:"font-serif text-3xl md:text-4xl mb-2 text-[#1B4D1B] text-center",children:U>0?"Before Your Next Set":"Before You Begin"}),u.jsx("p",{className:"text-base text-[#1B4D1B]/50 text-center mb-6 md:mb-8",children:U>0?"Quick reminder for the best experience":"Follow these tips for the best experience"}),u.jsx("div",{className:"space-y-4 md:space-y-5 mb-6 md:mb-10",children:Ne.map((Pe,Ve)=>u.jsxs("div",{className:`flex items-start gap-4 transition-all duration-500 ${Ve<=xe?"opacity-100":"opacity-20"}`,children:[u.jsx("div",{className:`mt-0.5 w-8 h-8 rounded-full shrink-0 flex items-center justify-center transition-all duration-500 ${Ve===xe?"bg-[#F4A28C] text-white":Ve<xe?"bg-[#7C9885] text-white":"bg-[#E8E4E0] text-[#1B4D1B]/30"}`,children:Ve<xe?u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 14 14",fill:"none",children:u.jsx("path",{d:"M3 7L6 10L11 4",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):u.jsx("span",{className:"scale-75",children:Pe.icon})}),u.jsx("p",{className:`text-base transition-colors duration-500 ${Ve<=xe?"text-[#1B4D1B]":"text-[#1B4D1B]/30"}`,children:Pe.text})]},Ve))}),u.jsx("div",{className:"text-center",children:xe<Ne.length-1?u.jsx("button",{onClick:()=>Ie(Pe=>Pe+1),className:"text-base text-[#7C9885] hover:text-[#6B8572] font-medium transition-colors",children:"Next"}
5071):u.jsx(Rs,{onClick:Ac,className:"bg-[#7C9885] hover:bg-[#6B8572] text-white px-10 py-5 text-lg rounded-full shadow-md hover:shadow-lg transition-all",children:"I'm Ready"})})]})})})()]})}function CPe({onDismiss:e}){const t=["Follow the dot with your eyes","Think about something that's been on your mind","Breathe naturally — we'll guide you between sets"],r=.5+(t.length-1)*2.2,i=Math.round((r+2.4)*1e3);return D.useEffect(()=>{const o=setTimeout(e,i);return()=>clearTimeout(o)},[e,i]),u.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-[#FAF3E8] cursor-pointer",onClick:e,role:"button",tabIndex:0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&e()},children:u.jsxs(qe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.6,ease:"easeOut"},className:"max-w-md mx-6 text-center space-y-6",children:[t.map((o,l)=>u.jsx(qe.p,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.5+l*2.2,duration:.9,ease:"easeOut"},className:"font-serif text-2xl md:text-3xl text-[#1B4D1B] leading-relaxed",children:o},l)),u.jsx(qe.p,{initial:{opacity:0}
5071,animate:{opacity:1},transition:{delay:r+.6,duration:.6},className:"text-xs text-[#1B4D1B]/40 tracking-wide uppercase pt-4",children:"Tap anywhere to begin"})]})})}function EPe({onSelect:e,onSkip:t}){const n=[{emoji:"😫",label:"Very unwell"},{emoji:"😕",label:"Somewhat unwell"},{emoji:"😐",label:"Neutral"},{emoji:"🙂",label:"Somewhat well"},{emoji:"😌",label:"Very well"}];return u.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-[#FAF3E8]",children:u.jsxs(qe.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"bg-white rounded-3xl shadow-2xl px-8 py-10 md:px-12 md:py-12 max-w-lg mx-4 text-center",children:[u.jsx("h3",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B] mb-8",children:"How do you feel?"}),u.jsx("div",{className:"flex items-center justify-center gap-3 md:gap-5 mb-8",children:n.map(a=>u.jsx("button",{onClick:()=>e(a.emoji),"aria-label":a.label,className:"text-4xl md:text-5xl w-14 h-14 md:w-16 md:h-16 rounded-full flex items-center justify-center hover:bg-[#FAF3E8] hover:scale-110 transition-all focus:outline-none focus:ring-2 focus:ring-[#7C9885]",children:a.emoji},a.emoji))}),u.jsx("button",{onClick:t,className:"text-sm text-[#1B4D1B]/50 hover:text-[#1B4D1B]/80 underline underline-offset-4 transition-colors",children:"Skip"})]})})}function IPe({onShowIntro:e,onFullscreenChange:t,isAuthenticated:n}){const[a,r]=D.useState("config"),[s,i]=D.useState(!1),[o,l]=D.useState(""),[d,c]=D.useState(!1),[f,m]=D.useState(""),[x,y]=D.useState(!1),[b,w]=D.useState(!1),[S,k]=D.useState(()=>typeof window<"u"?window.innerWidth<768:!1),[C,E]=D.useState(30),[T,_]=D.use
5071State("seconds"),[A,$]=D.useState(60),[O,z]=D.useState(oa),[P,j]=D.useState(Ur),[G,X]=D.useState($l.count),[J,V]=D.useState($l.durationSeconds),[Q,F]=D.useState($l.restSeconds),[H,B]=D.useState([]),[Y,ne]=D.useState(null),[ee,U]=D.useState(null),[oe,pe]=D.useState("calm_down"),he=D.useRef(null),xe=D.useRef(null),Ie=D.useRef(null),_e=D.useRef(null),Oe=D.useRef(null),Ye=D.useRef(!1),ft=D.useRef(!1),ze=D.useRef(!0),[ct,ot]=D.useState(0),tt=()=>T==="minutes"?C*60:C,Tt=()=>{document.fullscreenElement?document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen().catch(()=>{})},bn=async()=>{if(ze.current)try{_e.current&&(_e.current.getTracks().forEach($e=>$e.stop()),_e.current=null),he.current&&(he.current.srcObject=null);const Be=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}}),lt=he.current;lt?(lt.srcObject=Be,_e.current=Be,lt.onloadedmetadata=()=>{lt.play().catch($e=>{console.error("[CAMERA] Error playing video after metadata loaded:",$e)})},lt.onerror=$e=>{console.error("[CAMERA] Video error:",$e)},i(!0),l("")):(console.error("[CAMERA] videoRef.current is null!"),Be.getTracks().forEach($e=>$e.stop()))}catch(Be){console.error("[CAMERA] Error accessing camera:",Be),i(!1),Be.name==="NotAllowedError"||Be.name==="PermissionDeniedError"?l("Camera blocked. Click the lock icon in your address bar to allow access, then reload the page."):Be.name==="NotFoundError"||Be.name==="DevicesNotFoundError"?l("No camera found. Please connect a camera to use this feature."):Be.name==="NotReadableError"||Be.name==="TrackStartError"?l("Camera is being used by another application. Please close other apps using the camera."):Be.name==="OverconstrainedError"?l("Camera constraints cannot be satisfied. Trying with default settings..."):l("Unable to access camera. Please check your camera settings.")}},Ut=async()=>{if(ze.current)try{const Be=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:16e3}});Oe.current=Be,c(!0),m("")}catch(Be){if(console.error("[MICROPHONE] Error accessing microphone:",Be),c(!1),Be.name==="NotAllowedError"||Be.name==="PermissionDeniedError"){const lt=typeof navigator<"u"?navigator.userAgent:"",$e=/iPhone|iPad|iPod|Android/i.test(lt);let Ue=!1;if($e)try{Ue=(await navigator.permissions.query({name:"microphone"})).state==="prompt"}catch{}if(Ue){const dt=await $H(),Qe=dt?.browser||"your browser";dt?.platform==="ios"||dt?.platform==="android"?m(`Microphone blocked at the system level. Open Settings → Apps → ${Qe} → Microphone to allow access.`):m("Microphone blocked at the system level. Enable microphone access for this browser in your device settings.")}else m("Microphone blocked. Click the lock icon in your address bar to allow access, then reload the page.")}else Be.name==="NotFoundError"||Be.name==="DevicesNotFoundError"?m("No microphone found. Please connect a microphone to enable voice emotion detection."):Be.name==="NotReadableError"||Be.name==="TrackStartError"?m("Microphone is being used by another application. Please close other apps using the microphone."):Be.name==="OverconstrainedError"?m("Microphone constraints cannot be satisfied. Trying with default settings..."):m("Unable to access microphone. Please check your microphone settings.")}},Tn=async()=>{if(ze.current)try{_e.current&&(_e.current.getTracks().forEach(Ue=>Ue.stop()),_e.current=null),he.current&&(he.current.srcObject=null),Oe.current&&(Oe.current.getTracks().forEach(Ue=>Ue.stop()),Oe.current=null);const Be=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:16e3}}),lt=Be.getVideoTracks(),$e=Be.getAudioTracks();if(lt.length>0){const Ue=new MediaStream(lt),dt=he.current;dt?(dt.srcObject=Ue,_e.current=Ue,dt.onloadedmetadata=()=>{dt.play().catch(Qe=>{console.error("[CAMERA] Error playing video after metadata loaded:",Qe)})},dt.onerror=Qe=>{console.error("[CAMERA] Video error:",Qe)},i(!0),l("")):(console.error("[CAMERA] videoRef.current is null!"),lt.forEach(Qe=>Qe.stop()))}$e.length>
50710&&(Oe.current=new MediaStream($e),c(!0),m(""))}catch(Be){console.error("[MEDIA] Combined getUserMedia failed; falling back to individual requests:",Be),await bn(),await Ut()}},Nn=async()=>{await Tn()},Pn=()=>{ze.current=!1;const Be=_e.current||he.current&&he.current.srcObject;Be&&Be.getTracks().forEach($e=>{$e.readyState!=="ended"&&$e.stop()}),he.current&&(he.current.paused||he.current.pause(),he.current.srcObject=null),_e.current=null;const lt=Oe.current;lt&&lt.getTracks().forEach($e=>$e.stop()),Oe.current=null,i(!1),c(!1)};D.useEffect(()=>{if(!he.current){const Be=document.createElement("video");Be.autoplay=!0,Be.playsInline=!0,Be.muted=!0,he.current=Be}},[]),D.useEffect(()=>{const Be=he.current;Be&&(a==="config"&&s&&xe.current?(Be.className="absolute inset-0 w-full h-full rounded-xl object-cover scale-x-[-1]",Be.parentNode!==xe.current&&xe.current.appendChild(Be),Be.style.transform="translateZ(0)",requestAnimationFrame(()=>{Be.style.transform="",Be.paused&&Be.readyState>=2&&Be.play().catch(()=>{})})):Ie.current&&(Be.className="fixed top-0 left-0 w-[1px] h-[1px] opacity-0 pointer-events-none z-[-1]",Be.parentNode!==Ie.current&&Ie.current.appendChild(Be)))},[s,a]),D.useEffect(()=>{if(Ye.current||x)return;Ye.current=!0,(async()=>{try{const lt="https://cdn.jsdelivr.net/npm/@vladmandic/face-api/model/";await Promise.all([fs.tinyFaceDetector.loadFromUri(lt),fs.faceLandmark68Net.loadFromUri(lt),fs.faceRecognitionNet.loadFromUri(lt),fs.faceExpressionNet.loadFromUri(lt)]),y(!0)}catch(lt){console.error("[MODELS] Error loading models from CDN:",lt);try{const $e="https://raw.githubusercontent.com/vladmandic/face-api/main/model/";await Promise.all([fs.tinyFaceDetector.loadFromUri($e),fs.faceLandmark68Net.loadFromUri($e),fs.faceRecognitionNet.loadFromUri($e),fs.faceExpressionNet.loadFromUri($e)]),y(!0)}catch($e){console.error("[MODELS] Error loading models from alternative source:",$e),l("Unable to load emotion detection models. Please check your internet connection.")}}})()},[x]),D.useEffect(()=>{if(x)return Tn(),()=>{if(ft.current)return;const Be=_e.current||he.current&&he.current.srcObject;Be&&Be.getTracks().forEach($e=>$e.stop()),he.current&&(he.current.srcObject=null),_e.current=null;const lt=Oe.current;lt&&lt.getTracks().forEach($e=>$e.stop()),Oe.current=null}},[x,ct]),D.useEffect(()=>{const Be=()=>{const Qe=_e.current;Qe&&(Qe.getTracks().forEach(Bn=>Bn.stop()),_e.current=null),he.current&&(he.current.srcObject=null);const An=Oe.current;An&&(An.getTracks().forEach(Bn=>Bn.stop()),Oe.current=null),i(!1),c(!1)},lt=()=>{x&&Tn()},$e=()=>{document.visibilityState==="hidden"?Be():document.visibilityState==="visible"&&lt()},Ue=()=>Be(),dt=()=>{document.visibilityState==="visible"&&lt()};return document.addEventListener("visibilitychange",$e),window.addEventListener("pagehide",Ue),window.addEventListener("pageshow",dt),()=>{document.removeEventListener("visibilitychange",$e),window.removeEventListener("pagehide",Ue),window.removeEventListener("pageshow",dt)}},[x]),D.useEffect(()=>{const Be=[],lt=async()=>{try{const dt=await navigator.permissions.query({name:"camera"}),Qe=()=>{dt.state==="granted"?bn():(i(!1),dt.state==="denied"&&l("Camera access was revoked. Click to grant access again."))};dt.addEventListener("change",Qe),Be.push(()=>dt.removeEventListener("change",Qe))}catch{}},$e=async()=>{try{const dt=await navigator.permissions.query({name:"microphone"}),Qe=()=>{dt.state==="granted"?Ut():(c(!1),dt.state==="denied"&&m("Microphone access was revoked. Click to grant access again."))};dt.addEventListener("change",Qe),Be.push(()=>dt.removeEventListener("change",Qe))}catch{}},Ue=(dt,Qe)=>{const An=dt.current;An&&An.getTracks().forEach(Bn=>{const Ga=()=>{Qe(!1)};Bn.addEventListener("ended",Ga),Be.push(()=>Bn.removeEventListener("ended",Ga))})};return lt(),$e(),Ue(_e,i),Ue(Oe,c),()=>Be.forEach(dt=>dt())},[s,d]),D.useEffect(()=>{const Be=()=>{const lt=!!document.fullscreenElement;w(lt),t?.(lt)};return document.addEventListener("fullscreenchange",Be),()=>document.removeEventListener("fullscreenchange",Be)},[t]),D.useEffect(()=>{const Be=()=>k(window.innerWidth<768);return Be(),window.addEventListener("resize",Be),()=>window.removeEventListener("resize",Be)},[]);const sa=({sessionId:Be,setId:lt})=>{ne(Be),U(lt),r("session")},pa=()=>{ft.current=!0,ze.current=!0,i(!1),l(""),c(!1),m(""),$(60),z(oa),j(Ur),X($l.count),V($l.durationSeconds),F($l.restSeconds),B([]),pe(null),ne(null),U(null),r("config"),setTimeout(()=>{ot(Be=>(setTimeout(()=>{ft.current=!1},500),Be+1))},300)};return u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:oPe,className:`text-center text-[#1B4D1B] ${a==="session"?"space-y-4":"space-y-0"}`,children:[a==="config"?u.jsx(vPe,{cameraAccess:s,cameraError:o,setCameraError:l,microphoneAccess:d,microphoneError:f,setMicrophoneError:m,requestCamera:bn,requestMicrophone:Ut,requestCameraAndMicrophone:Tn,modelsLoaded:x,videoRef:he,videoContainerRef:xe,audioStreamRef:Oe,sessionDuration:C,setSessionDuration:E,sessionDurationUnit:T,setSessionDurationUnit:_,bpm:A,setBpm:$,minBpm:O,setMinBpm:z,maxBpm:P,setMaxBpm:j,numberOfSets:G,setNumberOfSets:X,setDurationSeconds:J,setSetDurationSeconds:V,restDurationSeconds:Q,setRestDurationSeconds:F,setRestPrompts:B,isFullscreen:b,toggleFullscreen:Tt,isAuthenticated:n,onShowIntro:e,isMobile:S,onStartSession:sa,selectedPreset:oe,setSelectedPreset:pe}):u.jsx(NPe,{initialBpm:A,minBpm:O,maxBpm:P,numberOfSets:G,setDurationSeconds:J,restDurationSeconds:Q,restPrompts:H,sessionDurationSeconds:tt(),cameraAccess:s,microphoneAccess:d,reacquireMedia:Nn,videoRef:he,videoHiddenContainerRef:Ie,audioStreamRef:Oe,mediaStreamRef:_e,modelsLoaded:x,isFullscreen:b,toggleFullscreen:Tt,isMobile:S,initialSessionId:Y,initialSetId:ee,onRestart:pa,onFullscreenChange:t,setCameraAccess:i,onStopMedia:Pn,presetName:oe?Qx[oe]?.name:null}),u.jsx("div",{ref:Ie})]})}const TPe={hidden:{opacity:0}
5071,visible:{opacity:1}},APe={hidden:{opacity:0,scale:.95,y:20},visible:{opacity:1,scale:1,y:0,transition:{duration:.3,ease:"easeOut"}},exit:{opacity:0,scale:.95,y:20,transition:{duration:.2}}},_Pe=1,RB={monthly:{amount:"$8",label:"/month"},yearly:{amount:"$72",label:"/year"}},jPe={monthly:"/month",yearly:"/year"};function DPe({isOpen:e,onClose:t,onChoiceMade:n,freeSessionsUsed:a=0}){const[r,s]=D.useState(!1),[i,o]=D.useState(null),[l,d]=D.useState(""),[c,f]=D.useState("individual"),[m,x]=D.useState(o0),y=Math.max(0,_Pe-a),b=y>0,w=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),S=_=>c==="enterprise"?`$${l0(m,_)}`:RB[_].amount,k=_=>c==="enterprise"?jPe[_]:RB[_].label,C=async _=>{const A=Wa();if(A){if(w){alert(`Localhost: Organization code "${_}" applied!`),n("enterprise_code");return}try{await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:A,code:_})}),n("enterprise_code")}catch{}}},E=async _=>{if(s(!0),o(_),d(""),w){localStorage.removeItem("solta_localhost_bls_set_count"),n(_),s(!1),o(null);return}try{const A=Wa(),$=ti();if(!$){d("Please log in to subscribe."),s(!1),o(null);return}const O=await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$,userId:A,priceId:i0(c,_),accountType:c,...c==="enterprise"&&{seats:m}})}),z=await O.json();O.ok&&z.url?(localStorage.setItem("solta_subscription_choice",JSON.stringify({plan:_,email:ti(),timestamp:new Date().toISOString()})),window.location.href=z.url):d(z.error||"Something went wrong. Please try again.")}catch{d("An error occurred. Please try again.")}finally{s(!1),o(null)}},T=()=>{n("free")};return e?u.jsx(CI,{children:e&&u.jsxs(qe.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-4",initial:"hidden",animate:"visible",exit:"hidden",children:[u.jsx(qe.div,{variants:TPe,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),u.jsxs(qe.div,{variants:APe,className:"relative bg-[#FAF3E8] rounded-2xl shadow-2xl max-w-md w-full p-6 sm:p-8 z-10 max-h-[90vh] overflow-y-auto",children:[t&&u.jsx("button",{onClick:t,className:"absolute top-4 right-4 text-[#1B4D1B]/40 hover:text-[#1B4D1B] transition-colors z-10","aria-label":"Close",children:u.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),u.jsxs("div",{className:"text-center mb-6",children:[u.jsx("div",{className:"w-14 h-14 mx-auto mb-4 bg-[#7C9885]/20 rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-7 h-7 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})}),u.jsx("h2",{className:"font-serif text-2xl sm:text-3xl text-[#1B4D1B] mb-2",children:"Support Accessible Mental Health Care"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/70",children:"Choose how you'd like to use Solta AI. Every subscription helps us keep therapy tools affordable for everyone."})]}),u.jsxs("div",{className:"flex flex-col items-center mb-4",children:[u.jsx(W2,{value:c,onChange:f,compact:!0}),c==="enterprise"&&u.jsx("p",{className:"text-xs text-[#1B4D1B]/70 mt-2",children:"Full access for every seat"})]}),c==="enterprise"&&u.jsx("div",{className:"mb-4",children:u.jsx(V2,{billingCycle:"yearly",seats:m,onSeatsChange:x})}),u.jsxs("div",{className:"space-y-3 mb-4",children:[u.jsxs("button",{onClick:()=>E("yearly"),disabled:r,className:"relative w-full bg-white rounded-xl p-4 border-2 border-[#7C9885] shadow-md text-left transition-all hover:shadow-lg disabled:opacity-60 disabled:cursor-not-allowed",children:[u.jsx("div",{className:"absolute -top-2.5 left-4",children:u.jsx("span",{className:"bg-[#F4A28C] text-white text-xs font-semibold px-3 py-0.5 rounded-full",children:"Best Value"})}),u.jsxs("div",{className:"flex items-center justify-between mt-1",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60",children:"Yearly"}),u.jsxs("div",{className:"flex items-baseline gap-1.5",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:S("yearly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:k("yearly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-0.5",children:"Save 25% vs. monthly"})]}),u.jsxs("div",{className:"text-right",children:[u.jsx("span",{className:"inline-block bg-[#7C9885] text-white text-xs font-semibold px-3 py-1.5 rounded-lg",children:r&&i==="yearly"?"...":"Start Free Trial"}),u.jsx("p",{className:"text-[10px] text-[#1B4D1B]/50 mt-1",children:"7 days free"})]})]}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/50 mt-2",children:"Unlimited sessions"})]}),u.jsxs("button",{onClick:()=>E("monthly"),disabled:r,className:"w-full bg-white rounded-xl p-4 border border-gray-200 text-left transition-all hover:border-[#7C9885]/50 hover:shadow-sm disabled:opacity-60 disabled:cursor-not-allowed",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60",children:"Monthly"}),u.jsxs("div",{className:"flex items-baseline gap-1.5",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:S("monthly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:k("monthly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-0.5",children:"Cancel anytime"})]}),u.jsxs("div",{className:"text-right",children:[u.jsx("span",{className:"inline-block bg-[#7C9885]/10 text-[#1B4D1B] text-xs font-semibold px-3 py-1.5 rounded-lg",children:r&&i==="monthly"?"...":"Start Free Trial"}),u.jsx("p",{className:"text-[10px] text-[#1B4D1B]/50 mt-1",children:"7 days free"})]})]}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/50 mt-2",children:"Unlimited sessions"})]}),u.jsx("button",{onClick:b?T:void 0,disabled:r||!b,className:`w-full bg-white rounded-xl p-4 border text-left transition-all ${b?"border-gray-200 hover:border-[#7C9885]/50 hover:shadow-sm":"border-gray-100 opacity-60 cursor-not-allowed"}`,children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60",children:"Free"}),u.jsx("div",{className:"flex items-baseline gap-1.5",children:u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:"$0"})}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-0.5",children:b?`${y} free session${y===1?"":"s"} remaining`:"No free sessions remaining"})]}),u.jsx("div",{className:"text-right",children:b?u.jsx("span",{className:"inline-block bg-[#7C9885]/10 text-[#1B4D1B] text-xs font-semibold px-3 py-1.5 rounded-lg",children:"Get Started"}):u.jsx("span",{className:"inline-block text-[#1B4D1B]/40 text-xs font-semibold px-3 py-1.5",children:"Unavailable"})})]})})]}),c==="individual"&&u.jsx("div",{className:"text-center mb-3",children:u.jsx(u0,{onCodeValidated:C})}),l&&u.jsx("p",{role:"alert",className:"text-sm text-red-500 text-center mb-3",children:l})]})]})}):null}const RPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function MPe(){const{user:e,loading:t}=eb(),[n,a]=D.useState(!1),[r,s]=D.useState(!1);D.useEffect(()=>{if(typeof window>"u")return;new URLSearchParams(window.location.search).get("from")==="pitch"&&sessionStorage.setItem("solta_investor_preview","true")},[]);const[i,o]=D.useState(!1),[l,d]=D.useState(!1),[c,f]=D.useState(0),m=!!e,x=e?.email||"";D.useEffect(()=>{if(t||!m)return;const S=ti();if(!S)return;const k=1;if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")return;const E=()=>d(!0),T=()=>{const _=Wa();if(!_){E();return}fetch("/.netlify/functions/get-session-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:_,email:S})}).then(A=>A.json()).then(A=>{const $=(A&&(A.sessionCount??A.blsSetCount))??0;f($),!($<k)&&E()}).catch(()=>E())};fetch("/.netlify/functions/get-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:S,userId:Wa()})}).then(_=>_.json()).then(_=>{const A=_.subscription,$=A&&(A.status==="active"||A.status==="trialing");if(_.success&&$)return;const O=localStorage.getItem("solta_subscription_choice");if(O){try{if(JSON.parse(O).email===S)return}catch{}localStorage.removeItem("solta_subscription_choice")}T()}).catch(()=>{const _=localStorage.getItem("solta_subscription_choice");if(_)try{if(JSON.parse(_).email===S)return}catch{}T()})},[t,m]);const y=S=>{const k=ti();localStorage.setItem("solta_subscription_choice",JSON.stringify({plan:S,email:k,timestamp:new Date().toISOString()})),d(!1)},b=()=>{a(!1)},w=()=>{a(!1)};return t?u.jsx("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center",children:u.jsxs("div",{className:"text-center space-y-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent roun
5071ded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:"Loading..."})]})}):u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:"Adaptive BLS – Solta AI",description:"Experience AI-powered bilateral stimulation. Our adaptive BLS tool monitors your facial expressions and adjusts speed in real-time to match your emotional state.",path:"/bls"}),!i&&u.jsx(Vs,{showJoinButton:!1}),u.jsxs("main",{className:i?"pt-4":"pt-24",children:[!n&&r&&u.jsxs("section",{className:"pt-4 pb-12 md:pt-6 md:pb-16 relative overflow-hidden",children:[u.jsx("div",{className:"absolute top-10 -left-20 w-72 h-72 bg-[#7C9885]/10 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute bottom-20 -right-20 w-80 h-80 bg-[#F4A28C]/15 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsxs("div",{className:"max-w-6xl mx-auto px-6 relative z-10",children:[u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:RPe,className:"text-center space-y-4",children:[u.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B]",children:"Adaptive BLS"}),u.jsx("p",{className:"text-lg text-[#1B4D1B]/70",children:"AI-powered bilateral stimulation with real-time emotion detection"})]}),u.jsxs(qe.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{duration:.6,delay:.2,ease:"easeOut"},className:"mt-10 grid grid-cols-1 md:grid-cols-4 gap-4",children:[u.jsxs("div",{className:"bg-gradient-to-br from-[#7C9885]/10 to-white/80 rounded-2xl p-5 border border-[#7C9885]/20 shadow-sm flex flex-col",children:[u.jsx("div",{className:"w-10 h-10 bg-[#7C9885] rounded-xl flex items-center justify-center shadow-sm mb-3",children:u.jsx("span",{className:"text-xl",children:"🧠"})}),u.jsx("h2",{className:"font-serif text-lg text-[#1B4D1B] mb-2",children:"What is BLS?"}),u.jsx("p",{className:"text-sm text-[#1B4D1B] leading-relaxed flex-1",children:"Bilateral stimulation is a core EMDR technique — rhythmic left-right sensory input that helps your brain process difficult emotions and memories."}),u.jsxs("div",{className:"mt-4 bg-white/60 rounded-lg p-2.5",children:[u.jsx("p",{className:"text-xs font-medium text-[#1B4D1B]/50 uppercase tracking-wider mb-1.5 text-center",children:"How it works"}),u.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"w-8 h-8 bg-[#7C9885]/15 rounded-full flex items-center justify-center mx-auto mb-0.5",children:u.jsx("span",{className:"text-sm",children:"👀"})}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/60",children:"Follow"})]}),u.jsx("svg",{className:"w-3 h-3 text-[#F4A28C] flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"w-8 h-8 bg-[#7C9885]/15 rounded-full flex items-center justify-center mx-auto mb-0.5",children:u.jsx("span",{className:"text-sm",children:"⚡"})}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/60",children:"Activate"})]}),u.jsx("svg",{className:"w-3 h-3 text-[#F4A28C] flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"w-8 h-8 bg-[#7C9885]/15 rounded-full flex items-center justify-center mx-auto mb-0.5",children:u.jsx("span",{className:"text-sm",children:"🌿"})}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/60",children:"Heal"})]})]})]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#F4A28C]/10 to-white/80 rounded-2xl p-5 border border-[#F4A28C]/20 shadow-sm flex flex-col",children:[u.jsx("div",{className:"w-10 h-10 bg-[#F4A28C] rounded-xl flex items-center justify-center shadow-sm mb-3",children:u.jsx("span",{className:"text-xl",children:"💡"})}),u.jsx("h2",{className:"font-serif text-lg text-[#1B4D1B] mb-2",children:"BLS is not full EMDR"}),u.jsxs("p",{className:"text-sm text-[#1B4D1B] leading-relaxed flex-1",children:["This is ",u.jsx("span",{className:"font-medium",children:"bilateral stimulation only"})," — one piece of the full EMDR protocol. Think of it as a helpful resource for:"]}),u.jsxs("div",{className:"mt-4 flex flex-wrap gap-1.5",children:[u.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 bg-white/70 rounded-full text-sm text-[#1B4D1B] border border-[#F4A28C]/20",children:"🔄 Between-session support"}),u.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 bg-white/70 rounded-full text-sm text-[#1B4D1B] border border-[#F4A28C]/20",children:"🧘 Self-regulation"}),u.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 bg-white/70 rounded-full text-sm text-[#1B4D1B] border border-[#F4A28C]/20",children:"🌱 Emotional grounding"})]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#7C9885]/5 via-[#F4A28C]/5 to-white/80 rounded-2xl p-5 border border-[#7C9885]/15 shadow-sm flex flex-col",children:[u.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-[#7C9885] to-[#5C7565] rounded-xl flex items-center justify-center shadow-sm mb-3",children:u.jsx("span",{className:"text-xl",children:"✨"})}),u.jsx("h2",{className:"font-serif text-lg text-[#1B4D1B] mb-2",children:"How we're different"}),u.jsxs("p",{className:"text-sm text-[#1B4D1B] leading-relaxed mb-3",children:["YouTube videos and tappers run at a ",u.jsx("span",{className:"font-medium",children:"fixed pace"}),". We ",u.jsx("span",{className:"font-medium",children:"adapt in real time"}),"."]}),u.jsxs("div",{className:"space-y-1.5 mt-auto",children:[u.jsx("p",{className:"text-xs font-medium text-[#1B4D1B]/50 uppercase tracking-wider",children:"Signals we read"}),u.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[u.jsxs("div",{className:"flex items-center gap-1.5 bg-white/60 rounded-lg px-2 py-1.5 border border-[#7C9885]/10",children:[u.jsx("span",{className:"text-sm",children:"😊"}),u.jsx("span",{className:"text-sm text-[#1B4D1B]",children:"Facial expression"})]}),u.jsxs("div",{className:"flex items-center gap-1.5 bg-white/60 rounded-lg px-2 py-1.5 border border-[#7C9885]/10",children:[u.jsx("span",{className:"text-sm",children:"🎙️"}),u.jsx("span",{className:"text-sm text-[#1B4D1B]",children:"Voice Emotion"})]}),u.jsxs("div",{className:"relative flex items-center gap-1.5 bg-white/60 rounded-lg px-2 py-1.5 border border-[#7C9885]/10 opacity-40 grayscale",children:[u.jsx("span",{className:"text-sm",children:"🤷‍♀️"}),u.jsx("span",{className:"text-sm text-[#1B4D1B]",children:"Body language"}),u.jsx("span",{className:"absolute -top-2 -right-2 bg-[#F4A28C] text-white text-[8px] font-bold uppercase px-1.5 py-0.5 rounded-full shadow-sm tracking-wide",style:{filter:"none",opacity:1},children:"Coming Soon"})]}),u.jsxs("div",{className:"relative flex items-center gap-1.5 bg-white/60 rounded-lg px-2 py-1.5 border border-[#7C9885]/10 opacity-40 grayscale",children:[u.jsx("span",{className:"text-sm",children:"💬"}),u.jsx("span",{className:"text-sm text-[#1B4D1B]",children:"Choice of words"}),u.jsx("span",{className:"absolute -top-2 -right-2 bg-[#F4A28C] text-white text-[8px] font-bold uppercase px-1.5 py-0.5 rounded-full shadow-sm tracking-wide",style:{filter:"none",opacity:1},children:"Coming Soon"})]})]})]})]}),u.jsxs("div",{className:"bg-gradient-to-br from-[#1B4D1B]/5 to-white/80 rounded-2xl p-5 border border-[#1B4D1B]/10 shadow-sm flex flex-col",children:[u.jsx("div",{className:"w-10 h-10 bg-[#1B4D1B] rounded-xl flex items-center justify-center shadow-sm mb-3",children:u.jsx("span",{className:"text-xl",children:"🚀"})}),u.jsx("h2",{className:"font-serif text-lg text-[#1B4D1B] mb-2",children:"Where we're headed"}),u.jsx("p",{className:"text-sm text-[#1B4D1B] leading-relaxed mb-3",children:"Adaptive BLS is just the beginning. We're building toward smarter, more personalized tools to support your mental health journey."}),u.jsxs("div",{className:"space-y-0 flex-1",children:[u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsxs("div",{className:"flex flex-col items-center",children:[u.jsx("div",{className:"w-6 h-6 bg-[#7C9885] rounded-full flex items-center justify-center flex-shrink-0",children:u.jsx("svg",{className:"w-3 h-3 text-white",f
5071ill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),u.jsx("div",{className:"w-0.5 h-5 bg-[#7C9885]/30"})]}),u.jsx("div",{className:"pt-0.5",children:u.jsxs("p",{className:"text-sm font-medium text-[#1B4D1B]",children:["EMDR-inspired regulation ",u.jsx("span",{className:"ml-1 text-[10px] font-medium text-white bg-[#7C9885] px-1.5 py-0.5 rounded-full",children:"Now"})]})})]}),u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsxs("div",{className:"flex flex-col items-center",children:[u.jsx("div",{className:"w-6 h-6 bg-[#F4A28C]/40 rounded-full flex items-center justify-center flex-shrink-0",children:u.jsx("div",{className:"w-1.5 h-1.5 bg-[#F4A28C] rounded-full"})}),u.jsx("div",{className:"w-0.5 h-5 bg-[#F4A28C]/20"})]}),u.jsx("div",{className:"pt-0.5",children:u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60",children:"Grounding EMDR sessions"})})]}),u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx("div",{className:"flex flex-col items-center",children:u.jsx("div",{className:"w-6 h-6 bg-[#1B4D1B]/10 rounded-full flex items-center justify-center flex-shrink-0",children:u.jsx("div",{className:"w-1.5 h-1.5 bg-[#1B4D1B]/30 rounded-full"})})}),u.jsx("div",{className:"pt-0.5",children:u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/40",children:"Full EMDR protocol"})})]})]})]})]}),u.jsx(qe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.5,ease:"easeOut"},className:"mt-10 text-center",children:u.jsxs("button",{onClick:()=>s(!1),className:"group px-10 py-4 text-lg font-medium text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md hover:shadow-lg transition-all tracking-wide inline-flex items-center gap-2",children:["Back to demo",u.jsx("svg",{className:"w-5 h-5 transition-transform group-hover:translate-x-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})})]})]}),u.jsx("section",{className:`${i||!n&&!r?"py-0":"py-16 md:py-24"} ${!n&&r?"hidden":""}`,children:u.jsx("div",{className:i?"w-full max-w-full mx-auto px-2":"w-[95%] max-w-[98%] mx-auto px-4",children:n?u.jsx(Xne,{email:x,onComplete:b,onSkip:w}):r?null:u.jsx(IPe,{onShowIntro:()=>s(!0),onFullscreenChange:o,isAuthenticated:m})})})]}),!i&&u.jsx(ui,{}),u.jsx(DPe,{isOpen:l,onClose:()=>d(!1),onChoiceMade:y,freeSessionsUsed:c})]})}const MB={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function $Pe(){const{t:e}=Ws(),[t,n]=D.useState({general:!0,clinicians:!0,investors:!0}),[a,r]=D.useState({general:{},clinicians:{},investors:{}}),s=c=>{n(f=>({...f,[c]:!f[c]}))},i=(c,f)=>{r(m=>({...m,[c]:{...m[c],[f]:!m[c][f]}}))},o=(e("faq.general.items")||[]).map(({q:c,a:f})=>({question:c,answer:f})),l=(e("faq.clinicians.items")||[]).map(({q:c,a:f})=>({question:c,answer:f})),d=[{question:e("faq.investors.q1"),answer:"jsx",jsx:u.jsxs("p",{className:"text-[#1B4D1B] leading-relaxed",children:[e("faq.investors.contactBefore"),u.jsx("a",{href:"mailto:[email protected]",className:"underline font-medium hover:text-[#4A6A53]",children:"[email protected]"}),e("faq.investors.contactBetween"),u.jsx("a",{href:"https://www.linkedin.com/company/soltaai/",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:text-[#4A6A53]",children:e("faq.investors.linkedinLabel")}),e("faq.investors.contactAfter")]})}];return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:e("faq.seo.title"),description:e("faq.seo.description"),path:"/faqs"}),u.jsx(Vs,{showJoinButton:!1}),u.jsxs("main",{className:"pt-24",children:[u.jsx("section",{className:"py-12 md:py-16",children:u.jsx("div",{className:"max-w-6xl mx-auto px-6",children:u.jsx(qe.div,{initial:"hidden",animate:"visible",variants:MB,className:"text-center",children:u.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B]",children:e("faq.heading")})})})}),u.jsx("section",{className:"py-16 md:py-24 bg-white/50",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:MB,className:"space-y-12 text-[#1B4D1B]",children:[u.jsxs("div",{role:"region","aria-labelledby":"faq-general-heading",children:[u.jsxs("button",{onClick:()=>s("general"),className:"w-full flex items-center justify-between mb-6 text-left focus:outline-none focus:ring-2 focus:ring-[#7C9885] rounded","aria-expanded":t.general,"aria-controls":"faq-general-content",children:[u.jsx("h2",{id:"faq-general-heading",className:"font-serif text-3xl md:text-4xl text-[#1B4D1B] border-b-2 border-[#1B4D1B] pb-2 flex-1",children:e("faq.section.general")}),u.jsx("svg",{className:`w-5 h-5 ml-4 text-[#1B4D1B] transition-transform duration-300 ${t.general?"rotate-0":"-rotate-90"}
5071`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),t.general&&u.jsx("div",{id:"faq-general-content",className:"space-y-4 mt-6",children:o.map((c,f)=>u.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[u.jsxs("button",{onClick:()=>i("general",f),className:"w-full flex items-center justify-between p-6 text-left hover:bg-[#F4B3A2] transition-colors focus:outline-none focus:ring-2 focus:ring-inset focus:ring-[#7C9885]","aria-expanded":!!a.general[f],"aria-controls":`faq-general-${f}`,children:[u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B] flex-1 pr-4",children:c.question}),u.jsx("svg",{className:`w-4 h-4 text-[#1B4D1B] transition-transform duration-300 flex-shrink-0 ${a.general[f]?"rotate-0":"-rotate-90"}`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),a.general[f]&&u.jsx("div",{id:`faq-general-${f}`,className:"px-6 pt-6 pb-6",children:u.jsx("p",{className:"text-[#1B4D1B] leading-relaxed whitespace-pre-line",children:c.answer})})]},f))})]}),u.jsxs("div",{role:"region","aria-labelledby":"faq-clinicians-heading",children:[u.jsxs("button",{onClick:()=>s("clinicians"),className:"w-full flex items-center justify-between mb-6 text-left focus:outline-none focus:ring-2 focus:ring-[#7C9885] rounded","aria-expanded":t.clinicians,"aria-controls":"faq-clinicians-content",children:[u.jsx("h2",{id:"faq-clinicians-heading",className:"font-serif text-3xl md:text-4xl text-[#1B4D1B] border-b-2 border-[#1B4D1B] pb-2 flex-1",children:e("faq.section.clinicians")}),u.jsx("svg",{className:`w-5 h-5 ml-4 text-[#1B4D1B] transition-transform duration-300 ${t.clinicians?"rotate-0":"-rotate-90"}`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),t.clinicians&&u.jsx("div",{id:"faq-clinicians-content",className:"space-y-4 mt-6",children:l.map((c,f)=>u.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[u.jsxs("button",{onClick:()=>i("clinicians",f),className:"w-full flex items-center justify-between p-6 text-left hover:bg-[#F4B3A2] transition-colors focus:outline-none focus:ring-2 focus:ring-inset focus:ring-[#7C9885]","aria-expanded":!!a.clinicians[f],"aria-controls":`faq-clinicians-${f}`,children:[u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B] flex-1 pr-4",children:c.question}),u.jsx("svg",{className:`w-4 h-4 text-[#1B4D1B] transition-transform duration-300 flex-shrink-0 ${a.clinicians[f]?"rotate-0":"-rotate-90"}`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),a.clinicians[f]&&u.jsx("div",{id:`faq-clinicians-${f}`,className:"px-6 pt-6 pb-6",children:Array.isArray(c.answer)?u.jsx("ul",{className:"space-y-3 text-[#1B4D1B] leading-relaxed",children:c.answer.map((m,x)=>u.jsx("li",{className:"list-disc list-inside",children:m},x))}):u.jsx("p",{className:"text-[#1B4D1B] leading-relaxed whitespace-pre-line",children:c.answer})})]},f))})]}),u.jsxs("div",{role:"region","aria-labelledby":"faq-investors-heading",children:[u.jsxs("button",{onClick:()=>s("investors"),className:"w-full flex items-center justify-between mb-6 text-left focus:outline-none focus:ring-2 focus:ring-[#7C9885] rounded","aria-expanded":t.investors,"aria-controls":"faq-investors-content",children:[u.jsx("h2",{id:"faq-investors-heading",className:"font-serif text-3xl md:text-4xl text-[#1B4D1B] border-b-2 border-[#1B4D1B] pb-2 flex-1",children:e("faq.section.investors")}),u.jsx("svg",{className:`w-5 h-5 ml-4 text-[#1B4D1B] transition-transform duration-300 ${t.investors?"rotate-0":"-rotate-90"}
5071`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),t.investors&&u.jsx("div",{id:"faq-investors-content",className:"space-y-4 mt-6",children:d.map((c,f)=>u.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[u.jsxs("button",{onClick:()=>i("investors",f),className:"w-full flex items-center justify-between p-6 text-left hover:bg-[#F4B3A2] transition-colors focus:outline-none focus:ring-2 focus:ring-inset focus:ring-[#7C9885]","aria-expanded":!!a.investors[f],"aria-controls":`faq-investors-${f}`,children:[u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B] flex-1 pr-4",children:c.question}),u.jsx("svg",{className:`w-4 h-4 text-[#1B4D1B] transition-transform duration-300 flex-shrink-0 ${a.investors[f]?"rotate-0":"-rotate-90"}`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"})})]}),a.investors[f]&&u.jsx("div",{id:`faq-investors-${f}`,className:"px-6 pt-6 pb-6",children:c.jsx?c.jsx:u.jsx("p",{className:"text-[#1B4D1B] leading-relaxed whitespace-pre-line",children:c.answer})})]},f))})]})]})})})]}),u.jsx(ui,{})]})}function hf(e,t={}){return e==null?e:String(e).replace(/\{(\w+)\}/g,(n,a)=>Object.prototype.hasOwnProperty.call(t,a)?String(t[a]):`{${a}}`)}const BPe={"Unlimited BLS sessions":"account.feature.unlimited","AI-adaptive speed control":"account.feature.adaptive","Emotion tracking & insights":"account.feature.emotion","Earn money for your referrals":"account.feature.affiliateEarn"};function FPe(e,t){const n=BPe[e];return n?t(n):e}const pf={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function OPe(){const e=Us(),{t,lang:n}=Ws(),a=n==="es"?"es-MX":"en-US",[r,s]=D.useState(""),[i,o]=D.useState(!1),[l,d]=D.useState(!1),[c,f]=D.useState(""),[m,x]=D.useState(null),[y,b]=D.useState(null),[w,S]=D.useState(!0),[k,C]=D.useState(null),[E,T]=D.useState(!1),[_,A]=D.useState("yearly"),[$,O]=D.useState("individual"),[z,P]=D.useState(o0),[j,G]=D.useState(null),[X,J]=D.useState(!1),[V,Q]=D.useState(""),[F,H]=D.useState(!1),[B,Y]=D.useState(!0),[ne,ee]=D.useState(!1),[U,oe]=D.useState(!1),[pe,he]=D.useState(!1),[xe,Ie]=D.useState(!1),[_e,Oe]=D.useState(""),[Ye,ft]=D.useState(!1);D.useEffect(()=>{if(!DH()){e("/bls");return}const $e=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",Ue=ti(),dt=$e&&IB!=null?IB:zN();f(Ue||""),s(dt||""),ze(),ct(),ot();const Qe=Bn=>{Bn.persisted&&ct()},An=()=>{document.visibilityState==="visible"&&ct()};return window.addEventListener("pageshow",Qe),document.addEventListener("visibilitychange",An),()=>{window.removeEventListener("pageshow",Qe),document.removeEventListener("visibilitychange",An)}},[e]),D.useEffect(()=>{if(y?.accountType!=="affiliate"){C(null);return}if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){C({totalReferred:fPe,paidReferred:mPe});return}const Ue=Wa();if(!Ue)return;let dt=!1;return fetch("/.netlify/functions/get-referral-stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Ue})}).then(Qe=>Qe.json()).then(Qe=>{!dt&&Qe.success&&C({totalReferred:Qe.totalReferred,paidReferred:Qe.paidReferred})}).catch(()=>{}),()=>{dt=!0}},[y?.accountType]);const ze=async()=>{const $e=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";$e&&x(new Date);try{const Ue=Wa();if(!Ue)return;const Qe=await(await fetch("/.netlify/functions/get-user-profile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Ue})})).json();if(Qe.success&&Qe.user&&(!$e&&Qe.user.createdAt&&x(Qe.user.createdAt),!zN())){const An=Qe.user.displayName||Qe.user.fullName||Qe.user.firstName;An&&(s(An),kB(An))}}catch{}},ct=async()=>{if(S(!0),window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){const Ue=new Date;Ue.setMonth(Ue.getMonth()+1);const dt=new Date;dt.setDate(dt.getDate()+7);
5071const Qe="Test Organization",An={none:null,individual:{id:"mock_sub",status:"active",planName:"Solta AI (Beta)",price:"$8",priceInterval:"month",currentPeriodEnd:Ue.toISOString(),cancelAtPeriodEnd:!1,cancelAt:null,trialEnd:null,features:["Unlimited BLS sessions","AI-adaptive speed control","Emotion tracking & insights"],accountType:"individual"},enterprise:{id:"mock_sub",status:"active",planName:"Enterprise plan (Beta)",price:"$120",priceInterval:"month",currentPeriodEnd:Ue.toISOString(),cancelAtPeriodEnd:!1,cancelAt:null,trialEnd:null,features:["Unlimited BLS sessions","AI-adaptive speed control","Emotion tracking & insights"],accountType:"enterprise",enterpriseCode:{code:"ABC123",accountName:Qe,isActive:!0,seats:20,seatsUsed:3}},covered_client:{id:"enterprise-code-access",status:"active",planName:`${Qe} – Organization Access`,price:"$0",priceInterval:"month",currentPeriodEnd:null,cancelAtPeriodEnd:!1,cancelAt:null,trialEnd:null,features:["Unlimited BLS sessions","AI-adaptive speed control","Emotion tracking & insights"],isEnterpriseCode:!0,accountName:Qe,accountType:"covered_client"},affiliate:{id:"affiliate-access",status:"active",planName:"Affiliate Program",price:"$0",priceInterval:"month",currentPeriodEnd:null,cancelAtPeriodEnd:!1,cancelAt:null,trialEnd:null,features:["Unlimited BLS sessions","AI-adaptive speed control","Emotion tracking & insights","Earn money for your referrals"],accountType:"affiliate",referralCode:"TESTUSERX7K2"},trialing:{id:"mock_sub",status:"trialing",planName:"Solta AI (Beta)",price:"$8",priceInterval:"month",currentPeriodEnd:dt.toISOString(),cancelAtPeriodEnd:!1,cancelAt:dt.toISOString(),trialEnd:dt.toISOString(),features:["Unlimited BLS sessions","AI-adaptive speed control","Emotion tracking & insights"],accountType:"individual"}};b(An[VE]??null),S(!1);return}try{const Ue=ti();if(!Ue){b(null);return}const Qe=await(await fetch("/.netlify/functions/get-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Ue,userId:Wa()})})).json();Qe.success&&Qe.subscription?b(Qe.subscription):b(null)}catch{b(null)}finally{S(!1)}},ot=async()=>{if(Y(!0),(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")&&TB!=null){H(TB),Y(!1);return}try{const Ue=Wa();if(!Ue)return;const Qe=await(await fetch("/.netlify/functions/get-email-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:Ue})})).json();Qe.success&&Qe.consent&&H(Qe.consent.marketing_consent&&!Qe.consent.unsubscribed_at)}catch{}finally{Y(!1)}},tt=async $e=>{ee(!0);const Ue=F;H($e);try{const dt=Wa(),Qe=ti();(await(await fetch("/.netlify/functions/record-email-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:dt,email:Qe,marketingConsent:$e,method:"settings_toggle"})})).json()).success||H(Ue)}catch{H(Ue)}finally{ee(!1)}},Tt=async()=>{d(!0);try{const $e=Wa();$e&&await fetch("/.netlify/functions/update-user-profile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:$e,displayName:r})}),kB(r),o(!1)}catch{}finally{d(!1)}},bn=async()=>{T(!0);try{const $e=ti();if(!$e){alert(t("account.alert.loginToManage"));return}const dt=await(await fetch("/.netlify/functions/create-portal-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$e})})).json();dt.success&&dt.url?window.location.href=dt.url:alert(dt.error||t("account.alert.portalFail"))}catch{alert(t("account.alert.portalError"))}finally{T(!1)}},Ut=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Tn=async()=>{if(!_e.trim())return;ft(!0);const $e=Wa();if(Ut){b(Ue=>({...Ue,enterpriseCode:{...Ue.enterpriseCode,accountName:_e.trim()}})),Ie(!1),ft(!1);return}try{(await(await fetch("/.netlify/functions/update-account-name",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:$e,accountName:_e.trim()})})).json()).success&&(b(Qe=>({...Qe,enterpriseCode:{...Qe.enterpriseCode,accountName:_e.trim()}})),Ie(!1))}catch{}finally{ft(!1)}},Nn=async($e,Ue)=>{G({code:$e,accountName:Ue});const dt=Wa();if(dt){if(Ut){alert(hf(t("account.alert.codeApplied"),{code:$e})),ct();return}try{await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:dt,code:$e})}),ct()}catch{}}},Pn={monthly:{amount:"$8",label:"/mo"},yearly:{amount:"$72",label:"/yr"}},sa={monthly:"/mo",yearly:"/yr"},pa=$e=>$==="enterprise"?`$${l0(z,$e)}`:Pn[$e].amount,Be=$e=>$==="enterprise"?sa[$e]:Pn[$e].label,lt=async()=>{J(!0),Q("");try{const $e=Wa(),Ue=ti();if(!Ue){Q(t("account.subscribe.error.login")),J(!1);return}const dt=await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Ue,userId:$e,priceId:i0($,_),accountType:$,...$==="enterprise"&&{seats:z}})}),Qe=await dt.json();dt.ok&&Qe.url?window.location.href=Qe.url:Q(Qe.error||t("account.subscribe.error.generic"))}catch{Q(t("account.subscribe.error.tryAgain"))}finally{J(!1)}};return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:t("account.seo.title"),description:t("account.seo.description"),path:"/account",noindex:!0}),u.jsx(Vs,{showJoinButton:!1}),u.jsxs("main",{className:"pt-24",children:[u.jsx("section",{className:"py-8 md:py-12",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,children:[u.jsx("h1",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B] mb-2",children:t("account.heading")}),u.jsx("p",{className:"text-[#1B4D1B]",children:t("account.subheading")})]})})}),u.jsx("section",{className:"pb-8",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,className:"bg-white rounded-lg shadow-md p-6 border border-gray-200",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[u.jsx("svg",{className:"w-5 h-5 text-[#1B4D1B]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),u.jsx("h2",{className:"font-semibold text-[#1B4D1B]",children:t("account.profile.heading")})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsx("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),u.jsx("label",{htmlFor:"full-name",className:"text-sm text-gray-700",children:t("account.profile.fullName")}
5071)]}),i?u.jsxs("div",{className:"flex gap-2",children:[u.jsx(el,{id:"full-name",type:"text",value:r,onChange:$e=>s($e.target.value),className:"flex-1",placeholder:t("account.profile.fullNamePlaceholder"),autoComplete:"name"}),u.jsx(Rs,{onClick:Tt,disabled:l,className:"bg-[#1B4D1B] hover:bg-[#0D2B0D] text-white focus:outline-none focus:ring-2 focus:ring-[#1B4D1B] focus:ring-offset-2",children:t(l?"account.profile.saving":"account.profile.save")}),u.jsx(Rs,{onClick:()=>{s(zN()||""),o(!1)},variant:"outline",className:"border-gray-400 text-gray-700 focus:outline-none focus:ring-2 focus:ring-[#1B4D1B] focus:ring-offset-2",children:t("account.profile.cancel")})]}):u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("p",{className:"font-medium text-[#1B4D1B]",children:r||t("account.profile.notSet")}),u.jsx("button",{onClick:()=>o(!0),className:"text-[#1B4D1B]/50 hover:text-[#1B4D1B] transition-colors focus:outline-none focus:ring-2 focus:ring-[#1B4D1B] focus:ring-offset-2 rounded","aria-label":t("account.profile.editName"),children:u.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsx("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),u.jsx("span",{className:"text-sm text-gray-700",children:t("account.profile.email")})]}),u.jsx("p",{className:"font-medium text-[#1B4D1B]",children:c})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsxs("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"17.5",cy:"6.5",r:"3.5",strokeWidth:2}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6.5 14l-3.5 7h7l-3.5-7zM14 17.5h7"})]}),u.jsx("span",{className:"text-sm text-gray-700",children:t("account.profile.accountType")})]}),u.jsx("p",{className:"font-medium text-[#1B4D1B]",children:w?t("account.profile.type.loading"):y?.isEnterpriseCode?t("account.profile.type.member"):y?.accountType==="enterprise"?t("account.profile.type.organization"):y?.accountType==="affiliate"?t("account.profile.type.affiliate"):t("account.profile.type.individual")})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsx("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),u.jsx("span",{className:"text-sm text-gray-700",children:t("account.profile.memberSince")})]}),u.jsx("p",{className:"font-medium text-[#1B4D1B]",children:w?t("account.profile.type.loading"):m?new Date(m).toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"}):""})]})]}),u.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200",children:u.jsx(Rs,{onClick:()=>ZLe(),className:"bg-[#7C9885] hover:bg-[#6B8572] text-white focus:outline-none focus:ring-2 focus:ring-[#7C9885] focus:ring-offset-2",children:t("account.signOut")})})]})})}),y?.enterpriseCode&&u.jsx("section",{className:"pb-8",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,transition:{delay:.025},className:"bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden",children:[u.jsx("div",{className:"bg-gradient-to-r from-[#7C9885] to-[#6B8572] px-6 py-5",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-white/20 flex items-center justify-center shrink-0",children:u.jsx("svg",{className:"w-5 h-5 text-white",f
5071ill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-white/80 text-xs font-medium uppercase tracking-wider",children:t("account.org.heading")}),xe?u.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[u.jsx("input",{type:"text",value:_e,onChange:$e=>Oe($e.target.value),className:"bg-white/20 text-white placeholder-white/50 border border-white/30 rounded-md px-2 py-1 text-base font-semibold focus:outline-none focus:ring-2 focus:ring-white/50 flex-1 min-w-0",placeholder:t("account.org.namePlaceholder"),autoFocus:!0,onKeyDown:$e=>{$e.key==="Enter"&&Tn(),$e.key==="Escape"&&Ie(!1)}}),u.jsx("button",{onClick:Tn,disabled:Ye||!_e.trim(),className:"bg-white/20 hover:bg-white/30 text-white text-sm font-medium px-3 py-1 rounded-md transition-colors disabled:opacity-50",children:Ye?"...":t("account.profile.save")}),u.jsx("button",{onClick:()=>Ie(!1),className:"text-white/70 hover:text-white text-sm font-medium px-2 py-1 transition-colors",children:t("account.profile.cancel")})]}):u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("h2",{className:"text-white font-semibold text-lg truncate",children:y.enterpriseCode.accountName}),u.jsx("button",{onClick:()=>{Oe(y.enterpriseCode.accountName),Ie(!0)},className:"text-white/60 hover:text-white transition-colors shrink-0","aria-label":t("account.org.editName"),children:u.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]})]})]})}),u.jsxs("div",{className:"p-6",children:[u.jsx("p",{className:"text-sm text-gray-600 mb-5",children:t("account.org.inviteBlurb")}),u.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"bg-[#FAF3E8] rounded-xl p-4",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider mb-2",children:t("account.org.memberCode")}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"font-mono text-2xl font-bold text-[#1B4D1B] tracking-[0.2em]",children:y.enterpriseCode.code}),u.jsx("button",{onClick:()=>{navigator.clipboard.writeText(y.enterpriseCode.code),oe(!0),setTimeout(()=>oe(!1),2e3)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all ${U?"bg-[#7C9885] text-white":"bg-[#7C9885]/10 text-[#1B4D1B] hover:bg-[#7C9885]/20"}`,"aria-label":t("account.org.copyCode"),children:U?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t("account.org.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),t("account.org.copy")]})})]})]}),u.jsxs("div",{className:"bg-[#FAF3E8] rounded-xl p-4",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider mb-2",children:t("account.org.inviteLink")}),u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("span",{className:"text-sm text-[#1B4D1B] truncate",children:[window.location.origin,"/join/",y.enterpriseCode.code]}),u.jsx("button",{onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/join/${y.enterpriseCode.code}`),he(!0),setTimeout(()=>he(!1),2e3)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all shrink-0 ${pe?"bg-[#7C9885] text-white":"bg-[#7C9885]/10 text-[#1B4D1B] hover:bg-[#7C9885]/20"}`,"aria-label":t("account.org.copyLink"),children:pe?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t("account.org.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),t("account.org.copy")]})})]})]})]}),typeof y.enterpriseCode.seats=="number"&&u.jsx(LPe,{used:y.enterpriseCode.seatsUsed??0,total:y.enterpriseCode.seats})]})]})})}),y?.accountType==="affiliate"&&y?.referralCode&&u.jsx("section",{className:"pb-8",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,transition:{delay:.025},className:"bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden",children:[u.jsx("div",{className:"bg-gradient-to-r from-[#7C9885] to-[#6B8572] px-6 py-5",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-white/20 flex items-center justify-center shrink-0",children:u.jsx("svg",{className:"w-5 h-5 text-white",f
5071ill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx("h2",{className:"text-white font-semibold text-lg truncate",children:t("account.affiliate.heading")})})]})}),u.jsxs("div",{className:"p-6",children:[k?.totalReferred>0?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-5",children:[u.jsxs("div",{className:"rounded-xl bg-gradient-to-br from-[#7C9885]/20 to-[#7C9885]/5 border border-[#7C9885]/25 p-4 text-center",children:[u.jsx("p",{className:"text-4xl font-bold text-[#1B4D1B] tabular-nums leading-none",children:k.totalReferred}),u.jsx("p",{className:"text-xs font-medium text-gray-600 uppercase tracking-wider mt-2",children:t("account.affiliate.statReferred")})]}),u.jsxs("div",{className:"rounded-xl bg-gradient-to-br from-[#7C9885]/20 to-[#7C9885]/5 border border-[#7C9885]/25 p-4 text-center",children:[u.jsx("p",{className:"text-4xl font-bold text-[#1B4D1B] tabular-nums leading-none",children:k.paidReferred}),u.jsx("p",{className:"text-xs font-medium text-gray-600 uppercase tracking-wider mt-2",children:t("account.affiliate.statPaid")})]})]}),u.jsx("p",{className:"text-sm text-gray-600 mb-5",children:bf(hf(t("account.affiliate.statsActive"),{referred:k.totalReferred,people:k.totalReferred===1?t("account.affiliate.person"):t("account.affiliate.people"),paid:k.paidReferred}))})]}):u.jsx("p",{className:"text-sm text-gray-600 mb-5",children:t("account.affiliate.statsEmpty")}),u.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"bg-[#FAF3E8] rounded-xl p-4",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider mb-2",children:t("account.affiliate.referralCode")}),u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"font-mono text-xl font-bold text-[#1B4D1B] tracking-wider break-all min-w-0",children:y.referralCode}),u.jsx("button",{onClick:()=>{navigator.clipboard.writeText(y.referralCode),oe(!0),setTimeout(()=>oe(!1),2e3)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all shrink-0 ${U?"bg-[#7C9885] text-white":"bg-[#7C9885]/10 text-[#1B4D1B] hover:bg-[#7C9885]/20"}`,"aria-label":t("account.affiliate.copyCode"),children:U?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t("account.org.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),t("account.org.copy")]})})]})]}),u.jsxs("div",{className:"bg-[#FAF3E8] rounded-xl p-4",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider mb-2",children:t("account.affiliate.referralLink")}),u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("span",{className:"text-sm text-[#1B4D1B] truncate",children:[window.location.origin,"/signup?ref=",y.referralCode]}),u.jsx("button",{onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/signup?ref=${y.referralCode}`),he(!0),setTimeout(()=>he(!1),2e3)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all shrink-0 ${pe?"bg-[#7C9885] text-white":"bg-[#7C9885]/10 text-[#1B4D1B] hover:bg-[#7C9885]/20"}`,"aria-label":t("account.affiliate.copyLink"),children:pe?u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t("account.org.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),t("account.org.copy")]})})]})]})]})]})]})})}),u.jsx("section",{className:"pb-8",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,transition:{delay:.1},className:"bg-white rounded-lg shadow-md p-6 border border-gray-200",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[u.jsx("svg",{className:"w-5 h-5 text-[#1B4D1B]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"})}),u.jsx("h2",{className:"font-semibold text-[#1B4D1B]",children:t("account.sub.heading")})]}
5071),w?u.jsx("div",{className:"text-center py-8 text-gray-700",role:"status","aria-live":"polite",children:t("account.sub.loading")}):y?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"bg-[#FAF3E8] rounded-lg p-4 mb-6",children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]",children:y.planName}),u.jsxs("p",{className:"text-sm text-gray-700",children:[y.status==="active"&&t("account.sub.status.active"),y.status==="trialing"&&u.jsx("span",{className:"text-[#7C9885]",children:hf(t("account.sub.trialUntil"),{date:new Date(y.trialEnd).toLocaleDateString(a,{month:"short",day:"numeric",year:"numeric"})})}),y.status==="canceled"&&t("account.sub.status.canceled"),y.status==="past_due"&&u.jsx("span",{className:"text-red-600",children:t("account.sub.status.pastDue")}),!["active","trialing","canceled","past_due"].includes(y.status)&&y.status]}),y.cancelAtPeriodEnd&&y.currentPeriodEnd&&u.jsx("p",{className:"text-sm text-amber-600 mt-1",children:hf(t("account.sub.cancelsOn"),{date:new Date(y.currentPeriodEnd).toLocaleDateString(a,{month:"short",day:"numeric",year:"numeric"})})})]}),u.jsxs("div",{className:"text-right",children:[u.jsx("p",{className:"text-2xl font-semibold text-[#1B4D1B]",children:y.price}),u.jsxs("p",{className:"text-sm text-gray-700",children:["/",y.priceInterval]})]})]})}),y.currentPeriodEnd&&!y.cancelAtPeriodEnd&&y.status!=="trialing"&&u.jsxs("div",{className:"mb-6 text-sm text-gray-700",children:[u.jsx("span",{className:"font-medium",children:t("account.sub.nextBillingLabel")})," ",new Date(y.currentPeriodEnd).toLocaleDateString(a,{month:"long",day:"numeric",year:"numeric"})]}),u.jsxs("div",{className:`mb-6 grid grid-cols-1 ${y.accountType==="enterprise"||y.cancelAtPeriodEnd||y.cancelAt?"sm:grid-cols-2":""} gap-4 items-start`,children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B] mb-3",children:t("account.sub.includedFeatures")}),u.jsx("ul",{className:y.accountType==="enterprise"||y.cancelAtPeriodEnd||y.cancelAt?"space-y-2":"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:y.features.map(($e,Ue)=>u.jsxs("li",{className:"flex items-start gap-2 text-gray-700",children:[u.jsx("span",{className:"w-2 h-2 mt-1.5 bg-[#1B4D1B] rounded-full shrink-0","aria-hidden":"true"}),u.jsx("span",{children:FPe($e,t)})]},Ue))})]}),y.accountType==="enterprise"&&!y.cancelAtPeriodEnd&&!y.cancelAt&&u.jsxs("div",{className:"bg-[#7C9885]/10 border border-[#7C9885]/20 rounded-xl p-5 flex flex-col items-center text-center",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-[#7C9885]/15 flex items-center justify-center mb-3",children:u.jsxs("svg",{className:"w-5 h-5 text-[#7C9885]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[u.jsx("circle",{cx:"12",cy:"7",r:"3",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7 19v-1a5 5 0 0110 0v1",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"5",cy:"9",r:"2",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M1 19v-.5a4 4 0 014-4",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"19",cy:"9",r:"2",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M23 19v-.5a4 4 0 00-4-4",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}),u.jsx("p",{className:"text-sm font-semibold text-[#1B4D1B]",children:y.enterpriseCode?.seats?hf(y.enterpriseCode.seats===1?t("account.sub.upToMembers"):t("account.sub.upToMembersPlural"),{count:y.enterpriseCode.seats}):t("account.sub.orgPlan")}),u.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("account.sub.allIncluded")})]}),(y.cancelAtPeriodEnd||y.cancelAt)&&u.jsxs("div",{className:"bg-gradient-to-br from-[#F4A28C]/10 to-[#F4A28C]/25 border border-[#F4A28C]/30 rounded-xl p-5 text-center",children:[u.jsx("div",{className:"w-10 h-10 mx-auto mb-3 rounded-full bg-[#F4A28C]/20 flex items-center justify-center",children:u.jsx("svg",{className:"w-5 h-5 text-[#F4A28C]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),u.jsx("p",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium mb-1",children:t("account.sub.subEnds")}),u.jsx("p",{className:"text-lg font-semibold text-[#1B4D1B]",children:new Date(y.cancelAt||y.currentPeriodEnd).toLocaleDateString(a,{month:"short",day:"numeric",year:"numeric"})})]})]}),u.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[u.jsxs("button",{onClick:bn,disabled:E,className:"w-full py-3 px-4 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed","aria-label":t("account.sub.manage"),children:[u.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),t(E?"account.sub.processing":"account.sub.manage")]}),u.jsxs("p",{className:"text-center text-sm text-gray-700 mt-4",children:[t("account.sub.needHelp"),u.jsx("a",{href:"mailto:[email protected]",className:"text-[#1B4D1B] hover:underline focus:outline-none focus:ring-2 focus:ring-[#1B4D1B] focus:ring-offset-2 rounded",children:"[email protected]"})]})]})]}):u.jsxs("div",{className:"py-4",children:[u.jsx("p",{className:"text-gray-700 mb-6 text-center",children:t("account.sub.cta")}),u.jsx("div",{className:"flex justify-center mb-6",children:u.jsx(W2,{value:$,onChange:O})}),$==="enterprise"&&u.jsx("div",{className:"mb-6",children:u.jsx(V2,{billingCycle:_,seats:z,onSeatsChange:P})}),u.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[u.jsxs("button",{onClick:()=>A("monthly"),className:`relative bg-white rounded-xl p-4 border-2 transition-all text-left ${_==="monthly"?"border-[#7C9885] shadow-md":"border-gray-200 hover:border-gray-300"}`,children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-1",children:t("account.sub.monthly")}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:pa("monthly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:Be("monthly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-1",children:t("account.sub.sevenDaysFree")}),_==="monthly"&&u.jsx("div",{className:"absolute top-2 right-2",children:u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]}),u.jsxs("button",{onClick:()=>A("yearly"),className:`relative bg-white rounded-xl p-4 border-2 transition-all text-left ${_==="yearly"?"border-[#7C9885] shadow-md":"border-gray-200 hover:border-gray-300"}`,children:[u.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2",children:u.jsx("span",{className:"bg-[#F4A28C] text-white text-xs font-medium px-2 py-0.5 rounded-full whitespace-nowrap",children:t("account.sub.bestValue")})}),u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-1",children:t("account.sub.yearly")}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-2xl font-bold text-[#1B4D1B]",children:pa("yearly")}),u.jsx("span",{className:"text-sm text-[#1B4D1B]/60",children:Be("yearly")})]}),u.jsx("p",{className:"text-xs text-[#7C9885] mt-1",children:t("account.sub.sevenDaysFree")}),_==="yearly"&&u.jsx("div",{className:"absolute top-2 right-2",children:u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]})]}),_==="yearly"&&u.jsxs("div",{className:"bg-[#F4A28C]/10 border border-[#F4A28C]/30 rounded-lg p-3 mb-6",children:[u.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-[#1B4D1B]",children:[u.jsx("svg",{className:"w-4 h-4 text-[#F4A28C]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),u.jsx("span",{className:"font-medium",children:t("account.sub.yearlyValue")})]}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/70 mt-1 text-center",children:t("account.sub.yearlyValueSub")})]}),u.jsx("div",{className:"bg-[#FAF3E8] rounded-xl p-4 mb-6",children:u.jsxs("ul",{className:"space-y-2 text-sm text-[#1B4D1B]/80",children:[u.jsxs("li",{className:"flex items-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),t("account.feature.unlimited")]}),u.jsxs("li",{className:"flex items-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),t("account.feature.adaptive")]}),u.jsxs("li",{className:"flex items-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),t("account.feature.emotion")]}),$==="enterprise"&&u.jsxs("li",{className:"flex items-center gap-2",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),hf(t("account.feature.entSeats"),{count:z})]})]})}),$==="individual"&&!j&&u.jsx("div",{className:"mb-6 text-center",children:u.jsx(u0,{onCodeValidated:Nn})}),j&&u.jsx("p",{className:"text-sm text-[#7C9885] mb-6 text-center",children:t("account.sub.codeApplied")}),V&&u.jsx("p",{className:"text-sm text-red-500 mb-4 text-center",children:V}),u.jsx(Rs,{onClick:lt,disabled:X||!!j,className:"w-full bg-[#7C9885] hover:bg-[#6
5071B8572] text-white py-6 text-lg",children:t(X?"account.sub.processing":_==="monthly"?"account.sub.startTrial":"account.sub.subscribeYearly")}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/50 mt-4 text-center",children:t("account.sub.cancelAnytime")})]})]})})}),u.jsx("section",{className:"pb-16",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:pf,transition:{delay:.05},className:"bg-white rounded-lg shadow-md p-6 border border-gray-200",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[u.jsx("svg",{className:"w-5 h-5 text-[#1B4D1B]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),u.jsx("h2",{className:"font-semibold text-[#1B4D1B]",children:t("account.email.heading")})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-[#1B4D1B] font-medium",children:t("account.email.title")}),u.jsx("p",{className:"text-sm text-gray-500 mt-1",children:t("account.email.body")})]}),B?u.jsx("div",{className:"w-11 h-6 bg-gray-200 rounded-full animate-pulse"}):u.jsx("button",{role:"switch","aria-checked":F,"aria-label":t("account.email.toggleAria"),disabled:ne,onClick:()=>tt(!F),className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-[#7C9885] focus:ring-offset-2 ${F?"bg-[#7C9885]":"bg-gray-300"} ${ne?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:u.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${F?"translate-x-6":"translate-x-1"}`})})]})]})})})]}),u.jsx(ui,{})]})}function LPe({used:e,total:t}){const{t:n}=Ws(),a=Math.max(t,1),r=Math.min(100,Math.round(e/a*100)),s=e>=a;return u.jsxs("div",{className:"mt-5 bg-[#FAF3E8] rounded-xl p-4",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("account.seat.heading")}),u.jsxs("p",{className:"text-sm font-semibold text-[#1B4D1B]",children:[e," / ",a," ",n("account.seat.usedSuffix")]})]}),u.jsx("div",{className:"w-full h-2 bg-[#7C9885]/15 rounded-full overflow-hidden",children:u.jsx("div",{className:`h-full rounded-full transition-all ${s?"bg-[#F4A28C]":"bg-[#7C9885]"}`,style:{width:`${r}%`}})}),s&&u.jsx("p",{className:"text-xs text-[#F4A28C] mt-2",children:n("account.seat.full")})]})}const BH="solta_pending_checkout",PPe=1800*1e3;function FH(){let e;try{e=sessionStorage.getItem(BH)}catch{return null}if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.ts&&Date.now()-t.ts>PPe)return null;const n=t.accountType==="enterprise"?"enterprise":"individual",a=parseInt(t.seats,10),r=n==="enterprise"?Number.isFinite(a)&&a>=_l?a:o0:void 0;return{plan:t.plan==="yearly"?"yearly":"monthly",accountType:n,...r!==void 0&&{seats:r}}}function OH(){try{sessionStorage.removeItem(BH)}catch{}}async function py({email:e,userId:t}){const n=FH();if(!n||!e||!t)return!1;try{const a=await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,userId:t,priceId:i0(n.accountType,n.plan),accountType:n.accountType,...n.accountType==="enterprise"&&{seats:n.seats}})}),r=await a.json();if(a.ok&&r.url)return OH(),window.location.href=r.url,!0}catch{}return!1}function zPe(){const e=Us(),[t,n]=D.useState("Processing login...");return D.useEffect(()=>{(async()=>{const r=new URLSearchParams(window.location.search),s=new URLSearchParams(window.location.hash.substring(1)),i=sessionStorage.getItem("solta_auth_return_url")||"/bls";sessionStorage.removeItem("solta_auth_return_url");const o=async b=>{const w=sessionStorage.getItem("solta_enterprise_code");if(sessionStorage.removeItem("solta_enterprise_code"),!!w)try{await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:b,code:w})})}catch(S){console.error("Error applying signup code:",S)}},l=s.get("access_token"),d=s.get("refresh_token");if(l){n("Completing login...");try{const{data:{session:b},error:w}=await No.auth.setSession({access_token:l,refresh_token:d});if(w){console.error("Session error:",w),n("Login failed. Redirecting..."),setTimeout(()=>e("/login"),2e3);return}if(b?.user){localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:b.user.email,userId:b.user.id}));try{await fetch("/.netlify/functions/create-user-record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:b.user.id,email:b.user.email})})}catch(k){console.error("Error creating user record:",k)}if(await o(b.user.id),n("Login successful! Redirecting..."),await py({email:b.user.email,userId:b.user.id}))return;e(i);return}}catch(b){console.error("Session error:",b),n("Login failed. Redirecting..."),setTimeout(()=>e("/login"),2e3);return}}const c=r.get("code");if(c){n("Completing login...");try{const{data:b,error:w}=await No.auth.exchangeCodeForSession(c);if(w){console.error("Code exchange error:",w),n("Login failed. Redirecting..."),setTimeout(()=>e("/login"),2e3);return}if(b?.session?.user){const S=b.session.user;localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:S.email,userId:S.id}));try{await fetch("/.netlify/functions/create-user-record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:S.id,email:S.email})})}catch(C){console.error("Error creating user record:",C)}if(await o(S.id),n("Login successful! Redirecting..."),await py({email:S.email,userId:S.id}))return;e(i);return}}catch(b){console.error("PKCE exchange error:",b),n("Login failed. Redirecting..."),setTimeout(()=>e("/login"),2e3);return}}const f=r.get("auth_success"),m=r.get("email"),x=r.get("userId");if(f==="true"&&m&&x){if(localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:m,userId:x})),n("Login successful! Redirecting..."),await py({email:m,userId:x}))return;e(i);return}const y=r.get("auth_error")||r.get("error");
5071if(y){console.error("Auth error:",y),n("Login failed. Redirecting..."),setTimeout(()=>e("/login"),2e3);return}n("No login data found. Redirecting..."),setTimeout(()=>e("/login"),2e3)})()},[e]),u.jsx("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center",children:u.jsxs("div",{className:"text-center space-y-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent rounded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:t})]})})}const UPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function WPe(){const e=Us(),{user:t,loading:n}=eb(),{t:a}=Ws(),[r,s]=D.useState(""),[i,o]=D.useState(""),[l,d]=D.useState(""),[c,f]=D.useState(!1),[m,x]=D.useState(!1),y=new URLSearchParams(window.location.search).get("returnUrl")||"/bls";D.useEffect(()=>{t&&!n&&e(y)},[t,n,e,y]);const b=async()=>{if(x(!0),d(""),window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")){sessionStorage.removeItem("solta_localhost_signed_out"),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:"[email protected]",userId:"test-user-google-localhost"})),e(y),x(!1);return}try{sessionStorage.setItem("solta_auth_return_url",y);const k=`${window.location.origin}/auth/callback`,{data:C,error:E}=await No.auth.signInWithOAuth({provider:"google",options:{redirectTo:k,queryParams:{access_type:"offline",prompt:"select_account"}}});E&&(d(a("auth.googleError")),x(!1))}catch{d(a("auth.googleError")),x(!1)}},w=async S=>{if(S.preventDefault(),f(!0),d(""),window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")){sessionStorage.removeItem("solta_localhost_signed_out"),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:r||"[email protected]",userId:"test-user-localhost"})),e(y),f(!1);return}try{console.log("[AUTH] Attempting login for:",r);const C=await fetch("/.netlify/functions/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:i})}),E=await C.json();if(console.log("[AUTH] Login response:",{status:C.status,ok:C.ok,data:E}),C.ok&&E.success){if(console.log("[AUTH] SUCCESS: Login successful"),E.session?.access_token&&E.session?.refresh_token){const{error:_}=await No.auth.setSession({access_token:E.session.access_token,refresh_token:E.session.refresh_token});_&&console.error("[AUTH] Failed to set session:",_)}if(localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:r,userId:E.userId})),await py({email:r,userId:E.userId}))return;e(y),d("")}else console.log("[AUTH] Login failed:",E.error),d(E.error||a("auth.login.error.invalid"))}catch(C){console.error("[AUTH] ERROR:",C),d(a("auth.login.error.tryAgain"))}finally{f(!1)}};return n?u.jsx("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center",children:u.jsxs("div",{className:"text-center space-y-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent rounded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:a("auth.loading")})]})}):u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(Vs,{showJoinButton:!1}),u.jsx("main",{className:"pt-24 pb-16",children:u.jsx("div",{className:"max-w-md mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:UPe,className:"text-center space-y-8",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:a("auth.login.title")}),u.jsx("p",{className:"text-sm text-[#1B4D1B] mt-2",children:a("auth.login.subtitle")})]}),u.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-8",children:[u.jsxs("form",{onSubmit:w,className:"space-y-6",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"auth-email",className:"sr-only",children:a("auth.login.emailLabel")}),u.jsx(el,{id:"auth-email",type:"email",placeholder:a("auth.login.emailPlaceholder"),value:r,onChange:S=>s(S.target.value),className:"w-full",autoComplete:"email",required:!0,"aria-required":"true"})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-1",children:[u.jsx("label",{htmlFor:"auth-password",className:"text-sm font-medium text-[#1B4D1B]",children:a("auth.login.passwordLabel")}),u.jsx("a",{href:"/reset-password",className:"text-sm text-[#7C9885] hover:text-[#6B8572] font-medium",children:a("auth.login.forgotPassword")})]}),u.jsx(el,{id:"auth-password",type:"password",placeholder:a("auth.login.passwordPlaceholder"),value:i,onChange:S=>o(S.target.value),className:"w-full",autoComplete:"current-password",required:!0,"aria-required":"true"})]})]}
5071),u.jsx("button",{type:"submit",disabled:c,className:"w-full bg-[#7C9885] hover:bg-[#6B8572] text-white py-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:a(c?"auth.login.submitLoading":"auth.login.submit")}),u.jsxs("div",{className:"relative flex items-center justify-center",children:[u.jsx("div",{className:"absolute inset-0 flex items-center",children:u.jsx("div",{className:"w-full border-t border-gray-300"})}),u.jsx("div",{className:"relative bg-white px-4 text-sm text-gray-500",children:a("auth.or")})]}),u.jsxs("button",{type:"button",onClick:b,disabled:m,className:"w-full flex items-center justify-center gap-3 bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 py-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",fill:"#4285F4"}),u.jsx("path",{d:"M9.003 18c2.43 0 4.467-.806 5.956-2.18l-2.909-2.26c-.806.54-1.836.86-3.047.86-2.344 0-4.328-1.584-5.036-3.711H.958v2.332A8.997 8.997 0 0 0 9.002 18z",fill:"#34A853"}),u.jsx("path",{d:"M3.964 10.712A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.33z",fill:"#FBBC05"}),u.jsx("path",{d:"M9.003 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.464.891 11.428 0 9.002 0A8.997 8.997 0 0 0 .958 4.958L3.965 7.29c.708-2.127 2.692-3.71 5.036-3.71z",fill:"#EA4335"})]}),a(m?"auth.connecting":"auth.continueGoogle")]}),l&&u.jsx("p",{role:"alert",className:"text-red-500 text-sm mt-2",children:l})]}),u.jsxs("p",{className:"text-sm text-[#1B4D1B]/70 text-center mt-6",children:[a("auth.login.noAccount")," ",u.jsx("a",{href:y!=="/bls"?`/signup?returnUrl=${encodeURIComponent(y)}`:"/signup",className:"text-[#7C9885] hover:text-[#6B8572] font-semibold underline",children:a("auth.login.signupLink")})]})]})]})})}),u.jsx(ui,{})]})}const VPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function HPe(){const e=Us(),{user:t,loading:n}=eb(),{t:a}=Ws(),[r,s]=D.useState(""),[i,o]=D.useState(""),[l,d]=D.useState(""),[c,f]=D.useState(!1),[m,x]=D.useState(!1),[y,b]=D.useState(""),[w,S]=D.useState(!1),[k,C]=D.useState(""),[E,T]=D.useState(""),[_,A]=D.useState(""),$=new URLSearchParams(window.location.search),O=$.get("returnUrl")||"/bls",z=$.get("enterpriseCode")||$.get("clinicCode")||$.get("ref")||"",P=O!=="/bls"?`/login?returnUrl=${encodeURIComponent(O)}`:"/login";D.useEffect(()=>{t&&!n&&e(O)},[t,n,e,O]),D.useEffect(()=>{if(!z)return;if(C(z),window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"){$.get("enterpriseCode")||$.get("clinicCode")?(A("enterprise"),T("Test Organization (localhost)")):(A("referral"),T(""));return}fetch("/.netlify/functions/validate-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:z})}).then(J=>J.json()).then(J=>{J.success&&J.valid?(A(J.kind||"enterprise"),T(J.accountName||"")):C("")}).catch(()=>{C("")})},[z]);const j=async()=>{if(x(!0),b(""),window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")){sessionStorage.removeItem("solta_localhost_signed_out"),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:"[email protected]",userId:"test-user-google-localhost"})),e(O),x(!1);return}try{sessionStorage.setItem("solta_auth_return_url",O),k?sessionStorage.setItem("solta_enterprise_code",k):sessionStorage.removeItem("solta_enterprise_code");const J=`${window.location.origin}/auth/callback`,{error:V}=await No.auth.signInWithOAuth({provider:"google",options:{redirectTo:J,queryParams:{access_type:"offline",prompt:"select_account"}}});V&&(b(a("auth.googleError")),x(!1))}catch{b(a("auth.googleError")),x(!1)}},G=async X=>{if(X.preventDefault(),f(!0),b(""),!r||!i||!l){b(a("auth.signup.error.fillFields")),f(!1);return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)){b(a("auth.signup.error.invali
5071dEmail")),f(!1);return}if(i.length<8){b(a("auth.signup.error.passwordLength")),f(!1);return}if(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")){sessionStorage.removeItem("solta_localhost_signed_out"),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:r||"[email protected]",userId:"test-user-localhost",displayName:l})),e(O),f(!1);return}try{const Q=await fetch("/.netlify/functions/create-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:i,fullName:l,enterpriseCode:k||void 0})}),F=await Q.json();if(!Q.ok||!F.success){const Y=F.error||"";Y.toLowerCase().includes("already")||Y.toLowerCase().includes("invalid email or password")?b("already_exists"):b(Y||a("auth.signup.error.generic")),f(!1);return}if(F.message!=="User created successfully"&&!k){b("already_exists"),f(!1);return}F.user?.id&&fetch("/.netlify/functions/record-email-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:F.user.id,email:r,marketingConsent:w,method:"signup_checkbox"})}).catch(()=>{});const H=await fetch("/.netlify/functions/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:i})}),B=await H.json();if(H.ok&&B.success){if(B.session?.access_token&&B.session?.refresh_token&&await No.auth.setSession({access_token:B.session.access_token,refresh_token:B.session.refresh_token}),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:r,userId:B.userId,displayName:l})),await py({email:r,userId:B.userId}))return;e(O)}else b(a("auth.signup.error.accountCreated")),e(O&&O!=="/bls"?`/login?returnUrl=${encodeURIComponent(O)}`:"/login")}catch(Q){console.error("Error creating account:",Q),b(a("auth.signup.error.tryAgain"))}finally{f(!1)}};return n?u.jsx("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center",children:u.jsxs("div",{className:"text-center space-y-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent rounded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:a("auth.loading")})]})}):u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(Vs,{showJoinButton:!1}),u.jsx("main",{className:"pt-24 pb-16",children:u.jsx("div",{className:"max-w-md mx-auto px-6",children:u.jsxs(qe.div,{variants:VPe,initial:"hidden",animate:"visible",className:"text-center space-y-8",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-serif text-3xl md:text-3xl text-[#1B4D1B]",children:a("auth.signup.title")}),u.jsx("p",{className:"text-sm text-[#1B4D1B] mt-2",children:a("auth.signup.subtitle")})]}),u.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-8",children:[u.jsxs("form",{onSubmit:G,className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"signup-fullName",className:"sr-only",children:a("auth.signup.fullNameLabel")}),u.jsx(el,{id:"signup-fullName",type:"text",placeholder:a("auth.signup.fullNamePlaceholder"),value:l,onChange:X=>d(X.target.value),required:!0,"aria-required":"true",autoComplete:"name"})]}),u.jsxs("div",{children:[u.jsx("label",{htmlFor:"signup-email",className:"sr-only",children:a("auth.signup.emailLabel")}),u.jsx(el,{id:"signup-email",type:"email",placeholder:a("auth.signup.emailPlaceholder"),value:r,onChange:X=>s(X.target.value),required:!0,"aria-required":"true",autoComplete:"email"})]}),u.jsxs("div",{children:[u.jsx("label",{htmlFor:"signup-password",className:"sr-only",children:a("auth.signup.passwordLabel")}),u.jsx(el,{id:"signup-password",type:"password",placeholder:a("auth.signup.passwordPlaceholder"),value:i,onChange:X=>o(X.target.value),required:!0,"aria-required":"true",minLength:8,autoComplete:"new-password"})]}),u.jsxs("label",{className:"flex items-start gap-3 cursor-pointer text-left",children:[u.jsx("input",{type:"checkbox",checked:w,onChange:X=>S(X.target.checked),className:"mt-0.5 h-4 w-4 rounded border-gray-300 text-[#7C9885] focus:ring-[#7C9885]"}),u.jsx("span",{className:"text-sm text-gray-600",children:a("auth.signup.marketingConsent")})]}),_?u.jsxs("div",{className:"bg-[#7C9885]/10 border border-[#7C9885]/30 rounded-lg p-3 flex items-center gap-2 text-left",children:[u.jsx("svg",{className:"w-4 h-4 text-[#7C9885] shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),u.jsx("span",{className:"text-sm text-[#1B4D1B]",children:_==="referral"?a("auth.signup.referredBy
5071Friend"):_==="access"?a("auth.signup.affiliateApplied"):u.jsxs(u.Fragment,{children:[a("auth.signup.joiningVia"),u.jsx("span",{className:"font-medium",children:E})]})})]}):u.jsx("div",{className:"text-left",children:u.jsx(u0,{onCodeChange:X=>C(X),onCodeValidated:(X,J,V)=>{C(X),A(J),T(V||"")}})}),y&&u.jsx("div",{role:"alert",className:"text-sm text-red-500",children:y==="already_exists"?u.jsxs("p",{children:[a("auth.signup.alreadyExistsPrefix"),u.jsx("a",{href:"/reset-password",className:"underline font-semibold hover:text-red-700",children:a("auth.signup.forgotPasswordLink")}),a("auth.signup.alreadyExistsBetween"),u.jsx("a",{href:P,className:"underline font-semibold hover:text-red-700",children:a("auth.signup.alreadyExistsLogin")}),a("auth.signup.alreadyExistsSuffix")]}):u.jsx("p",{children:y})}),u.jsx("button",{type:"submit",disabled:c,className:"w-full bg-[#7C9885] hover:bg-[#6B8572] text-white py-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:a(c?"auth.signup.submitLoading":"auth.signup.submit")}),u.jsxs("div",{className:"relative flex items-center justify-center",children:[u.jsx("div",{className:"absolute inset-0 flex items-center",children:u.jsx("div",{className:"w-full border-t border-gray-300"})}),u.jsx("div",{className:"relative bg-white px-4 text-sm text-gray-500",children:a("auth.or")})]}),u.jsxs("button",{type:"button",onClick:j,disabled:m,className:"w-full flex items-center justify-center gap-3 bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 py-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",fill:"#4285F4"}),u.jsx("path",{d:"M9.003 18c2.43 0 4.467-.806 5.956-2.18l-2.909-2.26c-.806.54-1.836.86-3.047.86-2.344 0-4.328-1.584-5.036-3.711H.958v2.332A8.997 8.997 0 0 0 9.002 18z",fill:"#34A853"}),u.jsx("path",{d:"M3.964 10.712A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.33z",fill:"#FBBC05"}),u.jsx("path",{d:"M9.003 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.464.891 11.428 0 9.002 0A8.997 8.997 0 0 0 .958 4.958L3.965 7.29c.708-2.127 2.692-3.71 5.036-3.71z",fill:"#EA4335"})]}),a(m?"auth.connecting":"auth.continueGoogle")]})]}),u.jsx("p",{className:"text-xs text-gray-500 text-center mt-6",children:a("auth.signup.terms")}),u.jsxs("p",{className:"text-sm text-[#1B4D1B]/70 text-center mt-4",children:[a("auth.signup.haveAccount")," ",u.jsx("a",{href:P,className:"text-[#7C9885] hover:text-[#6B8572] font-semibold underline",children:a("auth.signup.loginLink")})]})]})]})})}),u.jsx(ui,{})]})}function GPe(){const{pathname:e}=Vl();return D.useEffect(()=>{window.scrollTo(0,0)},[e]),null}const qPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function KPe(){const{t:e}=Ws(),[t,n]=D.useState(""),[a,r]=D.useState(""),[s,i]=D.useState(""),[o,l]=D.useState(!1),[d,c]=D.useState(""),f=Us(),m=Vl();D.useEffect(()=>{const y=m.hash;if(!y){i(e("auth.reset.error.noToken"));return}const b=new URLSearchParams(y.slice(1)),w=b.get("access_token"),S=b.get("type");w&&S==="recovery"?(c(w),i("")):i(e("auth.reset.error.invalidToken"))},[m.hash,e]);const x=async y=>{if(y.preventDefault(),t!==a){i(e("auth.reset.error.mismatch"));return}if(t.length<6){i(e("auth.reset.error.tooShort"));return}if(!d){i(e("auth.reset.error.useLink"));return}l(!0),i("");try{const b=await fetch("/.netlify/functions/update-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:d,password:t})}),w=await b.json();if(b.ok&&w.success){f("/bls");return}i(w.error||e("auth.reset.error.updateFail"))}catch{i(e("auth.reset.error.tryAgain"))}finally{l(!1)}};return u.jsx("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center py-16",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:qPe,className:"text-center space-y-8 text-[#1B4D1B] w-full max-w-md px-4",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl",children:e("auth.reset.title")}),u.jsx("p",{className:"text-sm text-[#1B4D1B] mt-2",children:e("auth.reset.subtitle")})]}),u.jsx("div",{className:"bg-white rounded-lg shadow-lg p-8",children:u.jsxs("form",{onSubmit:x,className:"space-y-6",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"new-password",className:"sr-only",children:e("auth.reset.newPasswordLabel")}),u.jsx(el,{id:"new-password",type:"password",placeholder:e("auth.reset.newPasswordPlaceholder"),value:t,onChange:y=>n(y.target.value),className:"w-full",required:!0,"aria-required":"true",minLength:6,autoComplete:"new-password"})]}),u.jsxs("div",{children:[u.jsx("label",{htmlFor:"confirm-password",className:"sr-only",children:e("auth.reset.confirmPasswordLabel")}),u.jsx(el,{id:"confirm-password",type:"password",placeholder:e("auth.reset.confirmPasswordPlaceholder"),value:a,onChange:y=>r(y.target.value),className:"w-full",required:!0,"aria-required":"true",minLength:6,autoComplete:"new-password"})]})]}),u.jsx("button",{type:"submit",disabled:o||!d,className:"w-full bg-[#7C9885] hover:bg-[#6
5071B8572] text-white py-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-[#7C9885] focus:ring-offset-2",children:e(o?"auth.reset.submitLoading":"auth.reset.submit")}),!d&&!s&&u.jsx("p",{className:"text-[#1B4D1B] text-sm mt-2",children:e("auth.reset.useEmailLink")}),s&&u.jsx("p",{role:"alert",className:"text-red-500 text-sm mt-2",children:s})]})})]})})}const XPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function YPe(){return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:"Privacy Policy – Solta AI",description:"Solta AI's privacy policy. Learn how we protect your data and your rights regarding personal information on our platform.",path:"/privacy"}),u.jsx(Vs,{}),u.jsx("main",{id:"main-content",className:"pt-24 pb-16",children:u.jsx("div",{className:"max-w-4xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:XPe,className:"prose prose-lg max-w-none",children:[u.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B] mb-2",children:"Privacy Policy"}),u.jsx("p",{className:"text-[#1B4D1B]/70 text-sm mb-8",children:"Last Updated: January 2025"}),u.jsxs("div",{className:"space-y-8 text-[#1B4D1B]",children:[u.jsx("p",{className:"text-lg leading-relaxed",children:"Privacy is our priority. We understand that you may be sharing sensitive information related to your mental health and trauma processing, and we take that responsibility seriously. Your data is stored securely encrypted on our servers, and we operate with strict policies protecting your data privacy."}),u.jsx("p",{className:"leading-relaxed",children:"Because we're in the early stages, these terms might change slightly over time. You can always find the most recent copy of these terms on this page. And while the details might change, our commitment to your privacy never will."}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"Solta AI Privacy Policy"}),u.jsx("p",{className:"leading-relaxed",children:'Solta AI, Inc. ("Solta AI" or "we") provides certain websites, platforms, applications and related online services (collectively referred to herein as the "Platform") to each Platform user ("User" or "you"). This Privacy Policy explains the types of information we may collect through the Platform, how we use and disclose such information and our purposes for doing so. It also describes how we protect Personal Information and your choices with regard to your Personal Information.'}),u.jsx("p",{className:"leading-relaxed mt-4",children:"To the extent you use the Platform, this Privacy Policy will apply to you, so please review it carefully."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"1. Information We Collect"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"As described in further detail below, we may collect both Personal Information (i.e., information that identifies you or other individuals) and Non-Personal Information (i.e., information that does not identify you or any other individual, directly or indirectly)."}),u.jsx("p",{className:"leading-relaxed mb-4",children:"We may collect the following types of Personal Information:"}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Account Information"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect full names of Users and email addresses when they provide it to us in the course of using the Platform. For example, we may collect a User's full name and email address when that User establishes an account on the Platform or when they sign in using Google OAuth."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Contact Information"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect Users' contact information, including email addresses, when they establish an account on the Platform or when they provide such information to us in connection with sending us an inquiry or other communication."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Online Identifiers"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect Users' online identifiers, such as their Internet Protocol (IP) addresses, automatically as they use the Platform."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Facial Expression Data"}),u.jsxs("p",{className:"leading-relaxed",children:["In order to provide our AI-powered bilateral stimulation services, we collect and process facial expression data through your device's camera in real-time. This data is used to detect emotional responses and adjust the bilateral stimulation accordingly. ",u.jsx("strong",{children:"This facial data is processed locally in your browser and is not stored on our servers."})," We do not retain recordings of your face or facial expression data after your session ends."]})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Session Data"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect data regarding your use of our bilateral stimulation tool, including session duration, settings preferences, and interaction patterns. This data helps us improve our service and personalize your experience."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Platform Usage Data"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect data regarding the ways in which our Users use the Platform, such as web pages visited, amount of time spent on web pages, hyperlinks on which a User clicks, number of Platform sessions, and the start and end time of such sessions."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Geolocation Data"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect geolocation data which generally identifies the area (but not the specific location) of the device used to access the Platform."})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-semibold text-[#1B4D1B]",children:"Device Type"}),u.jsx("p",{className:"leading-relaxed",children:"We may collect information about the type of device that is used to access the Platform."})]})]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"2. How We Use and Disclose Information"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"We may use and disclose Personal Information as described below:"}),u.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[u.jsx("li",{children:"We may use our Users' names and contact information to operate and provide our Platform, including without limitation, to provide specific Platform services, to enable our Users to establish and maintain accounts on the Platform and to communicate with Users."}),u.jsx("li",{children:"We may use facial expression data solely to provide real-time adjustment of bilateral stimulation speed and intensity during your sessions. This data is processed locally and is not transmitted to or stored on our servers."}),u.jsx("li",{children:"We may use Session Data to improve the Platform, understand usage patterns, and enhance the effectiveness of our bilateral stimulation tool."}),u.jsx("li",{children:"We may disclose Users' names and contact information to our service providers and affiliates that assist us or otherwise work with us to support our business functions, including the provision of our Platform."}),u.jsx("li",{children:"We may use any of the Personal Information described 
5071in this Privacy Policy as needed to comply with applicable law, regulation, legal process, subpoena or governmental request."}),u.jsx("li",{children:"We may use Platform usage data, geolocation data and device type data for analytics purposes, such as analyzing trends relating to our Users' use of the Platform, and to improve the Platform."})]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"3. Data Security"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"We implement information security measures designed to maintain the security and integrity of the Personal Information that we collect and maintain. Examples of security measures that we use include, but are not limited to, the following:"}),u.jsxs("ul",{className:"list-disc pl-6 space-y-2 mb-4",children:[u.jsx("li",{children:"Data encryption at rest and in transit"}),u.jsx("li",{children:"Use of multi-factor authentication"}),u.jsx("li",{children:"Password protection and management"}),u.jsx("li",{children:"Role-based access control for employees who access Personal Information"}),u.jsxs("li",{children:[u.jsx("strong",{children:"Local processing of facial expression data"})," (never transmitted to servers)"]})]}),u.jsx("p",{className:"leading-relaxed mb-4",children:"Your account information is stored securely with full encryption on our servers. Our encryption protocols ensure that team members cannot access your personal data under normal operational circumstances."}),u.jsx("p",{className:"leading-relaxed",children:"We regularly assess the effectiveness of our data security measures and may modify such measures, as appropriate, to adequately protect information that we collect and maintain. Despite the security measures we implement, there are inherent risks in transmission of information over the Internet and therefore we cannot guarantee that unauthorized access to or use of information will never occur."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"4. Camera and Webcam Usage"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"Our Platform uses your device's camera to detect facial expressions in real-time. This is essential for our AI-powered bilateral stimulation feature to work effectively."}),u.jsx("p",{className:"font-semibold mb-2",children:"Important information about camera usage:"}),u.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[u.jsx("li",{children:"Camera access is only activated when you start a bilateral stimulation session"}),u.jsx("li",{children:"Facial expression data is processed entirely within your browser (client-side)"}),u.jsx("li",{children:"No video or images of your face are transmitted to our servers"}),u.jsx("li",{children:"No recordings are stored or saved"}),u.jsx("li",{children:"You can revoke camera permissions at any time through your browser settings"})]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"5. Links to Third-Party Sites"}),u.jsx("p",{className:"leading-relaxed",children:"Our Platform may include links to third-party websites. We do not endorse or recommend such third-party websites and are not responsible for the privacy practices of the operators of those websites. We encourage you to read the privacy policies which may apply to your use of third-party websites."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"6. Children Under 18"}),u.jsx("p",{className:"leading-relaxed",children:"Our Platform is not intended for use by children under the age of 18 and we do not knowingly collect Personal Information from children under the age of 18. If you become aware that we have collected Personal Information from a child under the age of 18, please contact us at [email protected] so that we may seek to delete such Personal Information."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"7. Direct Marketing"}),u.jsx("p",{className:"leading-relaxed",children:"Depending on the choices you have made, you may receive direct marketing communications from us. We may use your name and contact information to send such communications to you. Direct marketing communications may include updates about our products and services and other promotional material that may be of interest to you. When we send direct marketing communications to you via email, we will include an unsubscribe link in the email which allows you to opt out of receiving further direct marketing emails from us."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"8. Our Service Providers"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"We work with third-party service providers and disclose Personal Information to those providers so that they may assist us with certain activities. Our service providers include:"}),u.jsxs("ul",{className:"list-disc pl-6 space-y-2 mb-4",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Supabase"})," - Authentication and database services"]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Google"})," - OAuth authentication"]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Netlify"})," - Website hosting"]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Stripe"})," - Payment processing (when applicable)"]})]}),u.jsx("p",{className:"leading-relaxed",children:"We carefully evaluate the information privacy and security practices of those providers prior to engaging them and select only those providers that we reasonably determine are able to adequately protect Personal Information."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"9. International Data Transfers"}),u.jsx("p",{className:"leading-relaxed",children:"In connection with providing our Platform, we may transfer information internationally from the country in which you access the Platform to other countries around the globe, as permitted by applicable laws. We may transfer such information to a country that does not have the same privacy or data protection laws as the country in which such information was collected."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"10. Retention of Personal Information"}),u.jsx("p",{className:"leading-relaxed",children:'We may retain Personal Information until the purposes of using and disclosing such information described 
5071in this Privacy Policy have been fulfilled, as permitted under applicable laws and regulations. However, you may, at any time, request that we delete your Personal Information as specified in the section below titled "Your Choices Regarding Personal Information".'})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"11. Your Choices Regarding Personal Information"}),u.jsx("p",{className:"leading-relaxed mb-4",children:"Subject to data protection laws, you may have certain rights with respect to your Personal Information, including:"}),u.jsxs("ul",{className:"list-disc pl-6 space-y-2 mb-4",children:[u.jsx("li",{children:"The right to request a copy of the Personal Information which we hold about you"}),u.jsx("li",{children:"The right to request that we correct any Personal Information if it is found to be inaccurate or out of date"}),u.jsx("li",{children:"The right to request your Personal Information is erased where it is no longer necessary to retain such data"}),u.jsx("li",{children:"The right to withdraw your consent to the processing at any time, where consent was the lawful basis for processing your Personal Information"}),u.jsx("li",{children:"The right to request that we provide you with your Personal Information and where possible, to transmit that data directly to another data controller"}),u.jsx("li",{children:"The right to object to our processing of Personal Information, where applicable"})]}),u.jsxs("p",{className:"leading-relaxed",children:["If you would like to exercise your data protection rights, you may send a request to us at ",u.jsx("a",{href:"mailto:[email protected]",className:"text-[#7C9885] hover:text-[#F4A28C] underline",children:"[email protected]"}),". We will respond to your request as required by any applicable laws or regulations."]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"12. Mental Health Disclaimer"}),u.jsxs("p",{className:"leading-relaxed mb-4",children:["Solta AI is a wellness tool designed to provide bilateral stimulation for relaxation and self-guided emotional processing. ",u.jsx("strong",{children:"Solta AI is not a substitute for professional mental health treatment, therapy, or medical advice."})]}),u.jsxs("p",{className:"leading-relaxed",children:["If you are in crisis, please seek out professional help or a crisis line. You can find resources at ",u.jsx("a",{href:"https://www.findahelpline.com",className:"text-[#7C9885] hover:text-[#F4A28C] underline",target:"_blank",rel:"noopener noreferrer",children:"www.findahelpline.com"})," or call the 988 Suicide & Crisis Lifeline."]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"13. Privacy Policy Changes"}),u.jsx("p",{className:"leading-relaxed",children:"We may change this Privacy Policy from time to time. We will post any updated version of this Privacy Policy on our Platform. Please check the Platform frequently to ensure you have reviewed the most recent version of the Privacy Policy."})]}),u.jsx("hr",{className:"border-[#7C9885]/30"}),u.jsxs("section",{children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"Questions"}),u.jsxs("p",{className:"leading-relaxed",children:["If you have any questions about this Privacy Policy, please feel free to contact us at ",u.jsx("a",{href:"mailto:[email protected]",className:"text-[#7C9885] hover:text-[#F4A28C] underline",children:"[email protected]"}),"."]})]}),u.jsx("hr",{className:"border-[#7C9885]/30"})]})]})})}),u.jsx(ui,{})]})}const JPe={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function QPe(){const[e]=rw(),t=e.get("session_id"),[n,a]=D.useState("loading");return D.useEffect(()=>{if(!t){a("no_session");return}const r=sessionStorage.getItem("pending_signup");if(!r){a("success");return}(async()=>{try{const{email:i,password:o}=JSON.parse(r);await fetch("/.netlify/functions/create-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:o})});const l=await fetch("/.netlify/functions/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:o})}),d=await l.json();l.ok&&d.success&&(d.session?.access_token&&d.session?.refresh_token&&await No.auth.setSession({access_token:d.session.access_token,refresh_token:d.session.refresh_token}),localStorage.setItem("soltaai_mvp_access",JSON.stringify({email:i,userId:d.userId}))),sessionStorage.removeItem("pending_signup")}catch(i){console.error("[SUCCESS] Error creating account:",i)}a("success")})()},[t]),u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(Vs,{showJoinButton:!1}),u.jsx("main",{className:"pt-24",children:u.jsx("section",{className:"py-16 md:py-24",children:u.jsx("div",{className:"max-w-2xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:JPe,className:"text-center space-y-8",children:[n==="loading"&&u.jsxs("div",{className:"space-y-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent roun
5071ded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:"Verifying your subscription..."})]}),n==="success"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-20 h-20 mx-auto bg-[#7C9885] rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-10 h-10 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),u.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B]",children:"Welcome to Solta AI!"}),u.jsx("p",{className:"text-lg text-[#1B4D1B]/80",children:"Your subscription is now active. You have unlimited access to BLS sessions."}),u.jsxs("div",{className:"bg-white rounded-xl p-6 space-y-4",children:[u.jsx("h2",{className:"font-semibold text-xl text-[#1B4D1B]",children:"What's included:"}),u.jsxs("ul",{className:"space-y-2 text-[#1B4D1B]/80",children:[u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Unlimited BLS sessions"]}),u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"AI-adaptive speed control"]}),u.jsxs("li",{className:"flex items-center justify-center gap-2",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Emotion tracking & insights"]})]})]}),u.jsx(fv,{to:"/bls",className:"inline-block bg-[#7C9885] hover:bg-[#6B8572] text-white px-8 py-4 rounded-lg text-lg font-medium transition-colors",children:"Start a Session"})]}),n==="no_session"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-20 h-20 mx-auto bg-[#F4A28C] rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-10 h-10 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),u.jsx("h1",{className:"font-serif text-4xl text-[#1B4D1B]",children:"Something went wrong"}),u.jsx("p",{className:"text-lg text-[#1B4D1B]/80",children:"We couldn't verify your subscription. Please try again or contact support."}),u.jsx(fv,{to:"/bls",className:"inline-block bg-[#7C9885] hover:bg-[#6B8572] text-white px-8 py-4 rounded-lg text-lg font-medium transition-colors",children:"Go to BLS Sessions"})]})]})})})}),u.jsx(ui,{})]})}function e3(){const[e,t]=D.useState(250),n=D.useRef();D.useEffect(()=>{const S=performance.now(),k=2500,C=40,E=460,T=_=>{const $=(_-S)%(k*2)/k;let O=$<1?$:2-$;O=O<.5?2*O*O:1-Math.pow(-2*O+2,2)/2,t(C+(E-C)*O),n.current=requestAnimationFrame(T)};return n.current=requestAnimationFrame(T),()=>cancelAnimationFrame(n.current)},[]);const a=190,r=310,s=45,i=50,o=24,l=14,d=7,c=16,f=S=>{const k=Math.max(-1,Math.min(1,(e-S)/220));return{x:S+k*c,y:s}},m=f(a),x=f(r),y=(S,k)=>`M ${S-i} ${k} C ${S-i*.5} ${k-o*1.6}, ${S+i*.5} ${k-o*1.6}, ${S+i} ${k} C ${S+i*.5} ${k+o*1.35}, ${S-i*.5} ${k+o*1.35}, ${S-i} ${k}`,b=(S,k)=>`M ${S-i-5} ${k+1} Q ${S} ${k-o*2.3}, ${S+i+5} ${k+1}`,w=(S,k,C,E)=>u.jsxs(u.Fragment,{children:[u.jsx("path",{d:b(S,k),fill:"none",stroke:"#1B4D1B",strokeWidth:1,opacity:.15}),u.jsx("path",{d:y(S,k),fill:"white",stroke:"#1B4D1B",strokeWidth:1.5}),u.jsxs("g",{clipPath:`url(#${E})`,children:[u.jsx("circle",{cx:C.x,cy:C.y,r:l,fill:"#7C9885",opacity:.2}),u.jsx("circle",{cx:C.x,cy:C.y,r:d,fill:"#1B4D1B"}),u.jsx("circle",{cx:C.x-2,cy:C.y-2.5,r:2,fill:"white",opacity:.75}),u.jsx("circle",{cx:C.x+3,cy:C.y+2,r:1,fill:"white",opacity:.3})]})]});return u.jsx("div",{style:{maxWidth:480,margin:"0 auto"},children:u.jsxs("svg",{viewBox:"0 0 500 90",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Two eyes tracking a moving dot, illustrating bilateral stimulation",children:[u.jsxs("defs",{children:[u.jsx("clipPath",{id:"eyeClipL",children:u.jsx("path",{d:y(a,s)})}),u.jsx("clipPath",{id:"eyeClipR",children:u.jsx("path",{d:y(r,s)})}),u.jsx("filter",{id:"dotGlow",children:u.jsx("feDropShadow",{dx:"0",dy:"0",stdDeviation:"3",floodColor:"#7C9885",floodOpacity:"0.3"})})]}),w(a,s,m,"eyeClipL"),w(r,s,x,"eyeClipR"),u.jsx("circle",{cx:e,cy:s,r:9,fill:"#7C9885",filter:"url
5071(#dotGlow)"})]})})}const c0="/assets/vudy-dark-C1WVYRFj.png",d0="/assets/pinyahta-DyxeuHNN.png",t3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20width='814'%20height='1000'%3e%3cpath%20d='M788.1%20340.9c-5.8%204.5-108.2%2062.2-108.2%20190.5%200%20148.4%20130.3%20200.9%20134.2%20202.2-.6%203.2-20.7%2071.9-68.7%20141.9-42.8%2061.6-87.5%20123.1-155.5%20123.1s-85.5-39.5-164-39.5c-76.5%200-103.7%2040.8-165.9%2040.8s-105.6-57-155.5-127C46.7%20790.7%200%20663%200%20541.8c0-194.4%20126.4-297.5%20250.8-297.5%2066.1%200%20121.2%2043.4%20162.7%2043.4%2039.5%200%20101.1-46%20176.3-46%2028.5%200%20130.9%202.6%20198.3%2099.2zm-234-181.5c31.1-36.9%2053.1-88.1%2053.1-139.3%200-7.1-.6-14.3-1.9-20.1-50.6%201.9-110.8%2033.7-147.1%2075.8-28.5%2032.4-55.1%2083.6-55.1%20135.5%200%207.8%201.3%2015.6%201.9%2018.1%203.2.6%208.4%201.3%2013.6%201.3%2045.4%200%20102.5-30.4%20135.5-71.3z'/%3e%3c/svg%3e",n3="/assets/nature-DKLR15-6.png",a3="/assets/Georgia_Tech_Yellow_Jackets_logo.svg-BXDcu4wm.png",rm="/assets/Texas_Tech_Athletics_logo.svg-Dn6q692P.png",r3="data:image/webp;base64,UklGRgoPAABXRUJQVlA4WAoAAAAQAAAAxwAAxwAAQUxQSIYHAAABoMb//9nW+qVN18w6tn3W4dq27Xun7ti2bdu2bRvj5bHZDp3a/B4s+eWf/7I8uq/XImICoNz/5f4vD6f07FuBZZdQLzbG4Yhm6FCPjo521K4ayMfz1z0pTEKfjY12OKIZOxzRMTERmqxN4mIcjmiWDkd0bHMrI8vQ9PvFBTlul9bsfNW8HLfL9fDBnevHx39USS+xL+LfTF5KvZJTnJ/jdjF0Z3sKPddPv60paF7WfW9+ttul2Z1bUHhzQxAjAHtk09/WpT0qQvrVrt26l+y97NBfOV5ULjidVNtPj7BUxLwPWIAQXDW66947XtRccOf02E9rhVqBoRTZrPW+6/kykotd6ct/qhMigM7Nu5yhHQWi9MLIS0qI6J73hsjuPUT0zWKiXGXUAy27f60K+kZ+s/I2IW9/35bAaeWNpBMUAKjR9qkKontDHLM9iIiZddgBfHqfNi0Q9Bdip6hc+zAA+K3/hB1YmqaqIT7uzKiRXML7s6ADjCimXK0CXEodfApRwLO0QgeAhpkExCEBTGai4gpJjzpPKLPsfID/thJDgWtrd13gFRcFx4sMwh4oFTfQwz+L0svKCXyRj4g1+YI/9IFuJJzIoE2hEg7Xw55O6WjhRfwP8UAgZ/E6QRop71dNtu2o6tElg9KJG1iIOMpmLG+Q8FxVLS/cV8Mko/kFMV4wlpDTJPxDoIm9kXjWaOqj/BEYi6UrbWcQLSCV4nnHYADdrxkMvOUmyVVob3puyWq++Ubz8JbDaOqlk/Br2vZTKXlqmFHPYI7fbGE0gXtok0g1cDhcIeAvgrHsy6xlNLCStoM0pbAF9KVs9jeW5Vk1DWekl7SHIj04CFApn4B1jGWpAfUsYuWUPwOAJZTxZiepgLSLYN9+CwAgluIOMDlO2jxCbG6PEsEHCdjZTLVVs/aUq5QQWlPSrOamfzGpqVpI6nKpBERdI+R9ZG6my5QbkWqv4XeCgriBIC83NZZNSF0oqW37qwYo/1Cghv81NTNVz5C+BNWqOAtUg/8lYJJgYp6/RzlXQ21ywVtqMJmyL8i8CElI9HYC1bDbqUCs5iNgtHmRdlJO2tWS0EmBdZQl5iUKiXItULVvKgTyMxS5omnZSfkI1J9zjaMFnyTgCLPyI6p7O4K6tTtG0aw9KNcCzUnUHUJrGyE4a6dEg9i7hMJEU1LhKKp63gDqi5ho0SBtlNVws58JqbITlb2HagJ5261moLV1IeHOM6bD9l46Kqd2E4FcR14KmkNuErCbxWS8tToPFVPb1wGNU4u/1AbTKKnhZd9RNanugPMeGRGx6MAHERbQGHHjtpVBbQq+W/Y9Xrdu/fr163acz0aUizyuu3tTKgDDRN8AYLmbcrTse7Jtu+LWTRsXT+r1Y7QITG07CysweY+CLcq848Bl3NOVwDQknbK8zDvBhaULvshGHER5WNMMhaZeCGIDLz4mFHU3Q29hW2As7SDg0WATtAfXTGA89pxMcL9rfpogp2NspmeG3B1srGEa5VFFsxP+8F4VYN+Ygilmp51vEei5n3LV5Pjvwha6fErBT83Ny66zoGvINco+UyMOwAR9bEMpedGlbYmhhf2bU1kfeNNF8E5k05GjtVm1DOwLXCLpFHyYgOdrMOlu5efs6QgDO4W/gN4DignyFypwnDLOjx/vgSDjcuCVZro1cRFwjaRyiLJQ4qYBLrMa1zpcJ+oGuyneOioLKYeDuOmFw8Gwajwq7Aj6v0XBUSrxlDuVucnwfGZc/Yue1OMA/qW4rUpVKBjFy3t59yXDCj+Bx4HHDhRMVIKTlPGcWJfiAjCs93KxMxc1XZQ0la8pjyQ+XndhQ8Pym4YYwoW0mJL7iVJEBgHbcyEdwRVgWNXy8STw+ZmPIC9QsqRQblbiYQxmVzOukYjdOKl9mYB/N1SAiP0E31QOOqLc3mJY9QoRm3ICs30E/ENQgDi3Gnp+0csyuBjX+kMpTOBkF+LDcF5ey6HsCVCCTwiY85E+9oU+zAyDUigOo1wU2CUWIp4N5iX8OgVfU4GfC9UQnX7sxGf+RkwPgNIYcIiSXY+Z4woiZgXy4pdJ+jNcBX66S8DVL1rYBL4xD1FeHwql8gukeiewqnsJSw7i5dWnJNwaqgLPHifgg/Xfh2gSWvTb7ULM6RIApfLzbBLmt2Pz9T1U9O5x8CB+dwPpvgN1VCCgh08N0XNzc8eoID8RAKx+QY1+XHTpSTEiHmpiAa4F0U8Kjqj66RbUfCS+bmRwgN0mKoj2oErfHEfqqT7RkaEBkp9o0Wa12QNCKzw/+gpqfzyweqi/TQQAqL/Z7VNRfnD93OFLV+6jcv5fPwPv9buPWXzwGiLKPq2IeO/U+umD+kYAQHCPKfufIvqIMiLmpm5eNHrgm9raD5656Xw+Ivq0I+LF5cO6VYaSz8+4mEeiX9/yix24r52Y7ExK+ON3tglJTmdySomgRGdy/O+a4xOTncltXtT2m9OZnBj/O+M/Ep3JCRUVAKp93H+fh8G12fFRApRGi6C3BUoK7C2CNkF/IIqBlV9rN2vfv8VKV/eN/7VhmF0AUx8mQrn/y/1f7v//EwVWUDggXgcAAPAuAJ0BKsgAyAA+SSSPRaKiIZEZdVgoBISm7jRtRs0Vr4A/UD+gI3tXv8p/GO6upb1T8mOYh2M8F8fjSv0AfE9xp/h/63+Qfu9/kHsA+6P3A/1L/3foueoD+AegD9Mf9F/lfeW/tP+Z9gH7AewB/Hv8f///aX/sHsAf2X/p+wB+1Xqp/6H9qP/j8iX7dfvR7Tf/p/6fuAegB1D/Fr8AO4L+Ktxv3HLg3mDZr3ZP7Mj9XTtf4PM4dExFdO1/g8zh0TEV0wnJsIbN1whCe8r7NQnOATJRrR/mkq97mjBC5yim+PiHnKKy6PJTBU19RDNBvoIqz5XoWCgDuCTMCeMgZ52AF1ACaDWAt5BnU+T0EX/0TXfru89uhLG1AKdrWovd+Z2v3O3yHboQCBQ4m6XJ84w4F8gGGv54FLEB+gisyYHbOCqXYvhQI2uc+x0HM0tL82BjKK/7kUxXTRbyMj8ENX+jNi/8HmcOiYiuna/weZw6JiK6dr/B5nDomIrp2v6wAAD++ELAAAAjMiExHDMeYVHqI/eyL5mpimnjTfTUMyls1Lw0R//7+i05s8pMevcZJX7K3z6+zf4Be4zgJe4BiHIZUNyqEPowPMtI/yUUAZ5/7cbZKb7PGnEIjdRDbFb/Ch1rXoOtbAUlyLhGk8r44ftHy/9b2zjO8AvItCjMzqNzDQbgfe3N+rq4xCry7hK7Wrpwazkx67ZHFZhI5Hgj/OaT/haIuES6XvDfuHBpyZST/IRh/4IrIsCtUnTY/wVEwJMlQ8l4h9IGcHY9SR4fZsDSuJcajh4lYWFxgGNCna6z4aN/qQ7Q8x17Va9/+gJyvqy/11ouGZzQ1LZYO27kkPlWpAh7mS2Vjh198vgvp+qP9jks69y/dNS2Z/HDbwjSKf0Gwi04s++htWgRV/wG7HKhKkM7435EOQ3pEoR//PLRANb6gyZ1WWQqGKQcxI30FRakHFjCkOcC/uM9GXlRvr4SWAWasVtbtJ6S3V+b0REVDZDiakig9L882FCiAF3WADstimxH2ChSoPD8U1mjkq2qlWInm6SSrFjmVxXbxB8RKY2TdoU2gBqIOW0/1ui7Ph2iAQqyC5BBndIHv3EUiwC5qU1cxCdEdFf641wbUl4HqFtMLQjY5cifV6/RhC/GYOgaF1fYxHX
5071h674LFqmAT0Z6BvuI9o4fxZZNlXfU78IDC2tLR86ZeG7I17f/ptmT9dmt6jfXY2eIC/poFCJ8HVFsyZgpIfi/SQZ94nA7AUPeFNFpfAKxSbvNJVbWjs6oDEkNrr2Tfns3DkA++8EN6LjH3OfXSKOSrYF6uck5AJSTPB4fV03lLSzreJDiUSPJv6AmEIyDzOzJELUR4jA6XAtaz2WXvklzUzArfzigeKLckk1B4839puYLg1Zt41CuxYLgH8CBGZmjo5w3ZIOGSiny6vdj/WmIiGCYK2hKUQB9jETqnHL4qAHnyOfIGLlUVbi+qqaUyzVUvdVp9R1KjxfkL8Poygj0naYOqzpgGzK/wToAL/77P//384gQtWOrMP+WzC02yI+vhlk20LB83xLYMzY2UKYy4vlykmZSe1LdmAHmcnYnW9RNKvUtTRblrn2c+mAEjZHVTBYM3Ai78A/MsUbWAc+LSXrHOeQALmMFo64BiTT3EyTudm/aiR7jt8RCRc60Hsi//8/PTGEvGwmJYWvD0vJQPS8lgejqzhoSjgFSGhxhcsw/u7y36HlFcatEnWQLHqcw9TUePwfdqOMrUbgnUUY5mDf3b7rM+quL5K+guwsMDQK6XQJCB6T+sxv9l1YVAmrGRQEwnu52lX+CppegmdE95QR2cSuthpXUDgpK45qOHXjyPpYbfxfe9oc3nw8DGfNk0Ufq8I3GFus2LKhAmxHZAL8Q435fdEuFxUW20kOlQs7mCWgchrFx/MI9sxmtJjomlb8aKPOeVun5OVlEXHxi+gGuAoywNe8msFovgOps7es2kV+jJlJBuwR7kxiw8X4KsI+AjQdWDzVgVL92FAA/0LdWlPyzdbDCg44aeOKs7cB85eQ6XBsUG+BOw2dF8K0V/+9XJQBpwVItfwdS1HrWxv+SygAhXzK2ApK0rRx3Azo/iEvBZWe4+JBCiYPkBALXMneA3Db7VGWJFwpMPvR8dk4TP3uHP7STcw6ozjUfmkDpXfrZDxy8xFDBH+drGdnTpQp1/Hh//VYRLb9/NpeapOMj487c42WeLseCCRZxdxgeJVPhJRMqO/lHvL6wKXv2AlqmQvp9q5Yytvpf/a9R0+MA36maeDPOG5vxtDz5vjawvaimPvuG2D/JbvLIpeqr3+vMW0dogSTnSXrcnNCVAlbyo2ygwMjfVV3jlLRJH1tzIkxRk2t/xZBLwEXOAabSSmFsWiQN/Wf+U5aHhNzDsuxkji+66SvzpwldWZks491RY5XvPHmfUu1X8wN41/dQL2cH8sf8yCRW8eFP/7bHl1YlLzNRP9Wdmz31JI1n1wHDiYHzms3kFofIx1DvAAAAAAAAAAAA",s3="/assets/Texas_Longhorns_logo.svg-D9g7d1un.png",i3="/assets/think_aita-C1TB5xrZ.png",o3="/assets/EMDRIA_LOGO_REG_highres-AB_Ejj3m.webp",l3="/assets/sessions-health-icon-Cxs-Dqbs.png",LH="/assets/create_x-BR3Cyd3O.avif";function $g({children:e}){return u.jsx("span",{className:"w-10 h-10 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e})})}const ZPe=()=>u.jsxs($g,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"5"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"#1B4D1B"})]}),e6e=()=>u.jsxs($g,{children:[u.jsx("circle",{cx:"4",cy:"12",r:"0.7",fill:"#1B4D1B",stroke:"none",opacity:"0.35"}),u.jsx("circle",{cx:"8",cy:"12",r:"1.1",fill:"#1B4D1B",stroke:"none",opacity:"0.55"}),u.jsx("circle",{cx:"12.5",cy:"12",r:"1.6",fill:"#1B4D1B",stroke:"none",opacity:"0.75"}),u.jsx("circle",{cx:"18",cy:"12",r:"2.4",fill:"#1B4D1B",stroke:"none"})]}),t6e=()=>u.jsxs($g,{children:[u.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),u.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),u.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),u.jsx("circle",{cx:"9",cy:"6",r:"2",fill:"#E5EBE0"}),u.jsx("circle",{cx:"15",cy:"12",r:"2",fill:"#E5EBE0"}),u.jsx("circle",{cx:"7",cy:"18",r:"2",fill:"#E5EBE0"})]}),n6e=()=>u.jsx($g,{children:u.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z",fill:"#1B4D1B"})}),a6e=()=>u.jsxs($g,{children:[u.jsx("path",{d:"M12 18V5"}),u.jsx("path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}),u.jsx("path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}),u.jsx("path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}),u.jsx("path",{d:"M18 18a4 4 0 0 0 2-7.464"}),u.jsx("path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}),u.jsx("path",{d:"M6 18a4 4 0 0 1-2-7.464"}),u.jsx("path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"})]}),r6e=()=>u.jsxs($g,{children:[u.jsx("circle",{cx:"9",cy:"11",r:"2.8"}),u.jsx("line",{x1:"9",y1:"8.2",x2:"9",y2:"4"}),u.jsx("line",{x1:"9",y1:"4",x2:"11",y2:"3"}),u.jsx("line",{x1:"9",y1:"4",x2:"7",y2:"3"}),u.jsx("line",{x1:"6.4",y1:"9.8",x2:"3",y2:"8.5"}),u.jsx("line",{x1:"3",y1:"8.5",x2:"2",y2:"9.5"}),u.jsx("line",{x1:"3",y1:"8.5",x2:"2.5",y2:"6.5"}),u.jsx("line",{x1:"6.4",y1:"12.2",x2:"3.5",y2:"14.5"}),u.jsx("line",{x1:"3.5",y1:"14.5",x2:"2.5",y2:"15.5"}),u.jsx("line",{x1:"3.5",y1:"14.5",x2:"2",y2:"13.5"}),u.jsx("line",{x1:"11.8",y1:"11",x2:"19",y2:"14"}),u.jsx("line",{x1:"19",y1:"14",x2:"21.5",y2:"13"}),u.jsx("line",{x1:"19",y1:"14",x2:"21.5",y2:"16"}),u.jsx("circle",{cx:"21.5",cy:"13",r:"0.7",fill:"#1B4D1B",stroke:"none"}),u.jsx("circle",{cx:"21.5",cy:"16",r:"0.7",fill:"#1B4D1B",stroke:"none"})]});function s6e(){const[e,t]=D.useState(3);D.useEffect(()=>{const a=[3,4,5,6,7,8,7,6,5,4];let r=0;const s=setInterval(()=>{r=(r+1)%a.length,t(a[r])},900);return()=>clearInterval(s)},[]);const n=a=>a>=e?"#E8E4E0":a<3?"#7C9885":a<5?"#C4B5A6":a<7?"#D4A89A":"#C9897A";return u.jsx("div",{className:"flex gap-0.5",children:Array.from({length:10},(a,r)=>u.jsx("div",{className:"flex-1 h-2 rounded-full transition-colors duration-300",style:{backgroundColor:n(r)}},r))})}const q1={hidden:{opacity:0,y:40},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}},u3=(()=>{const e=[{label:"Feb 2",users:8,b2cPaying:0,b2bPaying:0},{label:"Feb 16",users:28,b2cPaying:4,b2bPaying:0},{label:"Mar 2",users:49,b2cPaying:8,b2bPaying:0},{label:"Mar 16",users:62,b2cPaying:12,b2bPaying:0},{label:"Mar 30",users:80,b2cPaying:16,b2bPaying:0},{label:"Apr 13",users:97,b2cPaying:24,b2bPaying:0},{label:"Apr 27",users:115,b2cPaying:32,b2bPaying:0},{label:"May 11",users:134,b2cPaying:40,b2bPaying:0}],t=new Date,n=t.toLocaleDateString("en-US",{month:"short"}),a=t.getDate(),r=`${n} ${a}`;return e[e.length-1].label!==r&&e.push({label:r,users:142,b2cPaying:43,b2bPaying:300}),e.map(i=>({...i,b2cFree:Math.max(0,i.users-i.b2cPaying)}))})();function PH(){const[e,t]=D.useState(null),[n,a]=D.useState(()=>new Set),[r,s]=D.useState(u3);D.useEffect(()=>{window.location.hostname!=="localhost"&&fetch("/.netlify/functions/get-growth-data").then(F=>F.json()).then(F=>{F.success&&F.growth?.length>1&&s(F.growth)}).catch(()=>{})},[]);const i=F=>a(H=>{const B=new Set(H);return B.has(F)?B.delete(F):B.add(F),B}),o=F=>!n.has(F),l=o("total"),d=o("totalPaying"),c=o("b2cPaying"),f=F=>F.b2cFree??Math.max(0,(F.users||0)-(F.b2cPaying??F.paying??0)),m=F=>F.b2bPaying??0,x=F=>F.b2cPaying??F.paying??0,y=F=>c?x(F):0,b=F=>y(F)+(d?m(F):0),w=F=>b(F)+(l?f(F):0),S=[];r.forEach(F=>{l&&S.push(w(F)),d&&S.push(b(F)),c&&S.push(y(F))});
5071const k=Math.max(1,...S),C=400,E=200,T=36,_=28,A=16,$=28,O=C-T-_,z=E-A-$,P=(F,H)=>({x:T+H/(r.length-1)*O,y:A+z-F/k*z}),j=r.map((F,H)=>P(w(F),H)),G=r.map((F,H)=>P(b(F),H)),X=r.map((F,H)=>P(y(F),H)),J=F=>F.map((H,B)=>`${B===0?"M":"L"}${H.x},${H.y}`).join(" "),V=F=>`${J(F)} L${F[F.length-1].x},${A+z} L${F[0].x},${A+z} Z`,Q=[0,Math.round(k/2),k];return u.jsxs("div",{className:"bg-white rounded-xl shadow-md p-5",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("p",{className:"text-sm font-semibold text-[#1B4D1B]/70",children:"User Growth"}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("button",{type:"button",onClick:()=>i("total"),"aria-pressed":o("total"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${o("total")?"":"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#F4A28C]"}),u.jsx("span",{className:"text-[10px] text-[#1B4D1B]/50",children:"+ Free"})]}),u.jsxs("button",{type:"button",onClick:()=>i("totalPaying"),"aria-pressed":o("totalPaying"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${o("totalPaying")?"":"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#1B4D1B]"}),u.jsx("span",{className:"text-[10px] text-[#1B4D1B]/50",children:"+ B2B paid"})]}),u.jsxs("button",{type:"button",onClick:()=>i("b2cPaying"),"aria-pressed":o("b2cPaying"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${o("b2cPaying")?""
5071:"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#7C9885]"}),u.jsx("span",{className:"text-[10px] text-[#1B4D1B]/50",children:"B2C Paid"})]})]})]}),u.jsxs("svg",{viewBox:`0 0 ${C} ${E}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",onMouseLeave:()=>t(null),children:[Q.map(F=>{const H=A+z-F/k*z;return u.jsxs("g",{children:[u.jsx("line",{x1:T,y1:H,x2:C-_,y2:H,stroke:"#1B4D1B",strokeOpacity:"0.08",strokeWidth:"1"}),u.jsx("text",{x:T-6,y:H+4,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.4",fontSize:"10",children:F})]},F)}),u.jsx("defs",{children:u.jsxs("linearGradient",{id:"userGrowthTotalGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#F4A28C",stopOpacity:"0.25"}),u.jsx("stop",{offset:"100%",stopColor:"#F4A28C",stopOpacity:"0.03"})]})}),l&&u.jsxs(u.Fragment,{children:[u.jsx("path",{d:V(j),fill:"url(#userGrowthTotalGrad)"}),u.jsx("path",{d:J(j),fill:"none",stroke:"#F4A28C",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),d&&u.jsx("path",{d:J(G),fill:"none",stroke:"#1B4D1B",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),c&&u.jsx("path",{d:J(X),fill:"none",stroke:"#7C9885",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),e!==null&&u.jsx("line",{x1:j[e].x,y1:A,x2:j[e].x,y2:A+z,stroke:"#1B4D1B",strokeOpacity:"0.12",strokeWidth:"1",strokeDasharray:"4 3"}),l&&j.map((F,H)=>u.jsx("circle",{cx:F.x,cy:F.y,r:e===H?5:3.5,fill:"#F4A28C",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`t${H}`)),d&&G.map((F,H)=>u.jsx("circle",{cx:F.x,cy:F.y,r:e===H?5:3.5,fill:"#1B4D1B",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`tp${H}`)),c&&X.map((F,H)=>u.jsx("circle",{cx:F.x,cy:F.y,r:e===H?5:3.5,fill:"#7C9885",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`bc${H}`)),e!==null&&(()=>{const F=r[e],H=j[e].x,B=[l&&{dot:"#F4A28C",label:`${f(F)} Free`},d&&{dot:"#4A7C4A",label:`${m(F)} B2B paid`},c&&{dot:"#7C9885",label:`${x(F)} B2C paid`}].filter(Boolean);if(B.length===0)return null;const Y=150,ne=38,ee=ne+B.length*16+6,U=Math.min(Math.max(H-Y/2,4),C-Y-4),oe=[l&&j[e].y,d&&G[e].y,c&&X[e].y].filter(xe=>typeof xe=="number"),pe=oe.length?Math.min(...oe):A,he=Math.max(pe-ee-10,2);return u.jsxs("g",{style:{pointerEvents:"none"},children:[u.jsx("rect",{x:U,y:he,width:Y,height:ee,rx:"8",fill:"#1B4D1B",fillOpacity:"0.94"}),u.jsx("text",{x:U+10,y:he+16,fill:"white",fontSize:"11",fontWeight:"600",children:F.label}),u.jsxs("text",{x:U+10,y:he+33,fill:"white",fillOpacity:"0.85",fontSize:"13",fontWeight:"600",children:[w(F)," total"]}),B.map((xe,Ie)=>u.jsxs("g",{transform:`translate(${U+10}, ${he+ne+14+Ie*16})`,children:[u.jsx("circle",{cx:"4",cy:"-3",r:"3.5",fill:xe.dot}),u.jsx("text",{x:"14",y:"0",fill:"white",fillOpacity:"0.9",fontSize:"10.5",children:xe.label})]},xe.label))]})})(),r.map((F,H)=>u.jsx("rect",{x:j[H].x-O/r.length/2,y:A,width:O/r.length,height:z,fill:"transparent",onMouseEnter:()=>t(H),style:{cursor:"pointer"}},`hit${H}`)),r.map((F,H)=>u.jsx("text",{x:j[H].x,y:E-4,textAnchor:"middle",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"10",children:F.label},F.label))]})]})}function i6e(){const e=Us(),[t]=rw(),[n,a]=D.useState(()=>localStorage.getItem("investor_access")==="true"),[r,s]=D.useState(""),[i,o]=D.useState(""),[l,d]=D.useState("58"),[c,f]=D.useState("12"),[m,x]=D.useState(0),y=["Raising institutional pre-seed round. Reach out to book a pitch."];D.useEffect(()=>{fetch("/.netlify/functions/get-investor-metrics").then(w=>w.json()).then(w=>{w.success&&(w.totalUsers&&d(String(w.totalUsers)),w.payingSubscribers!=null&&f(String(w.payingSubscribers)))}).catch(()=>{})},[]);const b=async w=>{if(w.preventDefault(),!r||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)){o("Please enter a valid email address.");return}try{await fetch("/.netlify/functions/save-investor-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})})}catch{}localStorage.setItem("investor_access","true");const S=t.get("redirect");if(S){e(S,{replace:!0});return}a(!0),o("")};return n?u.jsxs("div",{className:"relative bg-[#FAF3E8] text-[#7C9885] font-sans overflow-x-hidden selection:bg-[#F4A28C]/40",children:[u.jsx(vs,{title:"Solta AI — Investor Overview",description:"Investor overview for Solta AI. Revolutionizing trauma reprocessing therapy with AI-powered adaptive bilateral stimulation.",path:"/investors",noindex:!0}),u.jsx("div",{className:"absolute -top-24 -left-24 -z-10 w-80 h-80 bg-[#7C9885]/20 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute bottom-0 right-0 -z-10 w-[28rem] h-[28rem] bg-[#F4A28C]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx(Vs,{showJoinButton:!1}),u.jsx("style",{children:`
5072        @keyframes marquee {
5073          0% { transform: translate3d(100vw, 0, 0); }
5074          100% { transform: translate3d(-100%, 0, 0); }
5075        }
5076      `}),u.jsx("div",{className:"fixed top-[68px] left-0 right-0 z-40 bg-[#7B9EB8] text-white py-4 overflow-hidden",children:u.jsx("div",{className:"inline-block whitespace-nowrap text-base font-medium tracking-wide will-change-transform",style:{animation:"marquee 18s linear"},onAnimationEnd:()=>x(w=>(w+1)%y.length),children:y[m]},m)}),u.jsxs("main",{id:"main-content",children:[u.jsxs("section",{className:"relative h-screen flex items-center justify-center overflow-hidden bg-[#FAF3E8] pt-20","aria-label":"Hero",children:[u.jsx("div",{className:"absolute -top-24 -left-24 w-80 h-80 bg-[#7C9885]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute bottom-0 right-0 w-[28rem] h-[28rem] bg-[#F4A28C]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsxs("div",{className:"relative z-10 text-center",children:[u.jsxs(qe.h1,{initial:{opacity:0,y:100}
5076,animate:{opacity:1,y:0},transition:{duration:1,ease:"easeOut"},className:"text-6xl md:text-8xl lg:text-9xl font-serif tracking-wider text-[#1B4D1B] mb-6",children:["Solta",u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx(qe.p,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:1,delay:.3,ease:"easeOut"},className:"text-xl md:text-2xl lg:text-3xl text-[#1B4D1B] font-light tracking-wide",children:"Join us in revolutionizing trauma reprocessing therapy."}),u.jsx(qe.p,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:1,delay:.6,ease:"easeOut"},className:"mt-4 text-base md:text-lg text-[#1B4D1B]/50 max-w-2xl mx-auto tracking-wide",children:"Starting with wellness. Building toward the first AI-guided EMDR therapy platform."}),u.jsxs(qe.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:1,delay:.9,ease:"easeOut"},className:"mt-10 flex flex-col sm:flex-row items-center justify-center gap-4",children:[u.jsx("a",{href:"/investors/pitch",className:"px-8 py-3.5 text-white bg-[#1B4D1B] hover:bg-[#7C9885] rounded-full shadow-md transition-colors font-medium tracking-wide text-sm",children:"View Pitch Deck"}),u.jsx("a",{href:"/bls",target:"_blank",rel:"noopener noreferrer",className:"px-8 py-3.5 text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md transition-colors font-medium tracking-wide text-sm",children:"Try Live Product"}),u.jsx("a",{href:"https://calendar.notion.so/meet/sofia-czsjz29w0/at2bq4oxk",target:"_blank",rel:"noopener noreferrer",className:"px-8 py-3.5 text-white bg-[#F4A28C] hover:bg-[#7C9885] rounded-full shadow-md transition-colors font-medium tracking-wide text-sm",children:"Schedule a Quick Chat"})]})]})]}),u.jsx("section",{className:"py-16 md:py-24 bg-white/50",children:u.jsx("div",{className:"max-w-7xl mx-auto px-6",children:u.jsx(qe.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:q1,children:u.jsxs("div",{className:"grid md:grid-cols-2 gap-12 md:gap-16",children:[u.jsxs("div",{className:"space-y-5",children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"About the Team"}),[{name:"Sofia Y. Muller",role:"Founder & CEO",photo:pw,photoSize:"w-20 h-20",linkedin:"https://www.linkedin.com/in/sofiamuller/",credentials:[{text:"Brain Health Research",logo:t3},{text:"MS CS, Machine Learning",logo:a3},{text:"Nature Medicine Co-author",logo:n3},{text:"BBA, Finance & Management",logo:rm}]},{name:"Dr. Carlos Castañeda",role:"Clinical Advisor (Co-Founder Track)",photo:hw,photoSize:"w-16 h-16",linkedin:"https://www.linkedin.com/in/carlos-casta%C3%B1eda-704/",credentials:[{text:"PhD, Clinical Education",logo:rm},{text:"Experienced Founder",logo:i3},{text:"MA, Mental Health; LPCC, NCC",logo:r3},{text:"BS, Psychology",logo:s3}]}].map(w=>u.jsx("div",{className:"bg-white/60 rounded-2xl border border-[#1B4D1B]/10 shadow-sm p-4",children:u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:`${w.photoSize} rounded-2xl bg-[#7C9885]/15 border border-[#7C9885]/25 overflow-hidden flex-shrink-0 shadow-sm`,children:u.jsx("img",{src:w.photo,alt:w.name,className:"w-full h-full object-cover"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("h3",{className:"font-serif text-lg text-[#1B4D1B] leading-tight flex items-center gap-1.5",children:[u.jsx("span",{children:w.name}),u.jsx("a",{href:w.linkedin,target:"_blank",rel:"noopener noreferrer",className:"text-[#1B4D1B]/30 hover:text-[#0A66C2] transition-colors flex-shrink-0","aria-label":`${w.name} LinkedIn profile`,children:u.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})]}),u.jsx("p",{className:"text-xs text-[#F4A28C] font-semibold tracking-wide mt-0.5 leading-tight",children:w.role}),u.jsx("ul",{className:"mt-2 grid grid-cols-1 sm:grid-cols-2 gap-x-3 gap-y-1",children:w.
5076credentials.map((S,k)=>u.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-[#1B4D1B]/85 leading-snug",children:[u.jsx("div",{className:"w-5 h-5 rounded-full bg-white shadow-sm border border-[#1B4D1B]/8 flex items-center justify-center flex-shrink-0",children:u.jsx("img",{src:S.logo,alt:"","aria-hidden":"true",className:"max-h-3.5 max-w-3.5 object-contain"})}),u.jsx("span",{className:"font-medium",children:S.text})]},k))})]})]})},w.name)),u.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-stretch gap-3",children:[u.jsx("div",{className:"flex-1 bg-white/60 rounded-2xl border border-[#1B4D1B]/10 shadow-sm p-4 min-w-0",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"w-14 h-14 rounded-xl bg-[#7C9885]/15 border border-[#7C9885]/25 flex items-center justify-center flex-shrink-0 shadow-sm text-[#7C9885]",children:u.jsxs("svg",{className:"w-7 h-7",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"9",r:"3.5"}),u.jsx("path",{d:"M5 20c0-3.5 3.1-6 7-6s7 2.5 7 6"})]})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("h3",{className:"font-serif text-base text-[#1B4D1B] leading-tight",children:"Volunteer Clinical Advisor"}),u.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[[o3,l3].map((w,S)=>u.jsx("div",{className:"w-5 h-5 rounded-full bg-white shadow-sm border border-[#1B4D1B]/8 flex items-center justify-center flex-shrink-0",children:u.jsx("img",{src:w,alt:"","aria-hidden":"true",className:"max-h-3.5 max-w-3.5 object-contain"})},S)),u.jsx("span",{className:"text-[10px] text-[#1B4D1B]/70",children:"EMDR Consultant · Director of Product"})]})]})]})}),u.jsxs("div",{className:"flex flex-col items-center justify-center bg-white rounded-2xl border border-[#1B4D1B]/10 shadow-sm px-4 py-2 flex-shrink-0",children:[u.jsx("img",{src:LH,alt:"Georgia Tech CREATE-X",className:"h-10 object-contain"}),u.jsx("span",{className:"text-[10px] text-[#7C9885] font-semibold tracking-[0.15em] uppercase mt-1",children:"Accelerator"})]})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"What is EMDR?"}),u.jsx("p",{className:"font-serif italic text-base md:text-lg text-[#1B4D1B]/60 mt-2",children:"Eye Movement Desensitization Reprocessing"})]}),u.jsx("div",{className:"flex justify-center",children:u.jsx("div",{className:"w-[300px] max-w-full",children:u.jsx(e3,{})})}),u.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"font-serif text-xl text-[#1B4D1B] mb-4",children:"How it works"}),u.jsx("ol",{className:"space-y-3",children:[{text:"Focus on what's bothering you",Icon:ZPe},{text:"Follow bilateral stimulation",Icon:e6e},{text:"Adjustment based on emotion detected",Icon:t6e}].map((w,S)=>u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx(w.Icon,{}),u.jsx("span",{className:"text-sm text-[#1B4D1B] font-medium",children:w.text})]},S))})]}),u.jsxs("div",{children:[u.jsx("h3",{className:"font-serif text-xl text-[#1B4D1B] mb-4",children:"Why it works"}),u.jsx("ul",{className:"space-y-3",children:[{text:"Mimics REM sleep",Icon:n6e},{text:"Suppresses fight or flight response",Icon:a6e},{text:"Increases neuroplasticity",Icon:r6e}].map((w,S)=>u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx(w.Icon,{}),u.jsx("span",{className:"text-sm text-[#1B4D1B] font-medium",children:w.text})]},S))})]})]}),u.jsxs("div",{children:[u.jsx("p",{className:"text-xs font-semibold text-[#1B4D1B]/50 tracking-[0.2em] uppercase text-center mb-3",children:"Recommended by"}),u.jsxs("div",{className:"flex items-center justify-center gap-8 mb-2 flex-wrap",children:[u.jsx("img",{src:"/who-logo.svg",alt:"World Health Organization",className:"h-9 opacity-75 max-w-[130px] object-contain"}),u.jsx("img",{src:"/apa-logo.svg",alt:"American Psychological Association",className:"h-9 opacity-75 max-w-[110px] object-contain"}),u.jsx("img",{src:"/va-logo.svg",alt:"U.S. Department of Veterans Affairs",className:"h-9 opacity-75 max-w-[130px] object-contain"})]}),u.jsx("p",{className:"text-[10px] font-medium text-[#1B4D1B]/45 tracking-[0.1em] uppercase text-center mb-4",children:"Used to treat 20+ conditions worldwide"}),u.jsx("div",{className:"bg-[#5C7565] rounded-full py-2.5 px-6 text-center shadow-sm",children:u.jsx("span",{className:"text-white text-sm md:text-base font-semibold tracking-wide",children:"Outperforms medication. Faster than talk therapy."})})]})]})]})})})}),u.jsx("section",{id:"content",className:"py-16 md:py-24 bg-[#FAF3E8]",children:u.jsx("div",{className:"max-w-7xl mx-auto px-6",children:u.jsx(qe.div,{initial:"hidden",
5076whileInView:"visible",viewport:{once:!0},variants:q1,children:u.jsxs("div",{className:"grid md:grid-cols-2 gap-12 md:gap-16",children:[u.jsxs("div",{className:"flex flex-col gap-6 h-full",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"The Problem"}),u.jsx("p",{className:"font-serif italic text-base md:text-lg text-[#1B4D1B]/60 mt-2",children:"Dysregulation is widespread — and EMDR is inaccessible"})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[auto_1fr] gap-6 flex-1",children:[u.jsxs("div",{className:"bg-white/60 rounded-2xl border border-[#1B4D1B]/10 shadow-sm p-6 flex flex-col justify-center items-center text-center",children:[u.jsx("span",{className:"font-serif text-5xl md:text-6xl text-[#F4A28C] font-bold leading-none whitespace-nowrap",children:"1 in 3"}),u.jsx("span",{className:"text-sm md:text-base text-[#1B4D1B]/80 leading-snug mt-3 max-w-[180px]",children:"adults experience anxiety, trauma, or sleep issues each year"})]}),u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"bg-white/60 rounded-2xl border border-[#1B4D1B]/10 shadow-sm p-6 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[u.jsx("span",{className:"w-10 h-10 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0",children:u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),u.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})}),u.jsx("h3",{className:"font-serif text-xl text-[#1B4D1B]",children:"Cost Barrier"})]}),u.jsx("p",{className:"font-serif text-2xl md:text-3xl text-[#F4A28C] font-bold leading-none",children:"$150–$300"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/70 mt-1",children:"per session"})]}),u.jsxs("div",{className:"bg-white/60 rounded-2xl border border-[#1B4D1B]/10 shadow-sm p-6 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[u.jsx("span",{className:"w-10 h-10 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0",children:u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("polyline",{points:"12 7 12 12 15 14"})]})}),u.jsx("h3",{className:"font-serif text-xl text-[#1B4D1B]",children:"Supply Side Constraints"})]}),u.jsx("p",{className:"font-serif text-2xl md:text-3xl text-[#F4A28C] font-bold leading-none",children:"<10%"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/70 mt-1",children:"of therapists trained in EMDR"})]})]})]}),u.jsx("div",{className:"bg-[#5C7565] rounded-full py-2.5 px-6 text-center shadow-sm",children:u.jsx("span",{className:"text-white text-sm md:text-base font-semibold tracking-wide",children:"Effective care exists — most people can't reach it"})})]}),u.jsxs("div",{className:"flex flex-col gap-5",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"The Solution"}),u.jsx("p",{className:"font-serif italic text-base md:text-lg text-[#1B4D1B]/60 mt-2",children:"AI-powered EMDR at a fraction of the cost"})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 shadow-sm p-5 flex items-center gap-4",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-[#7C9885] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-base",children:"1"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-lg font-semibold text-[#1B4D1B]",children:"User follows the dot"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/60",children:"Bilateral stimulation calms the nervous system"})]}),u.jsx("div",{className:"relative w-28 h-10 bg-[#FDF5EB] rounded-lg overflow-hidden flex-shrink-0",children:u.jsx(qe.div,{className:"absolute top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-[#7C9885] shadow",animate:{left:["8%","82%","8%"]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}})})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 shadow-sm p-5 flex items-center gap-4",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-[#F4A28C] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-base",children:"2"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-lg font-semibold text-[#1B4D1B]",children:"Solta reads emotion"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/60",children:"Facial expression, voice, body language, choice of words"})]}),u.jsx("div",{className:"w-28 h-14 flex-shrink-0 flex items-center justify-center",children:u.jsxs("div",{className:"relative",style:{width:48,height:56},children:[u.jsxs("svg",{width:"48",height:"56",viewBox:"0 0 64 76",children:[u.jsx("circle",{cx:"32",cy:"32",r:"22",fill:"#F4A28C",opacity:"0.3"}),u.jsx("path",{d:"M12,28 Q12,8 32,8 Q52,8 52,28",fill:"#1B4D1B",opacity:"0.2"}),u.jsx("circle",{cx:"24",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"40",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"25",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("circle",{cx:"41",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("path",{d:"M24,40 Q32,47 40,40",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",opacity:"0.4"}),u.jsx("circle",{cx:"32",cy:"35",r:"1.5",fill:"#1B4D1B",opacity:"0.15"}
5076),u.jsx("rect",{x:"28",y:"53",width:"8",height:"8",rx:"2",fill:"#F4A28C",opacity:"0.2"}),u.jsx("path",{d:"M16,68 Q20,60 28,60 L36,60 Q44,60 48,68",fill:"#7C9885",opacity:"0.2"}),[[24,30],[40,30],[32,35],[24,40],[40,40],[32,44],[18,30],[30,30],[34,30],[46,30],[14,24],[50,24],[32,10],[22,14],[42,14],[16,40],[48,40],[32,52],[20,50],[44,50]].map(([w,S],k)=>u.jsx("circle",{cx:w,cy:S,r:"1.3",fill:"#7C9885",opacity:"0.65"},k)),u.jsxs("g",{stroke:"#7C9885",strokeWidth:"0.6",opacity:"0.3",children:[u.jsx("line",{x1:"18",y1:"30",x2:"24",y2:"30"}),u.jsx("line",{x1:"24",y1:"30",x2:"30",y2:"30"}),u.jsx("line",{x1:"34",y1:"30",x2:"40",y2:"30"}),u.jsx("line",{x1:"40",y1:"30",x2:"46",y2:"30"}),u.jsx("line",{x1:"32",y1:"10",x2:"32",y2:"35"}),u.jsx("line",{x1:"24",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"40",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"14",y1:"24",x2:"16",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"20",y2:"50"}),u.jsx("line",{x1:"20",y1:"50",x2:"32",y2:"52"}),u.jsx("line",{x1:"32",y1:"52",x2:"44",y2:"50"}),u.jsx("line",{x1:"44",y1:"50",x2:"48",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"50",y2:"24"}),u.jsx("line",{x1:"22",y1:"14",x2:"32",y2:"10"}),u.jsx("line",{x1:"32",y1:"10",x2:"42",y2:"14"}),u.jsx("line",{x1:"24",y1:"40",x2:"32",y2:"44"}),u.jsx("line",{x1:"32",y1:"44",x2:"40",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"24",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"40",y2:"40"})]})]}),u.jsx(qe.div,{className:"absolute inset-x-0 h-0.5 bg-[#7C9885]/60",animate:{top:["5%","90%","5%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]})})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 shadow-sm p-5 flex items-center gap-4",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-[#7C9885] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-base",children:"3"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-lg font-semibold text-[#1B4D1B]",children:"The experience adapts"}),u.jsx("p",{className:"text-sm text-[#1B4D1B]/60",children:"Speed and stimulation adjust in real time"})]}),u.jsxs("div",{className:"w-28 flex-shrink-0",children:[u.jsxs("div",{className:"flex justify-between mb-1",children:[u.jsx("span",{className:"text-[9px] text-[#7C9885]",children:"Slow"}),u.jsx("span",{className:"text-[9px] text-[#7C9885]",children:"Fast"})]}),u.jsx(s6e,{})]})]}),u.jsx("div",{className:"bg-[#5C7565] rounded-3xl py-3 px-6 text-center shadow-sm",children:u.jsxs("span",{className:"text-white text-base md:text-lg font-semibold tracking-wide",children:["Clinically grounded · Continuously adaptive",u.jsx("br",{}),"Always available"]})})]})]})})})}),u.jsx("section",{className:"py-16 md:py-24 bg-white/50",children:u.jsx("div",{className:"max-w-7xl mx-auto px-6",children:u.jsx(qe.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:q1,children:u.jsxs("div",{className:"grid md:grid-cols-2 gap-12 md:gap-16",children:[u.jsxs("div",{className:"space-y-6",children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"Market Opportunity"}),u.jsxs("div",{className:"bg-[#1B4D1B] rounded-2xl shadow-md p-6",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-bold tracking-wider uppercase text-white/60",children:"TAM"}),u.jsx("span",{className:"text-4xl font-bold text-white",children:"$461B+"})]}),u.jsx("p",{className:"text-lg font-semibold text-white/80",children:"Total Addressable Market"}),u.jsx("p",{className:"text-base text-white/60 mt-1",children:"Global Mental Health Market"}),u.jsxs("div",{className:"bg-[#7C9885] rounded-2xl shadow-md p-6 mt-5",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-bold tracking-wider uppercase text-white/60",children:"SAM"}),u.jsx("span",{className:"text-4xl font-bold text-white",children:"$2.5B"})]}),u.jsx("p",{className:"text-lg font-semibold text-white/80",children:"Serviceable Addressable Market"}),u.jsx("p",{className:"text-base text-white/60 mt-1",children:"U.S. Mental Health Apps Market"}),u.jsxs("div",{className:"bg-[#F4A28C] rounded-2xl shadow-md p-6 mt-5 curs
5076or-pointer hover:shadow-lg transition-shadow",onClick:()=>window.open("https://claude.ai/public/artifacts/29e9dcb0-19cc-4845-8d97-6be795001285","_blank"),children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-bold tracking-wider uppercase text-white/70",children:"SOM"}),u.jsx("span",{className:"text-4xl font-bold text-white",children:"$4.2M"})]}),u.jsx("p",{className:"text-lg font-semibold text-white/90",children:"Serviceable Obtainable Market"}),u.jsx("p",{className:"text-base text-white/70 mt-1",children:"35K B2C x $96 · 500 B2B x $1,800"})]})]})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-start justify-between",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"Traction"}),u.jsx("p",{className:"text-[#1B4D1B]/60 mt-2",children:"Early traction, zero marketing spend."})]}),u.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-[#3D7A4A]/8 border border-[#3D7A4A]/15 flex-shrink-0 mt-1",children:[u.jsxs("span",{className:"relative flex h-2 w-2",children:[u.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-[#3D7A4A]/40"}),u.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-[#3D7A4A]"})]}),u.jsx("span",{className:"text-xs text-[#3D7A4A]/70 font-medium",children:"Live Data"})]})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[u.jsxs("div",{className:"col-span-2 bg-white rounded-xl shadow-md p-5 flex flex-col",children:[u.jsx("p",{className:"text-xs font-semibold text-[#1B4D1B]/50 tracking-[0.15em] uppercase mb-3",children:"B2B traction"}),u.jsxs("div",{className:"flex-1 flex items-center justify-center gap-8 flex-wrap",children:[u.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[u.jsx("a",{href:"https://vudy.app/",target:"_blank",rel:"noopener noreferrer","aria-label":"Vudy website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:c0,alt:"Vudy",className:"h-8 md:h-10 max-w-[130px] object-contain"})}),u.jsx("span",{className:"text-[10px] font-semibold tracking-[0.12em] uppercase text-white bg-[#3D7A4A] rounded-full px-2 py-0.5",children:"1st contract · +$100 MRR"})]}),u.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[u.jsx("a",{href:"https://www.pinyahta.com/",target:"_blank",rel:"noopener noreferrer","aria-label":"Pinyahta website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:d0,alt:"Pinyahta",className:"h-8 md:h-10 max-w-[130px] object-contain"})}),u.jsx("span",{className:"text-[10px] font-semibold tracking-[0.12em] uppercase text-[#1B4D1B]/60 bg-[#1B4D1B]/8 rounded-full px-2 py-0.5",children:"Signed pilot"})]})]})]}),u.jsx("div",{className:"flex flex-col gap-4",children:[{label:"Customer Acquisition Cost",value:"$0"},{label:"Conversion Rate",value:Number(l)>0?`${Math.round(Number(c)/Number(l)*100)}%`:"—"}].map(w=>u.jsxs("div",{className:"flex-1 bg-white rounded-xl shadow-md p-3 text-center flex flex-col justify-center",children:[u.jsx("p",{className:"text-xl font-bold text-[#7C9885]",children:w.value}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/60 mt-0.5 leading-tight",children:w.label})]},w.label))})]}),u.jsx(PH,{}),u.jsx("div",{className:"text-right",children:u.jsx("a",{href:"/investors/traction",className:"text-xs text-[#7C9885] hover:text-[#F4A28C] underline underline-offset-2 transition-colors",children:"See traction dashboard →"})})]})]})})})}),u.jsx("section",{className:"py-16 md:py-24 bg-[#7C9885]",children:u.jsx("div",{className:"max-w-7xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:q1,className:"text-center space-y-6",children:[u.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-white",children:"Let's Talk"}),u.jsx("a",{href:"mailto:[email protected]",className:"text-xl text-white/90 hover:text-white underline underline-offset-4 transition-colors block",children:"[email protected]"}),u.jsx("a",{href:"https://calendar.notion.so/meet/sofia-czsjz29w0/at2bq4oxk",target:"_blank",rel:"noopener noreferrer",className:"inline-block px-8 py-3.5 bg-white text-[#7C9885] hover:bg-[#FAF3E8] rounded-full transition-colors font-medium tracking-wide shadow-md",children:"Schedule a Quick Chat"}),u.jsxs("div",{className:"flex items-center justify-center gap-4",children:[u.jsx("a",{href:"https://www.linkedin.com/in/sofiamuller/",target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 bg-white/20 hover:bg-white/30 text-white rounded-full transition-colors font-medium tracking-wide",children:"Founder's LinkedIn"}),u.jsx("a",{href:"https://www.linkedin.com/company/soltaai/",target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 bg-white/20 hover:bg-white/30 text-white rounded-full transition-colors font-medium tracking-wide",children:"Solta AI's LinkedIn"})]})]})})})]}),u.jsx(ui,{})]}):u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8] flex items-center justify-center px-6 relative overflow-hidden",children:[u.jsx(vs,{title:"Solta AI — Investor Overview",description:"Investor overview for Solta AI. Revolutionizing trauma reprocessing therapy with AI-powered adaptive bilateral stimulation.",path:"/investors",noindex:!0}),u.jsx("div",{className:"absolute -top-32 -left-32 w-96 h-96 bg-[#7C9885]/15 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute -bottom-32 -right-32 w-[28rem] h-[28rem] bg-[#F4A28C]/15 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsxs(qe.div,{initial:{opacity:0,y:30,scale:.97}
5076,animate:{opacity:1,y:0,scale:1},transition:{duration:.7,ease:"easeOut"},className:"relative bg-white/80 backdrop-blur-sm rounded-3xl shadow-xl border border-[#7C9885]/10 p-12 max-w-md w-full text-center",children:[u.jsxs("h1",{className:"font-serif text-4xl text-[#1B4D1B] mb-1",children:["Solta",u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx("p",{className:"text-[#1B4D1B]/70 text-base tracking-wide mb-2",children:"Investor Overview"}),u.jsx("p",{className:"text-[#1B4D1B]/55 text-sm mb-10",children:"Emotions are visible. AI therapy should adapt."}),u.jsxs("form",{onSubmit:b,className:"space-y-4",children:[u.jsx("p",{className:"text-[#1B4D1B]/70 text-base mb-2",children:"Enter your email to view"}),u.jsx("input",{type:"email",value:r,onChange:w=>{s(w.target.value),o("")},placeholder:"[email protected]",autoFocus:!0,className:"w-full px-5 py-3.5 rounded-xl border border-[#7C9885]/15 bg-[#FAF3E8]/50 text-[#1B4D1B] placeholder-[#1B4D1B]/40 focus:outline-none focus:ring-2 focus:ring-[#7C9885]/30 focus:border-[#7C9885]/30 text-center text-base transition-all"}),i&&u.jsx(qe.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-[#F4A28C] text-sm",children:i}),u.jsx("button",{type:"submit",className:"w-full px-6 py-3.5 text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md hover:shadow-lg transition-all font-medium tracking-wide text-base",children:"View Overview"})]}),u.jsxs("div",{className:"mt-10 pt-6 border-t border-[#1B4D1B]/10",children:[u.jsx("p",{className:"text-[#1B4D1B]/60 text-sm mb-2",children:"Interested in investing? Contact us"}),u.jsxs("div",{className:"flex items-center justify-center gap-4 text-sm",children:[u.jsx("a",{href:"mailto:[email protected]",className:"text-[#7C9885] hover:text-[#F4A28C] transition-colors",children:"[email protected]"}),u.jsx("span",{className:"text-[#1B4D1B]/20",children:"|"}),u.jsx("a",{href:"https://www.linkedin.com/company/soltaai/",target:"_blank",rel:"noopener noreferrer",className:"text-[#7C9885] hover:text-[#F4A28C] transition-colors",children:"LinkedIn"})]})]})]})]})}const Zx=816,HE=1056;function $B(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return t();const a=document.createElement("script");a.src=e,a.onload=()=>t(),a.onerror=()=>n(new Error(`Failed to load ${e}`)),document.head.appendChild(a)})}function o6e({width:e=70,height:t=84}){return u.jsxs("div",{className:"relative flex-shrink-0",style:{width:e,height:t},children:[u.jsxs("svg",{width:e,height:t,viewBox:"0 0 64 76",children:[u.jsx("circle",{cx:"32",cy:"32",r:"22",fill:"#F4A28C",opacity:"0.3"}),u.jsx("path",{d:"M12,28 Q12,8 32,8 Q52,8 52,28",fill:"#1B4D1B",opacity:"0.2"}),u.jsx("circle",{cx:"24",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"40",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"25",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("circle",{cx:"41",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("path",{d:"M24,40 Q32,47 40,40",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",opacity:"0.4"}),u.jsx("circle",{cx:"32",cy:"35",r:"1.5",fill:"#1B4D1B",opacity:"0.15"}),u.jsx("rect",{x:"28",y:"53",width:"8",height:"8",rx:"2",fill:"#F4A28C",opacity:"0.2"}),u.jsx("path",{d:"M16,68 Q20,60 28,60 L36,60 Q44,60 48,68",fill:"#7C9885",opacity:"0.2"}),[[24,30],[40,30],[32,35],[24,40],[40,40],[32,44],[18,30],[30,30],[34,30],[46,30],[14,24],[50,24],[32,10],[22,14],[42,14],[16,40],[48,40],[32,52],[20,50],[44,50]].map(([n,a],r)=>u.jsx("circle",{cx:n,cy:a,r:"1.3",fill:"#7C9885",opacity:"0.65"},r)),u.jsxs("g",{stroke:"#7C9885",strokeWidth:"0.6",opacity:"0.3",children:[u.jsx("line",{x1:"18",y1:"30",x2:"24",y2:"30"}),u.jsx("line",{x1:"24",y1:"30",x2:"30",y2:"30"}),u.jsx("line",{x1:"34",y1:"30",x2:"40",y2:"30"}),u.jsx("line",{x1:"40",y1:"30",x2:"46",y2:"30"}),u.jsx("line",{x1:"32",y1:"10",x2:"32",y2:"35"}),u.jsx("line",{x1:"24",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"40",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"14",y1:"24",x2:"16",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"20",y2:"50"}),u.jsx("line",{x1:"20",y1:"50",x2:"32",y2:"52"}),u.jsx("line",{x1:"32",y1:"52",x2:"44",y2:"50"}),u.jsx("line",{x1:"44",y1:"50",x2:"48",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"50",y2:"24"}),u.jsx("line",{x1:"22",y1:"14",x2:"32",y2:"10"}),u.jsx("line",{x1:"32",y1:"10",x2:"42",y2:"14"}),u.jsx("line",{x1:"24",y1:"40",x2:"32",y2:"44"}),u.jsx("line",{x1:"32",y1:"44",x2:"40",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"24",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"40",y2:"40"})]})]}),u.jsx(qe.div,{className:"absolute inset-x-0 h-0.5 bg-[#7C9885]/60",animate:{top:["5%","90%","5%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]})}function l6e({url:e,name:t,size:n=10}){return u.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-[#1B4D1B]/30 hover:text-[#0A66C2] transition-colors flex-shrink-0","aria-label":`${t} LinkedIn`,children:u.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"
5076currentColor",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})}function u6e({data:e,tall:t}){const a=t?100:90,r=22,s=8,i=8,o=16,l=320-r-s,d=a-i-o,c=A=>A.b2cFree??Math.max(0,(A.users||0)-(A.b2cPaying??A.paying??0)),f=A=>A.b2cPaying??A.paying??0,m=A=>A.b2bPaying??0,x=A=>f(A),y=A=>f(A)+m(A),b=A=>f(A)+m(A)+c(A),w=Math.max(1,...e.map(b)),S=(A,$)=>({x:r+$/(e.length-1)*l,y:i+d-A/w*d}),k=e.map((A,$)=>S(b(A),$)),C=e.map((A,$)=>S(y(A),$)),E=e.map((A,$)=>S(x(A),$)),T=A=>A.map(($,O)=>`${O===0?"M":"L"}${$.x},${$.y}`).join(" "),_=A=>`${T(A)} L${A[A.length-1].x},${i+d} L${A[0].x},${i+d} Z`;return u.jsxs("svg",{viewBox:`0 0 320 ${a}`,className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",children:[u.jsx("defs",{children:u.jsxs("linearGradient",{id:"opTotalGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#F4A28C",stopOpacity:"0.25"}),u.jsx("stop",{offset:"100%",stopColor:"#F4A28C",stopOpacity:"0.03"})]})}),u.jsx("text",{x:r-4,y:i+d+4,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.45",fontSize:"7",children:"0"}),u.jsx("text",{x:r-4,y:i+4,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.45",fontSize:"7",children:w}),u.jsx("line",{x1:r,y1:i+d,x2:320-s,y2:i+d,stroke:"#1B4D1B",strokeOpacity:"0.1",strokeWidth:"0.8"}),u.jsx("path",{d:_(k),fill:"url(#opTotalGrad)"}),u.jsx("path",{d:T(k),fill:"none",stroke:"#F4A28C",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:T(C),fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:T(E),fill:"none",stroke:"#7C9885",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("text",{x:k[0].x,y:a-3,textAnchor:"start",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"7",children:e[0].label}),u.jsx("text",{x:k[k.length-1].x,y:a-3,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"7",children:e[e.length-1].label}),u.jsxs("g",{transform:`translate(${r+2}, ${i+4})`,children:[u.jsx("circle",{cx:"2",cy:"2",r:"2",fill:"#F4A28C"}),u.jsx("text",{x:"7",y:"4",fill:"#1B4D1B",fillOpacity:"0.7",fontSize:"7",fontWeight:"600",children:"+ Free"}),u.jsx("circle",{cx:"36",cy:"2",r:"2",fill:"#1B4D1B"}),u.jsx("text",{x:"41",y:"4",fill:"#1B4D1B",fillOpacity:"0.7",fontSize:"7",fontWeight:"600",children:"+ B2B paid"}),u.jsx("circle",{cx:"90",cy:"2",r:"2",fill:"#7C9885"}),u.jsx("text",{x:"95",y:"4",fill:"#1B4D1B",fillOpacity:"0.7",fontSize:"7",fontWeight:"600",children:"B2C Paid"})]})]})}const c6e="2026-02-02T00:00:00Z";function d6e(){const e=new Date(c6e),t=new Date;let n=(t.getUTCFullYear()-e.getUTCFullYear())*12+(t.getUTCMonth()-e.getUTCMonth());return t.getUTCDate()<e.getUTCDate()&&(n-=1),Math.max(0,n)}function h6e(){const[e,t]=D.useState(u3);D.useEffect(()=>{window.location.hostname!=="localhost"&&fetch("/.netlify/functions/get-growth-data").then(i=>i.json()).then(i=>{i.success&&i.growth?.length>1&&t(i.growth)}).catch(()=>{})},[]);const n=e[e.length-1],a=n.b2cPaying??n.paying??0,r=n.users>0?Math.round(a/n.users*100):0,s=d6e();return u.jsx("div",{className:"relative",style:{width:Zx,height:HE,background:"linear-gradient(135deg, #FAF3E8 0%, #F4F1EA 100%)",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",color:"#1B4D1B"},children:u.jsxs("div",{className:"w-full h-full flex flex-col",style:{padding:"28px 36px"},children:[u.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-[#1B4D1B]/15",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"font-serif leading-none",style:{fontSize:28},children:[u.jsx("span",{className:"text-[#1B4D1B]",children:"Solta"}),u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx("p",{className:"font-serif italic text-[#1B4D1B]/70 mt-0.5",style:{fontSize:10},children:"Emotions are visible. AI therapy should adapt."})]}),u.jsxs("div",{className:"text-right flex-shrink-0",children:[u.jsx("p",{className:"text-[9px] font-semibold text-[#1B4D1B]/50 tracking-[0.15em] uppercase whitespace-nowrap",children:"Investor One-Pager"}),u.jsx("p",{className:"text-[9px] text-[#1B4D1B]/60 mt-0.5 whitespace-nowrap",children:"SoltaAI.com/investors"}),u.jsx("p",{className:"text-[9px] text-[#1B4D1B]/60 whitespace-nowrap",children:"[email protected]"})]})]}),u.jsxs("div",{className:"mt-3 text-center",children:[u.jsx("h2",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:16},children:"Building the first AI-guided EMDR therapy platform"}),u.jsx("p",{className:"text-[10px] text-[#1B4D1B]/70 mt-0.5",children:"Starting with emotion-adaptive bilateral stimulation"})]}),u.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-3 mt-3 min-h-0",children:[u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B]",style:{fontSize:14},children:"About the Team"}),u.jsxs("div",{className:"flex items-center gap-2 bg-white rounded-full border border-[#1B4D1B]/10 px-3 py-1 flex-shrink-0",children:[u.jsx("img",{src:LH,alt:"",style:{height:18},className:"object-contain"}),u.jsx("span",{className:"text-[#7C9885] font-semibold tracking-[0.12em] uppercase whitespace-nowrap",style:{fontSize:8},children:"CREATE-X Accelerator"})]})]}),u.jsx("div",{className:"space-y-2",children:[{name:"Sofia Y. Muller",role:"Founder & CEO",photo:pw,size:44,linkedin:"https://www.linkedin.com/in/sofiamuller/",credentials:[{text:"Brain Health Research",logo:t3},{text:"MS CS, Machine Learning",logo:a3},{text:"Nature Medicine Co-author",logo:n3},{text:"BBA, Finance & Management",logo:rm}]},{name:"Dr. Carlos Castañeda",role:"Clinical Advisor (Co-Founder Track)",photo:hw,size:40,linkedin:"https://www.linkedin.com/in/carlos-casta%C3%B1eda-704/",credentials:[{text:"PhD, Clinical Education",logo:rm},{text:"Experienced Founder",logo:i3},{text:"MA Mental Health; LPCC, NCC",logo:r3},{text:"BS, Psychology",logo:s3}]},{role:"Volunteer Clinical Advisor",size:36,anonymous:!0,credentials:[{text:"EMDR Consultant",logo:o3},{text:"Director of Product",logo:l3}]}].map(i=>u.jsxs("div",{className:"flex items-start gap-2",children:[i.anonymous?u.jsx("div",{className:"rounded-lg bg-[#7C9885]/15 border border-[#7C9885]/25 flex items-center justify-center flex-shrink-0 text-[#7C9885]",style:{width:i.size,height:i.size},children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{width:i.size*.55,height:i.size*.55},children:[u.jsx("circle",{cx:"12",cy:"9",r:"3.5"}),u.jsx("path",{d:"M5 20c0-3.5 3.1-6 7-6s7 2.5 7 6"})]})}):u.jsx("img",{src:i.photo,alt:i.name,className:"rounded-lg object-cover flex-shrink-0",style:{width:i.size,height:i.size}}),u.jsxs("div",{className:"flex-1 min-w-0",children:[i.anonymous?u.jsx("p",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:11},children:i.role}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx("p",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:11},children:i.name}),u.jsx(l6e,{url:i.linkedin,name:i.name,size:9})]}),u.jsx("p",{className:"text-[#F4A28C] font-semibold tracking-wide",style:{fontSize:8},children:i.role})]}),u.jsx("div",{className:"grid grid-cols-2 gap-x-2 gap-y-0.5 mt-0.5",children:i.credentials.map((o,l)=>u.jsxs("div",{className:"flex items-center gap-1 text-[#1B4D1B]/80",style:{fontSize:7.5,lineHeight:1.15},children:[u.jsx("div",{className:"rounded-full bg-white border border-[#1B4D1B]/10 flex items-center justify-center flex-shrink-0",style:{width:14,height:14},children:u.jsx("img",{src:o.logo,alt:"",className:"object-contain",style:{maxHeight:9,maxWidth:9}})}),u.jsx("span",{className:"whitespace-nowrap",children:o.text})]},l))})]})]},i.name||i.role))})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm",children:[u.jsxs("div",{className:"mb-2",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:14},children:"What is EMDR?"}),u.jsx("p",{className:"italic text-[#1B4D1B]/60 leading-tight",style:{fontSize:9},children:"Eye Movement Desensitization Reprocessing"})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-2",children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B] mb-1",style:{fontSize:10},children:"How it works"}),u.jsx("ul",{style:{display:"flex",flexDirection:"column",gap:4},children:["Focus on what's bothering you","Follow bilateral stimulation","Adjustment based on emotion"].map(i=>u.jsxs("li",{className:"text-[#1B4D1B]/80",style:{fontSize:9,lineHeight:"12px",paddingLeft:10,position:"relative"},children:[u.jsx("span",{style:{position:"absolute",left:0,top:4,width:4,height:4,borderRadius:"50%",background:"#7C9885"}}),i]},i))})]}),u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B] mb-1",style:{fontSize:10},children:"Why it works"}),u.jsx("ul",{style:{display:"flex",flexDirection:"column",gap:4},children:["Mimics REM sleep","Suppresses fight or flight response","Increases neuroplasticity"].map(i=>u.jsxs("li",{className:"text-[#1B4D1B]/80",style:{fontSize:9,lineHeight:"12px",paddingLeft:10,position:"relative"},children:[u.jsx("span",{style:{position:"absolute",left:0,top:4,width:4,height:4,borderRadius:"50%",background:"#F4A28C"}}),i]},i))})]})]}),u.jsxs("div",{className:"mb-2",children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B] mb-1",style:{fontSize:10},children:"What it treats"}),u.jsx("div",{className:"grid grid-cols-3",style:{rowGap:4,columnGap:8},children:["PTSD & trauma","Anxiety","Addiction & cravings","Performance anxiety","Phobias","Sleep disorders"].map(i=>u.jsxs("div",{className:"text-[#1B4D1B]/80",style:{fontSize:9,lineHeight:"12px",paddingLeft:10,position:"relative"},children:[u.jsx("span",{style:{position:"absolute",left:0,top:4,width:4,height:4,borderRadius:"50%",background:"#7C9885"}}),i]},i))})]}),u.jsx("div",{className:"flex justify-center mb-2",children:u.jsx("div",{style:{width:160},children:u.jsx(e3,{})})}),u.jsxs("div",{className:"flex items-center justify-center gap-4 mb-1",children:[u.jsx("img",{src:"/who-logo.svg",alt:"WHO",style:{height:16},className:"opacity-70 object-contain"}),u.jsx("img",{src:"/apa-logo.svg",alt:"APA",style:{height:16},className:"opacity-70 object-contain"}),u.jsx("img",{src:"/va-logo.svg",alt:"VA",style:{height:16},className:"opacity-70 object-contain"})]}),u.jsx("p",{className:"text-center text-white bg-[#5C7565] rounded-full py-1 font-semibold",style:{fontSize:10},children:"Outperforms medication. Faster than talk therapy."})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm",children:[u.jsxs("div",{className:"mb-2",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:14},children:"The Problem"}),u.jsx("p",{className:"italic text-[#1B4D1B]/60 leading-tight",style:{fontSize:9},children:"Dysregulation is widespread — EMDR is inaccessible"})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[u.jsxs("div",{className:"bg-[#F4A28C]/15 rounded-lg p-2 text-center",children:[u.jsx("p",{className:"font-serif font-bold text-[#F4A28C] leading-none whitespace-nowrap",style:{fontSize:18},children:"1 in 3"}),u.jsx("p",{className:"text-[#1B4D1B]/70 mt-1",style:{fontSize:8},children:"experience anxiety, trauma, or sleep issues each year"})]}),u.jsxs("div",{className:"bg-[#F4A28C]/15 rounded-lg p-2 text-center",children:[u.jsx("p",{className:"font-serif font-bold text-[#F4A28C] leading-none",style:{fontSize:16},children:"$150–$300"}),u.jsx("p",{className:"text-[#1B4D1B]/70 mt-1",style:{fontSize:8},children:"per EMDR session"})]}),u.jsxs("div",{className:"bg-[#F4A28C]/15 rounded-lg p-2 text-center",children:[u.jsx("p",{className:"font-serif font-bold text-[#F4A28C] leading-none",style:{fontSize:22},children:"<10%"}),u.jsx("p",{className:"text-[#1B4D1B]/70 mt-1",style:{fontSize:8},children:"of therapists EMDR-trained"})]})]}),u.jsx("p",{className:"text-center text-white bg-[#5C7565] rounded-full py-1 mt-2 font-semibold",style:{fontSize:10},children:"Effective care exists — most people can't reach it"})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm",children:[u.jsxs("div",{className:"mb-2",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:14},children:"The Solution"}),u.jsx("p",{className:"italic text-[#1B4D1B]/60 leading-tight",style:{fontSize:9},children:"AI-powered EMDR at a fraction of the cost"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"flex-1 min-w-0 space-y-1.5",children:[{n:1,color:"#7C9885",title:"User follows the dot",desc:"Bilateral stimulation calms the nervous system"}
5076,{n:2,color:"#F4A28C",title:"Solta reads emotion",desc:"Face, voice, body language, choice of words"},{n:3,color:"#7C9885",title:"The experience adapts",desc:"Speed & stimulation adjust in real time"}].map(i=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"rounded-full flex items-center justify-center flex-shrink-0 text-white font-bold",style:{width:20,height:20,fontSize:10,backgroundColor:i.color},children:i.n}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]",style:{fontSize:10},children:i.title}),u.jsx("p",{className:"text-[#1B4D1B]/60",style:{fontSize:9},children:i.desc})]})]},i.n))}),u.jsx(o6e,{width:68,height:80})]}),u.jsx("p",{className:"text-center text-white bg-[#5C7565] rounded-full py-1 mt-2 font-semibold",style:{fontSize:10},children:"Clinically grounded · Continuously adaptive · Always available"})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B] mb-2",style:{fontSize:14},children:"Market Opportunity"}),u.jsxs("div",{className:"bg-[#1B4D1B] rounded-lg p-2",children:[u.jsxs("div",{className:"flex items-baseline justify-between",children:[u.jsx("span",{className:"font-bold text-white/70 tracking-wider",style:{fontSize:9},children:"TAM"}),u.jsx("span",{className:"font-bold text-white",style:{fontSize:16},children:"$461B+"})]}),u.jsx("p",{className:"text-white/70",style:{fontSize:9},children:"Global Mental Health Market"}),u.jsxs("div",{className:"bg-[#7C9885] rounded-lg p-2 mt-1.5",children:[u.jsxs("div",{className:"flex items-baseline justify-between",children:[u.jsx("span",{className:"font-bold text-white/70 tracking-wider",style:{fontSize:9},children:"SAM"}),u.jsx("span",{className:"font-bold text-white",style:{fontSize:16},children:"$2.5B"})]}),u.jsx("p",{className:"text-white/70",style:{fontSize:9},children:"U.S. Mental Health Apps"}),u.jsxs("div",{className:"bg-[#F4A28C] rounded-lg p-2 mt-1.5",children:[u.jsxs("div",{className:"flex items-baseline justify-between",children:[u.jsx("span",{className:"font-bold text-white/80 tracking-wider",style:{fontSize:9},children:"SOM"}),u.jsx("span",{className:"font-bold text-white",style:{fontSize:16},children:"$4.2M"})]}),u.jsx("p",{className:"text-white/80",style:{fontSize:9},children:"35K B2C × $96 · 500 B2B × $1,800"})]})]})]})]}),u.jsxs("div",{className:"bg-white/70 rounded-xl border border-[#1B4D1B]/10 p-3 shadow-sm flex flex-col",children:[u.jsxs("div",{className:"mb-2",children:[u.jsx("h3",{className:"font-serif text-[#1B4D1B] leading-tight",style:{fontSize:14},children:"Traction"}),u.jsxs("p",{className:"italic text-[#1B4D1B]/60 leading-tight",style:{fontSize:9},children:[s," ",s===1?"month":"months",", zero marketing spend · 1st B2B contracts signed"]})]}),u.jsxs("div",{className:"grid grid-cols-4 gap-1.5 mb-2",children:[u.jsxs("div",{className:"bg-white rounded-lg p-1.5 text-center border border-[#1B4D1B]/8",children:[u.jsxs("p",{className:"font-bold text-[#7C9885]",style:{fontSize:14},children:[r,"%"]}),u.jsx("p",{className:"text-[#1B4D1B]/60",style:{fontSize:8},children:"Conv."})]}),u.jsxs("div",{className:"bg-white rounded-lg p-1.5 text-center border border-[#1B4D1B]/8",children:[u.jsx("p",{className:"font-bold text-[#7C9885]",style:{fontSize:14},children:"$0"}),u.jsx("p",{className:"text-[#1B4D1B]/60",style:{fontSize:8},children:"CAC"})]}),u.jsxs("div",{className:"bg-white rounded-lg p-1.5 flex flex-col items-center border border-[#1B4D1B]/8",children:[u.jsx("div",{className:"flex-1 flex items-center",children:u.jsx("a",{href:"https://vudy.app/",target:"_blank",rel:"noopener noreferrer","aria-label":"Vudy website",className:"inline-flex items-center",children:u.jsx("img",{src:c0,alt:"Vudy",style:{height:16},className:"object-contain"})})}),u.jsx("p",{className:"text-[#3D7A4A] whitespace-nowrap",style:{fontSize:7},children:"+$100 MRR"})]}),u.jsxs("div",{className:"bg-white rounded-lg p-1.5 flex flex-col items-center border border-[#1B4D1B]/8",children:[u.jsx("div",{className:"flex-1 flex items-center",children:u.jsx("a",{href:"https://www.pinyahta.com/",target:"_blank",rel:"noopener noreferrer","aria-label":"Pinyahta website",className:"inline-flex items-center",children:u.jsx("img",{src:d0,alt:"Pinyahta",style:{height:22},className:"object-contain"})})}),u.jsx("p",{className:"text-[#1B4D1B]/60 whitespace-nowrap",style:{fontSize:7},children:"Signed pilot"})]})]}),u.jsx("div",{className:"bg-white rounded-lg p-2 border border-[#1B4D1B]/8 overflow-hidden flex-1 min-h-0 flex items-center",children:u.jsx(u6e,{data:e,tall:!0})})]}),u.jsxs("div",{className:"bg-[#1A3C34] rounded-xl px-5 py-3 shadow-sm text-white flex flex-col col-span-2",children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-2 gap-2",children:[u.jsx("h3",{className:"font-serif text-white whitespace-nowrap",style:{fontSize:18},children:"The Ask"}),u.jsx("span",{className:"italic text-white/60 whitespace-nowrap",style:{fontSize:10}
5076,children:"Closing the gap to seed-ready"})]}),u.jsxs("div",{className:"flex items-center gap-6",children:[u.jsx("p",{className:"font-serif font-bold leading-none whitespace-nowrap",style:{fontSize:48},children:"$1M"}),u.jsx("div",{className:"flex-1 grid grid-cols-2 gap-4",children:[{label:"Instrument",value:"Post-money SAFE"},{label:"Minimum check",value:"$25K"}].map(i=>u.jsxs("div",{children:[u.jsx("p",{className:"font-bold text-[#F4A28C] tracking-[0.1em] uppercase whitespace-nowrap",style:{fontSize:8},children:i.label}),u.jsx("p",{className:"font-serif font-bold text-white whitespace-nowrap mt-0.5",style:{fontSize:12},children:i.value})]},i.label))})]})]})]}),u.jsxs("div",{className:"mt-3 pt-2 border-t border-[#1B4D1B]/15 flex items-center justify-between gap-2",style:{fontSize:8},children:[u.jsx("span",{className:"text-[#1B4D1B]/60 whitespace-nowrap",children:"© SoltaAI · Georgia Tech CREATE-X"}),u.jsx("span",{className:"text-[#1B4D1B]/60 whitespace-nowrap",children:"SoltaAI.com/investors · linkedin.com/company/soltaai"}),u.jsx("span",{className:"italic text-[#1B4D1B]/50 whitespace-nowrap",children:"Reach out to discuss terms."})]})]})})}function p6e(){const e=D.useRef(null),[t,n]=D.useState(1),[a,r]=D.useState(!1),[s,i]=D.useState("");D.useEffect(()=>{const l=()=>{const d=window.innerWidth,c=Math.min(d-32,Zx);n(c/Zx)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);const o=async()=>{if(!(a||!e.current)){r(!0),i("Loading…");try{await $B("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"),await $B("https://cdn.jsdelivr.net/npm/[email protected]/dist/jspdf.umd.min.js");const l=window.modernScreenshot,d=window.jspdf&&window.jspdf.jsPDF;if(!l?.domToPng||!d)throw new Error("PDF libraries did not load");i("Rendering page…");const c=await l.domToPng(e.current,{backgroundColor:"#FAF3E8",scale:2});i("Building PDF…");const f=new d({orientation:"portrait",unit:"in",format:"letter"});f.addImage(c,"PNG",0,0,8.5,11,void 0,"FAST");const m=new Date,x=`${String(m.getFullYear()).slice(-2)}${String(m.getMonth()+1).padStart(2,"0")}${String(m.getDate()).padStart(2,"0")}`;f.save(`SoltaAI_OnePager_${x}.pdf`)}catch(l){console.error("PDF export failed:",l),alert(`Export failed: ${l.message||l}`)}finally{r(!1),i("")}}};return u.jsxs("div",{className:"min-h-screen bg-[#F4F1EA] py-6 px-4 overflow-x-hidden",children:[u.jsx(vs,{title:"Solta AI — Investor One-Pager",description:"Investor one-pager for Solta AI. Adaptive BLS, AI-guided EMDR.",path:"/investors/onepager",noindex:!0}),u.jsx("div",{className:"max-w-3xl mx-auto mb-3",children:u.jsx("a",{href:"/investors",className:"inline-block text-sm text-[#1B4D1B]/60 hover:text-[#F4A28C] underline underline-offset-4",children:"← Back to investor overview"})}),u.jsxs("div",{className:"max-w-3xl mx-auto mb-5 flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-serif text-xl md:text-2xl text-[#1B4D1B]",children:"Investor One-Pager"}),u.jsx("p",{className:"text-xs md:text-sm text-[#1B4D1B]/60",children:"US Letter (8.5 × 11 in), portrait."}),u.jsxs("p",{className:"text-[11px] text-[#1B4D1B]/50 md:hidden mt-1",children:["Preview below scales to fit your screen — tap ",u.jsx("b",{children:"Export PDF"})," for a full-size readable version."]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a&&u.jsx("span",{className:"text-xs text-[#1B4D1B]/70",children:s}),u.jsx("button",{onClick:o,disabled:a,className:"px-4 py-2 rounded-full bg-[#1B4D1B] text-white text-sm font-semibold shadow-sm hover:bg-[#7C9885] transition-colors disabled:opacity-50",children:"Export PDF"})]})]}),u.jsx("div",{className:"mx-auto overflow-hidden shadow-2xl rounded-lg",style:{width:Zx*t,height:HE*t},children:u.jsx("div",{style:{transform:`scale(${t})`,transformOrigin:"top left",width:Zx,height:HE},className:"bg-[#FAF3E8]",children:u.jsx("div",{ref:e,children:u.jsx(h6e,{})})})})]})}const Eu=2,K1="soltaai-raise",VN=["soltaai-raise-v18","soltaai-raise-v17","soltaai-raise-v16","soltaai-raise-v15","soltaai-raise-v14","soltaai-raise-v13","soltaai-raise-v12","soltaai-raise-v11","soltaai-raise-v10","soltaai-raise-v9","soltaai-raise-v8","soltaai-raise-v7","soltaai-raise-v6","soltaai-raise-v5","soltaai-raise-v4","soltaai-raise-v3","soltaai-raise-v2","soltaai-raise-v1"],f6e=["ios-eng","cv-eng","pm","va-admin"],ju=[{id:"founder-salary",cat:"People",title:"Founder Compensation",loc:"Austin, TX",icon:"👩‍💻",type:"recurring",subtype:"salary",salMin:8e4,salMax:15e4,salDefault:1e5},{id:"ios-eng",cat:"People",title:"iOS Engineer",loc:"Mexico (2–5× cost advantage vs US)",icon:"🇲🇽",type:"recurring",subtype:"hire",levels:{Junior:{"25th":1300,"50th":2
5076600,"75th":3900,"90th":5400,"99th":6500},"Mid-Level":{"25th":2100,"50th":3200,"75th":4500,"90th":6200,"99th":7800},Senior:{"25th":3400,"50th":4800,"75th":6500,"90th":8500,"99th":10500}}},{id:"cv-eng",cat:"People",title:"Computer Vision Engineer",loc:"Mexico (2–5× cost advantage vs US)",icon:"🇲🇽",type:"recurring",subtype:"hire",levels:{Junior:{"25th":1400,"50th":2800,"75th":4200,"90th":5800,"99th":7200},"Mid-Level":{"25th":2600,"50th":3800,"75th":5200,"90th":7500,"99th":9500},Senior:{"25th":4e3,"50th":5600,"75th":7800,"90th":10200,"99th":13e3}}},{id:"pm",cat:"People",title:"Technical Project Manager",loc:"Mexico (2–5× cost advantage vs US)",icon:"🇲🇽",type:"recurring",subtype:"hire",startMo:1,levels:{Junior:{"25th":1500,"50th":2e3,"75th":2500,"90th":3e3,"99th":3500},"Mid-Level":{"25th":2500,"50th":3200,"75th":4e3,"90th":4800,"99th":5500},Senior:{"25th":3500,"50th":4200,"75th":5e3,"90th":5800,"99th":6500}},desc:"Mexico-based bilingual technical PM to coordinate engineering sprints, manage product roadmap execution, and bridge communication between founder and development team. At seed scale (2–3 engineers), this is a hybrid role — part project coordination, part product management, part QA — which is more valuable than a pure PM at this stage. Traditional PMs oversee 5–10 engineers, so this hire grows into the role as the team scales. Frees founder bandwidth from day-to-day engineering coordination to focus on fundraising, partnerships, and clinical strategy. Salary benchmarks: Glassdoor MX$29k–66k/mo, ERI MXN 557k–997k/yr, Levels.fyi MX$503k–$1.03M/yr. Hired onto Mexican entity payroll with IMSS benefits."},{id:"cab",cat:"People",title:"Clinical Advisory Board (×3)",loc:"US-based EMDR clinicians",icon:"🧠",type:"recurring",subtype:"cab",desc:"Three board-certified EMDR clinicians providing clinical validation, protocol review, and regulatory guidance. Strengthens credibility with payers and regulators. Standard seed-stage compensation: $1k–6k/yr cash per advisor + 0.05–0.25% equity each (equity not modeled here).",tiers:{"Equity-heavy":{perAdvisor:100,label:"~$100/mo ea · mostly equity"},Balanced:{perAdvisor:250,label:"$250/mo ea · cash + equity"},"Cash-forward":{perAdvisor:500,label:"$500/mo ea · heavier cash"}},tierDefault:"Balanced",count:3},{id:"recruiter",cat:"People",title:"Recruiting & Job Postings",loc:"US + Mexico",icon:"🔍",type:"one-time",subtype:"range",desc:"Talent acquisition for 3 engineering/PM placements + LinkedIn promoted job postings. Options span from cost-efficient Mexico-based recruiter + free LinkedIn postings to US fractional recruiter + promoted LinkedIn ads. Mexico-based tech recruiters (CodersLink, Ventes Mexico, EchoGlobal) charge 15–25% of annual salary or flat fees — significantly cheaper than US agencies given Mexico salary levels. US fractional recruiters run $100–$200/hr (40–80hrs per hire). LinkedIn promoted job posts add $150–$500/role/month in CPC spend (~$1.50–$4.50/click) to boost visibility beyond free listings.",low:4e3,mid:1e4,high:22e3},{id:"va-admin",cat:"People",title:"Executive Assistant / Admin VA",loc:"Mexico-based remote",icon:"📋",type:"recurring",subtype:"cab",desc:"Mexico-based bilingual VA (Spanish/English) handling ops so the founder stays focused on product and fundraising: calendar management, investor follow-ups, travel booking, expense tracking, vendor coordination, and application submissions. LATAM-based bilingual VAs run $8–$15/hr through managed services. Hired onto Mexican entity payroll with IMSS benefits for full compliance.",tiers:{"PT (~20 hr/wk)":{perAdvisor:1e3,label:"$1k/mo · ~$12/hr, part-time"},"PT (~30 hr/wk)":{perAdvisor:1500,label:"$1.5k/mo · ~$12/hr, heavier part-time"},"FT (~40 hr/wk)":{perAdvisor:2e3,label:"$2k/mo · ~$12/hr, full-time"}},tierDefault:"PT (~20 hr/wk)",count:1},{id:"team-onsites",cat:"People",title:"Team Onsites (3× CDMX + 1× Austin/yr)",loc:"Mexico City & Austin, TX",icon:"✈️",type:"recurring",subtype:"cab",desc:"Quarterly in-person sprints to maintain velocity and team cohesion across distributed team: 3×/yr in Mexico City (low-cost, engineers are local) and 1×/yr in Austin (co-located with founder). Week-long each. Covers flights, accommodations, coworking, and meals. CDMX is highly cost-effective — coworking ~$10–25/day, Airbnb ~$50–100/night.",tiers:{"Lean (3 ppl)":{perAdvisor:1250,label:"$1.25k/mo · ~$15k/yr, 3-person team"},"Standard (4 ppl)":{perAdvisor:1750,label:"$1.75k/mo · ~$21k/yr, 4-person team"},"Full (5+ ppl)":{perAdvisor:2500,label:"$2.5k/mo · ~$30k/yr, 5-person team"}},tierDefault:"Standard (4 ppl)",count:1},{id:"qsehra",cat:"People",title:"QSEHRA Health Stipend (US Employees)",loc:"US-based W-2s",icon:"💊",type:"recurring",subtype:"cab",desc:"Tax-advantaged health reimbursement for US W-2 employees (companies <50 FTEs). Employees select their own ACA-compliant plan; company reimburses tax-free up to IRS max ($529/mo individual, $1,067/mo family). Admin via Take Command or PeopleKeep ($20–50/mo per employee). Activates when US-based W-2 hires come on board.",tiers:{"Lean ($300/mo ea)":{perAdvisor:300,label:"$300/mo per employee · below avg, partial coverage"},"Standard ($450/mo ea)":{perAdvisor:450,label:"$450/mo per employee · near avg, solid coverage"},"Max ($529/mo ea)":{perAdvisor:529,label:"$529/mo per employee · 2025 IRS max individual"}},tierDefault:"Standard ($450/mo ea)",count:0},{id:"mx-benefits",cat:"People",title:"Mexico Employee Benefits (IMSS/INFONAVIT)",loc:"Mexico",icon:"🇲🇽",type:"recurring",subtype:"cab",scalesWith:"mx",desc:"Mandatory employer contributions per Mexico-based employee: IMSS (health, disability, pension), INFONAVIT (housing fund), payroll tax, and PTU (profit sharing). Adds ~25–35% to gross salary — non-optional under Mexican labor law. Some startups add private health insurance (~$50–150/mo) as a competitive retention tool. Cost scales automatically with enabled Mexico roles.",tiers:{"Mandatory only":{perAdvisor:525,label:"$525/person/mo · IMSS/INFONAVIT at ~30% load"},"Mandatory + private ins":{perAdvisor:675,label:"$675/person/mo · adds gastos médicos mayores"},"Full package":{perAdvisor:800,label:"$800/person/mo · mandatory + private health + vales"}},tierDefault:"Mandatory only",count:1},{id:"equipment",cat:"People",title:"Equipment & Home Office Setup",loc:"All employees",icon:"💻",type:"one-time",subtype:"range",scalesWith:"mx",desc:"One-time hardware provisioning per Mexico-based hire: MacBook Pro (~$1.5–2.5k), monitor (~$300–500), peripherals (~$200), ergonomic workspace stipend (~$300–500). Admin VA needs lighter hardware. Cost scales automatically with enabled Mexico roles. Per-hire: ~$1.5k–$3.3k depen
5076ding on role.",low:1750,mid:2500,high:3250},{id:"learning",cat:"People",title:"Professional Development Stipend",loc:"All employees",icon:"📚",type:"recurring",subtype:"range",scalesWith:"mx",desc:"Annual learning budget per employee — a low-cost, high-retention perk standard at seed stage. Covers courses, conferences, books, and certifications (Udemy, Coursera, WWDC, iOS/ML conferences). $500–$2k/yr per person. Cost scales automatically with enabled Mexico roles.",low:42,mid:85,high:167},{id:"payroll-platform",cat:"People",title:"Payroll & HR Platform",loc:"US + Mexico",icon:"📊",type:"recurring",subtype:"cab",desc:"Payroll processing, tax filing, and compliance across both jurisdictions. US: Gusto ($40 base + $6/employee/mo) or Justworks ($59/employee/mo). Mexico: Deel EOR ($49–99/employee/mo) or local payroll provider ($100–300/mo) — local provider is more cost-efficient once Mexican entity is formed.",tiers:{"DIY + local MX":{perAdvisor:150,label:"$150/mo · Gusto US ($50) + local MX payroll ($100)"},"Gusto + Deel EOR":{perAdvisor:300,label:"$300/mo · Gusto ($50) + Deel EOR 2 employees ($250)"},"Justworks + Deel":{perAdvisor:450,label:"$450/mo · Justworks ($180) + Deel EOR ($270)"}},tierDefault:"DIY + local MX",count:1},{id:"turnover-buffer",cat:"People",title:"Employee Turnover Buffer",loc:"Mexico",icon:"🔄",type:"recurring",subtype:"range",scalesWith:"mx",desc:"Monthly reserve per employee against replacement costs. Early-stage turnover runs ~15–25% annually. Mexico-specific costs include: statutory severance (3 months salary + 20 days/year served), recruiter fees (~$4k–8k), equipment (~$2–3k), and productivity ramp. Cost scales automatically with enabled Mexico roles.",low:100,mid:150,high:225},{id:"api-emotion",cat:"APIs & Subscriptions",title:"Emotion Detection API (Hume AI)",loc:"",icon:"😊",type:"recurring",subtype:"cab",desc:"Hume AI Expression Measurement + EVI for voice emotion analysis — a core product capability. Plans scale with user volume: Pro ($70/mo, 1k TTS + 1.2k EVI min), Scale ($200/mo), Business ($500/mo). Supplements client-side ONNX models with higher-accuracy cloud processing as user base grows.",tiers:{Pro:{perAdvisor:70,label:"$70/mo · 1k TTS + 1.2k EVI min"},Scale:{perAdvisor:200,label:"$200/mo · 3.3k TTS + 5k EVI min"},Business:{perAdvisor:500,label:"$500/mo · 10k TTS + 12.5k EVI min"}},tierDefault:"Scale",count:1},{id:"api-llm",cat:"APIs & Subscriptions",title:"LLM Inference (Anthropic / OpenAI)",loc:"",icon:"🤖",type:"recurring",subtype:"range",desc:"Claude or GPT API powering session summarization, adaptive prompt generation, and clinical note drafting — key product differentiators. Usage-based pricing (~$3–15/1M input tokens). Cost scales linearly with active user base.",low:50,mid:200,high:500},{id:"api-infra",cat:"APIs & Subscriptions",title:"Cloud Infrastructure & Hosting",loc:"",icon:"☁️",type:"recurring",subtype:"range",desc:"Production infrastructure: hosting (Vercel/AWS), database (Supabase), edge functions, CDN, and monitoring (Sentry/Datadog). Cost scales with user growth — architected for efficiency at early stage.",low:50,mid:150,high:400},{id:"api-other",cat:"APIs & Subscriptions",title:"Other Paid APIs & Tools",loc:"",icon:"🔌",type:"recurring",subtype:"range",desc:"Supporting SaaS stack: analytics (Mixpanel/Amplitude), transactional email (SendGrid/Resend), payments (Stripe), push notifications, error tracking, and app store fees ($99/yr Apple). Bundle of tools essential for product operations.",low:75,mid:200,high:400},{id:"api-wispr",cat:"APIs & Subscriptions",title:"Wispr Flow (Voice Dictation)",loc:"",icon:"🎙️",type:"recurring",subtype:"cab",desc:"AI voice-to-text dictation — team productivity tool for faster writing, coding, and documentation. Not a product API. Pro: $15/mo unlimited dictation + AI commands. Teams: ~$10/user/mo for 3+ seats.",tiers:{"Solo Pro":{perAdvisor:15,label:"$15/mo · 1 seat, unlimited"},"Team (×3)":{perAdvisor:30,label:"$10/user/mo · 3 seats"},"Team (×5)":{perAdvisor:50,label:"$10/user/mo · 5 seats"}},tierDefault:"Solo Pro",count:1},{id:"api-11labs",cat:"APIs & Subscriptions",title:"ElevenLabs (TTS & Voice AI)",loc:"",icon:"🔊",type:"recurring",subtype:"cab",desc:"Ultra-realistic TTS and voice cloning API — potential product feature for guided bilateral stimulation audio and multilingual voice narration. Credit-based: Starter 30k chars through Scale 2M+. Enables differentiated, soothing voice guidance during sessions.",tiers:{Starter:{perAdvisor:5,label:"$5/mo · 30k credits"},Creator:{perAdvisor:22,label:"$22/mo · 100k credits"},Pro:{perAdvisor:99,label:"$99/mo · 500k credits, API"},Scale:{perAdvisor:330,label:"$330/mo · 2M credits, low-latency"}},tierDefault:"Creator",count:1},{id:"sub-notion",cat:"APIs & Subscriptions",title:"Notion (Workspace)",loc:"",icon:"📝",type:"recurring",subtype:"cab",desc:"Team workspace for docs, wikis, and project management. Seat-based: Plus $10/seat/mo, Business $20/seat/mo (adds AI + SSO). Guests (contractors, advisors) are free. Scales linearly as team grows.",tiers:{"Plus (×1)":{perAdvisor:10,label:"$10/mo · 1 seat, Plus annual"},"Plus (×4)":{perAdvisor:40,label:"$40/mo · 4 seats, Plus annual"},"Business (×4)":{perAdvisor:80,label:"$80/mo · 4 seats, Business annual (AI incl)"}},tierDefault:"Plus (×1)",count:1},{id:"sub-linkedin",cat:"APIs & Subscriptions",title:"LinkedIn Premium",loc:"",icon:"🔗",type:"recurring",subtype:"cab",desc:"LinkedIn Premium for investor outreach, hiring pipeline, and BD networking. Business ($60/mo): unlimited searches + 15 InMails. Sales Navigator Core ($100/mo): advanced lead gen with filters for investor and clinician targeting.",tiers:{"Premium Business":{perAdvisor:60,label:"$60/mo · 15 InMails, unlimited search"},"Sales Navigator Core":{perAdvisor:100,label:"$100/mo · advanced search, lead lists"}},tierDefault:"Premium Business",count:1},{id:"sub-claude",cat:"APIs & Subscriptions",title:"Anthropic (Claude Pro/Team)",loc:"",icon:"🤖",type:"recurring",subtype:"cab",desc:"Claude AI subscriptions for founder and engineering team. Pro ($20/mo): Claude Code, extended thinking, projects. Team Standard ($25/seat/mo): adds admin controls, shared projects. Team Premium ($125/seat/mo): Claude Code + 6.25× Pro usage. Direct productivity multiplier for a small team.",tiers:{"Pro (×1 founder)":{perAdvisor:20,label:"$20/mo · 1 Pro seat for founder"},"Pro (×2)":{perAdvisor:40,label:"$40/mo · 2 Pro seats"},"Team Std (×4)":{perAdvisor:100,label:"$100/mo · 4 Team Standard seats (annual)"},"Team Std+Prem (×4)":{perAdvisor:175,label:"$175/mo · 3 Std + 1 Premium seat"}},tierDefault:"Pro (×1 founder)",count:1},{id:"sub-netlify",cat:"APIs & Subscriptions",title:"Netlify (Hosting & Deploy)",loc:"",icon:"🌐",type:"recurring",subtype:"cab",desc:"Web hosting and CI
5076/CD for the SoltaAI web application. Credit-based: Personal ($9/mo, 1k credits), Pro ($20/mo, 5k credits + team collaboration at $19/additional member). Sufficient for early-stage traffic with room to scale.",tiers:{"Personal ($9/mo)":{perAdvisor:9,label:"$9/mo · 1k credits, solo"},"Pro 1-seat ($20/mo)":{perAdvisor:20,label:"$20/mo · 5k credits, 1 member"},"Pro 3-seat ($58/mo)":{perAdvisor:58,label:"$58/mo · 5k credits + 2 extra seats"}},tierDefault:"Pro 1-seat ($20/mo)",count:1},{id:"sub-github",cat:"APIs & Subscriptions",title:"GitHub Team + Copilot",loc:"",icon:"🐙",type:"recurring",subtype:"cab",desc:"Source control and engineering collaboration. Team ($4/user/mo): protected branches, code owners, required reviewers, 3k CI/CD min. Copilot Business ($19/user/mo): AI-assisted coding with IP indemnity — significant velocity boost for a small team.",tiers:{"Team (×3)":{perAdvisor:12,label:"$12/mo · 3 users, GitHub Team only"},"Team+Copilot (×3)":{perAdvisor:69,label:"$69/mo · 3 users, Team + Copilot Biz"},"Team+Copilot (×4)":{perAdvisor:92,label:"$92/mo · 4 users, Team + Copilot Biz"}},tierDefault:"Team (×3)",count:1},{id:"sub-manus",cat:"APIs & Subscriptions",title:"Manus AI (Autonomous Agent)",loc:"",icon:"🤖",type:"recurring",subtype:"cab",desc:"Autonomous AI agent for automated research, competitor analysis, and content generation. Credit-based: Standard $20/mo (4k credits), Plus $39/mo (8k), Pro $199/mo (19.9k). Extends founder capacity for market research and due diligence without additional headcount.",tiers:{"Standard ($20/mo)":{perAdvisor:20,label:"$20/mo · 4k credits"},"Plus ($39/mo)":{perAdvisor:39,label:"$39/mo · 8k credits"},"Pro ($199/mo)":{perAdvisor:199,label:"$199/mo · 19.9k credits, 10 concurrent"}},tierDefault:"Plus ($39/mo)",count:1},{id:"patent",cat:"Legal",title:"Software Patent (Utility)",loc:"USPTO",icon:"📜",type:"one-time",subtype:"range",desc:"Utility patent protecting core AI-adaptive bilateral stimulation IP. Covers prior-art search, attorney drafting, provisional → non-provisional filing, and prosecution. Strengthens competitive moat and enterprise/exit valuation.",low:1e4,mid:16e3,high:25e3},{id:"trademark",cat:"Legal",title:'Trademark Registration — "SoltaAI"',loc:"USPTO",icon:"™️",type:"one-time",subtype:"range",desc:"Federal trademark protection for the SoltaAI brand. Covers comprehensive search, application filing ($350/class), attorney fees, and office-action response. Secures brand identity for market positioning.",low:1500,mid:2500,high:4e3},{id:"tos-privacy",cat:"Legal",title:"ToS, Privacy Policy & Cookie Policy",loc:"SaaS / AI / Health",icon:"📋",type:"one-time",subtype:"range",desc:"Attorney-drafted terms of service, privacy policy, acceptable use policy, and cookie policy tailored for AI health-tech SaaS. Required for app store compliance, enterprise sales, and regulatory readiness.",low:3500,mid:5e3,high:7500},{id:"fundraise-legal",cat:"Legal",title:"Fundraise Legal (SAFE/Convertible)",loc:"",icon:"💰",type:"one-time",subtype:"range",desc:"Legal review and preparation of SAFE notes, investor agreements, and cap table cleanup for this seed round. Standard early-stage fundraise legal overhead.",low:5e3,mid:7500,high:1e4},{id:"compliance-setup",cat:"Legal",title:"Regulatory & Compliance Framework (Setup)",loc:"US + International",icon:"🏥",type:"one-time",subtype:"range",desc:"One-time buildout of SoltaAI's compliance foundation across multiple frameworks. HIPAA: risk analysis, BAA templates, data handling policies, security assessment, employee training — prerequisite for organization partnerships (clinics, group practices, EAPs) and enterprise sales. SOC 2 Type I: readiness assessment, gap analysis, policy documentation, evidence collection setup — increasingly required by enterprise buyers and investors as a trust signal. State privacy laws (CCPA/CPRA, Texas TDPSA): data mapping, consent flows, privacy rights infrastructure. App store & biometric data compliance: facial/emotion data collection requires compliance with Illinois BIPA, Texas CUBI, Washington My Health My Data Act. Architecture already minimizes PHI exposure via client-side processing, reducing scope. Platforms like Vanta or Drata ($8k–$12k/yr) can automate evidence collection across frameworks.",low:8e3,mid:18e3,high:35e3},{id:"compliance-ongoing",cat:"Legal",title:"Compliance Consulting & Maintenance",loc:"US + International",icon:"🔄",type:"recurring",subtype:"range",startMo:1,desc:"Ongoing compliance costs after initial framework is in place. Includes: compliance platform subscription (Vanta/
5076Drata ~$700–$1k/mo), annual HIPAA risk reassessment, SOC 2 Type II audit prep and auditor fees (amortized monthly), policy updates as regulations evolve, annual employee security awareness training, vendor risk assessments for new integrations, and ad-hoc compliance consulting ($250–$300/hr) for new product features involving PHI or biometric data.",low:300,mid:700,high:1500},{id:"ip-assign",cat:"Legal",title:"IP Assignment & Founder Agreements",loc:"",icon:"📝",type:"one-time",subtype:"range",desc:"IP assignment to corporate entity, CIIA agreements, and any outstanding founder/contractor IP cleanup. Standard investor diligence requirement — ensures clean IP chain of title.",low:1500,mid:2500,high:4e3},{id:"mx-entity",cat:"Legal",title:"Mexican Entity Incorporation (S. de R.L.)",loc:"Mexico",icon:"🇲🇽",type:"one-time",subtype:"range",desc:"Establish a Mexican S. de R.L. de C.V. (LLC equivalent) subsidiary to legally employ engineers in Mexico at 2–5× cost advantage. Covers: name authorization, Acta Constitutiva, RFC registration with SAT, IMSS employer registration, Foreign Investment Registry filing, and corporate bank account. Process: 4–8 weeks.",low:3e3,mid:5e3,high:8e3},{id:"mx-crossborder",cat:"Legal",title:"Cross-Border Legal Structuring",loc:"US ↔ Mexico",icon:"⚖️",type:"one-time",subtype:"range",desc:"US-side attorney for parent-subsidiary structure, intercompany agreements, transfer pricing documentation, and IP licensing between US parent and Mexican subsidiary. Critical for avoiding double taxation and permanent establishment risk. Includes IRS check-the-box election for pass-through treatment.",low:3e3,mid:6e3,high:1e4},{id:"mx-accounting",cat:"Legal",title:"Mexican Accounting & Tax Compliance",loc:"Mexico",icon:"🧾",type:"recurring",subtype:"range",desc:"Ongoing Mexican accountant for monthly SAT filings (provisional ISR + IVA), payroll processing with IMSS/INFONAVIT contributions, annual tax return, and electronic accounting uploads. Employer contributions add ~25–35% on top of gross salary; corporate tax 30%, VAT 16%.",low:300,mid:500,high:800},{id:"fda-consultant",cat:"Legal",title:"FDA Regulatory Consultant",loc:"US",icon:"🏛️",type:"one-time",subtype:"range",desc:"Specialized SaMD regulatory consultant guiding pathway strategy (510(k) vs De Novo), pre-submission prep, and FDA reviewer correspondence. AI-adaptive bilateral stimulation likely qualifies for 510(k) if predicate exists (e.g. Freespira for PTSD) or De Novo if novel. Rates: $200–$400/hr. FDA clearance is the key unlock for healthcare reimbursement and enterprise scale.",low:15e3,mid:25e3,high:4e4},{id:"fda-user-fee",cat:"Legal",title:"FDA User Fees (Review + Registration)",loc:"US",icon:"📋",type:"one-time",subtype:"range",desc:"FDA submission review fees plus annual establishment registration ($9,280/yr). 510(k) small business rate: $6,084 (standard: $24,335). De Novo small business: ~$16.5k (standard: ~$66k). SoltaAI qualifies for small business rate (<$100M revenue). Budget includes first-year registration.",low:15e3,mid:26e3,high:42e3},{id:"fda-qms",cat:"Legal",title:"QMS & Software Documentation (IEC 62304)",loc:"",icon:"📑",type:"one-time",subtype:"range",desc:"Quality Management System (ISO 13485), software lifecycle documentation (IEC 62304), risk management (ISO 14971), Design History File, cybersecurity documentation (SBOM, threat model), and software V&V. For AI/ML SaMD, includes predetermined change control plan (PCCP). Partially DIY with QMS tools (Greenlight Guru, Qualio) + consultant review.",low:2e4,mid:35e3,high:55e3},{id:"fda-testing",cat:"Legal",title:"FDA Software Validation & Clinical Evidence",loc:"",icon:"🧪",type:"one-time",subtype:"range",desc:"Performance testing, analytical validation (emotion detection accuracy), usability engineering (IEC 62366), and clinical evidence generation for FDA submission. For SaMD: no biocompatibility needed — focus is software V&V, clinical validation, and cybersecurity testing per FDA guidance.",low:15e3,mid:3e4,high:5e4},{id:"legal-defense",cat:"Legal",title:"Legal Defense & Dispute Reserve",loc:"US + Mexico",icon:"⚖️",type:"one-time",subtype:"range",desc:"Reserve fund for unanticipated legal disputes during the runway period. Health-tech AI companies face elevated risk surface: employment disputes (especially cross-border Mexican labor law claims), regulatory challenges or FDA enforcement actions, IP infringement claims from incumbents, cease-and-desist from professional associations opposing AI-assisted therapy, HIPAA/data privacy complaints, and general commercial disputes.",low:15e3,mid:3e4,high:5e4},{id:"res-pilot",cat:"Research",title:"Pilot Validation Study",loc:"e.g. Northwestern, Georgia Tech",icon:"🔬",type:"one-time",subtype:"range",desc:"Sponsored research agreement for a small-scale pilot (n=20–50) validating adaptive bilateral stimulation efficacy. Generates peer-reviewed evidence supporting clinical claims — 
5076critical for FDA submission, payer conversations, and organizational adoption. Covers PI time, IRB, participant compensation, and data analysis. Universities add 15–55% F&A overhead.",low:15e3,mid:3e4,high:5e4},{id:"res-ra",cat:"Research",title:"Research Assistant / Graduate Student",loc:"University-based",icon:"🎓",type:"recurring",subtype:"range",desc:"Part-time graduate RA embedded in partner lab to run study protocol, collect data, and co-author publications. Cost-effective research capacity that also builds academic credibility and publication pipeline.",low:1e3,mid:1800,high:2500},{id:"res-irb",cat:"Research",title:"IRB & Regulatory Fees",loc:"",icon:"📑",type:"one-time",subtype:"range",desc:"Institutional Review Board application, protocol amendments, continuing reviews, and HIPAA/data governance compliance. Required for any human subjects research and FDA-quality evidence generation.",low:1500,mid:3e3,high:5e3},{id:"res-pub",cat:"Research",title:"Publication & Conference Costs",loc:"",icon:"📄",type:"one-time",subtype:"range",desc:"Open-access publication fees (APCs), poster printing, and conference registration/travel for presenting findings at ISTSS, APA, or Behavioral Health Tech. Peer-reviewed publications build clinical credibility and drive organic clinician awareness.",low:2e3,mid:4e3,high:7e3},{id:"mkt-influencer",cat:"Marketing",title:"Influencer Partnerships",loc:"Instagram / TikTok / YouTube",icon:"📣",type:"recurring",subtype:"cab",desc:"Mental health micro/nano-influencer partnerships targeting trauma survivors and therapy communities. Mental health/wellness niche commands 30–40% premium over general lifestyle. Nano (1k–10k followers): $50–500/post. Micro (10k–100k): $250–2k/post. High-trust channel for health-tech — 2–4 sponsored posts/month.",tiers:{"Nano only":{perAdvisor:400,label:"~$400/mo · 4 nano posts"},"Nano + Micro":{perAdvisor:1e3,label:"$1k/mo · 2 nano + 1 micro"},"Micro-focused":{perAdvisor:2500,label:"$2.5k/mo · 2–3 micro posts"}},tierDefault:"Nano + Micro",count:1},{id:"mkt-reddit",cat:"Marketing",title:"Reddit Ads",loc:"r/EMDR, r/ptsd, r/therapy, r/mentalhealth",icon:"🤖",type:"recurring",subtype:"cab",desc:"Targeted ads in mental health and therapy subreddits (r/EMDR, r/ptsd, r/therapy). 42% cheaper CPC than Facebook with strong niche community targeting. CPC: $0.50–$4, CPM: $1.50–$10. Health/wellness CPA: ~$5–15 per acquisition. Capital-efficient channel for early user acquisition.",tiers:{"Test ($750)":{perAdvisor:750,label:"$25/day · learning phase"},"Growth ($1.5k)":{perAdvisor:1500,label:"$50/day · optimization"},"Scale ($3k)":{perAdvisor:3e3,label:"$100/day · scaling"}},tierDefault:"Growth ($1.5k)",count:1},{id:"mkt-contractor",cat:"Marketing",title:"Part-Time Marketing Contractor",loc:"Remote / US-based",icon:"🎨",type:"recurring",subtype:"cab",desc:"Freelance marketer for brand development, social media content, copywriting, and community management. More capital-efficient than a full-time hire at this stage. Social media managers: $500–$2k/mo; fractional marketing leads: $2k–$5k/mo. Scope: branding, social, newsletter, and analytics.",tiers:{"Light (~10 hr/mo)":{perAdvisor:1e3,label:"$1k/mo · social posts + copy"},"Standard (~20 hr/mo)":{perAdvisor:2e3,label:"$2k/mo · brand guide + social"},"Full (~30 hr/mo)":{perAdvisor:3500,label:"$3.5k/mo · full content strategy"}},tierDefault:"Standard (~20 hr/mo)",count:1},{id:"mkt-conferences",cat:"Marketing",title:"Conferences & Events",loc:"SXSW / Capital Factory, BH Tech, APA",icon:"🎪",type:"one-time",subtype:"range",desc:"2–3 strategic events over runway for investor visibility and clinician acquisition. SXSW + Capital Factory House ($1.4–$1.9k badge + ~$300–$500 Startup Crawl table + demo materials) — local to Austin, high investor density. Behavioral Health Tech (~$1.5–$2.5k, payer/enterprise audience). APA or ISTSS for clinical credibility. Plus travel, hotel, and booth materials.",low:3e3,mid:7e3,high:14e3}
5076,{id:"mkt-aso",cat:"Marketing",title:"App Store Optimization (ASO)",loc:"iOS App Store",icon:"📱",type:"one-time",subtype:"range",desc:"Professional app store screenshots, preview video, keyword optimization, and A/B testing. Top 3 keywords drive ~65% of organic installs — ASO is the highest-leverage organic acquisition channel for mobile. One-time setup with periodic refresh.",low:1500,mid:3500,high:7e3},{id:"mkt-content",cat:"Marketing",title:"Content & SEO (Blog / Video)",loc:"",icon:"✍️",type:"recurring",subtype:"cab",desc:"Educational blog posts, SEO-optimized content on EMDR/bilateral stimulation/trauma recovery, and short-form video for TikTok/Reels. Builds organic authority and trust in the mental health space — compounds over time as a durable acquisition channel. Partially handled by marketing contractor.",tiers:{"DIY + Tools":{perAdvisor:200,label:"$200/mo · SEO tools + AI drafts"},"Writer + Tools":{perAdvisor:800,label:"$800/mo · 4 posts + SEO tools"},"Full Content":{perAdvisor:2e3,label:"$2k/mo · blog + video + SEO"}},tierDefault:"Writer + Tools",count:1},{id:"mkt-email",cat:"Marketing",title:"Email Marketing & CRM",loc:"",icon:"📧",type:"recurring",subtype:"range",desc:"Email platform (Loops, Resend, ConvertKit — $0–$50/mo at early scale) plus onboarding sequences, nurture drip campaigns, monthly newsletter to users and clinicians, and waitlist management. Drives activation and retention at near-zero marginal cost.",low:50,mid:150,high:400},{id:"mkt-creative",cat:"Marketing",title:"Design & Creative Assets",loc:"",icon:"🖌️",type:"one-time",subtype:"range",desc:"One-time professional design sprint: brand guide finalization, pitch deck design, product demo video (60–90s), social media templates, clinician one-pager, and investor materials. Freelance designer ($50–$150/hr) or design service (Superside) for a focused sprint.",low:2e3,mid:5e3,high:1e4},{id:"fundraise-travel",cat:"Ops & Insurance",title:"Founder Fundraise Travel",loc:"Austin → SF / NYC",icon:"✈️",type:"one-time",subtype:"range",desc:"3–5 trips to SF and 1–2 to NYC for investor meetings during 6-month fundraise cycle. RT flights Austin↔SF ~$200–$350, Austin↔NYC ~$200–$400. Hotels ~$150–$250/night × 2–3 nights. Meals & rideshare ~$75–$100/day.",low:4e3,mid:7e3,high:12e3},{id:"insurance-do",cat:"Ops & Insurance",title:"D&O Insurance (Directors & Officers)",loc:"US",icon:"🛡️",type:"recurring",subtype:"range",desc:"Protects founders, executives, and board members from personal liability. Seed-stage startups typically carry $1M–$2M coverage. Standard investor requirement before closing. Health-tech and AI sectors see higher premiums. Side-A only (personal protection) is typical at seed.",low:350,mid:500,high:700},{id:"insurance-cyber",cat:"Ops & Insurance",title:"Cyber & General Liability Insurance",loc:"US",icon:"🔐",type:"recurring",subtype:"range",desc:"Cyber liability covers data breach response, legal fees, and notification costs. General liability covers third-party claims. Health-tech companies handling facial/emotion data face higher cyber premiums — but essential given the data sensitivity of the product. Bundling D&O + cyber + GL yields savings.",low:150,mid:250,high:420},{id:"us-accounting",cat:"Ops & Insurance",title:"US Accounting & Tax (CPA)",loc:"US (Delaware C-Corp)",icon:"🧮",type:"recurring",subtype:"range",desc:"Startup-specialized CPA for monthly bookkeeping, Delaware franchise tax, federal/state returns, R&D tax credit documentation, cap table maintenance, and investor-ready financials. R&D credits can offset significant engineering spend — important given the ML-heavy development roadmap.",low:500,mid:800,high:1200},{id:"valuation-409a",cat:"Ops & Insurance",title:"409A Valuation",loc:"US",icon:"📊",type:"one-time",subtype:"range",desc:"Independent appraisal of common stock fair market value — required by IRS before granting employee stock options. Must be completed before first equity grants, after each funding round, and at least every 12 months. Budget covers 1–2 valuations over 24-month runway.",low:2e3,mid:3500,high:5e3},{id:"google-workspace",cat:"Ops & Insurance",title:"Google Worksp
5076ace + Domain + App Store",loc:"",icon:"📧",type:"recurring",subtype:"range",desc:"Google Workspace Business Starter: $7/user/mo for custom email, Drive, Meet, Calendar. Plus Apple Developer Program ($99/yr), Google Play ($25 one-time), and domain renewal (~$15/yr). Standard operational infrastructure.",low:30,mid:60,high:100},{id:"per-diem-meals",cat:"Ops & Insurance",title:"Per Diem & Business Meals",loc:"Austin + travel",icon:"🍽️",type:"recurring",subtype:"range",desc:"Monthly allocation for founder business meals (investor coffees, advisor dinners, networking events) and per diem on travel days. GSA standard M&IE: $68/day domestically, $86 in high-cost cities (SF/NYC). Business meals 50% tax-deductible. Covers ~2–4 local meetings/week plus travel days.",low:300,mid:500,high:800}],m6e=["25th","50th","75th","90th","99th"],g6e=["Junior","Mid-Level","Senior"],x6e=["low","mid","high"],BB={low:"Budget",mid:"Typical",high:"Premium"},FB=["People","APIs & Subscriptions","Legal","Research","Marketing","Ops & Insurance"],X1=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),HN=e=>e>=1e3?"$"+(e/1e3).toFixed(1)+"k":"$"+e.toLocaleString(),fr=e=>"$"+e.toLocaleString(),Ae={sage:"#8EA58C",sageDk:"#6B8568",salm:"#E8937C",salmDk:"#D47A62",bg:"#FAFAF7",card:"#FFFFFF",cardOff:"#F5F5F0",brd:"#E8E4DC",brdOn:"#C5D4C3",txt:"#2C3630",mid:"#5A6660",lt:"#8A9490",fnt:"#B8C0BC",crm:"#F0EDE6"},OB={"founder-salary":{sal:125e3},"ios-eng":{pct:"90th",startMo:3},"cv-eng":{pct:"90th",startMo:5},pm:{on:!1},cab:{startMo:3},recruiter:{tier:"low"},"va-admin":{cabTier:"FT (~40 hr/wk)"},"team-onsites":{cabTier:"Full (5+ ppl)",startMo:7},qsehra:{on:!1},"mx-benefits":{cabTier:"Mandatory + private ins"},equipment:{tier:"low"},learning:{tier:"low",startMo:3},"payroll-platform":{cabTier:"Gusto + Deel EOR"},"turnover-buffer":{tier:"high",startMo:7},"api-emotion":{startMo:5},"api-llm":{startMo:5},"api-infra":{startMo:6},"api-other":{startMo:2},"api-wispr":{cabTier:"Team (×3)",startMo:5},"api-11labs":{cabTier:"Pro",startMo:7},"sub-notion":{cabTier:"Business (×4)",startMo:3},"sub-linkedin":{startMo:2},"sub-claude":{cabTier:"Team Std+Prem (×4)",startMo:3},"sub-netlify":{cabTier:"Pro 3-seat ($58/mo)",startMo:3},"sub-github":{startMo:3},"sub-manus":{startMo:3},"tos-privacy":{tier:"low"},"fundraise-legal":{tier:"low"},"compliance-setup":{tier:"low"},"compliance-ongoing":{tier:"low",startMo:5},"ip-assign":{tier:"low"},"mx-entity":{tier:"low"},"mx-crossborder":{tier:"low"},"mx-accounting":{tier:"low"},"mkt-influencer":{cabTier:"Micro-focused"},"mkt-reddit":{cabTier:"Scale ($3k)"},"mkt-content":{cabTier:"DIY + Tools"},"mkt-email":{tier:"low"},"mkt-creative":{tier:"low"},"fundraise-travel":{tier:"low"},"insurance-do":{tier:"low"},"insurance-cyber":{tier:"low"},"per-diem-meals":{tier:"low"},_contingencyPct:25},Lx=()=>({items:ju.map(t=>{const n={id:t.id,on:!0,open:!1,sen:"Mid-Level",pct:"50th",sal:t.salDefault||0,tier:"mid",cabTier:t.tierDefault||"Balanced",startMo:1},a=OB[t.id];return a?Object.assign({},n,a):n}),catOpen:{People:!0,APIs:!0,Legal:!0,Research:!0,Marketing:!0},contingencyPct:OB._contingencyPct});function LB({open:e,color:t}){return u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:e?"rotate(180deg)":"rotate(0)",transition:"transform .25s",flexShrink:0},children:u.jsx("path",{d:"M4 6L8 10L12 6",stroke:t||Ae.lt,strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function y6e({on:e,toggle:t}){return u.jsx("div",{onClick:n=>{n.stopPropagation(),t()},style:{width:20,height:20,borderRadius:6,flexShrink:0,cursor:"pointer",border:"2px solid "+(e?Ae.sage:Ae.brd),background:e?Ae.sage+"18":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"all .2s"},children:e&&u.jsx("svg",{width:"11",height:"9",viewBox:"0 0 12 10",fill:"none",children:u.jsx("path",{d:"M1 5L4.5 8.5L11 1.5",stroke:Ae.sageDk,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Y1({opts:e,val:t,set:n,color:a,labels:r}){return u.jsx("div",{style:{display:"flex",gap:3,flexWrap:"wrap"},children:e.map(s=>{const i=t===s;return u.jsx("button",{onClick:()=>n(s),style:{padding:"6px 12px",border:"1px solid "+(i?a:Ae.brd),borderRadius:20,fontSize:12,fontWeight:i?600:400,fontFamily:"'DM Sans',system-ui",background:i?a+"18":"transparent",color:i?a:Ae.lt,cursor:"pointer",transition:"all .15s",whiteSpace:"nowrap"},children:r&&r[s]||s},s)})})}
5076function PB({value:e,onChange:t,min:n,max:a,step:r}){const s=(e-n)/(a-n)*100;return u.jsxs("div",{style:{padding:"4px 0"},children:[u.jsxs("div",{style:{position:"relative",height:28,display:"flex",alignItems:"center"},children:[u.jsx("div",{style:{position:"absolute",left:0,right:0,height:6,borderRadius:3,background:Ae.crm}}),u.jsx("div",{style:{position:"absolute",left:0,height:6,borderRadius:3,width:s+"%",background:"linear-gradient(90deg,"+Ae.sage+","+Ae.salm+")",transition:"width .1s"}}),u.jsx("input",{type:"range",min:n,max:a,step:r,value:e,onChange:i=>t(+i.target.value),style:{position:"absolute",width:"100%",height:28,opacity:0,cursor:"pointer",zIndex:2}}),u.jsx("div",{style:{position:"absolute",left:"calc("+s+"% - 10px)",width:20,height:20,borderRadius:"50%",background:"#fff",border:"3px solid "+Ae.salm,boxShadow:"0 2px 8px rgba(0,0,0,.12)",transition:"left .1s",pointerEvents:"none"}})]}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.fnt},children:[u.jsx("span",{children:fr(n)}),u.jsx("span",{children:fr(a)})]})]})}function b6e(){const e=Us(),[t,n]=D.useState(()=>Lx().items),[a,r]=D.useState(()=>Lx().catOpen),[s,i]=D.useState(!1),[o,l]=D.useState(null),[d,c]=D.useState(()=>Lx().contingencyPct),f=D.useRef(null),m=D.useRef(t),x=D.useRef(a),y=D.useRef(d);D.useEffect(()=>{m.current=t},[t]),D.useEffect(()=>{x.current=a},[a]),D.useEffect(()=>{y.current=d},[d]);const b=D.useCallback((F,H)=>{l({text:F,ok:H!==!1}),setTimeout(()=>l(null),1400)},[]),w=D.useCallback(()=>{if(X1)try{const F=m.current,H=x.current,B=y.current,Y=JSON.stringify({items:F.map(function(ne){return{id:ne.id,on:ne.on,open:ne.open,sen:ne.sen,pct:ne.pct,sal:ne.sal,tier:ne.tier,cabTier:ne.cabTier,startMo:ne.startMo}}),catOpen:H,contingencyPct:B});localStorage.setItem(K1,Y),b("Saved")}catch(F){b("Save error: "+F.message,!1)}},[b]),S=D.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(w,400)},[w]);D.useEffect(()=>{if(!X1){i(!0);return}try{var F=null,H=localStorage.getItem(K1);if(H)F=JSON.parse(H);else for(var B=0;B<VN.length;B++)try{var Y=localStorage.getItem(VN[B]);if(Y){F=JSON.parse(Y);try{localStorage.setItem(K1,Y)}catch{}try{localStorage.removeItem(VN[B])}catch{}break}}catch{}if(F){var ne=Lx();if(F.items){var ee=ne.items.map(function(oe){var pe=F.items.find(function(he){return he.id===oe.id});return pe?Object.assign({},oe,pe):oe});n(ee)}if(F.catOpen){var U=Object.assign({},F.catOpen);"APIs"in U&&!("APIs & Subscriptions"in U)&&(U["APIs & Subscriptions"]=U.APIs,delete U.APIs),r(function(oe){return Object.assign({},oe,U)})}typeof F.contingencyPct=="number"&&c(F.contingencyPct)}}catch{}i(!0)},[]);var k=function(F,H,B){n(function(Y){return Y.map(function(ne){return ne.id===F?Object.assign({},ne,{[H]:B}):ne})}),setTimeout(S,0)},C=function(F){n(function(H){return H.map(function(B){return B.id===F?Object.assign({},B,{open:!B.open}):B})}),setTimeout(S,0)},E=function(F){r(function(H){return Object.assign({},H,{[F]:!H[F]})}),setTimeout(S,0)},T=t.filter(function(F){return F.on&&f6e.indexOf(F.id)!==-1}).length,_=function(F){var H=ju.find(function(Y){return Y.id===F.id});if(!H)return 0;var B=0;return H.subtype==="salary"?B=Math.round(F.sal/12):H.subtype==="hire"?B=(H.levels[F.sen]||{})[F.pct]||0:H.subtype==="range"?B=H[F.tier]||0:H.subtype==="cab"&&(B=(H.tiers[F.cabTier]||{perAdvisor:0}).perAdvisor*H.count),H.scalesWith==="mx"?B*T:B},A=function(F){var H=ju.find(function(ne){return ne.id===F.id});if(!H)return 0;if(H.type==="recurring"){var B=Eu*12,Y=Math.max(0,B-(F.startMo-1));return _(F)*Y}return _(F)},$=t.filter(function(F){return F.on}),O={};FB.forEach(function(F){var H=ju.filter(function(B){return B.cat===F});O[F]=H.reduce(function(B,Y){var ne=t.find(function(ee){return ee.id===Y.id});return ne&&ne.on?B+A(ne):B},0)});var z=FB.slice().sort(function(F,H){return O[H]-O[F]}),P=$.reduce(function(F,H){return F+A(H)},0),j=Math.round(P*d/100),G=P+j,X=$.filter(function(F){var H=ju.find(function(B){return B.id===F.id});return H&&H.type==="recurring"}).reduce(function(F,H){return F+_(H)}
5076,0),J=$.filter(function(F){var H=ju.find(function(B){return B.id===F.id});return H&&H.type==="one-time"}).reduce(function(F,H){return F+_(H)},0),V=function(){var F=Lx();if(n(F.items),r(F.catOpen),c(10),X1)try{localStorage.removeItem(K1)}catch{}b("Reset")},Q=function(){var F=["const DEPLOYED_DEFAULTS = {"];t.forEach(function(B){var Y=[];B.on||Y.push("on:false"),B.sen!=="Mid-Level"&&Y.push('sen:"'+B.sen+'"'),B.pct!=="50th"&&Y.push('pct:"'+B.pct+'"');var ne=ju.find(function(ee){return ee.id===B.id});ne&&ne.subtype==="salary"&&B.sal!==(ne.salDefault||0)&&Y.push("sal:"+B.sal),B.tier!=="mid"&&Y.push('tier:"'+B.tier+'"'),ne&&ne.subtype==="cab"&&B.cabTier!==(ne.tierDefault||"Balanced")&&Y.push('cabTier:"'+B.cabTier+'"'),B.startMo!==1&&Y.push("startMo:"+B.startMo),Y.length>0&&F.push('  "'+B.id+'": { '+Y.join(", ")+" },")}),d!==10&&F.push("  _contingencyPct: "+d+","),F.push("};");var H=F.join(`
5077`);navigator.clipboard.writeText(H).then(function(){b("Copied to clipboard")}).catch(function(){b("Copy failed",!1)})};return s?u.jsxs("div",{style:{minHeight:"100vh",background:Ae.bg,color:Ae.txt,fontFamily:"'DM Sans',system-ui,sans-serif",padding:"36px 20px 48px"},children:[u.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;
5077600&family=Fraunces:opsz,[email protected],400;9..144,600;9..144,700&display=swap",rel:"stylesheet"}),o&&u.jsx("div",{style:{position:"fixed",bottom:16,right:16,zIndex:10,background:Ae.card,border:"1px solid "+(o.ok?Ae.brdOn:Ae.salm),borderRadius:10,padding:"6px 14px",fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:o.ok?Ae.sage:Ae.salm,boxShadow:"0 2px 8px rgba(0,0,0,.08)",display:"flex",alignItems:"center",gap:6},children:o.ok?u.jsxs(u.Fragment,{children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M2 6L5 9L10 3",stroke:Ae.sage,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),o.text]}):u.jsxs("span",{children:["⚠ ",o.text]})}),u.jsxs("div",{style:{maxWidth:1200,margin:"0 auto 28px"},children:[u.jsxs("button",{onClick:function(){e("/investors")},style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,fontFamily:"'DM Sans',system-ui",color:Ae.mid,background:"transparent",border:"none",cursor:"pointer",padding:"0 0 14px"},children:[u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:u.jsx("path",{d:"M10 12L6 8L10 4",stroke:Ae.lt,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Back to Investors Page"]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14,flexWrap:"wrap",gap:8},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsxs("span",{style:{fontFamily:"'Fraunces',serif",fontWeight:700,fontSize:18},children:[u.jsx("span",{style:{color:Ae.sage},children:"Solta"}),u.jsx("span",{style:{color:Ae.salm},children:"AI"})]}),u.jsx("span",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,background:Ae.crm,padding:"3px 8px",borderRadius:10,letterSpacing:.5},children:"USE OF FUNDS"})]}),u.jsxs("div",{style:{display:"flex",gap:6},children:[X1&&u.jsx("button",{onClick:Q,style:{fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.sage,background:"transparent",border:"1px solid "+Ae.brdOn,borderRadius:8,padding:"4px 10px",cursor:"pointer"},children:"Copy Defaults"}),u.jsx("button",{onClick:V,style:{fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,background:"transparent",border:"1px solid "+Ae.brd,borderRadius:8,padding:"4px 10px",cursor:"pointer"},children:"Reset All"})]})]}),u.jsx("h1",{style:{fontFamily:"'Fraunces',serif",fontSize:26,fontWeight:700,margin:"0 0 6px",letterSpacing:-.3},children:"Use of Funds"}),u.jsxs("p",{style:{fontSize:14,color:Ae.mid,margin:0,lineHeight:1.55},children:["Interactive capital allocation model. Toggle line items, adjust tiers to see how funding maps to ",u.jsxs("strong",{style:{color:Ae.txt},children:[Eu,"-year runway"]}),". All selections auto-save."]})]}),u.jsxs("div",{style:{maxWidth:1200,margin:"0 auto 20px",background:Ae.card,border:"1px solid "+Ae.brdOn,borderRadius:16,overflow:"hidden",boxShadow:"0 2px 12px rgba(142,165,140,.1)",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:12,padding:"16px 20px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:20,flexWrap:"wrap"},children:[u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"Recurring Burn"}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt},children:[fr(X),"/mo"]})]}),u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"One-Time"}),u.jsx("div",{style:{fontSize:11,color:Ae.fnt},children:fr(J)})]}),u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"Contingency"}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt},children:[d,"% · +",fr(j)]})]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[u.jsxs("div",{style:{fontSize:12,color:Ae.mid,fontFamily:"'DM Sans',system-ui"},children:[Eu,"-yr runway"]}),u.jsx("div",{style:{fontSize:28,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",letterSpacing:-1.5,background:"linear-gradient(135deg,"+Ae.sage+","+Ae.salmDk+")",WebkitBackgroun
5077dClip:"text",WebkitTextFillColor:"transparent"},children:fr(G)})]})]}),u.jsx("div",{style:{maxWidth:1200,margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(340px, 1fr))",gap:"0 16px"},children:z.map(function(F){var H=ju.filter(function(ee){return ee.cat===F}),B=a[F]!==!1,Y=H.filter(function(ee){var U=t.find(function(oe){return oe.id===ee.id});return U&&U.on}),ne=O[F];return u.jsxs("div",{style:{marginBottom:12},children:[u.jsxs("div",{onClick:function(){E(F)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 4px",cursor:"pointer",userSelect:"none"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsx(LB,{open:B,color:Ae.mid}),u.jsx("span",{style:{fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.mid,letterSpacing:1.5,textTransform:"uppercase",fontWeight:600},children:F}),u.jsxs("span",{style:{fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.fnt},children:[Y.length,"/",H.length]})]}),u.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,fontWeight:500},children:fr(ne)})]}),u.jsx("div",{style:{maxHeight:B?H.length*600:0,overflow:"hidden",transition:"max-height .4s cubic-bezier(.4,0,.2,1)"},children:H.map(function(ee){var U=t.find(function(ze){return ze.id===ee.id});if(!U)return null;var oe=_(U),pe=A(U),he=ee.type==="recurring",xe=ee.subtype==="salary",Ie=ee.subtype==="hire",_e=ee.subtype==="range",Oe=ee.subtype==="cab",Ye="";Ie&&(Ye=U.sen+" · "+U.pct),xe&&(Ye=fr(U.sal)+"/yr"),_e&&(Ye=BB[U.tier]),Oe&&(Ye=(ee.tiers[U.cabTier]||{}).label||U.cabTier);var ft=ee.scalesWith==="mx"?" × "+T+" MX roles":"";return u.jsxs("div",{style:{background:U.on?Ae.card:Ae.cardOff,border:"1px solid "+(U.on?Ae.brdOn:Ae.brd),borderRadius:16,marginBottom:8,overflow:"hidden",transition:"all .25s",opacity:U.on?1:.5,boxShadow:U.on?"0 1px 4px rgba(0,0,0,.04)":"none"},children:[u.jsxs("div",{onClick:function(){U.on&&C(ee.id)},style:{padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:U.on?"pointer":"default",gap:10,flexWrap:"wrap"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,flex:1,minWidth:0},children:[u.jsx(y6e,{on:U.on,toggle:function(){k(ee.id,"on",!U.on)}}),u.jsxs("div",{style:{minWidth:0},children:[u.jsxs("div",{style:{fontSize:14,fontWeight:600,color:U.on?Ae.txt:Ae.lt},children:[ee.icon," ",ee.title]}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt,marginTop:1},children:[ee.loc&&u.jsx("span",{children:ee.loc}),Ye&&u.jsxs(u.Fragment,{children:[u.jsx("span",{style:{margin:"0 4px"},children:"·"}),u.jsx("span",{style:{color:U.on?xe?Ae.salm:Ae.sage:Ae.fnt},children:Ye})]}),ft&&u.jsx("span",{style:{color:Ae.lt,fontSize:10},children:ft})]})]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[u.jsx("div",{style:{textAlign:"right"},children:he?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{fontSize:17,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",color:U.on?Ae.txt:Ae.fnt,letterSpacing:-.5},children:[HN(oe),u.jsx("span",{style:{fontSize:11,fontWeight:400,color:Ae.lt,marginLeft:2},children:"/mo"})]}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace"},children:[fr(pe)," / ",Eu,"yr"]})]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{fontSize:17,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",color:U.on?Ae.txt:Ae.fnt,letterSpacing:-.5},children:fr(oe)}),u.jsx("div",{style:{fontSize:11,color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace"},children:"one-time"})]})}),U.on&&u.jsx(LB,{open:U.open})]})]}),u.jsx("div",{style:{maxHeight:U.on&&U.open?600:0,overflow:"hidden",transition:"max-height .3s cubic-bezier(.4,0,.2,1)"},children:u.jsxs("div",{style:{padding:"0 18px 16px",borderTop:"1px solid "+Ae.crm,paddingTop:14},children:[ee.desc&&u.jsx("p",{style:{fontSize:12,color:Ae.mid,margin:"0 0 12px",lineHeight:1.5},children:ee.desc}),xe&&u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:10},children:"Annual Salary"}),u.jsx(PB,{value:U.sal,onChange:function(ze){k(ee.id,"sal",ze)},min:ee.salMin,max:ee.salMax,step:5e3})]}),Ie&&u.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap"},children:[u.jsxs("div",{style:{flex:1,minWidth:170},children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:8},children:"Seniority"}),u.jsx(Y1,{opts:g6e,val:U.sen,set:function(ze){k(ee.id,"sen",ze)},color:Ae.sage})]}),u.jsxs("div",{style:{flex:1,minWidth:230},children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:8},children:"Quality Percentile"}),u.jsx(Y1,{opts:m6e,val:U.pct,set:function(ze){k(ee.id,"pct",ze)},color:Ae.salm})]})]}),_e&&u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:8},children:"Cost Tier"}),u.jsx(Y1,{opts:x6e,val:U.tier,set:function(ze){k(ee.id,"tier",ze)},color:Ae.sage,labels:BB}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10,fontSize:11,fontFamily:"'JetBrains Mono',monospace",color:Ae.fnt},children:[u.jsx("span",{children:fr(ee.low)}),u.jsx("span",{children:fr(ee.mid)}),u.jsx("span",{children:fr(ee.high)})]})]}),Oe&&u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:8},children:"Tier"}),u.jsx(Y1,{opts:Object.keys(ee.tiers),val:U.cabTier,set:function(ze){k(ee.id,"cabTier",ze)},color:Ae.sage}),u.jsx("div",{style:{marginTop:12,display:"flex",gap:14,flexWrap:"wrap"},children:Object.entries(ee.tiers).map(function(ze){var ct=ze[0],ot=ze[1];return u.jsxs("div",{style:{flex:1,minWidth:140,padding:"10px 12px",borderRadius:10,border:"1px solid "+(U.cabTier===ct?Ae.brdOn:Ae.brd),background:U.cabTier===ct?Ae.sage+"08":"transparent",transition:"all .2s"},children:[u.jsx("div",{style:{fontSize:12,fontWeight:600,color:U.cabTier===ct?Ae.sageDk:Ae.lt,marginBottom:2},children:ct}),u.jsx("div",{style:{fontSize:11,color:Ae.mid},children:ot.label}),u.jsxs("div",{style:{fontSize:13,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",color:U.cabTier===ct?Ae.txt:Ae.fnt,marginTop:4},children:[fr(ot.perAdvisor*ee.count),u.jsxs("span",{style:{fontSize:10,fontWeight:400,color:Ae.lt},children:["/mo",ee.count>1?" total":""]})]})]},ct)})})]}),Ie&&u.jsxs("div",{style:{marginTop:14},children:[u.jsx("div",{style:{height:4,background:Ae.crm,borderRadius:2,position:"relative",overflow:"hidden"},children:(function(){var ze=ee.levels[U.sen]["25th"],ct=ee.levels[U.sen]["99th"],ot=ct>ze?Math.max(0,Math.min(100,(oe-ze)/(ct-ze)*100)):0;return u.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:ot+"%",background:"linear-gradient(90deg,"+Ae.sage+","+Ae.salm+")",borderRadius:2,transition:"width .3s"}})})()}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:4,fontSize:10,
5077color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace"},children:[u.jsxs("span",{children:[HN(ee.levels[U.sen]["25th"]),"/mo"]}),u.jsxs("span",{children:[HN(ee.levels[U.sen]["99th"]),"/mo"]})]})]}),he&&u.jsxs("div",{style:{marginTop:14,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase"},children:"Starts Month"}),U.startMo>1&&u.jsxs("span",{style:{fontSize:10,color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace"},children:[Math.max(0,Eu*12-(U.startMo-1))," of ",Eu*12," mo active"]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[u.jsx("button",{onClick:function(ze){ze.stopPropagation(),k(ee.id,"startMo",Math.max(1,U.startMo-1))},style:{width:24,height:24,borderRadius:6,border:"1px solid "+Ae.brd,background:"transparent",cursor:"pointer",fontSize:14,color:Ae.lt,display:"flex",alignItems:"center",justifyContent:"center"},children:"−"}),u.jsx("span",{style:{fontSize:13,fontFamily:"'JetBrains Mono',monospace",color:Ae.txt,minWidth:20,textAlign:"center"},children:U.startMo}),u.jsx("button",{onClick:function(ze){ze.stopPropagation(),k(ee.id,"startMo",Math.min(Eu*12,U.startMo+1))},style:{width:24,height:24,borderRadius:6,border:"1px solid "+Ae.brd,background:"transparent",cursor:"pointer",fontSize:14,color:Ae.lt,display:"flex",alignItems:"center",justifyContent:"center"},children:"+"})]})]})]})})]},ee.id)})})]},F)})}),u.jsxs("div",{style:{maxWidth:1200,margin:"16px auto 0",background:Ae.card,border:"1px solid "+Ae.brd,borderRadius:16,padding:"14px 18px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"Contingency Buffer"}),u.jsx("div",{style:{fontSize:11,color:Ae.fnt},children:"Unplanned costs, overruns, market shifts"})]}),u.jsxs("div",{style:{textAlign:"right"},children:[u.jsxs("div",{style:{fontSize:17,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",color:Ae.txt,letterSpacing:-.5},children:[d,"%"]}),u.jsx("div",{style:{fontSize:11,color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace"},children:fr(j)})]})]}),u.jsx(PB,{value:d,onChange:function(F){c(F),setTimeout(S,0)},min:0,max:25,step:1})]}),u.jsxs("div",{style:{maxWidth:1200,margin:"20px auto 0",background:Ae.card,border:"1px solid "+Ae.brdOn,borderRadius:16,overflow:"hidden",boxShadow:"0 2px 12px rgba(142,165,140,.1)"},children:[u.jsxs("div",{style:{padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:10},children:[u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"Recurring Burn"}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt},children:[fr(X),"/mo · ",fr(X*12),"/yr"]})]}),u.jsxs("div",{style:{textAlign:"center"},children:[u.jsx("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:"One-Time"}),u.jsx("div",{style:{fontSize:11,color:Ae.fnt},children:fr(J)})]}),u.jsxs("div",{style:{textAlign:"right"},children:[u.jsxs("div",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",color:Ae.lt,letterSpacing:1.2,textTransform:"uppercase",marginBottom:2},children:["Contingency (",d,"%)"]}),u.jsxs("div",{style:{fontSize:11,color:Ae.fnt},children:["+",fr(j)]})]})]}),u.jsxs("div",{style:{background:"linear-gradient(135deg,"+Ae.sage+"10,"+Ae.salm+"10)",borderTop:"1px solid "+Ae.crm,padding:"18px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:12},children:[u.jsxs("div",{children:[u.jsx("div",{style:{fontFamily:"'Fraunces',serif",fontSize:15,fontWeight:600,marginBottom:2},children:"Total Raise Need"}),u.jsxs("div",{style:{fontSize:12,color:Ae.mid},children:[Eu,"-yr runway · ",$.length,"/",t.length," items"]})]}),u.jsx("div",{style:{fontSize:32,fontWeight:700,fontFamily:"'JetBrains Mono',monospace",letterSpacing:-1.5,background:"linear-gradient(135deg,"+Ae.sage+","+Ae.salmDk+")",WebkitBackgroun
5077dClip:"text",WebkitTextFillColor:"transparent"},children:fr(G)})]})]}),u.jsx("div",{style:{maxWidth:1200,margin:"12px auto 0",textAlign:"center",fontSize:10,color:Ae.fnt,fontFamily:"'JetBrains Mono',monospace",lineHeight:1.7},children:"Salary: Glassdoor, ERI, Levels.fyi · Legal: USPTO, UpCounsel · APIs: vendor pricing pages · Mar 2026"})]}):u.jsx("div",{style:{minHeight:"100vh",background:Ae.bg,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"'DM Sans',system-ui",color:Ae.lt,fontSize:14},children:"Loading…"})}const v6e={hidden:{opacity:0,y:40},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}},zB={monthly:{amount:"$8",label:"/mo"},yearly:{amount:"$72",label:"/yr"}},w6e={monthly:"/mo",yearly:"/yr"},S6e="solta_pending_checkout";function k6e(){const e=Us(),{user:t,loading:n}=eb(),a=!!t,[r,s]=D.useState("monthly"),[i,o]=D.useState("individual"),[l,d]=D.useState(o0),[c,f]=D.useState(null),[m,x]=D.useState(!1),[y,b]=D.useState(""),w=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),S=A=>i==="enterprise"?`$${l0(l,A)}`:zB[A].amount,k=A=>i==="enterprise"?w6e[A]:zB[A].label,C=async(A,$)=>{if(f({code:A,accountName:$}),!a)return;const O=Wa();if(O){if(w){alert(`Localhost: Organization code "${A}" applied! You now have access.`),e("/bls");return}try{(await(await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:O,code:A})})).json()).success&&e("/bls")}catch{}}},E=async(A,$,O)=>{if(x(!0),b(""),w){localStorage.removeItem("solta_localhost_bls_set_count"),alert(`Localhost: ${$} subscription simulated! Session count reset.`),x(!1);return}try{const z=Wa(),P=ti();if(!P){b("Please log in to subscribe"),x(!1);return}const j=$==="enterprise"?O??l:void 0,G=await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:P,userId:z,priceId:i0($,A),accountType:$,...j!==void 0&&{seats:j}})}),X=await G.json();G.ok&&X.url?window.location.href=X.url:(b(X.error||"Something went wrong. Please try again."),x(!1))}catch{b("An error occurred. Please try again."),x(!1)}},T=async()=>{if(!a){try{sessionStorage.setItem(S6e,JSON.stringify({plan:r,accountType:i,...i==="enterprise"&&{seats:l},ts:Date.now()}))}catch{}e(`/signup?returnUrl=${encodeURIComponent("/subscribe")}`);return}await E(r,i)},_=D.useRef(!1);return D.useEffect(()=>{if(n||!a||_.current)return;const A=FH();A&&(OH(),_.current=!0,s(A.plan),o(A.accountType),A.accountType==="enterprise"&&A.seats&&d(A.seats),E(A.plan,A.accountType,A.seats))},[n,a]),u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:"Subscribe – Solta AI",description:"Choose your Solta AI subscription plan. Start with a 7-day free trial. Monthly or yearly options available.",path:"/subscribe"}),u.jsx(Vs,{}),u.jsx("main",{className:"pt-24 pb-16",children:u.jsx("div",{className:"max-w-3xl mx-auto px-6",children:u.jsxs(qe.div,{initial:"hidden",animate:"visible",variants:v6e,className:"text-center space-y-8",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:"Choose Your Plan"}),u.jsx("p",{className:"text-lg text-[#1B4D1B]/80 mt-3",children:"Start with a 7-day free trial. Cancel anytime."})]}),u.jsx(W2,{value:i,onChange:o}),i==="enterprise"&&u.jsx("div",{className:"max-w-xl mx-auto",children:u.jsx(V2,{billingCycle:r,seats:l,onSeatsChange:d})}),u.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6 max-w-xl mx-auto",children:[u.jsxs("button",{onClick:()=>s("monthly"),className:`relative bg-white rounded-2xl p-6 border-2 transition-all text-left ${r==="monthly"?"border-[#7C9885] shadow-lg":"border-gray-200 hover:border-gray-300"}`,children:[u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-2",children:"Monthly"}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-4xl font-bold text-[#1B4D1B]",children:S("monthly")}),u.jsx("span",{className:"text-base text-[#1B4D1B]/60",children:k("monthly")})]}),u.jsx("p",{className:"text-sm text-[#7C9885] mt-2",children:"7 days free"}),r==="monthly"&&u.jsx("div",{className:"absolute top-4 right-4",children:u.jsx("svg",{className:"w-6 h-6 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]}),u.jsxs("button",{onClick:()=>s("yearly"),className:`relative bg-white rounded-2xl p-6 border-2 transition-all text-left ${r==="yearly"?"border-[#7C9885] shadow-lg":"border-gray-200 hover:border-gray-300"}`,children:[u.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:u.jsx("span",{className:"bg-[#F4A28C] text-white text-xs font-semibold px-3 py-1 rounded-full",children:"Best Value"})}),u.jsx("p",{className:"text-sm font-medium text-[#1B4D1B]/60 mb-2",children:"Yearly"}),u.jsxs("div",{className:"flex items-baseline gap-1",children:[u.jsx("span",{className:"text-4xl font-bold text-[#1B4D1B]",children:S("yearly")}),u.jsx("span",{className:"text-base text-[#1B4D1B]/60",children:k("yearly")})]}),u.jsx("p",{className:"text-sm text-[#7C9885] mt-2",children:"7 days free"}),r==="yearly"&&u.jsx("div",{className:"absolute top-4 right-4",children:u.jsx("svg",{className:"w-6 h-6 text-[#7C9885]",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]})]}),r==="yearly"&&u.jsxs(qe.div,{initial:{opacity:0,y:10}
5077,animate:{opacity:1,y:0},className:"bg-[#F4A28C]/10 border border-[#F4A28C]/30 rounded-lg p-4 max-w-xl mx-auto",children:[u.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-[#1B4D1B]",children:[u.jsx("svg",{className:"w-4 h-4 text-[#F4A28C]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),u.jsx("span",{className:"font-medium",children:"Best value — save 25%"})]}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/70 mt-1 text-center",children:"Like getting 3 months free vs. paying monthly."})]}),u.jsxs("div",{className:"bg-white rounded-2xl p-6 max-w-xl mx-auto",children:[u.jsx("h3",{className:"font-semibold text-lg text-[#1B4D1B] mb-4",children:"What's included"}),u.jsxs("ul",{className:"space-y-3 text-[#1B4D1B]/80",children:[u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885] flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Unlimited BLS sessions"]}),u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885] flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"AI-adaptive speed control"]}),u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885] flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Emotion tracking & session insights"]}),i==="enterprise"&&u.jsxs("li",{className:"flex items-center gap-3",children:[u.jsx("svg",{className:"w-5 h-5 text-[#7C9885] flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:u.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),l," ",l===1?"member":"members"," — full access for each"]})]})]}),i==="individual"&&!c&&u.jsx("div",{className:"max-w-xl mx-auto",children:u.jsx(u0,{onCodeValidated:C})}),c&&u.jsx("p",{className:"text-sm text-[#7C9885]",children:"Organization code applied! Redirecting..."}),y&&u.jsx("p",{role:"alert",className:"text-sm text-red-500",children:y}),u.jsx("button",{onClick:T,disabled:m||!!c,className:"w-full max-w-xl mx-auto block bg-[#7C9885] hover:bg-[#6B8572] text-white py-4 rounded-lg text-lg font-semibold disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?"Processing...":"Start Free Trial"}),u.jsx("p",{className:"text-xs text-[#1B4D1B]/50",children:"Cancel anytime. No commitment required."})]})})}),u.jsx(ui,{})]})}const N6e={hidden:{opacity:0,y:60},visible:{opacity:1,y:0,transition:{duration:.6,ease:"easeOut"}}};function C6e(){const[e]=rw(),[t,n]=D.useState("processing"),[a,r]=D.useState("");return D.useEffect(()=>{const s=e.get("token");if(!s){n("error"),r("Invalid unsubscribe link.");return}(async()=>{try{const l=await(await fetch("/.netlify/functions/process-unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s})})).json();l.success?n("success"):(n("error"),r(l.error||"Unable to process your request."))}catch{n("error"),r("Something went wrong. Please try again.")}})()},[e]),u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:"Unsubscribe – Solta AI",description:"Manage your email preferences",path:"/unsubscribe"}),u.jsx(Vs,{}),u.jsx("main",{className:"pt-24 pb-16",children:u.jsx("div",{className:"max-w-md mx-auto px-6",children:u.jsxs(qe.div,{variants:N6e,initial:"hidden",animate:"visible",className:"text-center space-y-6",children:[t==="processing"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent roun
5077ded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:"Processing your request..."})]}),t==="success"&&u.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-8",children:[u.jsx("h1",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"You've been unsubscribed"}),u.jsxs("p",{className:"text-gray-600",children:["You will no longer receive marketing emails from Solta AI. You can re-subscribe anytime from your"," ",u.jsx("a",{href:"/account",className:"text-[#7C9885] hover:text-[#6B8572] underline",children:"account settings"}),"."]})]}),t==="error"&&u.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-8",children:[u.jsx("h1",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"Something went wrong"}),u.jsx("p",{className:"text-gray-600",children:a}),u.jsxs("p",{className:"text-gray-500 text-sm mt-4",children:["Contact us at"," ",u.jsx("a",{href:"mailto:[email protected]",className:"text-[#7C9885] underline",children:"[email protected]"})," ","if you need help."]})]})]})})}),u.jsx(ui,{})]})}function E6e(){const{code:e}=uK(),t=Us(),[n,a]=D.useState("loading"),r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");return D.useEffect(()=>{if(!e){t("/");return}if(!DH()){t(`/signup?enterpriseCode=${encodeURIComponent(e)}`);return}(async()=>{const i=Wa();if(r){a("success"),setTimeout(()=>t("/bls"),1500);return}try{(await(await fetch("/.netlify/functions/apply-enterprise-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:i,code:e})})).json()).success?(a("success"),setTimeout(()=>t("/bls"),1500)):a("error")}catch{a("error")}})()},[e,t,r]),u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8]",children:[u.jsx(vs,{title:"Join Organization – Solta AI",noindex:!0}),u.jsx(Vs,{showJoinButton:!1}),u.jsx("main",{className:"pt-24 pb-16 flex items-center justify-center",children:u.jsxs("div",{className:"max-w-md mx-auto px-6 text-center space-y-6",children:[n==="loading"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-12 h-12 border-4 border-[#7C9885] border-t-transparent rounded-full animate-spin mx-auto"}),u.jsx("p",{className:"text-[#1B4D1B] text-lg",children:"Applying organization code..."})]}),n==="success"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-16 h-16 mx-auto bg-[#7C9885]/20 rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-8 h-8 text-[#7C9885]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),u.jsx("p",{className:"text-[#1B4D1B] text-lg font-medium",children:"You're all set!"}),u.jsx("p",{className:"text-gray-600",children:"Redirecting to your session..."})]}),n==="error"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-16 h-16 mx-auto bg-red-100 rounded-full flex items-center justify-center",children:u.jsx("svg",{className:"w-8 h-8 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),u.jsx("p",{className:"text-[#1B4D1B] text-lg font-medium",children:"Invalid or expired code"}),u.jsx("p",{className:"text-gray-600 mb-4",children:"This organization code is no longer active."}),u.jsx("button",{onClick:()=>t("/bls"),className:"px-6 py-3 bg-[#7C9885] hover:bg-[#6B8572] text-white rounded-lg transition-colors",children:"Continue to Solta AI"})]})]})})]})}const ff=["shipped","in-progress","planned","may-be"],I6e={shipped:{label:"Shipped",color:"#3D7A4A",bg:"#3D7A4A18"},"in-progress":{label:"In Progress",color:"#B8860B",bg:"#FEF3C7"},planned:{label:"Planned",color:"#6B7C74",bg:"#6B7C7415"},"may-be":{label:"May Be",color:"#D97706",bg:"#FEF3C7"}},T6e=[{number:1,title:"Smart BLS",subtitle:"Adaptive bilateral stimulation with real-time emotion intelligence",color:"#8DA399",sections:[{heading:"Product",icon:"◈",items:[{text:"Adaptive BLS with real-time facial expression recognition",status:"shipped"},{text:"Voice emotion detection",status:"shipped"},{text:"AI-driven BLS speed adjustment based on emotional state",status:"shipped"},{text:"Freemium model: 15 free sessions, then subscription with 7-day trial",status:"shipped"}
5077,{text:"Payments and authentication infrastructure",status:"shipped"},{text:"Enterprise plan MVP (clinics, group practices, EAPs)",status:"shipped"},{text:"Pre-session device setup and readiness check",status:"shipped"},{text:"Improved AI emotion models",status:"planned",children:[{text:"Broader emotion range via face and voice"},{text:"Evaluate third-party APIs for depression & anxiety detection"},{text:"Sarcasm detection"}]},{text:"Body language detection",status:"in-progress",children:[{text:"Twitches, stretching"}]},{text:"Choice-of-words emotion detection",status:"planned"},{text:"Session history & progress tracking",status:"planned"},{text:"Support finding an EMDR therapist",status:"planned"},{text:"Adapt product for clinician-led in-session BLS use",status:"may-be"}]},{heading:"Safety Guardrails",icon:"⊘",items:[{text:"Crisis resources integrated (988 Lifeline, Crisis Text Line)",status:"shipped"},{text:"Disclaimers: not a replacement for professional therapy",status:"shipped"},{text:"All emotion processing runs on-device — no data transmitted or stored",status:"shipped"},{text:"Messaging focused on grounding, anxiety, and mild stress — not therapy, trauma, or PTSD",status:"planned"},{text:"Contraindication warnings",status:"planned"}]},{heading:"Regulation",icon:"⬡",items:[{text:"FDA: operating in enforcement discretion zone (wellness tool)",status:"shipped"},{text:"Not currently a HIPAA-covered entity",status:"shipped"},{text:"Regulatory compliance tracker (FDA, HIPAA, FTC, biometric data laws)",status:"planned"},{text:"HIPAA compliance",status:"planned",children:[{text:"Enable sharing session history with clinicians"}]}]},{heading:"GTM",icon:"◎",items:[{text:"Ideal customers",status:"planned",children:[{text:"People who do self-EMDR and grounding with BLS"},{text:"Therapists offering in-between session BLS support"}]},{text:"Strategy",status:"planned",children:[{text:"Clinical advisory board & their network"},{text:"Advertising"}]}]},{heading:"Pricing & Revenue",icon:"◇",note:"* These numbers may change after further analysis",items:[{text:"Individuals: $11/month",status:"planned"},{text:"Organizations (clinics, group practices, corporate wellness, EAPs)",status:"planned",children:[{text:"Up to 20 seats: $79/month"},{text:"Up to 60 seats: $149/month"},{text:"50+ seats: custom pricing"}]}]}]},{number:2,title:"AI-Guided EMDR Sessions",subtitle:"LLM-powered guidance through individual EMDR phases",color:"#F4A492",sections:[{heading:"Product",icon:"◈",items:[{text:"Intake form",status:"planned"},{text:"Phased EMDR rollout by safety level",status:"planned",children:[{text:"Start with Phases 2 (Preparation) & 8 (Reevaluation)"},{text:"Then Phase 3 (Assessment) & Phases 5–7 (Installation → Closure)"},{text:"Finally Phase 4 (Desensitization) — highest risk, last to automate"},{text:"Therapist guides any phases not yet available on platform"}]},{text:"LLM integration",status:"planned",children:[{text:"Prompts to activate target memories"},{text:"Between-set guidance: breathing exercises, reflection"},{text:"Next set adjusted based on user input"}]}]},{heading:"AI Model Improvements",icon:"◈",items:[{text:"Detect dissociation, overwhelm, and crisis indicators",status:"planned"},{text:"Detect yawns, burps",status:"planned"}]},{heading:"Safety Guardrails",icon:"⊘",items:[{text:"Auto-pause session if warning signs are detected",status:"planned"},{text:"Therapist involvement",status:"planned",children:[{text:"Therapist assigned to each user"},{text:"On-call therapist to intervene in crisis situations",status:"may-be"},{text:"Therapist consultation required before starting EMDR sessions",status:"may-be"}]}]},{heading:"Regulation",icon:"⬡",items:[{text:"Geo-restrict access in Illinois and other states where AI-therapy is prohibited or heavily regulated",status:"planned"},{text:"Initiate research & clinical validation through academic partnerships",status:"planned"}]},{heading:"GTM",icon:"◎",items:[{text:"Ideal customers",status:"planned",children:[{text:"Existing Phase 1 users"},{text:"Clinics, group practices & EAPs that prefer to allocate their time to talk therapy"},{text:"Clinics & group practices whose clients are hesitant to transition from talk therapy"},{text:"Clients seeking a more affordable path to complete EMDR treatment"},{text:"Enterprise: insurance companies covering EMDR"}]}]},{heading:"Pricing & Revenue",icon:"◇",items:[{text:"TBD",status:"planned"}]}]}
5077,{number:3,title:"Full EMDR Protocol",subtitle:"Complete, clinically validated, autonomous EMDR experience",color:"#2F3E38",sections:[{heading:"Product",icon:"◈",items:[{text:"All 8 EMDR phases automated and clinically validated",status:"planned"},{text:"Solta determines next phase based on previous session history",status:"planned"},{text:"Extensive educational material",status:"planned"}]},{heading:"Safety Guardrails",icon:"⊘",items:[{text:"TBD",status:"planned"}]},{heading:"Regulation",icon:"⬡",items:[{text:"TBD",status:"planned"}]},{heading:"GTM",icon:"◎",items:[{text:"Ideal customers",status:"planned",children:[{text:"Existing Phase 1 & 2 users"},{text:"People living with long-lasting effects of trauma"},{text:"Clinicians not trained in EMDR who want to offer it"},{text:"Enterprise: employer benefits programs"},{text:"Enterprise: hospitals aiming to reduce readmission"}]},{text:"Strategy",status:"planned",children:[{text:"Educational campaigns on EMDR effectiveness"}]}]},{heading:"Pricing & Revenue",icon:"◇",items:[{text:"TBD",status:"planned"}]}]}],UB="soltaai-roadmap";function WB({status:e,onClick:t}){const n=I6e[e];return n?u.jsx("span",{onClick:t,style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:n.color,background:n.bg,padding:"2px 8px",borderRadius:3,flexShrink:0,whiteSpace:"nowrap",cursor:t?"pointer":"default",transition:"all 0.15s ease",border:t?"1px solid "+n.color+"30":"1px solid transparent"},title:t?"Click to change status":void 0,children:n.label}):null}function A6e(){return u.jsx("span",{style:{cursor:"grab",opacity:.25,fontSize:14,lineHeight:1,flexShrink:0,userSelect:"none",padding:"0 2px"},title:"Drag to reorder",children:"⠿"})}function VB({text:e,onSave:t,style:n}){return u.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,onBlur:a=>t(a.currentTarget.textContent),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),a.currentTarget.blur())},style:{...n,outline:"none",borderRadius:3,padding:"0 2px",margin:"0 -2px",cursor:"text"},onFocus:a=>{a.currentTarget.style.background="#F0EDE8"},onBlurCapture:a=>{a.currentTarget.style.background="transparent"},children:e})}function _6e(){const[e,t]=D.useState(T6e),[n,a]=D.useState(0),[r,s]=D.useState({}),[i,o]=D.useState("idle"),[l,d]=D.useState(!1),c=D.useRef(null),f=D.useRef(null),m=e[n];D.useEffect(()=>{try{const O=localStorage.getItem(UB);if(O){const z=JSON.parse(O);z.phases&&t(z.phases),z.collapsed&&s(z.collapsed),typeof z.activePhase=="number"&&a(z.activePhase)}}catch{}d(!0)},[]);const x=()=>{o("saving");try{const O=JSON.stringify({phases:e,collapsed:r,activePhase:n});localStorage.setItem(UB,O),o("saved"),setTimeout(()=>o("idle"),2e3)}catch{o("error"),setTimeout(()=>o("idle"),3e3)}},y=O=>{const z=n+"-"+O;s(P=>({...P,[z]:!P[z]}))},b=O=>{const z=n+"-"+O;return r[z]!==!0},w=O=>t(z=>{const P=JSON.parse(JSON.stringify(z));return O(P[n]),P}),S=(O,z)=>w(P=>{const j=P.sections[O].items[z];j.status=ff[(ff.indexOf(j.status)+1)%ff.length]}),k=(O,z,P)=>w(j=>{const G=j.sections[O].items[z].children[P];G.status?G.status=ff[(ff.indexOf(G.status)+1)%ff.length]:G.status="planned"}),C=(O,z,P)=>w(j=>{j.sections[O].items[z].text=P}),E=(O,z,P,j)=>w(G=>{G.sections[O].items[z].children[P].text=j}),T=(O,z)=>w(P=>{P.sections[O].heading=z}),_=(O,z)=>{c.current={sIdx:O,iIdx:z}},A=(O,z,P)=>{O.preventDefault(),f.current={sIdx:z,iIdx:P}},$=O=>{if(O.preventDefault(),!c.current||!f.current)return;const{sIdx:z,iIdx:P}=c.current,{sIdx:j,iIdx:G}=f.current;z===j&&w(X=>{const J=X.sections[z].items,[V]=J.splice(P,1);J.splice(G,0,V)}),c.current=null,f.current=null};return u.jsxs("div",{style:{minHeight:"100vh",background:"#FAFAF7",fontFamily:"'DM Sans', 'Helvetica Neue', sans-serif",color:"#2F3E38",padding:"40px 24px",boxSizing:"border-box"},children:[u.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700&family=DM+Serif+Display&display=swap",rel:"stylesheet"}),u.jsxs("div",{style:{maxWidth:800,margin:"0 auto 48px"},children:[u.jsxs("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:14,letterSpacing:"0.15em",textTransform:"uppercase",marginBottom:8,display:"flex",alignItems:"center",gap:6},children:[u.jsx("span",{style:{color:"#8DA399"},children:"Solta"}),u.jsx("span",{style:{color:"#F4A492"},children:"AI"})]}),u.jsx("h1",{style:{fontFamily:"'DM Serif Display', serif",fontSize:"clamp(28px, 5vw, 42px)",fontWeight:400,lineHeight:1.15,margin:"0 0 12px",color:"#2F3E38"},children:"Company Roadmap"}),u.jsx("p",{style:{fontSize:15,color:"#6B7C74",margin:"0 0 12px",lineHeight:1.6,maxWidth:540},children:"From adaptive BLS to full AI-guided EMDR — product, safety, regulation, go-to-market, and pricing across every phase."}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[u.jsx("p",{style:{fontSize:12,color:"#8A9690",margin:0},children:"Click badge to cycle status · Drag ⠿ to reorder · Click text to edit"}),u.jsx("button",{onClick:x,disabled:i==="saving",style:{fontSize:12,fontWeight:600,fontFamily:"'DM Sans', sans-serif",color:i==="saved"?"#3D7A4A":i==="error"?"#C53030":"#2F3E38",background:i==="saved"?"#3D7A4A12":i==="error"?"#C5303012":"#FFFFFF",border:"1px solid "+(i==="saved"?"#3D7A4A30":i==="error"?"#C5303030":"#E0E0D8"),borderRadius:8,padding:"8px 20px",cursor:i==="saving"?"wait":"pointer",transition:"all 0.2s ease",whiteSpace:"nowrap",flexShrink:0},children:i==="saving"?"Saving…":i==="saved"?"✓ Saved":i==="error"?"Error — retry":"Save"})]})]}),l?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{maxWidth:800,margin:"0 auto 40px"},children:u.jsx("div",{style:{display:"flex",borderRadius:12,overflow:"hidden",border:"1px solid #E0E0D8"},children:e.map((O,z)=>
5077{const P=z===n;return u.jsxs("button",{onClick:()=>a(z),style:{flex:1,padding:"18px 12px",border:"none",cursor:"pointer",background:P?O.color:"#FFFFFF",color:P?O.color==="#2F3E38"?"#FAFAF7":"#2F3E38":"#8A9690",fontFamily:"'DM Sans', sans-serif",fontSize:13,fontWeight:P?700:500,transition:"all 0.35s cubic-bezier(0.4, 0, 0.2, 1)",borderRight:z<2?"1px solid #E0E0D8":"none",display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[u.jsxs("span",{style:{fontSize:11,letterSpacing:"0.1em",textTransform:"uppercase",opacity:.7},children:["Phase ",O.number]}),u.jsx("span",{children:O.title})]},z)})})}),u.jsxs("div",{style:{maxWidth:800,margin:"0 auto",animation:"fadeSlide 0.4s ease"},children:[u.jsxs("div",{style:{marginBottom:36,paddingBottom:24,borderBottom:"2px solid "+m.color+"20"},children:[u.jsxs("div",{style:{display:"inline-block",padding:"4px 14px",borderRadius:100,background:m.color+"18",color:m.color==="#2F3E38"?"#2F3E38":m.color,fontSize:12,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",marginBottom:14},children:["Phase ",m.number]}),u.jsx("h2",{style:{fontFamily:"'DM Serif Display', serif",fontSize:"clamp(24px, 4vw, 32px)",fontWeight:400,margin:"0 0 8px",color:"#2F3E38"},children:m.title}),u.jsx("p",{style:{fontSize:15,color:"#6B7C74",margin:0,lineHeight:1.5},children:m.subtitle})]}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:20},children:m.sections.map((O,z)=>
5077{const P=O.items.length===1&&O.items[0].text==="TBD",j=b(z);return u.jsxs("div",{style:{background:"#FFFFFF",borderRadius:12,padding:j?"28px 28px 24px":"20px 28px",border:"1px solid #E8E8E2",position:"relative",overflow:"hidden",transition:"padding 0.2s ease"},children:[u.jsx("div",{style:{position:"absolute",top:0,left:0,width:4,height:"100%",background:m.color,borderRadius:"12px 0 0 12px"}}),u.jsxs("div",{onClick:()=>y(z),style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsx("span",{style:{fontSize:15,opacity:.5},children:O.icon}),u.jsx("h3",{contentEditable:!0,suppressContentEditableWarning:!0,onClick:G=>G.stopPropagation(),onBlur:G=>T(z,G.currentTarget.textContent),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur())},style:{fontSize:16,fontWeight:700,margin:0,color:"#2F3E38",letterSpacing:"-0.01em",outline:"none",borderRadius:3,padding:"0 2px",cursor:"text"},onFocus:G=>{G.currentTarget.style.background="#F0EDE8"},onBlurCapture:G=>{G.currentTarget.style.background="transparent"},children:O.heading}),!j&&!P&&u.jsxs("span",{style:{fontSize:11,color:"#8A9690",marginLeft:4},children:[O.items.length," item",O.items.length!==1?"s":""]})]}),u.jsx("span",{style:{fontSize:14,color:"#8A9690",transform:j?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease",lineHeight:1},children:"▾"})]}),j&&u.jsxs("div",{style:{marginTop:14},children:[O.note&&u.jsx("p",{style:{fontSize:12,color:"#8A9690",margin:"0 0 12px",fontStyle:"italic"},children:O.note}),P?u.jsx("div",{style:{padding:"8px 0",textAlign:"center"},children:u.jsx("span",{style:{fontSize:13,color:"#8A9690",opacity:.5,fontStyle:"italic"},children:"To be determined"})}):u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:O.items.map((G,X)=>u.jsxs("div",{draggable:!0,onDragStart:()=>_(z,X),onDragOver:J=>A(J,z,X),onDrop:$,style:{borderRadius:6,transition:"background 0.15s ease"},onMouseEnter:J=>{J.currentTarget.style.background="#F7F7F4"},onMouseLeave:J=>{J.currentTarget.style.background="transparent"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,padding:"4px 6px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,flex:1},children:[u.jsx(A6e,{}),u.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:G.status==="shipped"?"#8DA399":m.color,marginTop:7,flexShrink:0,opacity:G.status==="shipped"?1:.4}}),u.jsx(VB,{text:G.text,onSave:J=>C(z,X,J),style:{fontSize:14,color:G.status==="shipped"?"#2F3E38":"#4A5B53",lineHeight:1.55,fontWeight:G.children?600:400}})]}),u.jsx(WB,{status:G.status,onClick:J=>{J.stopPropagation(),S(z,X)}})]}),G.children&&u.jsx("div",{style:{paddingLeft:46,marginTop:4,display:"flex",flexDirection:"column",gap:6},children:G.children.map((J,V)=>u.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[u.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,flex:1},children:[u.jsx("div",{style:{width:4,height:4,borderRadius:"50%",background:m.color,marginTop:8,flexShrink:0,opacity:.25}}),u.jsx(VB,{text:J.text,onSave:Q=>E(z,X,V,Q),style:{fontSize:13,color:"#6B7C74",lineHeight:1.55}})]}),J.status?u.jsx(WB,{status:J.status,onClick:Q=>{Q.stopPropagation(),k(z,X,V)}}):u.jsx("span",{onClick:Q=>{Q.stopPropagation(),k(z,X,V)},style:{fontSize:9,color:"#C0C0B8",cursor:"pointer",padding:"2px 6px",borderRadius:3,border:"1px dashed #D0D0C8",flexShrink:0,whiteSpace:"nowrap"},title:"Click to add status",children:"+ STATUS"})]},V))})]},X))})]})]},z)})}),u.jsx("div",{style:{marginTop:48,display:"flex",alignItems:"center",gap:8,justifyContent:"center"},children:e.map((O,z)=>u.jsx("div",{style:{height:3,borderRadius:2,background:z<=n?O.color:"#E0E0D8",flex:1,maxWidth:80,transition:"background 0.4s ease"}},z))}),u.jsx("div",{style:{marginTop:40,textAlign:"center"},children:u.jsx("p",{style:{fontSize:11,color:"#8A9690",opacity:.5,margin:0},children:"SoltaAI Roadmap · Last updated March 2026 · Confidential"})})]},n)]}):u.jsx("div",{style:{maxWidth:800,margin:"0 auto",textAlign:"center",padding:"80px 0"},children:u.jsx("p",{style:{fontSize:14,color:"#8A9690"},children:"Loading\\u2026"})}),u.jsx("style",{children:`
5078        @keyframes fadeSlide {
5079          from { opacity: 0; transform: translateY(12px); }
5080          to { opacity: 1; transform: translateY(0); }
5081        }
5082      `})]})}const j6e="/assets/va_no_words-Do7V3U4H.png",D6e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAUVBMVEVHcEyVVEGVVEGVVEGVVEGVVEGVVEGVVEGVVEGVVEGVVEGVVEH9/Pj///6TTzuQSTOodmiMQSiyh3vWwbrezMbNs6v
5082EpJvn2tX28e26lYueY1LRvfzxAAAAC3RSTlMAeqAvXw2O8cbgSrDbBZkAAAI1SURBVFiFrVfRYoMgDKw6RY2AWBX1/z90qGCR0BbG7slS7rxESODxeIOyzfK6IQCkqfOsLd/N86OoFPMOUhXB9AyxtUYWRK/87BPVV/rPJ/qOn4/0svnGB2g+5PPr67+YyMP4ALmfX4fyAepEvlchiu9RCI7fwMlDYP5ttDa/jOcD2OshYP1gNEkB7HgtKPwf4+x6ZFyB4TkAhn/ff2q+gGFe+fGLi36entPcC44FKmyAiW2Y5EIVZr6/feroiW7yuDj5mcVfz8kKdOQghu54PkCXDSmcFYbYAsuiKVQKMdFL7xjaXAGy84tbAoTYzHSm+OO8zs/upekqFCiFKm2zmU8lqPQzrpzokcENorpHcKI300fzQqE197ygGNAqZkZgeRkWUseFYigfrTtkHBzf0YgOegxNbu2PeHdA7XiFjqp3k5B5CoEWWGy7XFJ/FnNciYwDaSeMP98I1J6drAXGIIEGf0XtgIYJEM9WjhIALBDnAHAIcQ4ITmKcg8bTUKIEaryQ4hzkeCnHOcjwZopz0HqaUpRAiQtKlAPiKWkQs5kqt6iCVRNv2/ksi3QS7CZROGVdtSXRmyo+Cv4ycZWpwa4pBDWWfjR9QU3u5HQpCKkV6GoJZG5rYzO9wapKTJ5Dkx0Zbq5bf4f1NtGrJruCndrr4GtZcGAnjKEu/38HjOQjTvoh6y9BOEfu1INm+lE3/bCdftxPv3CkX3nSL10hJj5f+3YkXjx3JF59dyRevg+EXv9/AUOpk2sDTQ8FAAAAAElFTkSuQmCC",R6e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAY1BMVEX///85ekosdEA0d0YwdkP2+ffE1sn8/fzw9fI9fk7I2czZ5dwpcz3f6eJVjWTA08Xp8OuxybeCqYyivqmMr5Rum3lPiV5klXBHhFfO3dJ3o4O4zb2qxLCauaKTtJxdkGoMaCth0EZPAAACDUlEQVRYhe1V25ajIBCEplUUFMQbIMb5/69cvCUzueyc5G33WC95aKroqm4MISdOnDjxHyMrx6m9BME/oyd1lwPA3Mm+LT7QSGdASileSKASqkZfKzptWmPaptDZazpvJaMrckFcBQi0LdeKMLkEjABJh6Z8wS8roDsYtISoHijKOvpql74YO2rQFc/4Lkd6FcCvSyR6KVEQEYUogh8OiShbuSf8rQyRlNthWu2LUa8FlJ3gHfX9cQeT902Ind8H5Uqd3JJylmFuXBxP0Np3h4BN7vKzG591QoUQbg3yHjEmmV0UL+ta611Ahp/8pIND2U9K6NsGeGnH+JPF/So4H+f9Hns3THHMD4pMCzWmez1rpd274YlouovLt2PjfYQj7tKzjw0k3K09lJ3Ew00Wgkh4WI+hf5hBzGozgb4IvjJptOVM3JtvYet6QNgM6EcBws1mg0kYMz6aikoEK651NcjdJ2NP9yg+hGo/McwMoiUG5hpmUsGxRRTr5/zlKVZyyWLZOIYwpEtjaVAx0WRAPJY0vOIvx5Xp464DoPUqrkpW9wjMqzIjot2uzx8GcK8hxhBqt8YUpxjfYGzGzjUnE0ZXg/iF/wNB5nVq7PqM7RRTrkLyO+sGna9T4K7xc9/33eTeohNSy9ubyP7yIXoJYz4gfYd//Gq8h/bZxr4D9eF/wxXJJ8GdOHHixL+LP3YcGmSjwjJtAAAAAElFTkSuQmCC",M6e="/assets/ash-Ca8x5bA-.png",$6e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAGFBMVEXZdlbaaUTab03+9/X67Ojz1s/quKvhlX9bn3iyAAALz0lEQVR4nO1ai5LkJgxEsjH//8cxerYwnp1UpXKpyrJ3s2Mbo1arJTDe1n7bV238aQD8pwH8sfZPUP8bvv9j+436b/vn21ZV/6bU/guqIm5E9AcBXP3s/Xrjgl85+pm8r+il65TWt92Zr/EO4Svj/DhdzvA4rfWNHRo9oD1uzUN+vfJKQp4/ow1e71V0R/9eIG84XlF5AGa7aO1MXS4cF+N5zi94nuOY6zicDOLoetpMaPM+wWyE5+nb00CJCF4Ja+xIoSEDQgHDMHQdL/LAMRkdqkKRI4BTrSvJ4mT3RKj9qN8ADg3BDsLHU5V2rrgQC8TgGIy3MNu1w9TB6enDJu/4XU1CJLKhCDq7mvRfAKMkWqihKJ288RKdx5CumSzXaACAc1CR0jQ+YzBSQXLPdbfBm9HdcgiiJAGX795QhjPj3QmOJDjOAp1v0o4zUK0e+c0AIW3WPPFvSEHcLOQcSsBJBXe33KAkFalgtIUBXdMgTEEQptwijhNA8hLW3L71LdHBkgAcMF4u+aq3lmKUtmYZkB9JAr2Vye1HELgt9jHunGb3glXKHhRoCKwORRLMD7V/RHZydbhYfTpsn0TsgVKgYkmLjsZbb5ynj0PLg56N2qgMIMFpwwZfQw8Yxt04Y8egw8PcYqlDh6IKd8S+6vKAFQTb6Ix21kCn+DXv+qAUaZBtKjDYXTXQ0X4ycMDU4STU9HLdNMAHlUeiraBvaZ3m7aEqkPAoAJsJ2O88XAJStTDnoxyDAlEILZNOdN8T9Rw72HVcTQSgupyDDLOtEUigyDIIoa0A/PcZWdeHkyjZZT9JrRxZErAUIA/AcWpgQGDx7VEbqh5l9gkIg1RuSoxjMGaG2j8tAC5Jg5EKCx9lKOa06F2gDnCd/u74gg4Pc1k5vwvhPDh0ivTrCH1JsyxDNfxLLrJOPj7V9/u5RGTYwr7mHYvJu8mSlEbwIzB0hQAhhlLEaa85wcqN/UYKxBdurVIgxf8+cXhWODwvApkpai5JcEhajTjx6XXJ5jsIuAy6vdExLOtmk8e1rkeTbP0eqdopfK+F1x1t6b2LIiJ0/5SVqIZhJsIQ26GC26gcJxmo0vDPqEWP47CBaYjHtFXCcGgYpkVjYE50pN9PEvsnQBjUYrSIdUYgzXKAhJQ0Rnpa1xnAZG8QbgoMQL9Xf0lNVqCwz8yAJT13RkB9URCnxgcQMMN6u+VR18jT4VBON689KSWW8nIPmZPpvBJ4s9ct7O7FVz27EYwj2k2Jf+l+ThH45BxuqtvuoUMLJElAY7wiWjycAK04IjYzxs0S4grb8n8QxjXyD7Qe8YGzATQJkTD0RKBhiBAcwyLfE5NXhXTSHaqV2MPfgJIWXIRk7t/EV2pbxJ8UXBCPFGePYUoJACORoB6aFiRATsaMPUnI+lMMXo8zsyhQcYPR0WSkOB3ShFIFF4yEDYQNqClNtDLv1wYJnuUP0/CRNBGUWZpfDS6IejqjprmNcfXeR7AN6B5zNEQmRclzj+7aBuHZhi2n9dl0XFf3UtYHRD5VUTMiKAGk+s1J+KF1cuPTbcmcaBc1dBOysX4p+kkcRA/JbULA6ne3SaJMJ/FAk8NCrsLkzdV0tLni+ImAdl3udzV/ymNaBdBQhAgIljFZHGZV+oYE8VySJp9PdEanUpywFKCTcxfcE0eFxPFo9xUJsCpI9u9qeekzQrCbesB46xPR3S7Z4ZhwEo0g5J9JsHVBzmG38bs6RX0o8zO6L09kvgjQNcAJgBzO+NF8Vu65xT2aloOnx2vBnMmOTwQOJMcWMN9RoKxPwGyV4RnwoD5CYhQ8IHxVglbbq9trhV/OKQdtWY/7Q+a5n422zRyPNcHDKJx75DrNPJaWa7G/0czz1bMl2R8hwIumd8m8Ie3S1gPXu321XrKYQoCwFlopKMGhzBYpA8/BPmaByvTqBntI6ngOPxkpMQCiFgY9lA1m5q+jorlzET3GfQnMPlgRoeujKM78XeaCQzYadq59QkJ5VpOZPldikwdsktS5iEqsd1SDPTj0AJAsDj+0nhPxFkIrQvhIt62Hsd16/Mz+IY9oshowDGvr67K0AgCC/FtCmObR0ksmzK0Mkfxkok6Ip73VqV6mLAiMUsElZzz4+jnoLRb3k5PXAQsHAqDqGUFd
5082oHIljRtP8mTgVfHiV/vKgY9zo5CFoZkfj9HBemJocZUUwhzlsB3h+XE/E5v9vuKQCbiR8WZcsKyMxXwLww6lORlRH60XRR/R3umri+l+rMv4XM3bIzR4SRJAajCiOqsFOoJNWRQIOtrzQExLdzXhWJDYoym6HwicAffJzddqq1fsQqsCMB59evY9EmLdi5BNEGXi8uAc3R/gho0av6K1OLZnBOiggCnjInUXqmnXhx7bKOsWitP3Cm9Iw9iy58PQOqJBvQcDBLy3YKysTuZO3QRtVqfWVIsncezOtZGbhPyEEFayzDVUZGGLWtkmm+klMIfRPVnuwYTtjHTy3WpBYI63JIBiVrEYiK9tZUgJ0e36mEgscKdvgjCx79L6Nvo0G+81OhWui4dmaZIcNSB7S6CVfsdg7jPHdrhoPKCMeAxqlK/TKfz12uosuOLJ9daUBtCuLtANwiC/0u1pQUr+sB1BwCV8+OZeh8IrU7t7j88o6q7lJHGCkPW5mL8a+YRw2TQ78kgBNJ99lZDUTVS2LICUlTINZ1AIGejyxiSEEwNLP9s616qTr+qkVMUfGxhykGCNeKZ8zQLyfdqruWrvJHT7Kh+Lx1A08bK0ixn7w5Jcg8DvrIvivFtQ90My8wHhXtO6+2LDAGgA9EWi1AOpGbECugDBmWU5BOhMwLaVzN5Zr9zjWEwriivtS6D0JdqpDuAb/uaXA0HSLF3Jy4CvHYClsEmpGAUW2tYB7UWmJKRqKV+0KZfDHjKHF1tHgoUvBW78E1RoiqkqBaAlQYBq1HvcmVvrUqXus/bmCdZBbkGef5ooKUSa/pPqgQhYibo0yNOlh7v68wjCXMfNXG4RcUhzS7bmN0edbqGXFsiIY+fiMirvD1XERQ4YXnB0MlFP3jrUX1+f+CBgjgyEaS+SQq/6a7wru49Kt/y54XkCTjVyaRn3/9aVY9/Co05esbxoeLhcgFIWu6PjAsAd8HLU9RnEI9kixui7pWE+9AodOX7+m2uQeJNt8aJIuwGrPtWFUdAstll4OQKa5dE14H2ReE+LOWxPNZkLHEmWWMmWMF2rUYuI+z0ehYwyPv1nL9aQGv6bbLMf5DHFamlg5WD4wwMbxYyCO5wcWHhUigDDC4cxcYkAerJlEhBYiqp5f59FIw+khlCMH3YsNA3YAJ70NvdXlwYoF88LgQXEWS720GZUHo8dZ6JrCLz4i9ZaSKDQJn9SO8irhVqywtCTKi+IE0FPz/w+ED/lWI3xGsQBe9PcQDaetZg0q4NdExMqluT5CPMRR/ZhGcwYA2hpyQf8KBqhZuulK2MdEYUYu+Igus64fvEakbAgAz29WlwAotV/eQlS1RNjOa0tBgJXHK3PGmow8wyilhnC8B0YQEoZbESBQAI9Z/y2tlyOtCGK8CwD22/NzXMUxSbk+J5BRS34ooTtj9aL/oyAXKUuXumAQ8tj0YqTF9OIE/gIsrllpbiS9vB1leO8S16sn/1qUJtL7xRXiUXpaP0yiFEA5QAUDYgArWUbZx+uh0/XlhbRXk5myBYDIEI4X6Ln0n9arGFwrGVju3R5xc+PM1HqK7pV3stdcS9lBEjXYSXzCpiYpmLhiMQsRY1wXL+pTL9eDCCsleXnYOv1RQFFw/K9vjtgXm8uK6L1enpVHGxwIVsjIGXBXQtKGRsmrW0rUd25vu247fFSFB/y+YgCjrd38PbqDqt/tBVxHG3KQBy/wuVP13aMbOoAPXT2bvadis35NbGiYu5wPSomIODshrdsjZaz2z6QBdvs2+F4M7RQ9PB4C6zBwRtn1QjMkftuH/X86IFSqzlrSbMQvitMtPf81W6R2FaES/di6LO/e+18QrUD8DOHn274KilK8f9ww7O0/zz2zxfLmb8AQKJoi2jlj9sAAAAASUVORK5CYII=",B6e="/assets/1_minute-C47Wq4W4.mov",F6e="/assets/product_picture-BuAJ0nwW.png",HB="https://drive.google.com/file/d/1UL7fK4vEvbpqPwHTR-olLcFQV8oblRor/view?usp=sharing",zH=D.createContext(null),GN=new Map;function Al(e){if(GN.has(e))return GN.get(e);const t=new Promise((n,a)=>{const r=document.createElement("script");r.src=e,r.onload=()=>n(),r.onerror=()=>a(new Error(`Failed to load ${e}`)),document.head.appendChild(r)});return GN.set(e,t),t}function Me({as:e="span",className:t,style:n,children:a}){const s=e==="span"?{display:"inline-block",...n}:n;return u.jsx(e,{"data-edit":"",style:s,className:t,children:a})}const O6e=(()=>{if(typeof document>"u")return"";const e=512,t=288,n=document.createElement("canvas");n.width=e,n.height=t;const a=n.getContext("2d");a.fillStyle="#FDF5EB",a.fillRect(0,0,e,t);const r=a.createRadialGradient(e*.08,t*.12,0,e*.08,t*.12,e*.55);r.addColorStop(0,"rgba(124,152,133,0.22)"),r.addColorStop(1,"rgba(124,152,133,0)"),a.fillStyle=r,a.fillRect(0,0,e,t);const s=a.createRadialGradient(e*.92,t*.88,0,e*.92,t*.88,e*.6);return s.addColorStop(0,"rgba(244,162,140,0.25)"),s.addColorStop(1,"rgba(244,162,140,0)"),a.fillStyle=s,a.fillRect(0,0,e,t),n.toDataURL("image/png")})();function so({children:e}){return u.jsx("div",{className:"w-full h-full relative overflow-hidden",style:{backgroundImage:`url(${O6e})`,backgroundSize:"cover",backgroundPosition:"center"},children:u.jsx("div",{className:"relative z-10 w-full h-full",children:e})})}function L6e({badge:e="Investor Presentation – May 2026"}={}){return u.jsx(so,{children:u.jsxs("div",{"data-animated":"",className:"w-full h-full flex flex-col items-center justify-center relative",children:[u.jsx(qe.div,{className:"absolute w-20 h-20 bg-[#7C9885] rounded-full shadow-lg",style:{top:"calc(50% - 60px)",opacity:.8},animate:{left:["6%","86%","6%"]},transition:{duration:6,repeat:1/0,ease:"easeInOut"}}),u.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center px-12 -mt-8",children:[u.jsxs("h1",{className:"font-serif leading-none",style:{fontSize:"clamp(72px, 11vw, 140px)"},children:[u.jsx(Me,{className:"text-[#1B4D1B]",children:"Solta"}),u.jsx(Me,{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx(Me,{as:"p",className:"font-serif text-[#1B4D1B] -mt-2 whitespace-nowrap",style:{fontSize:"clamp(24px, 3vw, 40px)"},children:"Join us in revolutionizing mental health care"}),u.jsx("div",{className:"mt-6 inline-block px-6 py-2 rounded-md bg-[#7C9885]/70",children:u.jsx(Me,{className:"text-white text-base md:text-lg font-medium tracking-wide whitespace-nowrap",children:e})})]}),u.jsx("div",{className:"absolute bottom-10 left-0 right-0 flex justify-center z-10",children:u.jsx(Me,{className:"text-[#7C9885] font-semibold text-lg tracking-wide whitespace-nowrap",children:"SoltaAI.com"})})]})})}function P6e(){return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-10 py-8",children:[u.jsxs("div",{className:"mb-4",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"The Solution"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"AI-powered EMDR at a fraction of the cost"})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-[1fr_2.2fr_1fr] gap-6 items-start",children:[u.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[u.jsx("div",{className:"w-12 h-12 bg-[#7C9885] rounded-full flex items-center justify-center shadow-md",children:u.jsx("span",{className:"text-white font-bold text-lg",children:"1"})}),u.jsx(Me,{as:"h3",className:"font-semibold text-lg text-[#2F3E38] block whitespace-nowrap",children:"Bilateral stimulation"}),u.jsx(Me,{as:"p",className:"text-sm italic text-[#2F3E38]/60 block",children:"User follows dot with their eyes"}),u.jsx("div",{"data-animated":"",className:"relative w-full h-44 bg-white/70 rounded-2xl overflow-hidden border border-[#7C9885]/20 shadow-inner",children:u.jsx(qe.div,{className:"absolute top-1/2 -translate-y-1/2 w-7 h-7 rounded-full bg-[#7C9885] shadow-lg",animate:{left:["8%","84%","8%"]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}})})]}),u.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[u.jsx("div",{className:"w-12 h-12 bg-[#F4A28C] rounded-full flex items-center justify-center shadow-md",children:u.jsx("span",{className:"text-white font-bold text-lg",children:"2"})}),u.jsx(Me,{as:"h3",className:"font-semibold text-lg text-[#2F3E38] block whitespace-nowrap",children:"Multi-modal emotion detection"}),u.jsx("div",{"data-animated":"",className:"w-full bg-white/70 rounded-2xl border border-[#F4A28C]/25 shadow-inner p-3",children:u.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[u.jsx(J1,{label:"Facial expression",sublabel:"Computer vision",accent:"#7C9885",children:u.jsx(Rze,{})}),u.jsx(J1,{label:"Speech emotion",sublabel:"Voice analysis",accent:"#F4A28C",children:u.jsx(Mze,{})}),u.jsx(J1,{label:"Body language",sublabel:"Pose detection",accent:"#7C9885",children:u.jsx($ze,{})}),u.jsx(J1,{label:"Choice of words",sublabel:"On-device NLP",accent:"#F4A28C",children:u.jsx(Bze,{})})]})})]}),u.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[u.jsx("div",{className:"w-12 h-12 bg-[#7C9885] rounded-full flex items-center justify-center shadow-md",children:u.jsx("span",{className:"text-white font-bold text-lg",children:"3"})}),u.jsx(Me,{as:"h3",className:"font-semibold text-lg text-[#2F3E38] block whitespace-nowrap",children:"Real-time adaptive loop"}),u.jsx(Me,{as:"p",className:"text-sm italic text-[#2F3E38]/60 block",children:"Speed and experience adjust"}),u.jsx("div",{"data-animated":"",className:"relative w-full h-44 bg-white/70 rounded-2xl overflow-hidden border border-[#7C9885]/20 shadow-inner flex items-center justify-center",children:u.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 240 110",preserveAspectRatio:"xMidYMid meet",className:"text-[#2F3E38]",children:[u.jsx("rect",{x:"8",y:"36",width:"60",height:"32",rx:"8",fill:"#7C9885"}),u.jsx("text",{x:"38",y:"56",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:"Signals"}),u.jsx("rect",{x:"90",y:"36",width:"60",height:"32",rx:"8",fill:"#F4A28C"}),u.jsx("text",{x:"120",y:"56",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:"AI"}),u.jsx("rect",{x:"172",y:"36",width:"60",height:"32",rx:"8",fill:"#7C9885"}),u.jsx("text",{x:"202",y:"56",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:"Stim"}),u.jsx("line",{x1:"70",y1:"52",x2:"88",y2:"52",stroke:"#2F3E38",strokeWidth:"1.5",markerEnd:"url(#arrowEnd)"}),u.jsx("line",{x1:"152",y1:"52",x2:"170",y2:"52",stroke:"#2F3E38",strokeWidth:"1.5",markerEnd:"url(#arrowEnd)"}),u.jsx("path",{d:"M202,70 C202,98 38,98 38,70",fill:"none",stroke:"#2F3E38",strokeWidth:"1.5",strokeDasharray:"4 3",markerEnd:"url(#arrowEnd)"}),u.jsx("text",{x:"120",y:"100",textAnchor:"middle",fill:"#2F3E38",fontSize:"9",opacity:"0.5",children:"repeat"}),u.jsx(qe.circle,{r:"5",fill:"#3B82F6",animate:{cx:[38,79,120,161,202,202,120,38,38],cy:[52,52,52,52,52,70,92,70,52]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut"}}),u.jsx("defs",{children:u.jsx("marker",{id:"arrowEnd",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:u.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#2F3E38"})})})]})})]})]}),u.jsx("div",{className:"mt-3 bg-white/70 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm grid grid-cols-[1fr_1.4fr_1fr] divide-x divide-[#2F3E38]/10 overflow-hidden",children:[{title:"On-device architecture",phase:"today",desc:"Zero marginal cost per session. No API platform risk."},{title:"Proprietary models",phase:"in development",desc:"Body language model trained from scratch. Facial expression and speech emotion models fine-tuned on our session data."},{title:"Clinical + IP",phase:"Phase 2",desc:"Provisional patent on adaptive algorithm. Clinical validation through IRB-approved study."}].map((e,t)=>u.jsxs("div",{className:"px-3.5 py-2",children:[u.jsxs("div",{className:"flex items-baseline gap-1.5 mb-0.5",children:[u.jsx(Me,{as:"h4",className:"font-serif text-[13px] text-[#2F3E38] font-bold leading-tight block whitespace-nowrap",children:e.title}),u.jsx(Me,{as:"span",className:"text-[8.5px] font-bold text-[#5C7565] bg-[#E5EBE0] rounded-full px-2 py-[1.5px] tracking-[0.12em] uppercase whitespace-nowrap",children:e.phase})]}),u.jsx(Me,{as:"p",className:"text-[10.5px] text-[#2F3E38]/70 leading-snug block",children:e.desc})]},t))})]})})}function Bg({children:e}){return u.jsx("span",{className:"w-9 h-9 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e})})}const z6e=()=>u.jsx(Bg,{children:u.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z",fill:"#1B4D1B"})}),U6e=()=>u.jsxs(Bg,{children:[u.jsx("path",{d:"M12 18V5"}),u.jsx("path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}),u.jsx("path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}),u.jsx("path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}),u.jsx("path",{d:"M18 18a4 4 0 0 0 2-7.464"}),u.jsx("path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}),u.jsx("path",{d:"M6 18a4 4 0 0 1-2-7.464"}),u.jsx("path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"})]}),W6e=()=>u.jsxs(Bg,{children:[u.jsx("circle",{cx:"9",cy:"11",r:"2.8"}),u.jsx("line",{x1:"9",y1:"8.2",x2:"9",y2:"4"}),u.jsx("line",{x1:"9",y1:"4",x2:"11",y2:"3"}),u.jsx("line",{x1:"9",y1:"4",x2:"7",y2:"3"}),u.jsx("line",{x1:"6.4",y1:"9.8",x2:"3",y2:"8.5"}),u.jsx("line",{x1:"3",y1:"8.5",x2:"2",y2:"9.5"}),u.jsx("line",{x1:"3",y1:"8.5",x2:"2.5",y2:"6.5"}),u.jsx("line",{x1:"6.4",y1:"12.2",x2:"3.5",y2:"14.5"}),u.jsx("line",{x1:"3.5",y1:"14.5",x2:"2.5",y2:"15.5"}),u.jsx("line",{x1:"3.5",y1:"14.5",x2:"2",y2:"13.5"}),u.jsx("line",{x1:"11.8",y1:"11",x2:"19",y2:"14"}),u.jsx("line",{x1:"19",y1:"14",x2:"21.5",y2:"13"}),u.jsx("line",{x1:"19",y1:"14",x2:"21.5",y2:"16"}),u.jsx("circle",{cx:"21.5",cy:"13",r:"0.7",fill:"#1B4D1B",stroke:"none"}),u.jsx("circle",{cx:"21.5",cy:"16",r:"0.7",fill:"#1B4D1B",stroke:"none"})]}),V6e=()=>u.jsxs(Bg,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"5"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"#1B4D1B"})]}),H6e=()=>u.jsxs(Bg,{children:[u.jsx("circle",{cx:"4",cy:"12",r:"0.7",fill:"#1B4D1B",stroke:"none",opacity:"0.35"}),u.jsx("circle",{cx:"8",cy:"12",r:"1.1",fill:"#1B4D1B",stroke:"none",opacity:"0.55"}),u.jsx("circle",{cx:"12.5",cy:"12",r:"1.6",fill:"#1B4D1B",stroke:"none",opacity:"0.75"}),u.jsx("circle",{cx:"18",cy:"12",r:"2.4",fill:"#1B4D1B",stroke:"none"})]}),G6e=()=>u.jsxs(Bg,{children:[u.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),u.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),u.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),u.jsx("circle",{cx:"9",cy:"6",r:"2",fill:"#E5EBE0"}),u.jsx("circle",{cx:"15",cy:"12",r:"2",fill:"#E5EBE0"}),u.jsx("circle",{cx:"7",cy:"18",r:"2",fill:"#E5EBE0"})]});function Fg({children:e}){return u.jsx("span",{className:"w-7 h-7 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0 shadow-sm",children:u.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e})})}const q6e=()=>u.jsx(Fg,{children:u.jsx("path",{d:"M12 2 L4 5 V11 C4 16 7.5 20 12 22 C16.5 20 20 16 20 11 V5 Z"})}),K6e=()=>u.jsxs(Fg,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"9",cy:"10",r:"0.9",fill:"#1B4D1B",stroke:"none"}),u.jsx("circle",{cx:"15",cy:"10",r:"0.9",fill:"#1B4D1B",stroke:"none"}),u.jsx("path",{d:"M7.5 16 L 9.5 14 L 11.5 16 L 13.5 14 L 15.5 16"})]}),X6e=()=>u.jsxs(Fg,{children:[u.jsx("path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14"}),u.jsx("path",{d:"M18 8c0-2.5-2-2.5-2-5"}),u.jsx("path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),u.jsx("path",{d:"M22 8c0-2.5-2-2.5-2-5"}),u.jsx("path",{d:"M7 12v4"})]}),Y6e=()=>u.jsx(Fg,{children:u.jsxs("g",{transform:"rotate(-22 12 12)",children:[u.jsx("circle",{cx:"12",cy:"6.5",r:"3.5"}),u.jsx("line",{x1:"9.5",y1:"5.5",x2:"14.5",y2:"5.5"}),u.jsx("line",{x1:"9.5",y1:"7.5",x2:"14.5",y2:"7.5"}),u.jsx("line",{x1:"9.8",y1:"10",x2:"14.2",y2:"10"}),u.jsx("rect",{x:"10.3",y:"10.5",width:"3.4",height:"11",rx:"1.4"})]})}),J6e=()=>u.jsxs(Fg,{children:[u.jsx("ellipse",{cx:"12",cy:"13",rx:"3.5",ry:"4",fill:"#1B4D1B",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"8",r:"2",fill:"#1B4D1B",stroke:"none"}),u.jsx("path",{d:"M8.5 11 L4 8 L3 5"}),u.jsx("path",{d:"M8.5 13 L3 12 L1.5 13"}),u.jsx("path",{d:"M8.5 14.5 L3 16 L2 19"}),u.jsx("path",{d:"M8.5 16 L5 19 L4.5 22"}),u.jsx("path",{d:"M15.5 11 L20 8 L21 5"}),u.jsx("path",{d:"M15.5 13 L21 12 L22.5 13"}),u.jsx("path",{d:"M15.5 14.5 L21 16 L22 19"}),u.jsx("path",{d:"M15.5 16 L19 19 L19.5 22"})]}),Q6e=()=>u.jsxs(Fg,{children:[u.jsx("path",{d:"M14 5 H20 L14 12 H20"}),u.jsx("path",{d:"M5 13 H10 L5 19 H10"})]});function Z6e(){const e=[{text:"Focus on what's bothering you",icon:u.jsx(V6e,{})},{text:"Follow bilateral stimulation",icon:u.jsx(H6e,{})},{text:"Adjustment based on emotion detected",icon:u.jsx(G6e,{})}],t=[{text:"Mimics REM sleep",icon:u.jsx(z6e,{})},{text:"Suppresses fight or flight response",icon:u.jsx(U6e,{})},{text:"Increases neuroplasticity",icon:u.jsx(W6e,{})}],n=[{text:"PTSD & trauma",icon:u.jsx(q6e,{})},{text:"Anxiety",icon:u.jsx(K6e,{})},{text:"Addiction & cravings",icon:u.jsx(X6e,{})},{text:"Performance anxiety",icon:u.jsx(Y6e,{})},{text:"Phobias",icon:u.jsx(J6e,{})},{text:"Sleep disorders",icon:u.jsx(Q6e,{})}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-6",children:[u.jsxs("div",{children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"What is EMDR?"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"Eye Movement Desensitization Reprocessing"})]}),u.jsx("div",{"data-animated":"",className:"flex justify-center mt-3",children:u.jsx("div",{className:"w-[340px]",children:u.jsx(e3,{})})}),u.jsxs("div",{className:"mt-5 grid grid-cols-3 gap-8 items-start",children:[u.jsxs("div",{children:[u.jsx(Me,{as:"h3",className:"font-serif tex
5082t-2xl text-[#2F3E38] block mb-4",children:"How it works"}),u.jsx("ol",{className:"space-y-4",children:e.map((a,r)=>u.jsxs("li",{className:"flex items-center gap-3",children:[a.icon,u.jsx(Me,{className:"text-base text-[#2F3E38] font-medium block leading-snug",children:a.text})]},r))})]}),u.jsxs("div",{children:[u.jsx(Me,{as:"h3",className:"font-serif text-2xl text-[#2F3E38] block mb-4",children:"Why it works"}),u.jsx("ul",{className:"space-y-4",children:t.map((a,r)=>u.jsxs("li",{className:"flex items-center gap-3",children:[a.icon,u.jsx(Me,{className:"text-base text-[#2F3E38] font-medium block leading-snug",children:a.text})]},r))})]}),u.jsxs("div",{children:[u.jsx(Me,{as:"h3",className:"font-serif text-2xl text-[#2F3E38] block mb-4",children:"What it treats"}),u.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-3.5",children:n.map((a,r)=>u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.icon,u.jsx(Me,{className:"text-[13px] text-[#2F3E38] font-medium block leading-snug",children:a.text})]},r))})]})]}),u.jsxs("div",{className:"mt-auto pt-3",children:[u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/50 tracking-[0.2em] uppercase text-center block mb-1.5",children:"Recommended by"}),u.jsxs("div",{className:"flex items-center justify-center gap-12 mb-2",children:[u.jsx("img",{src:"/who-logo.svg",alt:"World Health Organization",className:"h-9 opacity-75 max-w-[140px] object-contain"}),u.jsx("img",{src:"/apa-logo.svg",alt:"American Psychological Association",className:"h-9 opacity-75 max-w-[120px] object-contain"}),u.jsx("img",{src:"/va-logo.svg",alt:"U.S. Department of Veterans Affairs",className:"h-9 opacity-75 max-w-[140px] object-contain"})]}),u.jsx("div",{className:"bg-[#5C7565] rounded-full py-2 px-6 text-center shadow-sm",children:u.jsx(Me,{className:"text-white text-[15px] font-semibold tracking-wide block",children:"Outperforms medication. Faster than talk therapy."})})]})]})})}function eze(){const e=[{text:"Weakened immune function"},{text:"Disrupted sleep"},{text:"Digestive problems"},{text:"Chronic pain"},{text:"Accelerated aging"},{text:"Chronic procrastination",bold:!0},{text:"Difficulty concentrating",bold:!0}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-6",children:[u.jsxs("div",{className:"mb-3",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"The Problem"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"Dysregulation is widespread — and EMDR is inaccessible"})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-2 gap-6",children:[u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm p-5 flex flex-col min-h-0 overflow-hidden",children:[u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/50 tracking-[0.2em] uppercase block mb-2",children:"Personal cost"}),u.jsxs("div",{className:"flex items-baseline gap-3",children:[u.jsx(Me,{as:"span",className:"font-serif text-6xl text-[#E08B75] font-bold leading-none",children:"70%"}),u.jsx(Me,{as:"span",className:"text-[14px] text-[#2F3E38]/80 leading-snug block",children:"of adults experience trauma in their lifetime"})]}),u.jsxs("div",{className:"mt-4 pt-4 border-t border-[#2F3E38]/10 flex-1 min-h-0",children:[u.jsx(Me,{as:"h3",className:"font-serif text-base text-[#2F3E38] block mb-2.5",children:"Dysregulation lives in the body"}),u.jsx("ul",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:e.map((t,n)=>u.jsxs("li",{className:`flex items-center gap-2 text-[13px] ${t.bold?"text-[#2F3E38] font-semibold":"text-[#2F3E38]/80"}`,children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E08B75] flex-shrink-0"}),u.jsx(Me,{className:"block leading-snug",children:t.text})]},n))})]})]}),u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm p-5 flex flex-col min-h-0 overflow-hidden",children:[u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/50 tracking-[0.2em] uppercase block mb-2",children:"Cost to business"}),u.jsxs("div",{className:"flex items-baseline gap-3",children:[u.jsx(Me,{as:"span",className:"font-serif text-6xl text-[#E08B75] font-bold leading-none",children:"83%"}),u.jsx(Me,{as:"span",className:"text-[14px] text-[#2F3E38]/80 leading-snug block",children:"of US workers report work-related stress"})]}),u.jsxs("div",{className:"mt-4 pt-4 border-t border-[#2F3E38]/10 flex-1 min-h-0",children:[u.jsx(Me,{as:"h3",className:"font-serif text-base text-[#2F3E38] block mb-2.5",children:"Distraction and dysregulation drain enterprise value"}),u.jsxs("ul",{className:"space-y-2.5",children:[u.jsxs("li",{className:"flex items-baseline gap-2.5",children:[u.jsx(Me,{as:"span",className:"font-serif text-xl text-[#E08B75] font-bold leading-none whitespace-nowrap",children:"60+ min"}),u.jsx(Me,{as:"span",className:"text-[13px] text-[#2F3E38]/80 leading-snug block",children:"stressors keep workers physiologically activated — compromising focus, decisions, and creativity"})]}),u.jsxs("li",{className:"flex items-baseline gap-2.5",children:[u.jsx(Me,{as:"span",className:"font-serif text-xl text-[#E08B75] font-bold leading-none whitespace-nowrap",children:"$300B"}),u.jsx(Me,{as:"span",className:"text-[13px] text-[#2F3E38]/80 leading-snug block",children:"/year in lost productivity, absenteeism, and turnover"})]})]})]})]})]}),u.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-6 flex-shrink-0",children:[u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm p-5 flex items-center gap-4",children:[u.jsx("span",{className:"w-11 h-11 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0",children:u.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),u.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/50 tracking-[0.2em] uppercase block",children:"Cost barr
5082ier"}),u.jsxs("div",{className:"flex items-baseline gap-2.5 mt-1",children:[u.jsx(Me,{as:"span",className:"font-serif text-3xl text-[#E08B75] font-bold leading-none whitespace-nowrap",children:"$150–$300"}),u.jsx(Me,{as:"span",className:"text-[14px] text-[#2F3E38]/70 leading-tight block",children:"per session"})]})]})]}),u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm p-5 flex items-center gap-4",children:[u.jsx("span",{className:"w-11 h-11 rounded-full bg-[#E5EBE0] flex items-center justify-center flex-shrink-0",children:u.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("polyline",{points:"12 7 12 12 15 14"})]})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/50 tracking-[0.2em] uppercase block",children:"Supply side constraints"}),u.jsxs("div",{className:"flex items-baseline gap-2.5 mt-1",children:[u.jsx(Me,{as:"span",className:"font-serif text-3xl text-[#E08B75] font-bold leading-none whitespace-nowrap",children:"<10%"}),u.jsx(Me,{as:"span",className:"text-[14px] text-[#2F3E38]/70 leading-tight block",children:"of therapists trained in EMDR"})]})]})]})]})]})})}const GB=[{happy:72,sad:12,surprised:16},{happy:35,sad:48,surprised:17},{happy:20,sad:15,surprised:65},{happy:55,sad:30,surprised:15}];function tze(){const[e,t]=D.useState(0);D.useEffect(()=>{const r=setInterval(()=>t(s=>(s+1)%GB.length),2e3);return()=>clearInterval(r)},[]);const n=GB[e],a=[{label:"Happy",value:n.happy,color:"bg-[#7C9885]"},{label:"Sad",value:n.sad,color:"bg-[#F4A28C]"},{label:"Surprised",value:n.surprised,color:"bg-[#1B4D1B]/40"}];return u.jsx("div",{className:"flex flex-col gap-1.5 text-left flex-1",children:a.map(r=>u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"text-[8px] text-[#1B4D1B]/60 w-12 text-right",children:r.label}),u.jsx("div",{className:"flex-1 h-2 bg-[#1B4D1B]/10 rounded-full overflow-hidden",children:u.jsx(qe.div,{className:`h-full rounded-full ${r.color}`,animate:{width:`${r.value}%`},transition:{duration:.6,ease:"easeOut"}})})]},r.label))})}function nze({hideButton:e,showSteps:t,title:n="Demo (Phase 1 Beta)",subtitle:a="Median negative emotion intensity drops 70% after a session",video:r=B6e}={}){return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsx("div",{className:"mb-4 text-center",children:u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:n})}),u.jsxs("div",{className:"flex-1 min-h-0 flex gap-10 items-center justify-center",children:[!t&&u.jsxs("div",{className:"flex-shrink-0 w-[240px] text-left",children:[u.jsx(Me,{as:"p",className:"font-handwritten text-3xl text-[#E08B75] font-semibold leading-tight block",children:"Median negative emotion intensity drops"}),u.jsx(Me,{as:"span",className:"font-serif font-extrabold text-[#E08B75] leading-none block my-1",style:{fontSize:96},children:"70%"}),u.jsx(Me,{as:"p",className:"font-handwritten text-3xl text-[#E08B75] font-semibold leading-tight block",children:"after a session"})]}),t&&u.jsxs("div",{className:"flex-shrink-0 w-[240px] h-full flex flex-col justify-center gap-4",children:[u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-xl border border-[#2F3E38]/8 shadow-sm p-3 flex flex-col items-center text-center gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"w-6 h-6 rounded-full bg-[#7C9885] flex items-center justify-center shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-[11px]",children:"1"})}),u.jsx(Me,{as:"p",className:"text-[13px] font-semibold text-[#2F3E38] block",children:"Follow the dot"})]}),u.jsx("div",{"data-animated":"",className:"relative w-full h-10 bg-[#FDF5EB] rounded-lg overflow-hidden",children:u.jsx(qe.div,{className:"absolute top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-[#7C9885] shadow",animate:{left:["8%","84%","8%"]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}})})]}),u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-xl border border-[#2F3E38]/8 shadow-sm p-3 flex flex-col items-center text-center gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"w-6 h-6 rounded-full bg-[#F4A28C] flex items-center justify-center shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-[11px]",children:"2"})}),u.jsx(Me,{as:"p",className:"text-[13px] font-semibold text-[#2F3E38] block",children:"We read your emotions"})]}),u.jsxs("div",{"data-animated":"",className:"w-full flex items-center justify-center gap-3 px-2 py-1",children:[u.jsxs("div",{className:"relative flex-shrink-0",style:{width:44,height:52},children:[u.jsxs("svg",{width:"44",height:"52",viewBox:"0 0 64 76",children:[u.jsx("circle",{cx:"32",cy:"32",r:"22",fill:"#F4A28C",opacity:"0.3"}),u.jsx("path",{d:"M12,28 Q12,8 32,8 Q52,8 52,28",fill:"#1B4D1B",opacity:"0.2"}),u.jsx("circle",{cx:"24",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"40",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"25",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("circle",{cx:"41",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("path",{d:"M24,40 Q32,47 40,40",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",opacity:"0.4"}),u.jsx("circle",{cx:"32",cy:"35",r:"1.5",fill:"#1B4D1B",opacity:"0.15"}
5082),u.jsx("rect",{x:"28",y:"53",width:"8",height:"8",rx:"2",fill:"#F4A28C",opacity:"0.2"}),u.jsx("path",{d:"M16,68 Q20,60 28,60 L36,60 Q44,60 48,68",fill:"#7C9885",opacity:"0.2"}),[[24,30],[40,30],[32,35],[24,40],[40,40],[32,44],[18,30],[30,30],[34,30],[46,30],[14,24],[50,24],[32,10],[22,14],[42,14],[16,40],[48,40],[32,52],[20,50],[44,50]].map(([s,i],o)=>u.jsx("circle",{cx:s,cy:i,r:"1.3",fill:"#7C9885",opacity:"0.65"},o)),u.jsxs("g",{stroke:"#7C9885",strokeWidth:"0.6",opacity:"0.3",children:[u.jsx("line",{x1:"18",y1:"30",x2:"24",y2:"30"}),u.jsx("line",{x1:"24",y1:"30",x2:"30",y2:"30"}),u.jsx("line",{x1:"34",y1:"30",x2:"40",y2:"30"}),u.jsx("line",{x1:"40",y1:"30",x2:"46",y2:"30"}),u.jsx("line",{x1:"32",y1:"10",x2:"32",y2:"35"}),u.jsx("line",{x1:"24",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"40",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"14",y1:"24",x2:"16",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"20",y2:"50"}),u.jsx("line",{x1:"20",y1:"50",x2:"32",y2:"52"}),u.jsx("line",{x1:"32",y1:"52",x2:"44",y2:"50"}),u.jsx("line",{x1:"44",y1:"50",x2:"48",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"50",y2:"24"}),u.jsx("line",{x1:"22",y1:"14",x2:"32",y2:"10"}),u.jsx("line",{x1:"32",y1:"10",x2:"42",y2:"14"}),u.jsx("line",{x1:"24",y1:"40",x2:"32",y2:"44"}),u.jsx("line",{x1:"32",y1:"44",x2:"40",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"24",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"40",y2:"40"})]})]}),u.jsx(qe.div,{className:"absolute inset-x-0 h-0.5 bg-[#7C9885]/60",animate:{top:["5%","90%","5%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]}),u.jsx(tze,{})]})]}),u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-xl border border-[#2F3E38]/8 shadow-sm p-3 flex flex-col items-center text-center gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"w-6 h-6 rounded-full bg-[#7C9885] flex items-center justify-center shadow-sm",children:u.jsx("span",{className:"text-white font-bold text-[11px]",children:"3"})}),u.jsx(Me,{as:"p",className:"text-[13px] font-semibold text-[#2F3E38] block",children:"The experience adapts"})]}),u.jsx("div",{"data-animated":"",className:"w-full flex items-center justify-center py-1",children:u.jsxs("svg",{width:"180",height:"50",viewBox:"0 0 240 70",className:"w-full",children:[u.jsx("rect",{x:"8",y:"16",width:"55",height:"28",rx:"6",fill:"#7C9885"}),u.jsx("text",{x:"35",y:"34",textAnchor:"middle",fill:"white",fontSize:"9",fontWeight:"600",children:"Emotion"}),u.jsx("rect",{x:"92",y:"16",width:"55",height:"28",rx:"6",fill:"#F4A28C"}),u.jsx("text",{x:"119",y:"34",textAnchor:"middle",fill:"white",fontSize:"9",fontWeight:"600",children:"AI"}),u.jsx("rect",{x:"176",y:"16",width:"55",height:"28",rx:"6",fill:"#7C9885"}),u.jsx("text",{x:"203",y:"34",textAnchor:"middle",fill:"white",fontSize:"9",fontWeight:"600",children:"Stim"}),u.jsx("line",{x1:"65",y1:"30",x2:"90",y2:"30",stroke:"#2F3E38",strokeWidth:"1.5",markerEnd:"url(#arrowSm)"}),u.jsx("line",{x1:"149",y1:"30",x2:"174",y2:"30",stroke:"#2F3E38",strokeWidth:"1.5",markerEnd:"url(#arrowSm)"}),u.jsx("path",{d:"M203,46 C203,65 35,65 35,46",fill:"none",stroke:"#2F3E38",strokeWidth:"1.2",strokeDasharray:"3 2",markerEnd:"url(#arrowSm)"}),u.jsx("text",{x:"119",y:"64",textAnchor:"middle",fill:"#2F3E38",fontSize:"7",opacity:"0.4",children:"repeat"}),u.jsx(qe.circle,{r:"3.5",fill:"#3B82F6",animate:{cx:[35,77,119,161,203,203,119,35,35],cy:[30,30,30,30,30,46,60,46,30]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut"}}),u.jsx("defs",{children:u.jsx("marker",{id:"arrowSm",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:u.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#2F3E38"})})})]})})]})]}),u.jsxs("div",{"data-animated":"",className:"demo-stage relative rounded-2xl overflow-hidden shadow-xl border border-[#2F3E38]/10 bg-black",style:{aspectRatio:"16 / 9",maxHeight:"100%"},children:[u.jsx("video",{src:r,controls:!0,playsInline:!0,className:"demo-video block h-full w-auto"}),u.jsx("img",{src:F6e,alt:"Solta AI product preview",className:"demo-pdf-image block h-full w-auto object-cover"}),u.jsxs("a",{href:HB,target:"_blank",rel:"noopener noreferrer","data-pdf-link":HB,className:"demo-pdf-btn absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 items-center gap-2 px-6 py-3 rounded-full bg-white/80 text-[#2F3E38] text-base font-semibold tracking-wide shadow-lg",children:[u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"
5082currentColor",children:u.jsx("polygon",{points:"6 3 20 12 6 21 6 3"})}),"Watch Demo"]})]})]}),!e&&u.jsx("div",{className:"mt-5 flex justify-center",children:u.jsxs("a",{href:"/bls?from=pitch",target:"_blank",rel:"noopener noreferrer","data-pdf-link":"https://soltaai.com/bls?from=pitch",className:"inline-flex items-center gap-2 px-6 py-2.5 rounded-full bg-[#F4A28C] text-white text-base font-semibold tracking-wide shadow-md hover:bg-[#7C9885] transition-colors",children:[u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("polygon",{points:"6 3 20 12 6 21 6 3",fill:"currentColor"})}),"Try it live"]})})]})})}function aze({color:e}){return u.jsxs("svg",{width:"76",height:"76",viewBox:"0 0 96 96",fill:"none",stroke:e,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("ellipse",{cx:"22",cy:"52",rx:"6",ry:"14",fill:`${e}14`,transform:"rotate(-50 22 52)"}),u.jsx("ellipse",{cx:"74",cy:"52",rx:"6",ry:"14",fill:`${e}14`,transform:"rotate(50 74 52)"}),u.jsx("ellipse",{cx:"34",cy:"44",rx:"6",ry:"17",fill:`${e}26`,transform:"rotate(-22 34 44)"}),u.jsx("ellipse",{cx:"62",cy:"44",rx:"6",ry:"17",fill:`${e}26`,transform:"rotate(22 62 44)"}),u.jsx("ellipse",{cx:"48",cy:"38",rx:"7",ry:"20",fill:`${e}3D`}),u.jsx("circle",{cx:"48",cy:"58",r:"4",fill:e}),u.jsx("path",{d:"M14 72 C 28 68, 68 68, 82 72",strokeWidth:"2"}),u.jsx("path",{d:"M20 76 C 32 74, 64 74, 76 76",strokeWidth:"1.5",opacity:"0.5"})]})}function rze({color:e}){return u.jsxs("svg",{width:"76",height:"76",viewBox:"0 0 96 96",fill:"none",stroke:e,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M18 30 C 18 22, 24 16, 32 16 L 64 16 C 72 16, 78 22, 78 30 L 78 52 C 78 60, 72 66, 64 66 L 42 66 L 28 78 L 32 66 L 32 66 C 24 66, 18 60, 18 52 Z",fill:`${e}1A`}),u.jsx("line",{x1:"30",y1:"36",x2:"30",y2:"46",strokeWidth:"3.5"}),u.jsx("line",{x1:"38",y1:"30",x2:"38",y2:"52",strokeWidth:"3.5"}),u.jsx("line",{x1:"46",y1:"34",x2:"46",y2:"48",strokeWidth:"3.5"}),u.jsx("line",{x1:"54",y1:"28",x2:"54",y2:"54",strokeWidth:"3.5"}),u.jsx("line",{x1:"62",y1:"32",x2:"62",y2:"50",strokeWidth:"3.5"}),u.jsx("path",{d:"M82 22 l 2 6 l 6 2 l -6 2 l -2 6 l -2 -6 l -6 -2 l 6 -2 z",fill:e,stroke:"none"})]})}function sze({color:e}){return u.jsxs("svg",{width:"76",height:"76",viewBox:"0 0 96 96",fill:"none",stroke:e,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M48 10 L 78 22 L 78 48 C 78 66, 64 80, 48 86 C 32 80, 18 66, 18 48 L 18 22 Z",fill:`${e}14`}),u.jsx("text",{x:"48",y:"58",textAnchor:"middle",fontSize:"32",fontWeight:"700",fontFamily:"DM Serif Display, serif",fill:e,stroke:"none",children:"8"}),u.jsx("circle",{cx:"72",cy:"26",r:"9",fill:e,stroke:"none"}),u.jsx("path",{d:"M68 26 L 71 29 L 76 23",stroke:"white",strokeWidth:"2.5"})]})}const ize=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M1 12 C 4 6, 8 3, 12 3 C 16 3, 20 6, 23 12 C 20 18, 16 21, 12 21 C 8 21, 4 18, 1 12 Z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),oze=({color:e})=>u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M13 2 L 4 14 L 11 14 L 10 22 L 20 10 L 13 10 Z",fill:`${e}22`})}),lze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"4",y1:"20",x2:"4",y2:"10"}),u.jsx("line",{x1:"11",y1:"20",x2:"11",y2:"4"}),u.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"14"}),u.jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20"})]}),uze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("rect",{x:"9",y:"3",width:"6",height:"12",rx:"3",fill:`${e}22`}),u.jsx("path",{d:"M5 11 C 5 15, 8 18, 12 18 C 16 18, 19 15, 19 11"}),u.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"})]}),cze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M12 3 L 22 20 L 2 20 Z",fill:`${e}22`}),u.jsx("line",{x1:"12",y1:"10",x2:"12",y2:"14"}),u.jsx("circle",{cx:"12",cy:"17",r:"0.6",fill:e})]}),dze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"9",cy:"8",r:"3",fill:`${e}22`}),u.jsx("path",{d:"M2 20 C 2 15, 5 13, 9 13 C 13 13, 16 15, 16 20"}),u.jsx("circle",{cx:"17",cy:"9",r:"2.5",fill:`${e}22`}),u.jsx("path",{d:"M14 20 C 14 16, 17 15, 19 15 C 21 15, 22 17, 22 20"})]}),hze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9",fill:`${e}22`}),u.jsx("path",{d:"M8 12 L 11 15 L 16 9"})]}),pze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"6",cy:"6",r:"2.2",fill:e}),u.jsx("circle",{cx:"18",cy:"18",r:"2.2",fill:e}),u.jsx("path",{d:"M8 6 L 14 6 C 16 6, 18 8, 18 10 L 18 16"})]}),fze=({color:e})=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M4 20 L 4 8 L 12 4 L 20 8 L 20 20 Z",fill:`${e}22`}),u.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"12"}),u.jsx("line",{x1:"8",y1:"20",x2:"8",y2:"14"}),u.jsx("line",{x1:"16",y1:"20",x2:"16",y2:"14"})]});function mze(){const e=[{tag:"CURRENT",title:"EMDR-Inspired Wellness",color:"#8DA399",Hero:aze,features:[{Icon:ize,text:"Real-time emotion detection"},{Icon:oze,text:"Adaptive stimulation speed"},{Icon:lze,text:"Session history"}]},{tag:"PHASE 2",title:"AI-Guided EMDR Sessions",color:"#F4A492",Hero:rze,features:[{Icon:uze,text:"LLM voice guidance"},{Icon:cze,text:"Dissociation & crisis detection"},{Icon:dze,text:"Therapist-matched users"}]}
5082,{tag:"PHASE 3",title:"Full EMDR Protocol",color:"#2F3E38",Hero:sze,features:[{Icon:hze,text:"All 8 clinical phases"},{Icon:pze,text:"Auto phase sequencing"},{Icon:fze,text:"Clinics, group practices, EAPs & hospitals"}]}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsxs("div",{className:"mb-4",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"Product Roadmap"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"From EMDR-Inspired Wellness to Full AI-Guided EMDR"})]}),u.jsxs("div",{className:"relative px-8 mb-3",children:[u.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 h-[2px]",style:{left:"16.666%",right:"16.666%",background:"linear-gradient(to right, #8DA399, #F4A492, #2F3E38)"}}),u.jsx("div",{className:"relative grid grid-cols-3",children:e.map((t,n)=>u.jsx("div",{className:"flex justify-center",children:u.jsx("div",{className:"w-5 h-5 rounded-full border-[3px] border-white shadow-md",style:{backgroundColor:t.color}})},n))})]}),u.jsx("div",{className:"flex-1 min-h-0 grid grid-cols-3 gap-4",children:e.map((t,n)=>{const a=t.Hero;return u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm flex flex-col overflow-hidden",children:[u.jsx("div",{className:"h-1",style:{backgroundColor:t.color}}),u.jsxs("div",{className:"p-5 flex flex-col flex-1",children:[u.jsx("span",{className:"inline-block self-start text-[12px] font-bold tracking-[0.2em] uppercase px-2.5 py-1 rounded-full mb-3",style:{color:t.color,backgroundColor:`${t.color}1A`},children:u.jsx(Me,{className:"block",children:t.tag})}),u.jsx("div",{className:"flex justify-center my-3",children:u.jsx(a,{color:t.color})}),u.jsx(Me,{as:"h3",className:"font-serif text-2xl text-[#2F3E38] leading-tight block text-center mb-4",children:t.title}),u.jsx("ul",{className:"space-y-2 mt-auto",children:t.features.map((r,s)=>{const i=r.Icon;return u.jsxs("li",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg",style:{backgroundColor:`${t.color}12`},children:[u.jsx(i,{color:t.color}),u.jsx(Me,{className:"text-[14px] text-[#2F3E38] font-medium leading-snug block flex-1",children:r.text})]},s)})})]})]},n)})})]})})}function qB(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"#F4A28C",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M12 2 L3 9 v12 h6 v-6 h6 v6 h6 V9 z"}),u.jsx("rect",{x:"11",y:"11",width:"2",height:"6",fill:"white"}),u.jsx("rect",{x:"9",y:"13",width:"6",height:"2",fill:"white"})]})}function gze(){return u.jsxs("svg",{width:"20",height:"18",viewBox:"0 0 28 22",fill:"#F4A28C",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"6",cy:"6",r:"3.5"}),u.jsx("circle",{cx:"22",cy:"6",r:"3.5"}),u.jsx("circle",{cx:"14",cy:"5",r:"4"}),u.jsx("path",{d:"M0 20 c0 -4 4 -7 8 -7 c2 0 4 1 5 2 c1 -1 3 -2 5 -2 c4 0 8 3 8 7 z"})]})}const qN=[{label:"Phase 1",title:"EMDR-Inspired Wellness",stage:null,barColor:"#F4A28C",b2c:"$8/mo"},{label:"Phase 2",title:"AI-Guided EMDR Sessions",stage:null,barColor:"#8DA399",b2c:"$15/mo*"},{label:"Phase 3",title:"Full EMDR Protocol",stage:null,barColor:"#2F3E38",b2c:"$30/mo*"}],xze=["Clinics & group practices","EAPs & corporate wellness","Treatment centers"],yze=["+ Insurance carriers","+ Benefits programs","+ Hospitals","+ Veterans Affairs",{type:"mhPlatforms"}];function bze(){return u.jsxs("div",{className:"grid grid-cols-3 grid-rows-[auto_1fr_auto] gap-x-3 h-full",children:[qN.map((e,t)=>u.jsx("div",{className:"row-span-3 bg-white/70 backdrop-blur-sm rounded-xl border border-[#2F3E38]/8 shadow-sm overflow-hidden",style:{gridColumnStart:t+1,gridRowStart:1},children:u.jsx("div",{className:"h-1",style:{backgroundColor:e.barColor}})},`bg-${t}`)),qN.map((e,t)=>u.jsxs("div",{className:"px-4 pt-4 pb-1 z-10",style:{gridColumnStart:t+1,gridRowStart:1},children:[u.jsx(Me,{as:"p",className:"text-[13px] font-semibold tracking-[0.15em] uppercase block",style:{color:e.barColor},children:e.label}),u.jsx(Me,{as:"h3",className:"font-serif text-[18px] text-[#1A3C34] leading-tight block mt-1",children:e.title})]},`hdr-${t}`)),u.jsxs("div",{className:"z-10 my-1.5 mx-2 rounded-lg px-3 py-2 flex flex-col items-start justify-center text-left",style:{gridColumnStart:1,gridRowStart:2,backgroundColor:"rgba(124, 152, 133, 0.10)",border:"1.5px dashed #7C9885"},children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[u.jsx(qB,{}),u.jsx(Me,{as:"p",className:"text-[13px] font-bold text-[#7C9885] tracking-[0.15em] uppercase block",children:"B2B"})]}),u.jsx("ul",{className:"space-y-0.5",children:xze.map((e,t)=>u.jsxs("li",{className:"flex items-center gap-1.5 text-[15px] text-[#1A3C34] leading-snug font-medium",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#7C9885] flex-shrink-0"}),u.jsx(Me,{className:"block",children:e})]},t))}),u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 mt-1.5 pt-1.5 border-t border-[#7C9885]/20 w-full",children:[u.jsx("a",{href:"https://vudy.app/",target:"_blank",rel:"noopener noreferrer","aria-label":"Vudy website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:c0,alt:"Vudy",className:"h-8 max-w-[110px] object-contain mx-auto"})}),u.jsx("a",{href:"https://www.pinyahta.com/",target:"_blank",rel:"noopener noreferrer","aria-label":"Pinyahta website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:d0,alt:"Pinyahta",className:"h-8 max-w-[110px] object-contain mx-auto"})})]})]}),u.jsxs("div",{className:"z-10 my-1.5 mx-2 rounded-lg px-4 py-2 flex flex-col items-start justify-center text-left relative",style:{gridColumnStart:2,gridColumnEnd:4,gridRowStart:2,backgroundColor:"rgba(124, 152, 133, 0.10)",border:"1.5px dashed #7C9885"},children:[u.jsx("img",{src:j6e,alt:"VA",className:"absolute right-3 bottom-3 h-10 w-10 object-contain opacity-80 pointer-events-none"}),u.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[u.jsx(qB,{}),u.jsx(Me,{as:"p",className:"text-[13px] font-bold text-[#7C9885] tracking-[0.15em] uppercase block",children:"B2B"})]}),u.jsx("ul",{className:"grid grid-cols-2 gap-x-6 gap-y-0.5 w-full",children:yze.map((e,t)=>u.jsx("li",{className:"text-[15px] text-[#1A3C34] leading-snug font-medium",children:e?.type==="mhPlatforms"?u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx(Me,{className:"block",children:"+ Partnerships w/ mental health platforms"}),u.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[u.jsx("img",{src:D6e,alt:"Nema Health",className:"h-7 w-7 rounded-full object-contain"}),u.jsx("img",{src:R6e,alt:"BetterHelp",className:"h-7 w-7 rounded-full object-contain"}),u.jsx("img",{src:M6e,alt:"Ash",className:"h-7 w-7 rounded-full object-contain"})]})]}):u.jsx(Me,{className:"block",children:e})},t))})]}),qN.map((e,t)=>u.jsxs("div",{className:"px-3 pt-1 pb-3 z-10",style:{gridColumnStart:t+1,gridRowStart:3},children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[u.jsx(gze,{}),u.jsx(Me,{as:"p",className:"text-[13px] font-bold text-[#5C7565] tracking-[0.15em] uppercase block",children:"B2C"})]}),u.jsx(Me,{as:"p",className:"font-serif text-xl text-[#1A3C34] font-bold leading-none block",children:e.b2c})]},`b2c-${t}`))]})}function vze(){const e=[{tag:"Today",color:"#F4A28C",items:[{type:"organic"}]},{tag:"In progress",color:"#8DA399",items:["Wellness partnerships","Advisory board network",{type:"seo"}]},{tag:"Next",color:"#2F3E38",items:["Paid acquisition testing","Niche influencers"]}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsxs("div",{className:"mb-5",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#1A3C34] block leading-tight",children:"Business Model & Distribution"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"How we make money. How customers find us."})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-[2fr_1fr] gap-5",children:[u.jsx(bze,{}),u.jsx("div",{className:"flex flex-col gap-3",children:u.jsxs("div",{className:"relative flex-1 min-h-0 bg-white/70 backdrop-blur-sm rounded-xl border border-[#2F3E38]/8 shadow-sm px-5 py-4 flex flex-col",children:[u.jsx(Me,{as:"p",className:"text-[12px] font-semibold text-[#2F3E38]/50 tracking-[0.15em] uppercase block mb-3",children:"Distribution Timeline"}),u.jsxs("div",{className:"relative flex-1 min-h-0",children:[u.jsx("div",{className:"absolute left-[8px] top-2 bottom-2 w-[2px] bg-gradient-to-b from-[#F4A28C] via-[#8DA399] to-[#2F3E38] opacity-60"}),u.jsx("ul",{className:"h-full flex flex-col justify-between",children:e.map((t,n)=>u.jsxs("li",{className:"flex items-start gap-3",children:[u.jsx("div",{className:"mt-[5px] w-5 h-5 rounded-full border-[3px] border-white shadow-sm flex-shrink-0 relative z-10",style:{backgroundColor:t.color}}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx(Me,{as:"p",className:"text-[14px] font-bold tracking-[0.1em] uppercase block",style:{color:t.color},children:t.tag}),u.jsx("ul",{className:"mt-0.5 space-y-0",children:t.items.map((a,r)=>
5082u.jsx("li",{className:"text-[14px] text-[#1A3C34]/80 leading-snug",children:a?.type==="organic"?u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-[14px] text-[#1A3C34]/80",children:"Organic:"}),u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#0A66C2",children:u.jsx("path",{d:"M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.34V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.13 2.06 2.06 0 0 1 0 4.13zM7.12 20.45H3.56V9h3.56v11.45z"})}),u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#E4405F",children:u.jsx("path",{d:"M12 2.16c2.72 0 3.06.01 4.12.06 1.07.05 1.8.22 2.43.46.66.26 1.21.6 1.77 1.16.55.55.9 1.11 1.16 1.77.25.64.42 1.36.46 2.43.05 1.07.06 1.4.06 4.12s-.01 3.06-.06 4.12c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 0 1-1.16 1.77c-.55.55-1.11.9-1.77 1.16-.64.25-1.36.42-2.43.46-1.07.05-1.4.06-4.12.06s-3.06-.01-4.12-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 0 1-1.77-1.16 4.9 4.9 0 0 1-1.16-1.77c-.25-.64-.42-1.36-.46-2.43C2.17 15.06 2.16 14.72 2.16 12s.01-3.06.06-4.12c.05-1.07.22-1.8.46-2.43A4.9 4.9 0 0 1 3.84 3.68 4.9 4.9 0 0 1 5.6 2.52c.64-.25 1.36-.42 2.43-.46C9.1 2.01 9.43 2 12.16 2H12zm0 1.8c-2.67 0-2.99.01-4.04.06-.97.04-1.5.2-1.85.34-.47.18-.8.4-1.15.74-.35.35-.56.68-.74 1.15-.13.35-.3.88-.34 1.85-.05 1.05-.06 1.37-.06 4.04s.01 2.99.06 4.04c.04.97.2 1.5.34 1.85.18.47.4.8.74 1.15.35.35.68.56 1.15.74.35.13.88.3 1.85.34 1.05.05 1.37.06 4.04.06s2.99-.01 4.04-.06c.97-.04 1.5-.2 1.85-.34.47-.18.8-.4 1.15-.74.35-.35.56-.68.74-1.15.13-.35.3-.88.34-1.85.05-1.05.06-1.37.06-4.04s-.01-2.99-.06-4.04c-.04-.97-.2-1.5-.34-1.85a3.1 3.1 0 0 0-.74-1.15 3.1 3.1 0 0 0-1.15-.74c-.35-.13-.88-.3-1.85-.34-1.05-.05-1.37-.06-4.04-.06zm0 3.07A4.97 4.97 0 1 1 12 17a4.97 4.97 0 0 1 0-9.94zm0 8.2a3.23 3.23 0 1 0 0-6.46 3.23 3.23 0 0 0 0 6.46zm6.34-8.4a1.16 1.16 0 1 1-2.32 0 1.16 1.16 0 0 1 2.32 0z"})}),u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#000000",children:u.jsx("path",{d:"M19.32 6.95A4.46 4.46 0 0 1 16.5 4.5V4h-3.27v11.25a2.63 2.63 0 1 1-1.8-2.49V9.42a5.95 5.95 0 1 0 5.07 5.88V9.85a7.7 7.7 0 0 0 4.5 1.44V8.02a4.46 4.46 0 0 1-1.68-1.07z"})})]}),u.jsx(Me,{className:"text-[14px] text-[#1A3C34]/80 block",children:"Word of mouth"})]}):a?.type==="seo"?u.jsx("div",{className:"flex flex-col gap-1",children:u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-[14px] text-[#1A3C34]/80",children:"SEO:"}),u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",children:[u.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.76h3.56c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),u.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.56-2.76c-.98.66-2.24 1.05-3.72 1.05-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A10.98 10.98 0 0 0 12 23z",fill:"#34A853"}),u.jsx("path",{d:"M5.84 14.09A6.6 6.6 0 0 1 5.5 12c0-.72.12-1.42.34-2.09V7.07H2.18A10.98 10.98 0 0 0 1 12c0 1.78.42 3.46 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),u.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#000000",children:u.jsx("path",{d:"M22.28 9.37a6.1 6.1 0 0 0-.53-5.04 6.2 6.2 0 0 0-6.69-2.97A6.1 6.1 0 0 0 10.45 0a6.2 6.2 0 0 0-5.9 4.28 6.1 6.1 0 0 0-4.1 2.97 6.2 6.2 0 0 0 .76 7.24 6.1 6.1 0 0 0 .53 5.04 6.2 6.2 0 0 0 6.69 2.97A6.1 6.1 0 0 0 13.04 24a6.2 6.2 0 0 0 5.9-4.28 6.1 6.1 0 0 0 4.1-2.97 6.2 6.2 0 0 0-.76-7.38zM13.04 22.2a4.6 4.6 0 0 1-2.97-1.08l.15-.08 4.93-2.85a.8.8 0 0 0 .41-.7v-6.95l2.08 1.2a.07.07 0 0 1 .04.06v5.76a4.63 4.63 0 0 1-4.64 4.63zM3.6 18.13a4.6 4.6 0 0 1-.55-3.1l.15.09 4.93 2.85a.8.8 0 0 0 .82 0l6.02-3.47v2.41a.08.08 0 0 1-.03.06l-4.98 2.88a4.63 4.63 0 0 1-6.36-1.72zM2.34 7.89a4.6 4.6 0 0 1 2.42-2.03v5.87a.8.8 0 0 0 .4.7l6.02 3.47-2.08 1.2a.08.08 0 0 1-.07 0L4.05 14.22a4.63 4.63 0 0 1-1.7-6.33zm16.59 3.86-6.02-3.47 2.08-1.2a.08.08 0 0 1 .07 0l4.98 2.88a4.63 4.63 0 0 1-.72 8.35v-5.87a.8.8 0 0 0-.4-.7zm2.07-3.14-.15-.09-4.93-2.85a.8.8 0 0 0-.82 0l-6.02 3.47V6.73a.07.07 0 0 1 .03-.06l4.98-2.88a4.63 4.63 0 0 1 6.91 4.82zM8.68 13.47l-2.08-1.2a.07.07 0 0 1-.04-.06V6.45a4.63 4.63 0 0 1 7.6-3.55l-.14.08-4.93 2.85a.8.8 0 0 0-.41.7v6.95zm1.13-2.44 2.68-1.55 2.68 1.55v3.09l-2.68 1.55-2.68-1.55v-3.09z"})}),u.jsx("img",{src:$6e,alt:"Claude",className:"w-4 h-4 rounded object-contain"})]})}):u.jsx(Me,{className:"block",children:a})},r))})]})]},n))})]})]})})]}),u.jsx("div",{className:"mt-3 flex justify-end",children:u.jsx(Me,{as:"p",className:"text-[11px] text-[#2F3E38]/50 italic block",children:"* Pricing subject to change"})})]})})}function wze(){const e=[{label:"TAM · Total Addressable",value:"$461B+",sub:"Global Mental Health Market",width:"100%",bg:"#E5EBE0",barColor:"#7C9885"},{label:"SAM · Serviceable",value:"$2.5B",sub:"U.S. Mental Health Apps Market",width:"80%",bg
5082:"#C9D7C2",barColor:"#5C7565"},{label:"SOM · Obtainable",value:"$4.2M",sub:"35K B2C × $96  ·  500 B2B × $1,800",width:"60%",bg:"#1A3C34",barColor:"#F4A28C",darkText:!0,stage:"Seed Stage"}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsxs("div",{className:"mb-6",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#1A3C34] block leading-tight",children:"The Opportunity"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"Large market, multiple revenue streams"})]}),u.jsx("div",{className:"flex-1 min-h-0 flex flex-col justify-center gap-5 px-8",children:e.map((t,n)=>{const a=t.darkText;return u.jsxs("div",{className:"rounded-2xl shadow-md overflow-hidden flex mx-auto w-full",style:{maxWidth:t.width,backgroundColor:t.bg},children:[u.jsx("div",{className:"w-2 flex-shrink-0",style:{backgroundColor:t.barColor}}),u.jsxs("div",{className:"flex-1 px-8 py-6 flex items-center justify-between gap-6",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Me,{as:"p",className:`text-[14px] font-semibold tracking-[0.15em] uppercase block ${a?"text-[#F4A28C]":"text-[#1A3C34]/60"}`,children:t.label}),t.stage&&u.jsx("span",{className:"text-[12px] font-bold text-white bg-[#F4A28C] px-3 py-1 rounded-full whitespace-nowrap",children:t.stage})]}),u.jsx(Me,{as:"p",className:`text-[16px] mt-1 block leading-tight ${a?"text-white/85":"text-[#1A3C34]/75"}`,children:t.sub})]}),u.jsx(Me,{as:"p",className:`font-serif text-5xl font-bold leading-none block flex-shrink-0 ${a?"text-white":"text-[#1A3C34]"}`,children:t.value})]})]},n)})})]})})}function Sze(){const e=[{name:"Headspace",note:"$69/yr",x:.1,y:.3,color:"#5C7DD6"},{name:"Calm",note:"$70/yr",x:.18,y:.22,color:"#5C7DD6"},{name:"Woebot",note:"FDA breakthrough",x:.22,y:.78,color:"#7C5CD6"},{name:"Ash",note:"AI chatbot (CBT)",x:.28,y:.66,color:"#7C5CD6"},{name:"Nema Health",note:"Trauma · clinician-led",x:.55,y:.46,color:"#5C7DD6"},{name:"Virtual EMDR",note:"Dot following only · no adaptation",x:.7,y:.2,color:"#E08B75"},{name:"EMDR Apps",note:"No adaptation",x:.85,y:.16,color:"#E08B75"},{name:"In-person EMDR",note:"$150–$250 / session",x:.78,y:.32,color:"#7C9885"}],t={name:"Solta AI",note:"Adaptive EMDR-inspired wellness",x:.88,y:.86};return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsxs("div",{className:"mb-3",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"Competition"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"No one is doing what we're building"})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-[auto_1fr] gap-3 items-stretch",children:[u.jsx("div",{className:"flex items-center justify-center",children:u.jsx(Me,{as:"span",className:"text-[12px] font-semibold text-[#2F3E38]/60 tracking-[0.2em] uppercase whitespace-nowrap block",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:"Static · Manual ← → AI-Adaptive"})}),u.jsxs("div",{className:"flex flex-col",children:[u.jsxs("div",{className:"flex-1 relative bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm",children:[u.jsxs("div",{className:"absolute inset-0",children:[u.jsx("div",{className:"absolute left-0 right-0 top-1/2 h-px bg-[#2F3E38]/12"}),u.jsx("div",{className:"absolute top-0 bottom-0 left-1/2 w-px bg-[#2F3E38]/12"})]}),u.jsx("div",{className:"absolute top-3 right-4 text-[11px] font-semibold text-[#7C9885]/70 tracking-wider uppercase",children:"AI × EMDR"}),u.jsx("div",{className:"absolute top-3 left-4 text-[11px] font-semibold text-[#2F3E38]/35 tracking-wider uppercase",children:"AI × Generic"}),u.jsx("div",{className:"absolute bottom-3 left-4 text-[11px] font-semibold text-[#2F3E38]/35 tracking-wider uppercase",children:"Static × Generic"}),u.jsx("div",{className:"absolute bottom-3 right-4 text-[11px] font-semibold text-[#2F3E38]/35 tracking-wider up
5082percase",children:"Static × EMDR"}),u.jsx("div",{className:"absolute w-28 h-28 rounded-full bg-[#F4A28C]/15 border border-[#F4A28C]/40",style:{left:`${t.x*100}%`,top:`${(1-t.y)*100}%`,transform:"translate(-50%, -50%)"}}),e.map((n,a)=>u.jsxs("div",{className:"absolute flex flex-col items-center",style:{left:`${n.x*100}%`,top:`${(1-n.y)*100}%`,transform:"translate(-50%, -50%)"},children:[u.jsx("div",{className:"w-3.5 h-3.5 rounded-full shadow-sm",style:{backgroundColor:n.color,opacity:.85}}),u.jsx("div",{className:"mt-1 text-[12px] font-semibold text-[#2F3E38] leading-tight whitespace-nowrap",children:n.name}),u.jsx("div",{className:"text-[10px] text-[#2F3E38]/55 leading-tight whitespace-nowrap",children:n.note})]},a)),u.jsxs("div",{className:"absolute flex flex-col items-center",style:{left:`${t.x*100}%`,top:`${(1-t.y)*100}%`,transform:"translate(-50%, -50%)"},children:[u.jsx("div",{className:"w-6 h-6 rounded-full bg-[#F4A28C] shadow-md ring-4 ring-[#F4A28C]/20"}),u.jsx("div",{className:"mt-1 text-[14px] font-bold font-serif text-[#1B4D1B] leading-tight whitespace-nowrap",children:t.name}),u.jsx("div",{className:"text-[11px] text-[#2F3E38]/70 leading-tight whitespace-nowrap",children:t.note})]})]}),u.jsx(Me,{as:"p",className:"text-[12px] font-semibold text-[#2F3E38]/60 tracking-[0.2em] uppercase text-center mt-2 block",children:"Generic Wellness ← → EMDR / Trauma"})]})]}),u.jsx("div",{className:"mt-4 bg-[#5C7565] rounded-full py-2.5 px-6 text-center shadow-sm",children:u.jsx(Me,{className:"text-white text-base font-semibold tracking-wide block",children:"We're the only AI-adaptive EMDR product on the market"})})]})})}const kze="2026-02-02T00:00:00Z";function Nze(){const e=new Date(kze),t=new Date;let n=(t.getUTCFullYear()-e.getUTCFullYear())*12+(t.getUTCMonth()-e.getUTCMonth());return t.getUTCDate()<e.getUTCDate()&&(n-=1),Math.max(0,n)}function Cze(){const[e,t]=D.useState(u3);D.useEffect(()=>{window.location.hostname!=="localhost"&&fetch("/.netlify/functions/get-growth-data").then(o=>o.json()).then(o=>{o.success&&o.growth?.length>1&&t(o.growth)}).catch(()=>{})},[]);const n=e[e.length-1],a=n.b2cPaying??n.paying??0,r=n.users>0?Math.round(a/n.users*100):0,s=Nze(),i=[{value:`${r}%`,label:"Conversion to paid"},{value:"$0",label:"Acquisition cost"}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsxs("div",{className:"mb-4",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block leading-tight",children:"Traction"}),u.jsxs(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:[s," ",s===1?"month":"months"," since beta release"]})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-[1.4fr_1fr] gap-6",children:[u.jsx("div",{"data-animated":"",className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm px-6 py-5 h-full flex flex-col [&>div]:flex-1 [&>div]:min-h-0 [&>div]:flex [&>div]:flex-col [&>div]:bg-transparent [&>div]:shadow-none [&>div]:p-0 [&>div]:rounded-none [&_svg]:flex-1 [&_svg]:min-h-0",children:u.jsx(PH,{})}),u.jsxs("div",{className:"grid grid-rows-[auto_1fr_1fr] gap-4",children:[u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm px-5 py-4 flex flex-col items-center text-center",children:[u.jsx(Me,{as:"p",className:"text-[13px] font-semibold text-[#2F3E38]/60 tracking-wide uppercase block",children:"2 B2B contracts"}),u.jsxs("div",{className:"grid grid-cols-2 gap-3 w-full mt-3 items-end",children:[u.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[u.jsx("a",{href:"https://vudy.app/",target:"_blank",rel:"noopener noreferrer","aria-label":"Vudy website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:c0,alt:"Vudy",className:"h-7 max-w-[100px] object-contain"})}),u.jsx(Me,{as:"p",className:"text-[11px] text-[#2F3E38]/70 block",children:"300 seats paid"})]}),u.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[u.jsx("a",{href:"https://www.pinyahta.com/",target:"_blank",rel:"noopener noreferrer","aria-label":"Pinyahta website",className:"inline-flex items-center hover:opacity-80 transition-opacity",children:u.jsx("img",{src:d0,alt:"Pinyahta",className:"h-10 max-w-[120px] object-contain"})}),u.jsx(Me,{as:"p",className:"text-[11px] text-[#2F3E38]/70 block",children:"Pilot signed"})]})]})]}),i.map((o,l)=>u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm px-6 py-4 flex flex-col items-center justify-center text-center",children:[u.jsx(Me,{as:"p",className:"font-serif text-5xl text-[#E08B75] font-bold leading-none block",children:o.value}),u.jsx(Me,{as:"p",className:"text-[13px] font-semibold text-[#2F3E38]/60 tracking-wide uppercase mt-2 block",children:o.label})]},l))]})]}),u.jsx("div",{className:"mt-5 bg-[#5C7565] rounded-full py-2.5 px-6 text-center shadow-sm",children:u.jsx(Me,{className:"text-white text-base font-semibold tracking-wide block",children:"Strong organic pull · Healthy paid conversion · Distribution partners signed"})})]})})}function Eze(){const e=[{label:"Instrument",value:"Capped SAFE"},{label:"Minimum check",value:"$25K"}],t=[{label:"Engineering, R&D",pct:42,color:"#60A5FA",milestone:"2 top-tier Mexico-based engineers (2-for-1 vs. US); iOS, computer vision, CAB + pilot shipped"},{label:"Sales & Marketing",pct:25,color:"#F97316",milestone:"Full-time US growth marketer; paid acquisition, conferences, and content engine live"},{label:"General & Administrative",pct:18,color:"#FBBF24",milestone:"Founder in seat; insurance, accounting, ops stack"},{label:"Legal & Regulatory",pct:15,color:"#8B5CF6",milestone:"Patent + trademark filed; IP assignments complete; regulatory pathway secured"}];return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-6",children:[u.jsxs("div",{className:"mb-3",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#1A3C34] block leading-tight",children:"The Ask"}),u.jsx(Me,{as:"p",className:"font-serif italic text-base text-[#2F3E38]/60 block mt-1",children:"Closing the gap to a 
5082seed-ready company"})]}),u.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-[0.85fr_1.15fr] gap-5",children:[u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm px-6 py-5 flex flex-col",children:[u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center",children:[u.jsx(Me,{as:"p",className:"font-serif text-[96px] leading-none font-bold text-[#1A3C34] block",children:"$1M"}),u.jsx(Me,{as:"p",className:"text-[11px] font-semibold text-[#2F3E38]/55 tracking-[0.18em] uppercase mt-4 block",children:"Pre-seed raise"})]}),u.jsx("div",{className:"my-4 border-t border-[#2F3E38]/10"}),u.jsx("div",{className:"grid grid-cols-2 gap-3",children:e.map((n,a)=>u.jsxs("div",{className:"text-center",children:[u.jsx(Me,{as:"p",className:"text-[10px] font-semibold text-[#2F3E38]/50 tracking-[0.15em] uppercase block leading-tight",children:n.label}),u.jsx(Me,{as:"p",className:"font-serif text-[14px] font-bold text-[#1A3C34] block mt-1 leading-tight",children:n.value})]},a))})]}),u.jsxs("div",{className:"bg-white/70 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm px-6 py-5 flex flex-col",children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[u.jsx(Me,{as:"p",className:"text-[12px] font-semibold text-[#2F3E38]/55 tracking-[0.18em] uppercase block",children:"Use of Funds"}),u.jsx(Me,{as:"p",className:"text-[10px] italic text-[#2F3E38]/55 block",children:"24-month runway · 20% buffer"})]}),u.jsx("div",{className:"h-3 rounded-full overflow-hidden flex border border-[#2F3E38]/10 mb-4",children:t.map((n,a)=>u.jsx("div",{className:"h-full",style:{width:`${n.pct}%`,backgroundColor:n.color}},a))}),u.jsx("div",{className:"flex-1 min-h-0 flex flex-col justify-around",children:t.map((n,a)=>u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx("div",{className:"w-2.5 h-2.5 rounded-full mt-1.5 flex-shrink-0",style:{backgroundColor:n.color}}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[u.jsx(Me,{as:"span",className:"text-[13px] font-semibold text-[#1A3C34] block",children:n.label}),u.jsxs("span",{className:"text-[12px] font-bold text-[#2F3E38]/75 flex-shrink-0",style:{fontVariantNumeric:"tabular-nums"},children:[n.pct,"%"]})]}),u.jsxs(Me,{as:"p",className:"text-[11px] italic text-[#2F3E38]/65 leading-tight mt-0.5 block",children:["→ ",n.milestone]})]})]},a))})]})]}),u.jsxs("div",{className:"mt-3",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[u.jsx(Me,{as:"p",className:"text-[10px] font-semibold text-[#2F3E38]/55 tracking-[0.18em] uppercase whitespace-nowrap block",children:"Post-raise milestones"}),u.jsx("div",{className:"flex-1 h-px bg-[#2F3E38]/15"})]}),u.jsx("div",{className:"grid grid-cols-3 gap-5",children:[{center:!1,content:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"font-semibold text-[#1A3C34]",children:"Month 12-15 MRR:"})," $25K target",u.jsx("br",{}),"$40K stretch"]})},{center:!0,content:u.jsx(u.Fragment,{children:"Phase 2 clinical pilot launched"})},{center:!1,content:u.jsxs(u.Fragment,{children:["Provisional patent filed",u.jsx("br",{}),"2+ enterprise contracts at scale"]})}].map((n,a)=>u.jsxs("div",{className:`flex ${n.center?"items-center":"items-start"} gap-2`,children:[u.jsx("span",{className:`text-[10px] font-bold text-[#1A3C34] bg-[#E5EBE0] rounded-full w-5 h-5 flex items-center justify-center flex-shrink-0 ${n.center?"":"mt-px"}`,children:a+1}),u.jsx(Me,{as:"p",className:"text-[11px] text-[#2F3E38]/80 leading-snug block",children:n.content})]},a))})]}),u.jsx("div",{className:"mt-3",children:u.jsx(Me,{as:"p",className:"font-serif italic text-[11px] text-[#2F3E38]/55 leading-snug text-center block",children:"Founder is technical — ~60% of G&A comp is functionally R&D. Total funding to date: $5K CREATE-X SAFE (No MFN, no discount, no cap)."})})]})})}const Ize=[{name:"Sofia Y. Muller",role:"Founder & CEO",photo:pw,initials:"SM",linkedin:"https://www.linkedin.com/in/sofiamuller/",credentials:[{text:"Brain Health Research",logo:t3},{text:"MS CS, Machine Learning",logo:a3},{text:"Nature Medicine Co-author",logo:n3},{text:"BBA, Finance & Management",logo:rm}]},{name:"Dr. Carlos Castañeda",role:"Clinical Advisor (Co-Founder Track)",photo:hw,initials:"CC",linkedin:"https://www.linkedin.com/in/carlos-casta%C3%B1eda-704/",credentials:[{text:"PhD, Clinical Education",logo:rm},{text:"Experienced Founder",logo:i3},{text:"MA, Mental Health; LPCC, NCC",logo:r3},{text:"BS, Psychology",logo:s3}]}],Tze={role:"Volunteer Clinical Advisor",credentials:[{text:"EMDR Consultant",logo:o3},{text:"Director of Product",logo:l3}]};function Aze({url:e,name:t,size:n=16}){return u.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-[#2F3E38]/30 hover:text-[#0A66C2] transition-colors flex-shrink-0","aria-label":`${t} LinkedIn profile`,children:u.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"
5082currentColor","aria-hidden":"true",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})})}function _ze(){return u.jsx(so,{children:u.jsxs("div",{className:"w-full h-full flex flex-col px-12 py-8",children:[u.jsx(Me,{as:"h2",className:"font-serif text-3xl text-[#2F3E38] block mb-6",children:"About the Team"}),u.jsx("div",{className:"grid grid-cols-2 gap-6 flex-1 min-h-0",children:Ize.map(e=>u.jsx(jze,{member:e},e.name))}),u.jsx("div",{className:"flex justify-center mt-6",children:u.jsx(Dze,{member:Tze})})]})})}function UH({logo:e}){return u.jsx("div",{className:"w-9 h-9 rounded-full bg-white shadow-sm border border-[#2F3E38]/8 flex items-center justify-center flex-shrink-0",children:u.jsx("img",{src:e,alt:"","aria-hidden":"true",className:"max-h-6 max-w-6 object-contain"})})}function jze({member:e}){const[t,n]=D.useState(!1);return u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm p-6 flex flex-col",children:[u.jsxs("div",{className:"flex items-center gap-5",children:[u.jsx("div",{className:"w-32 h-32 rounded-2xl bg-[#7C9885]/15 border border-[#7C9885]/25 flex items-center justify-center overflow-hidden flex-shrink-0 shadow-sm",children:t?u.jsx("span",{className:"font-serif text-4xl text-[#7C9885]",children:e.initials}):u.jsx("img",{src:e.photo,alt:e.name,className:"w-full h-full object-cover",onError:()=>n(!0)})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Me,{as:"h3",className:"font-serif text-2xl text-[#2F3E38] block leading-tight",children:e.name}),e.linkedin&&u.jsx(Aze,{url:e.linkedin,name:e.name,size:16})]}),u.jsx(Me,{as:"p",className:"text-base text-[#F4A28C] font-semibold tracking-wide mt-1 block",children:e.role})]})]}),u.jsx("ul",{className:"mt-5 flex-1 grid grid-cols-2 grid-rows-2 gap-x-4 content-between items-center",children:e.credentials.map((a,r)=>u.jsxs("li",{className:"flex items-center gap-3 text-[14px] text-[#2F3E38]/85 leading-snug",children:[u.jsx(UH,{logo:a.logo}),u.jsx(Me,{className:"block flex-1 font-medium",children:a.text})]},r))})]})}function Dze({member:e}){return u.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-[#2F3E38]/8 shadow-sm py-3 px-5 flex items-center gap-4 max-w-[66%]",children:[u.jsx("div",{className:"w-16 h-16 rounded-xl bg-[#7C9885]/15 border border-[#7C9885]/25 flex items-center justify-center flex-shrink-0 text-[#7C9885]",children:u.jsxs("svg",{className:"w-8 h-8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"9",r:"3.5"}),u.jsx("path",{d:"M5 20c0-3.5 3.1-6 7-6s7 2.5 7 6"})]})}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx(Me,{as:"h3",className:"font-serif text-lg text-[#2F3E38] block leading-tight",children:e.role})}),u.jsx("ul",{className:"flex items-center gap-4 flex-shrink-0",children:e.credentials.map((t,n)=>u.jsxs("li",{className:"flex items-center gap-2.5 text-[13px] text-[#2F3E38]/85 leading-snug",children:[u.jsx(UH,{logo:t.logo}),u.jsx(Me,{className:"block font-medium whitespace-nowrap",children:t.text})]},n))})]})}function J1({label:e,sublabel:t,accent:n,children:a}){return u.jsxs("div",{className:"bg-white rounded-xl border border-[#2F3E38]/8 p-2.5 shadow-sm flex flex-col gap-2",children:[u.jsxs("div",{className:"flex items-start justify-between",children:[u.jsxs("div",{className:"text-left min-w-0 flex-1",children:[u.jsx("p",{className:"text-[12px] font-semibold text-[#2F3E38] leading-tight",children:e}),u.jsx("p",{className:"text-[10px] text-[#2F3E38]/55 leading-tight",children:t})]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full mt-1 flex-shrink-0 animate-pulse",style:{backgroundColor:n}})]}),u.jsx("div",{className:"h-12 w-full flex items-center",children:a})]})}function H2(e,t=2e3){const[n,a]=D.useState(0);return D.useEffect(()=>{const r=setInterval(()=>a(s=>(s+1)%e),t);return()=>clearInterval(r)},[e,t]),n}const KB=[{label:"Happy",color:"#7C9885",value:78,mouth:"M13 22 Q18 26 23 22",leftEye:{cy:16,ry:1.4},rightEye:{cy:16,ry:1.4}},{label:"Sad",color:"#F4A28C",value:64,mouth:"M13 24 Q18 21 23 24",leftEye:{cy:17,ry:1.4},rightEye:{cy:17,ry:1.4}},{label:"Calm",color:"#7C9885",value:52,mouth:"M13 23 Q18 23.5 23 23",leftEye:{cy:16,ry:.6},rightEye:{cy:16,ry:.6}}];function Rze(){const e=H2(KB.length),t=KB[e];return u.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",children:[u.jsx("circle",{cx:"18",cy:"18",r:"13",fill:"#F4A28C",opacity:"0.25"}),u.jsx(qe.ellipse,{cx:"13",rx:"1.4",animate:{cy:t.leftEye.cy,ry:t.leftEye.ry},transition:{duration:.5},fill:"#2F3E38",opacity:"0.7"}),u.jsx(qe.ellipse,{cx:"23",rx:"1.4",animate:{cy:t.rightEye.cy,ry:t.rightEye.ry},transition:{duration:.5},fill:"#2F3E38",opacity:"0.7"}),u.jsx(qe.path,{animate:{d:t.mouth},transition:{duration:.5},fill:"none",stroke:"#2F3E38",strokeWidth:"1.4",strokeLinecap:"round",opacity:"0.7"}),[[10,14],[26,14],[18,11],[18,26],[8,20],[28,20]].map(([n,a],r)=>u.jsx("circle",{cx:n,cy:a,r:"0.8",fill:"#7C9885",opacity:"0.7"},r))]}),u.jsx(qe.div,{className:"absolute inset-x-0 h-px bg-[#7C9885]/70",animate:{top:["10%","85%","10%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center justify-between mb-1",children:[u.jsx(qe.span,{initial:{opacity:0,y:2}
5082,animate:{opacity:1,y:0},className:"text-[9px] font-semibold text-[#2F3E38]",children:t.label},t.label),u.jsxs("span",{className:"text-[8px] text-[#2F3E38]/50",children:[t.value,"%"]})]}),u.jsx("div",{className:"h-1 bg-[#2F3E38]/8 rounded-full overflow-hidden",children:u.jsx(qe.div,{className:"h-full rounded-full",style:{backgroundColor:t.color},animate:{width:`${t.value}%`},transition:{duration:.7,ease:"easeOut"}})})]})]})}const XB=[{label:"Calm tone",color:"#7C9885"},{label:"Anxious tone",color:"#F4A28C"},{label:"Steady tone",color:"#7C9885"}];function Mze(){const e=H2(XB.length),t=XB[e],n=Array.from({length:18});return u.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.jsx("div",{className:"flex items-center gap-[2px] h-9 flex-1",children:n.map((a,r)=>u.jsx(qe.div,{className:"flex-1 rounded-full",style:{backgroundColor:t.color,opacity:.85},animate:{height:["20%",`${30+r*13%60}%`,`${50+r*7%40}%`,"25%"]},transition:{duration:1.2+r%4*.1,repeat:1/0,ease:"easeInOut",delay:r*.04%.8}},r))}),u.jsx(qe.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0},className:"text-[9px] font-semibold text-[#2F3E38] whitespace-nowrap",children:t.label},t.label)]})}const YB=[{label:"Open",color:"#7C9885",lh:[9,13],rh:[15,13],head:5},{label:"Tense",color:"#F4A28C",lh:[11,13],rh:[13,13],head:5.5},{label:"Relaxed",color:"#7C9885",lh:[10,14],rh:[14,14],head:5}];function $ze(){const e=H2(YB.length),t=YB[e];return u.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.jsxs("svg",{width:"32",height:"44",viewBox:"0 0 24 28",className:"flex-shrink-0",children:[u.jsx(qe.circle,{cx:"12",animate:{cy:t.head},transition:{duration:.6},r:"1.7",fill:t.color}),u.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"16",stroke:t.color,strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx(qe.line,{x1:"12",y1:"8",animate:{x2:t.lh[0],y2:t.lh[1]},transition:{duration:.6},stroke:t.color,strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx(qe.line,{x1:"12",y1:"8",animate:{x2:t.rh[0],y2:t.rh[1]},transition:{duration:.6},stroke:t.color,strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"12",y1:"16",x2:"10",y2:"22",stroke:t.color,strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"12",y1:"16",x2:"14",y2:"22",stroke:t.color,strokeWidth:"1.4",strokeLinecap:"round"})]}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx(qe.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0},className:"text-[9px] font-semibold text-[#2F3E38] block",children:t.label},t.label),u.jsx("div",{className:"flex gap-0.5 mt-1",children:[0,1,2].map(n=>u.jsx("div",{className:"h-1 flex-1 rounded-full",style:{backgroundColor:n<=e?t.color:"rgba(47,62,56,0.1)"}},n))})]})]})}const JB=[{word:'"breathing"',tag:"calm",color:"#7C9885"},{word:'"overwhelmed"',tag:"anxious",color:"#F4A28C"},{word:'"safer now"',tag:"regulated",color:"#7C9885"}];function Bze(){const e=H2(JB.length),t=JB[e];return u.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.jsx("div",{className:"relative flex-shrink-0",children:u.jsxs("svg",{width:"36",height:"32",viewBox:"0 0 36 32",children:[u.jsx("path",{d:"M3 4 H33 A2 2 0 0 1 35 6 V20 A2 2 0 0 1 33 22 H14 L8 28 V22 H3 A2 2 0 0 1 1 20 V6 A2 2 0 0 1 3 4 Z",fill:"white",stroke:t.color,strokeWidth:"1.4"}),u.jsx("line",{x1:"6",y1:"10",x2:"30",y2:"10",stroke:t.color,strokeWidth:"1",opacity:"0.4"}),u.jsx("line",{x1:"6",y1:"14",x2:"22",y2:"14",stroke:t.color,strokeWidth:"1",opacity:"0.4"})]})}),u.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[u.jsx(qe.div,{initial:{opacity:0,x:6},animate:{opacity:1,x:0},className:"text-[10px] font-semibold text-[#2F3E38] truncate italic",children:t.word},t.word),u.jsx(qe.span,{initial:{opacity:0}
5082,animate:{opacity:1},className:"inline-block text-[8px] font-semibold uppercase tracking-wider mt-0.5",style:{color:t.color},children:t.tag},t.tag)]})]})}const QB=1024,Fze=576;function Oze({title:e,children:t,hideTitle:n,fullscreen:a}){const r=D.useRef(null),[s,i]=D.useState(1),o=D.useContext(zH);return D.useEffect(()=>{if(!o||!r.current)return;const l=r.current;return o.register(e,l),()=>o.unregister(l)},[o,e]),D.useEffect(()=>{const l=r.current;if(!l)return;const d=()=>{const f=l.offsetWidth;f>0&&i(f/QB)};d();const c=new ResizeObserver(d);return c.observe(l),window.addEventListener("resize",d),()=>{c.disconnect(),window.removeEventListener("resize",d)}},[]),u.jsxs("div",{className:a?"w-full":"w-full max-w-5xl mx-auto",children:[!n&&u.jsx("p",{className:"text-xs uppercase tracking-widest text-[#2F3E38]/50 mb-3 font-medium",children:e}),u.jsx("div",{ref:r,className:`relative w-full bg-white overflow-hidden ${a?"":"rounded-2xl shadow-2xl border border-[#2F3E38]/8"}`,style:{aspectRatio:"16 / 9"},children:u.jsx("div",{style:{width:`${QB}px`,height:`${Fze}px`,transformOrigin:"top left",transform:`scale(${s})`},children:t})})]})}function ZB(e){const t=(e||"").toLowerCase();return t.includes("fraunces")||t.includes("instrument")||t.includes("serif")?"Georgia":t.includes("inter")||t.includes("dm sans")||t.includes("system-ui")?"Calibri":e||"Calibri"}function Lze(e){if(!e)return"000000";const t=e.trim();if(t.startsWith("#")){const r=t.slice(1);if(r.length===3)return(r[0]+r[0]+r[1]+r[1]+r[2]+r[2]).toUpperCase();if(r.length>=6)return r.slice(0,6).toUpperCase()}let n=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n||(n=t.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)/)),!n){const r=t.match(/color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(r){const s=i=>Math.round(parseFloat(i)*255).toString(16).padStart(2,"0");return(s(r[1])+s(r[2])+s(r[3])).toUpperCase()}}if(!n){try{const r=document.createElement("canvas").getContext("2d");r.fillStyle=t;const s=r.fillStyle;if(s.startsWith("#"))return s.slice(1,7).toUpperCase()}catch{}return"000000"}const a=r=>parseInt(r,10).toString(16).padStart(2,"0");return(a(n[1])+a(n[2])+a(n[3])).toUpperCase()}const eF=e=>e*.75;function nw(e,t,n=13.33,a=7.5){return{x:(e.left-t.left)/t.width*n,y:(e.top-t.top)/t.height*a,w:e.width/t.width*n,h:e.height/t.height*a}}async function KN(e,t){const n=e.map(a=>a.style.visibility);e.forEach(a=>{a.style.visibility="hidden"});try{return await t()}finally{e.forEach((a,r)=>{a.style.visibility=n[r]})}}function tF(e){const t=window.getComputedStyle(e);return{text:e.textContent.trim(),rect:e.getBoundingClientRect(),fontSizePx:parseFloat(t.fontSize)||16,fontFamily:(t.fontFamily||"Inter").split(",")[0].replace(/['"]/g,"").trim(),color:Lze(t.color),fontWeight:parseInt(t.fontWeight,10)||400,italic:t.fontStyle==="italic",textAlign:t.textAlign}}function Pze(e){const t=Array.from(e.querySelectorAll("[data-edit]")),n=new Set,a=[];for(const r of t){if(n.has(r))continue;const s=r.getBoundingClientRect(),i=[r];let o=r.nextSibling;for(;o;){if(o.nodeType===Node.TEXT_NODE&&!o.textContent.trim()){o=o.nextSibling;continue}if(o.nodeType===Node.ELEMENT_NODE&&o.hasAttribute?.("data-edit")){const l=o.getBoundingClientRect(),d=Math.min(s.bottom,l.bottom)-Math.max(s.top,l.top),c=Math.min(s.height,l.height);if(c>0&&d/c>.5)i.push(o),o=o.nextSibling;else break}else break}if(i.forEach(l=>n.add(l)),i.length===1)a.push({kind:"single",el:i[0],desc:tF(i[0])});else{const l=i.map(tF),d=Math.min(...l.map(y=>y.rect.left)),c=Math.min(...l.map(y=>y.rect.top)),f=Math.max(...l.map(y=>y.rect.right)),m=Math.max(...l.map(y=>y.rect.bottom)),x={left:d,top:c,right:f,bottom:m,width:f-d,height:m-c};a.push({kind:"runs",runs:l,rect:x,base:l[0]})}}return a}function zze(e,t,n){for(const a of t)if(a.kind==="single"){const r=a.desc;if(r.rect.width===0||r.rect.height===0||!r.text)continue;const s=nw(r.rect,n),i=r.textAlign==="center"||r.textAlign==="-webkit-center"?"center":r.textAlign==="right"?"right":"left";e.addText(r.text,{x:s.x,y:s.y,w:s.w,h:s.h,fontSize:eF(r.fontSizePx),fontFace:ZB(r.fontFamily),color:r.color,bold:r.fontWeight>=600,italic:r.italic,align:i,valign:"middle",margin:0,autoFit:!0,isTextBox:!0})}else{const{rect:r,runs:s,base:i}=a;if(r.width===0||r.height===0)continue;const o=nw(r,n),l=i.textAlign==="center"||i.textAlign==="-webkit-center"?"center":i.textAlign==="right"?"right":"left",d=s.filter(c=>c.text).map(c=>({text:c.text,options:{color:c.color,bold:c.fontWeight>=600,italic:c.italic,fontFace:ZB(c.fontFamily),fontSize:eF(c.fontSizePx)}}));e.addText(d,{x:o.x,y:o.y,w:o.w,h:o.h,align:l,valign:"middle",margin:0,autoFit:!0,isTextBox:!0})}}async function Uze(e,t,{onProgress:n}={}){const a=t.getBoundingClientRect(),r=Pze(t),s=Array.from(t.querySelectorAll("[data-edit]")),i=Array.from(t.querySelectorAll("[data-animated]")),o=i.map(f=>({el:f,rect:f.getBoundingClientRect(),innerEditables:Array.from(f.querySelectorAll("[data-edit]"))}));n?.("background");const l=await KN([...s,...i],()=>window.modernScreenshot.domToPng(t,{backgroundColor:"#FDF5EB",scale:2})),d=[];for(let f=0;f<o.length;f++){const{el:m,rect:x,innerEditables:y}=o[f];n?.(`region ${f+1}/${o.length}`);try{const b=await KN(y,()=>Vze(m,{durationMs:4e3,fps:10,scale:2,onProgress:w=>n?.(`region ${f+1}/${o.length} · ${w}`)}));d.push({rect:x,dataUrl:b})}catch(b){console.warn(`GIF capture failed for region ${f+1}, falling back to PNG:`,b);try{const w=await KN(y,()=>window.modernScreenshot.domToPng(m,{backgroundColor:"#FDF5EB",scale:2}));d.push({rect:x,dataUrl:w})}catch(w){console.error(`PNG fallback also failed for region ${f+1}:`,w)}}}const c=e.addSlide();c.background={data:l};for(const{rect:f,dataUrl:m}of d){const x=nw(f,a);c.addImage({data:m,x:x.x,y:x.y,w:x.w,h:x.h})}return zze(c,r,a),c}let Q1=null;async function Wze(){if(Q1)return Q1;const t=await(await fetch("https://cdn.jsdelivr.net/npm/[email protected]/dist/gif.worker.js")).text();return Q1=URL.createObjectURL(new Blob([t],{type:"application/javascript"})),Q1}async function Vze(e,{durationMs:t=3e3,fps:n=8,scale:a=1.5,onProgress:r}={}){const s=window.modernScreenshot,i=Math.round(t/1e3*n),o=1e3/n,l=[];for(let y=0;y<i;y++){const b=performance.now(),w=await s.domToCanvas(e,{backgroundColor:"#FDF5EB",scale:a});l.push(w),r?.(`frame ${y+1}/${i}`);const S=performance.now()-b,k=Math.max(0,o-S);await new Promise(C=>setTimeout(C,k))}const d=await Wze(),{width:c,height:f}=l[0],m=new window.GIF({workers:4,quality:12,width:c,height:f,workerScript:d});l.forEach(y=>m.addFrame(y,{delay:o,copy:!0})),r?.("encoding…");const x=await new Promise((y,b)=>{m.on("finished",y),m.on("abort",()=>b(new Error("GIF encode aborted"))),m.render()});return new Promise((y,b)=>{const w=new FileReader;w.onloadend=()=>y(w.result),w.onerror=b,w.readAsDataURL(x)})}const Hze={title:{title:"01 — Title",render:()=>u.jsx(L6e,{})},team:{title:"02 — Team",render:()=>u.jsx(_ze,{})},emdr:{title:"03 — What is EMDR",render:()=>u.jsx(Z6e,{})},problem:{title:"04 — The Problem",render:()=>u.jsx(eze,{})},solution:{title:"05 — The Solution",render:()=>u.jsx(P6e,{})},roadmap:{title:"06 — Product Roadmap",render:()=>u.jsx(mze,{})},demo:{title:"07 — Demo (Phase 1 Beta)",render:()=>u.jsx(nze,{})},opportunity:{title:"08 — The Opportunity",render:()=>u.jsx(wze,{})},bizmodel:{title:"09 — Business Model & Distribution",render:()=>u.jsx(vze,{})},competition:{title:"10 — Competition",render:()=>u.jsx(Sze,{})},traction:{title:"11 — Traction",render:()=>u.jsx(Cze,{})},ask:{title:"12 — The Ask",render:()=>u.jsx(Eze,{})}},Gze=["title","team","emdr","problem","solution","roadmap","demo","opportunity","bizmodel","competition","traction","ask"],nF="SoltaAI_Pitch_Deck";function qze(){const e=Us(),[t]=D.useState(()=>localStorage.getItem("investor_access")==="true"),[n,a]=D.useState(!1),[r,s]=D.useState(""),[i,o]=D.useState(0),[l,d]=D.useState(!1),c=Gze.map(P=>Hze[P]),f=D.useRef([]),m=D.useRef({register:(P,j)=>{f.current=[...f.current.filter(G=>
5082G.node!==j),{title:P,node:j}]},unregister:P=>{f.current=f.current.filter(j=>j.node!==P)}}).current,x=c.length,y=()=>o(P=>(P-1+x)%x),b=()=>o(P=>(P+1)%x),w=D.useRef(null),[S,k]=D.useState(!1);D.useEffect(()=>{const P=()=>k(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",P),()=>document.removeEventListener("fullscreenchange",P)},[]);const C=()=>{document.fullscreenElement?document.exitFullscreen?.():w.current?.requestFullscreen?.()};D.useEffect(()=>{const P=j=>{j.target?.isContentEditable||(j.key==="ArrowLeft"?y():j.key==="ArrowRight"?b():(j.key==="f"||j.key==="F")&&C())};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[]),D.useEffect(()=>{t||e("/investors?redirect=/investors/pitch",{replace:!0})},[t,e]),D.useEffect(()=>{t&&(Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js").catch(()=>{}),Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/jspdf.umd.min.js").catch(()=>{}))},[t]);const E=D.useRef(new Map),[T,_]=D.useState(0),[A,$]=D.useState(0);D.useEffect(()=>{if(!t)return;const P={cancelled:!1};return(async()=>{try{await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js");const j=window.modernScreenshot;if(!j?.domToPng||(await new Promise(X=>setTimeout(X,1500)),P.cancelled))return;document.fonts&&document.fonts.ready&&await document.fonts.ready;for(let X=0;f.current.length===0&&X<25;X++){if(P.cancelled)return;await new Promise(J=>setTimeout(J,200))}const G=[...f.current].sort((X,J)=>{const V=X.node.compareDocumentPosition(J.node);return V&Node.DOCUMENT_POSITION_FOLLOWING?-1:V&Node.DOCUMENT_POSITION_PRECEDING?1:0});$(G.length);for(let X=0;X<G.length;X++){if(P.cancelled)return;if(E.current.has(X)){_(V=>Math.max(V,X+1));continue}const{node:J}=G[X];J.classList.add("pdf-export-mode");try{if(P.cancelled)return;const V=await j.domToPng(J,{backgroundColor:"#FDF5EB",scale:1.5});if(P.cancelled)return;const Q=J.getBoundingClientRect(),F=Array.from(J.querySelectorAll("[data-pdf-link]")).map(H=>({url:H.getAttribute("data-pdf-link"),rect:H.getBoundingClientRect()}));E.current.set(X,{pngUrl:V,slideRect:Q,linkEls:F}),_(H=>Math.max(H,X+1))}catch(V){console.warn(`[pitch] pre-capture failed for slide ${X}:`,V)}finally{J.classList.remove("pdf-export-mode")}}}catch(j){console.warn("[pitch] pre-capture aborted:",j)}})(),()=>{P.cancelled=!0}},[t]);const O=async()=>{if(!n){a(!0),s("Loading…");try{await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"),await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/jspdf.umd.min.js");const P=window.modernScreenshot;if(!P||!P.domToPng)throw new Error("modern-screenshot did not load");const j=window.jspdf&&window.jspdf.jsPDF;if(!j)throw new Error("jsPDF did not load");const G=[...f.current].sort((H,B)=>{const Y=H.node.compareDocumentPosition(B.node);return Y&Node.DOCUMENT_POSITION_FOLLOWING?-1:Y&Node.DOCUMENT_POSITION_PRECEDING?1:0});if(G.length===0)throw new Error("No slides registered yet");const X=13.33,J=7.5,V=new j({orientation:"landscape",unit:"in",format:[X,J]});for(let H=0;H<G.length;H++){const{title:B,node:Y}=G[H],ne=`Slide ${H+1} / ${G.length} — ${B}`;s(ne);let ee,U,oe;const pe=E.current.get(H);if(pe)({pngUrl:ee,slideRect:U,linkEls:oe}=pe);else{o(H),await new Promise(he=>setTimeout(he,600)),Y.classList.add("pdf-export-mode"),await new Promise(he=>setTimeout(he,80));try{ee=await P.domToPng(Y,{backgroundColor:"#FDF5EB",scale:1.5}),U=Y.getBoundingClientRect(),oe=Array.from(Y.querySelectorAll("[data-pdf-link]")).map(he=>({url:he.getAttribute("data-pdf-link"),rect:he.getBoundingClientRect()})),E.current.set(H,{pngUrl:ee,slideRect:U,linkEls:oe})}finally{Y.classList.remove("pdf-export-mode")}}H>0&&V.addPage([X,J],"landscape"),V.addImage(ee,"PNG",0,0,X,J,void 0,"FAST");for(const{url:he,rect:xe}of oe){if(!he||xe.width===0||xe.height===0)continue;const Ie=nw(xe,U,X,J);V.link(Ie.x,Ie.y,Ie.w,Ie.h,{url:he})}}s("Building .pdf…");const Q=new Date,F=`${String(Q.getFullYear()).slice(-2)}${String(Q.getMonth()+1).padStart(2,"0")}${String(Q.getDate()).padStart(2,"0")}`;V.save(`${nF}_${F}.pdf`)}
5082catch(P){console.error("PDF export failed:",P),alert(`Export failed: ${P.message||P}`)}finally{a(!1),s("")}}},z=async({animated:P,ext:j="pptx"})=>{if(!n){a(!0),s("Loading…");try{await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"),await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/pptxgen.bundle.js"),P&&await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/gif.js");const G=window.modernScreenshot;if(!G||!G.domToPng)throw new Error("modern-screenshot did not load");const X=[...f.current].sort((H,B)=>{const Y=H.node.compareDocumentPosition(B.node);return Y&Node.DOCUMENT_POSITION_FOLLOWING?-1:Y&Node.DOCUMENT_POSITION_PRECEDING?1:0});if(X.length===0)throw new Error("No slides registered yet");const J=new window.PptxGenJS;J.layout="LAYOUT_WIDE";for(let H=0;H<X.length;H++){const{title:B,node:Y}=X[H],ne=`Slide ${H+1} / ${X.length} — ${B}`;s(ne),o(H),await new Promise(ee=>setTimeout(ee,600)),P&&await Uze(J,Y,{onProgress:ee=>s(`${ne} · ${ee}`)})}const V=new Date,Q=`${String(V.getFullYear()).slice(-2)}${String(V.getMonth()+1).padStart(2,"0")}${String(V.getDate()).padStart(2,"0")}`,F=`${nF}_${Q}${P?"_animated":""}`;if(s(`Building .${j}…`),j==="ppsx"){await Al("https://cdn.jsdelivr.net/npm/[email protected]/dist/jszip.min.js");const H=await J.write({outputType:"arraybuffer"}),B=await window.JSZip.loadAsync(H),Y=B.file("[Content_Types].xml");if(Y){const he=(await Y.async("string")).split("presentation.main+xml").join("slideshow.main+xml");B.file("[Content_Types].xml",he)}const ne=B.file("_rels/.rels");if(ne){const he=(await ne.async("string")).split("presentationml/presentation").join("presentationml/slideshow");B.file("_rels/.rels",he)}const ee=await B.generateAsync({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",compression:"DEFLATE"}),U=URL.createObjectURL(ee),oe=document.createElement("a");oe.href=U,oe.download=`${F}.ppsx`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(U)}else await J.writeFile({fileName:`${F}.pptx`})}catch(G){console.error("PPTX export failed:",G),alert(`Export failed: ${G.message||G}`)}finally{a(!1),s("")}}};return t?u.jsxs(zH.Provider,{value:m,children:[u.jsx("style",{children:`
5083        .demo-pdf-image, .demo-pdf-btn { display: none; }
5084        .pdf-export-mode .demo-video { display: none !important; }
5085        .pdf-export-mode .demo-stage { aspect-ratio: auto !important; background: transparent !important; }
5086        .pdf-export-mode .demo-pdf-image { display: block !important; }
5087        .pdf-export-mode .demo-pdf-btn { display: inline-flex !important; }
5088      `}),u.jsxs("div",{className:"min-h-screen bg-[#F4F1EA] py-12 px-6",children:[u.jsx(vs,{title:"Solta AI — Pitch",description:"Internal pitch deck asset playground.",path:"/investors/pitch",noindex:!0}),u.jsxs("div",{className:"max-w-5xl mx-auto mb-8 text-center",children:[u.jsx("h1",{className:"font-serif text-4xl text-[#2F3E38] mb-2",children:"Pitch Deck"}),u.jsx("p",{className:"text-[#2F3E38]/60 text-sm",children:"Use the arrows or ← → keys to move between slides."})]}),u.jsxs("div",{ref:w,className:S?"fixed inset-0 bg-[#FDF5EB] flex items-center justify-center":"relative max-w-5xl mx-auto",children:[u.jsx("button",{onClick:y,"aria-label":"Previous slide",className:`absolute top-1/2 -translate-y-1/2 z-30 w-12 h-12 rounded-full bg-white shadow-lg border border-[#2F3E38]/10 flex items-center justify-center text-[#2F3E38] hover:bg-[#FDF5EB] hover:scale-105 transition-all ${S?"left-6":"left-2 md:left-0 md:-translate-x-16"}`,children:u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M15 18l-6-6 6-6"})})}),u.jsx("div",{className:"overflow-hidden",style:S?{width:"min(100vw, calc(100vh * 16 / 9))"}:void 0,children:u.jsx("div",{className:"flex transition-transform duration-500 ease-out",style:{transform:`translateX(-${i*100}%)`},children:c.map(P=>u.jsx("div",{className:"w-full flex-shrink-0 px-0",children:u.jsx(Oze,{title:P.title,hideTitle:S,fullscreen:S,children:P.render()})},P.title))})}),u.jsx("button",{onClick:b,"aria-label":"Next slide",className:`absolute top-1/2 -translate-y-1/2 z-30 w-12 h-12 rounded-full bg-white shadow-lg border border-[#2F3E38]/10 flex items-center justify-center text-[#2F3E38] hover:bg-[#FDF5EB] hover:scale-105 transition-all ${S?"right-6":"right-2 md:right-0 md:translate-x-16"}`,children:u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M9 6l6 6-6 6"})})}),S&&u.jsx("button",{onClick:C,"aria-label":"Exit fullscreen",className:"absolute top-6 right-6 z-30 w-10 h-10 rounded-full bg-white/90 shadow-lg border border-[#2F3E38]/10 flex items-center justify-center text-[#2F3E38] hover:bg-white transition-all",children:u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M9 4H5a1 1 0 0 0-1 1v4M15 4h4a1 1 0 0 1 1 1v4M9 20H5a1 1 0 0 1-1-1v-4M15 20h4a1 1 0 0 0 1-1v-4"})})})]}),u.jsxs("div",{className:"flex flex-col items-center mt-6 gap-3",children:[u.jsx("div",{className:"flex items-center gap-2",children:c.map((P,j)=>u.jsx("button",{onClick:()=>o(j),"aria-label":`Go to slide ${j+1}`,className:`h-2 rounded-full transition-all ${j===i?"w-8 bg-[#2F3E38]":"w-2 bg-[#2F3E38]/25 hover:bg-[#2F3E38]/40"}`},P.title))}),u.jsxs("span",{className:"text-xs text-[#2F3E38]/50 tabular-nums",children:[String(i+1).padStart(2,"0")," / ",String(x).padStart(2,"0")]})]}),u.jsx("div",{className:"max-w-5xl mx-auto mt-12 text-center",children:u.jsx("a",{href:"/investors",className:"inline-block text-sm text-[#2F3E38]/60 hover:text-[#2F3E38] underline underline-offset-4",children:"← Back to investor overview"})}),u.jsxs("div",{className:"fixed bottom-6 right-6 z-50 bg-white rounded-2xl shadow-2xl border border-[#2F3E38]/10 p-3 flex items-center gap-2",children:[n&&r&&u.jsx("span",{className:"text-[10px] text-[#2F3E38]/70 max-w-[220px] truncate pl-2",children:r}),!n&&A>0&&u.jsx("span",{title:T<A?"Preparing the PDF in the background. You can click Export now (it'll just take longer) or wait for it to finish.":"All slides cached — Export PDF will be near-instant.",className:`text-[10px] tracking-wide pl-2 ${T<A?"text-[#2F3E38]/55":"text-[#7C9885] font-semibold"}`,children:T<A?`Preparing PDF · ${T}/${A}`:"PDF ready"}),u.jsx("button",{onClick:C,"aria-label":"Toggle fullscreen",title:"Fullscreen (F)",className:"text-xs w-9 h-9 rounded-full bg-white text-[#2F3E38] border border-[#2F3E38]/15 hover:bg-[#FDF5EB] transition-colors font-medium flex items-center justify-center",children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3"})})}),u.jsxs("div",{className:"relative",children:[u.jsxs("button",{onClick:()=>d(P=>!P),disabled:n,className:"text-xs px-4 py-2 rounded-full bg-[#2F3E38] text-white hover:bg-[#7C9885] transition-colors disabled:opacity-50 font-medium inline-flex items-center gap-1.5",children:[u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export",u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M6 9l6 6 6-6"})})]}),l&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>d(!1)}),u.jsx("div",{className:"absolute bottom-full mb-2 right-0 z-50 bg-white rounded-xl shadow-xl border border-[#2F3E38]/10 py-1 min-w-[200px]",children:[{label:"PDF",sub:"Flat slides, clickable links",action:()=>{d(!1),O()}},{label:"PPTX (animated)",sub:"Editable text + GIF animations",action:()=>{d(!1),z({animated:!0})}},{label:"PPSX (animated)",sub:"Opens directly in presentation mode",action:()=>{d(!1),z({animated:!0,ext:"ppsx"})}}].map(P=>u.jsxs("button",{onClick:P.action,disabled:n,className:"w-full text-left px-4 py-2.5 text-sm text-[#2F3E38]/80 hover:bg-[#FDF5EB] transition-colors disabled:opacity-50",children:[u.jsx("div",{className:"font-medium text-[#2F3E38]",children:P.label}),u.jsx("div",{className:"text-[11px] text-[#2F3E38]/50 mt-0.5",children:P.sub})]},P.label))})]})]})]})]})]}):null}const Kze=["First B2B contract: Vudy — 300 seats, $300 paid (+$100 MRR)","1 paying customer became a volunteer clinical advisor (EMDR consultant)","Signed reseller agreement with Francis Sanchinelli for LATAM + India distribution","Completed Georgia Tech's CREATE-X accelerator"],GE="2026-02-05T00:00:00Z",XN=10080*60*1e3,Xze=300*1e3;function WH(){const e=new Date(GE),t=new Date;let n=(t.getUTCFullYear()-e.getUTCFullYear())*12+(t.getUTCMonth()-e.getUTCMonth());return t.getUTCDate()<e.getUTCDate()&&(n-=1),Math.max(0,n)}function Yze(){const e=Date.now(),t=new Date(GE).getTime(),n=[];for(let k=t;k<=e;k+=XN)n.push(k);const a=Math.max(1,n.length),r=[5,14,26,40,54,67,78,87,94,104,115,125,134,142],s=[0,1,2,4,7,10,13,16,22,26,32,36,40,43],i=[0,0,0,0,0,0,0,0,0,0,0,0,0,300,310],o=[0,0,0,0,0,0,0,0,0,0,0,0,0,1,2],l=[0,4,1,3,4,0,0,4.5,5.5,1,5,2,110,9.5],d=[],c=[];for(let k=0;k<a;k++){const C=n[k]??t+k*XN,E=new Date(C).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"}),T=r[Math.min(k,r.length-1)],_=s[Math.min(k,s.length-1)],A=i[Math.min(k,i.length-1)],$=o[Math.min(k,o.length-1)];d.push({weekStart:new Date(C).toISOString(),label:E,totalUsers:T,b2cFree:Math.max(0,T-_),b2cPaying:_,b2bPaying:A,b2bContracts:$});const O=l[Math.min(k,l.length-1)];c.push({weekStart:new Date(C).toISOString(),label:E,netMrrCents:Math.round(O*100),addedMrrCents:Math.round(O*100),churnedMrrCents:0,signups:Math.max(0,(r[Math.min(k,r.length-1)]||0)-(r[Math.max(0,k-1)]||0)),newSubscribers:Math.max(0,(s[Math.min(k,s.length-1)]||0)-(s[Math.max(0,k-1)]||0)),cancellations:0})}const f=d[d.length-1]||{totalUsers:0,b2cPaying:0,b2bPaying:0,b2bContracts:0},m=f.b2bContracts||0,x=(f.b2cPaying||0)+m,y=(f.b2cPaying||0)+(f.b2bPaying||0),b=c.reduce((k,C)=>k+C.netMrrCents,0),w=5,S=18;return{generatedAt:new Date(e).toISOString(),weeksSinceLaunch:Math.max(0,Math.floor((e-t)/XN)),monthsSinceLaunch:WH(),paywallLaunch:GE,metrics:{totalUsers:f.totalUsers,newUsersLast7d:8,newUsersLast30d:31,payingSubscribers:x,activeSubscribers:Math.max(0,x-w),trialingSubscribers:w,mau:42,wau:25,conversionRate:f.totalUsers>0?(f.b2cPaying||0)/f.totalUsers:0,mrrCents:b,arpuCents:y>0?Math.round(b/y):0,totalSeats:y,totalSessions:952,avgSessionsPerMau:3.2,enterpriseSubscribers:m,annualSubscribers:S,annualFraction:x>0?S/x:0},userGrowth:d,mrrGrowth:c,demo:!0}}function mf(e){if(e==null||e===0)return"—";const t=e/100;return t>
5088=1e3?`$${Math.round(t).toLocaleString()}`:`$${t.toFixed(t%1===0?0:2)}`}function pr(e){return e==null||e===0?"—":e.toLocaleString()}function YN(e){return!e||e===0?"—":`${(e*100).toFixed(1)}%`}function aF(e){if(e==null||!isFinite(e))return"—";const t=e*100;return`${t>0?"+":""}${t.toFixed(1)}%`}function Jze(e){if(!Array.isArray(e)||e.length<2)return null;const t=e.length-1,n=new Date(e[t].weekStart),a=new Date(n);a.setDate(a.getDate()-30);let r=0,s=0,i=!1;for(const o of e){const l=new Date(o.weekStart);r+=o.netMrrCents||0,l<=a&&(s+=o.netMrrCents||0,i=!0)}return!i||s<=0?null:{fraction:(r-s)/s,mrrNowCents:r,mrrPriorCents:s}}function Qze(e){return e?new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"—"}function ed({label:e,value:t,sublabel:n,warn:a,details:r}){const s=Array.isArray(r)&&r.length>0;return u.jsxs("div",{className:"group relative bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-4 md:p-6 flex flex-col min-h-[156px] md:min-h-[128px] overflow-hidden transition-shadow hover:shadow-lg",tabIndex:s?0:void 0,children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsx("p",{className:"text-[11px] font-semibold tracking-[0.15em] uppercase text-[#1B4D1B]/55",children:e}),a&&u.jsx("span",{title:a,className:"text-[#F4A28C] text-base leading-none","aria-label":a,children:"⚠"})]}),u.jsx("p",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B] leading-none mt-3",children:t}),n&&u.jsx("p",{className:"text-xs text-[#1B4D1B]/55 mt-auto pt-2",children:n}),s&&u.jsxs("div",{className:"pointer-events-none absolute inset-0 bg-white/98 p-4 md:p-6 flex flex-col opacity-0 translate-y-1 transition-all duration-200 group-hover:opacity-100 group-hover:translate-y-0 group-focus-within:opacity-100 group-focus-within:translate-y-0","aria-hidden":"true",children:[u.jsx("p",{className:"text-[11px] font-semibold tracking-[0.15em] uppercase text-[#1B4D1B]/55",children:e}),u.jsx("div",{className:"mt-2 md:mt-3 space-y-1.5 text-[13px] md:text-sm leading-tight md:leading-normal text-[#1B4D1B]/85",children:r.map((i,o)=>u.jsxs("div",{className:"flex items-baseline justify-between gap-2 md:gap-3",children:[u.jsx("span",{className:"text-[#1B4D1B]/60",children:i.label}),u.jsx("span",{className:"font-semibold tabular-nums whitespace-nowrap",children:i.value})]},o))})]})]})}function Zze({data:e}){const[t,n]=D.useState(null),[a,r]=D.useState(()=>new Set);if(!e||e.length===0)return u.jsx("div",{className:"bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-6 h-full flex items-center justify-center text-sm text-[#1B4D1B]/50",children:"No data yet"});const s=H=>r(B=>{const Y=new Set(B);return Y.has(H)?Y.delete(H):Y.add(H),Y}),i=H=>!a.has(H),o=i("total"),l=i("totalPaying"),d=i("b2cPaying"),c=H=>Math.max(0,(H.totalUsers||0)-(H.b2cPaying||0)),f=H=>H.b2bPaying||0,m=H=>H.b2cPaying||0,x=H=>d?m(H):0,y=H=>x(H)+(l?f(H):0),b=H=>y(H)+(o?c(H):0),w=[];e.forEach(H=>{o&&w.push(b(H)),l&&w.push(y(H)),d&&w.push(x(H))});const S=Math.max(1,...w),k=qE(S),C=520,E=240,T=52,_=20,A=20,$=40,O=C-T-_,z=E-A-$,P=(H,B)=>({x:T+(e.length>1?B/(e.length-1)*O:O/2),y:A+z-H/k*z}),j=e.map((H,B)=>P(b(H),B)),G=e.map((H,B)=>P(y(H),B)),X=e.map((H,B)=>P(x(H),B)),J=H=>H.map((B,Y)=>`${Y===0?"M":"L"}${B.x},${B.y}`).join(" "),V=H=>H.length?`${J(H)} L${H[H.length-1].x},${A+z} L${H[0].x},${A+z} Z`:"",Q=[0,Math.round(k/2),k],F=O/Math.max(1,e.length);return u.jsxs("div",{className:"bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-5 md:p-6 h-full",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("h3",{className:"font-serif text-lg text-[#1B4D1B]",children:"User Growth"}),u.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-[#1B4D1B]/55",children:[u.jsxs("button",{type:"button",onClick:()=>s("total"),"aria-pressed":i("total"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${i("total")?"":"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#F4A28C]"})," + Free"]}),u.jsxs("button",{type:"button",onClick:()=>s("totalPaying"),"aria-pressed":i("totalPaying"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${i("totalPaying")?""
5088:"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#1B4D1B]"})," + B2B paid"]}),u.jsxs("button",{type:"button",onClick:()=>s("b2cPaying"),"aria-pressed":i("b2cPaying"),className:`flex items-center gap-1.5 transition-opacity hover:opacity-80 ${i("b2cPaying")?"":"opacity-40 line-through"}`,children:[u.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#7C9885]"})," B2C Paid"]})]})]}),u.jsxs("svg",{viewBox:`0 0 ${C} ${E}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",onMouseLeave:()=>n(null),children:[u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"tractionTotalGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#F4A28C",stopOpacity:"0.28"}),u.jsx("stop",{offset:"100%",stopColor:"#F4A28C",stopOpacity:"0.02"})]}),u.jsxs("linearGradient",{id:"tractionTotalPayingGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#1B4D1B",stopOpacity:"0.28"}),u.jsx("stop",{offset:"100%",stopColor:"#1B4D1B",stopOpacity:"0.02"})]}),u.jsxs("linearGradient",{id:"tractionB2cPayingGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#7C9885",stopOpacity:"0.28"}),u.jsx("stop",{offset:"100%",stopColor:"#7C9885",stopOpacity:"0.02"})]})]}),Q.map(H=>{const B=A+z-H/k*z;return u.jsxs("g",{children:[u.jsx("line",{x1:T,y1:B,x2:C-_,y2:B,stroke:"#1B4D1B",strokeOpacity:"0.08"}),u.jsx("text",{x:T-8,y:B+4,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.45",fontSize:"10",children:H})]},H)}),i("total")&&u.jsxs(u.Fragment,{children:[u.jsx("path",{d:V(j),fill:"url(#tractionTotalGrad)"}),u.jsx("path",{d:J(j),fill:"none",stroke:"#F4A28C",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),i("totalPaying")&&u.jsxs(u.Fragment,{children:[u.jsx("path",{d:V(G),fill:"url(#tractionTotalPayingGrad)"}),u.jsx("path",{d:J(G),fill:"none",stroke:"#1B4D1B",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),i("b2cPaying")&&u.jsxs(u.Fragment,{children:[u.jsx("path",{d:V(X),fill:"url(#tractionB2cPayingGrad)"}),u.jsx("path",{d:J(X),fill:"none",stroke:"#7C9885",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),t!==null&&u.jsx("line",{x1:j[t].x,y1:A,x2:j[t].x,y2:A+z,stroke:"#1B4D1B",strokeOpacity:"0.18",strokeDasharray:"4 3"}),i("total")&&j.map((H,B)=>u.jsx("circle",{cx:H.x,cy:H.y,r:t===B?5.5:3.5,fill:"#F4A28C",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`t${B}`)),i("totalPaying")&&G.map((H,B)=>u.jsx("circle",{cx:H.x,cy:H.y,r:t===B?5.5:3.5,fill:"#1B4D1B",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`tp${B}`)),i("b2cPaying")&&X.map((H,B)=>u.jsx("circle",{cx:H.x,cy:H.y,r:t===B?5.5:3.5,fill:"#7C9885",stroke:"white",strokeWidth:"2",style:{transition:"r 0.15s"}},`bc${B}`)),e.map((H,B)=>(e.length-1-B)%2===0?u.jsx("text",{x:j[B].x,y:E-12,textAnchor:"middle",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"10",children:H.label},H.label+B):null),t!==null&&(()=>{const H=e[t],B=j[t].x,Y=[o&&{dot:"#F4A28C",label:`${c(H)} Free`},l&&{dot:"#4A7C4A",label:`${f(H)} B2B paid`},d&&{dot:"#7C9885",label:`${m(H)} B2C paid`}].filter(Boolean);if(Y.length===0)return null;const ne=b(H),ee=150,U=38,oe=U+Y.length*16+6,pe=Math.min(Math.max(B-ee/2,T),C-_-ee),he=[i("total")&&j[t].y,i("totalPaying")&&G[t].y,i("b2cPaying")&&X[t].y].filter(_e=>typeof _e=="number"),xe=he.length?Math.min(...he):A,Ie=Math.max(xe-oe-10,4);return u.jsxs("g",{style:{pointerEvents:"none"},children:[u.jsx("rect",{x:pe,y:Ie,width:ee,height:oe,rx:"8",fill:"#1B4D1B",fillOpacity:"0.94"}),u.jsx("text",{x:pe+10,y:Ie+16,fill:"white",fontSize:"11",fontWeight:"600",children:H.label}),u.jsxs("text",{x:pe+10,y:Ie+33,fill:"white",fillOpacity:"0.85",fontSize:"13",fontWeight:"600",children:[ne," total"]}),Y.map((_e,Oe)=>u.jsxs("g",{transform:`translate(${pe+10}, ${Ie+U+14+Oe*16})`,children:[u.jsx("circle",{cx:"4",cy:"-3",r:"3.5",fill:_e.dot}),u.jsx("text",{x:"14",y:"0",fill:"white",fillOpacity:"0.9",fontSize:"10.5",children:_e.label})]},_e.label))]})})(),e.map((H,B)=>u.jsx("rect",{x:j[B].x-F/2,y:A,width:F,height:z,fill:"transparent",onMouseEnter:()=>n(B),onFocus:()=>n(B),style:{cursor:"pointer"}},`hit${B}`))]})]})}function qE(e){if(e<=0)return 0;const t=Math.floor(Math.log10(e)),n=Math.pow(10,t);for(const a of[1,1.2,1.5,2,2.5,3,4,5,6,8,10])if(e<=a*n)return a*n;return 10*n}function rF(e){const t=Math.abs(e),n=e<0?"-":"";return t===0?"$0":t>=1e3?`${n}
5088$${Math.round(t).toLocaleString()}`:`${n}$${t%1===0?t.toFixed(0):t.toFixed(2)}`}function e7e({data:e}){const[t,n]=D.useState(null);if(!e||e.length===0)return u.jsx("div",{className:"bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-6 h-full flex items-center justify-center text-sm text-[#1B4D1B]/50",children:"No data yet"});const a=e.map(G=>G.netMrrCents/100),r=Math.max(0,...a),s=Math.min(0,...a),i=qE(r),o=qE(Math.abs(s)),l=-o,d=i===0&&o===0?1:i,f=d-l||1,m=520,x=240,y=52,b=20,w=20,S=40,k=m-y-b,C=x-w-S,E=w+d/f*C,T=C/f,_=k/Math.max(1,e.length),A=Math.max(10,_*.6),$=[];$.push(0),d>0&&$.push(d),o>0&&$.push(-o),d>0&&$.push(d/2),o>0&&$.push(-o/2);const O=14,z=[];for(const G of $){if(z.some(V=>V===G))continue;const X=w+(d-G)*T;z.some(V=>Math.abs(w+(d-V)*T-X)<O)||z.push(G)}const P=z,j=G=>rF(G/100);return u.jsxs("div",{className:"bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-5 md:p-6 h-full",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("h3",{className:"font-serif text-lg text-[#1B4D1B]",children:"Weekly Net MRR"}),u.jsx("p",{className:"text-[11px] text-[#1B4D1B]/55",children:"Additions − churn"})]}),u.jsxs("svg",{viewBox:`0 0 ${m} ${x}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",onMouseLeave:()=>n(null),children:[P.map(G=>{const X=w+(d-G)*T,J=G===0;return u.jsxs("g",{children:[u.jsx("line",{x1:y,y1:X,x2:m-b,y2:X,stroke:"#1B4D1B",strokeOpacity:J?.18:.08}),u.jsx("text",{x:y-8,y:X+4,textAnchor:"end",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"10",children:rF(G)})]},G)}),e.map((G,X)=>{const J=G.netMrrCents/100,V=y+(X+.5)*_-A/2,Q=Math.abs(J)*T,F=J>=0?E-Q:E,H=J>=0;return u.jsxs("g",{children:[u.jsx("rect",{x:V,y:F,width:A,height:Math.max(Q,J===0?0:1),rx:"3",fill:H?"#F4A28C":"#1B4D1B",fillOpacity:t===X?1:H?.9:.35,style:{transition:"fill-opacity 0.15s"}}),(e.length-1-X)%2===0&&u.jsx("text",{x:V+A/2,y:x-12,textAnchor:"middle",fill:"#1B4D1B",fillOpacity:"0.5",fontSize:"10",children:G.label})]},G.label+X)}),t!==null&&(()=>{const G=e[t],X=y+(t+.5)*_,J=160,V=76,Q=Math.min(Math.max(X-J/2,y),m-b-J),F=4;return u.jsxs("g",{style:{pointerEvents:"none"},children:[u.jsx("rect",{x:Q,y:F,width:J,height:V,rx:"8",fill:"#1B4D1B",fillOpacity:"0.94"}),u.jsx("text",{x:Q+10,y:F+18,fill:"white",fontSize:"11",fontWeight:"600",children:G.label}),u.jsxs("text",{x:Q+10,y:F+34,fill:"white",fillOpacity:"0.9",fontSize:"10.5",children:["Net:",u.jsx("tspan",{fontWeight:"600",dx:"4",children:j(G.netMrrCents)})]}),u.jsxs("text",{x:Q+10,y:F+50,fill:"white",fillOpacity:"0.8",fontSize:"10",children:["+",j(G.addedMrrCents)," added"]}),u.jsxs("text",{x:Q+10,y:F+64,fill:"white",fillOpacity:"0.8",fontSize:"10",children:["−",j(G.churnedMrrCents)," churned"]})]})})(),e.map((G,X)=>u.jsx("rect",{x:y+X*_,y:w,width:_,height:C,fill:"transparent",onMouseEnter:()=>n(X),onFocus:()=>n(X),style:{cursor:"pointer"}},`hit${X}`))]})]})}function sF({name:e,logo:t,href:n,value:a,status:r,note:s}){const i=t?u.jsx("img",{src:t,alt:e,className:"h-7 w-auto object-contain object-left"}):null;return u.jsxs("div",{className:"bg-white rounded-2xl shadow-md border border-[#1B4D1B]/8 p-5 md:p-6",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2 min-h-[28px]",children:[t?n?u.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer","aria-label":`${e} website`,className:"inline-flex items-center hover:opacity-80 transition-opacity",children:i}):i:u.jsx("h4",{className:"font-serif text-xl text-[#1B4D1B]",children:e}),u.jsx("span",{className:"text-[10px] font-semibold tracking-[0.15em] uppercase text-[#7C9885] bg-[#7C9885]/10 rounded-full px-2.5 py-1 shrink-0",children:r})]}),u.jsx("p",{className:"font-serif text-3xl text-[#F4A28C] font-bold mt-2",children:a}),s&&u.jsx("p",{className:"text-sm text-[#1B4D1B]/65 mt-2",children:s})]})}function t7e(){const e=Us(),t=Vl(),[n]=rw(),[a]=D.useState(()=>localStorage.getItem("investor_access")==="true");D.useEffect(()=>{a||e(`/investors?redirect=${encodeURIComponent(t.pathname)}`,{replace:!0})},[a,e,t.pathname]);const r=n.get("print")==="1",s=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),i=n.get("demo")==="1"||s,[o,l]=D.use
5088State(null),[d,c]=D.useState(!1),[f,m]=D.useState(""),[x,y]=D.useState(!1),b=Kze,w=D.useCallback(async({fresh:E=!1}={})=>{if(i){const T=Yze();l(T),typeof window<"u"&&!window.__tractionLogged&&(window.__tractionLogged=!0,console.log("[traction] demo mode — using dummy data"));return}c(!0),m("");try{const _=await fetch(`/.netlify/functions/get-traction${E?"?fresh=1":""}`);if(!_.ok){const $=await _.json().catch(()=>({}));throw new Error($.message||$.error||`Request failed (${_.status})`)}const A=await _.json();l(A),typeof window<"u"&&!window.__tractionLogged&&(window.__tractionLogged=!0,console.log("[traction] loaded:",`users=${A.metrics.totalUsers}`,`paying=${A.metrics.payingSubscribers}`,`mau=${A.metrics.mau}`,`mrr=$${(A.metrics.mrrCents/100).toFixed(2)}`))}catch(T){m(T.message)}finally{c(!1)}},[i]);D.useEffect(()=>{w()},[w]),D.useEffect(()=>{if(r)return;const E=setInterval(()=>w({fresh:!0}),Xze);return()=>clearInterval(E)},[r,w]);const S=async()=>{if(o){y(!0);try{const{generateTractionPdfBlob:E}=await jH(async()=>{const{generateTractionPdfBlob:z}=await import("./TractionPdf-DIpS3vmC.js");return{generateTractionPdfBlob:z}},[]),T=await E({data:o,wins:b,generatedIso:o.generatedAt}),_=URL.createObjectURL(T),A=document.createElement("a");A.href=_;const $=new Date,O=`${String($.getFullYear()).slice(-2)}${String($.getMonth()+1).padStart(2,"0")}${String($.getDate()).padStart(2,"0")}`;A.download=`SoltaAI_Traction_${O}.pdf`,document.body.appendChild(A),A.click(),A.remove(),URL.revokeObjectURL(_)}catch(E){m(`PDF export: ${E.message}`)}finally{y(!1)}}},k=o?.metrics,C=o?.monthsSinceLaunch??WH();return!a||!a?null:u.jsxs("div",{className:`min-h-screen bg-[#FAF3E8] text-[#1B4D1B] font-sans ${r?"print-mode":""}`,children:[u.jsx(vs,{title:"Solta AI — Traction",description:"Live traction dashboard for Solta AI. Pulled from Stripe and Supabase.",path:"/investors/traction",noindex:!0}),u.jsx("style",{children:`
5089        .print-mode .no-print { display: none !important; }
5090        @media print {
5091          .no-print { display: none !important; }
5092        }
5093      `}),u.jsxs("main",{id:"main-content",className:"max-w-6xl mx-auto px-6 py-10 md:py-14","data-traction-ready":o?"true":"false",children:[u.jsx("a",{href:"/investors",className:"no-print inline-block text-sm text-[#1B4D1B]/60 hover:text-[#F4A28C] underline underline-offset-4 mb-4",children:"← Back to investor overview"}),u.jsxs("header",{className:"flex items-start justify-between gap-6 flex-wrap mb-8",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"font-serif text-4xl md:text-5xl text-[#1B4D1B] leading-tight",children:["Solta",u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})," · Traction"]}),u.jsxs("p",{className:"mt-2 text-[#1B4D1B]/65 text-sm md:text-base",children:[C," ",C===1?"month":"months"," post-paywall launch · $0 paid acquisition ·"," ",u.jsxs("span",{className:"text-[#1B4D1B]/55",children:["Last updated ",Qze(o?.generatedAt)]})]}),i&&u.jsx("p",{className:"mt-2 text-[10px] font-semibold tracking-[0.2em] uppercase text-[#F4A28C]",children:"Demo data · not live"})]}),u.jsxs("div",{className:"flex items-center gap-3 no-print",children:[u.jsx("button",{onClick:()=>w({fresh:!0}),disabled:d,className:"px-4 py-2 text-sm text-[#1B4D1B] bg-white border border-[#1B4D1B]/15 hover:bg-[#1B4D1B]/5 rounded-full transition-colors disabled:opacity-50",children:d?"Refreshing…":"Refresh"}),u.jsx("button",{onClick:S,disabled:x||!o,className:"px-5 py-2 text-sm text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md transition-colors disabled:opacity-50",children:x?"Generating PDF…":"Download as PDF"})]})]}),f&&u.jsxs("div",{className:"mb-6 bg-white border border-[#F4A28C]/40 rounded-xl p-4 text-sm text-[#1B4D1B]",children:[u.jsx("p",{className:"font-semibold text-[#F4A28C]",children:"Error loading live data"}),u.jsx("p",{className:"mt-1 text-[#1B4D1B]/75",children:f})]}),!o&&!f&&u.jsx("div",{className:"py-20 text-center text-[#1B4D1B]/60",children:"Loading live metrics…"}),k&&(()=>{const E=Jze(o?.mrrGrowth),T=Math.max(0,(k.payingSubscribers||0)-(k.enterpriseSubscribers||0)),_=Math.max(0,(k.totalSeats||0)-T),A=(k.totalUsers||0)+_,$=k.totalUsers>0?T/k.totalUsers:0;return u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"grid md:grid-cols-2 gap-5 md:gap-6 mb-10",children:[u.jsx(Zze,{data:o.userGrowth}),u.jsx(e7e,{data:o.mrrGrowth})]}),u.jsxs("section",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 md:gap-4 mb-10",children:[u.jsx(ed,{label:"Total Users",value:pr(A),sublabel:`${pr(k.totalUsers)}
5093 B2C · ${pr(_)} B2B`,details:[{label:"B2C signups",value:pr(k.totalUsers)},{label:"B2B seats",value:pr(_)},{label:"New B2C, 30 days",value:pr(k.newUsersLast30d)}]}),u.jsx(ed,{label:"Paying",value:pr(k.totalSeats),sublabel:`${pr(T)} B2C · ${pr(_)} B2B`,details:[{label:"B2C paid",value:pr(T)},{label:"B2B seats",value:pr(_)},{label:"ARPU /seat",value:mf(k.arpuCents)}]}),u.jsx(ed,{label:"MRR",value:mf(k.mrrCents),details:[{label:"Paid seats",value:pr(k.totalSeats)},{label:"ARPU /seat",value:mf(k.arpuCents)},{label:"Annualized",value:mf(k.mrrCents*12)}]}),u.jsx(ed,{label:"MRR Growth",value:E?aF(E.fraction):"—",sublabel:"Month over month",details:E?[{label:"MRR today",value:mf(E.mrrNowCents)},{label:"MRR 30 days ago",value:mf(E.mrrPriorCents)},{label:"Change",value:aF(E.fraction)}]:[{label:"Status",value:"Insufficient history"}]})]}),u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"Direct to consumer"}),u.jsxs("section",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 md:gap-4 mb-10",children:[u.jsx(ed,{label:"% Annual",value:k.payingSubscribers>0?`${Math.round((k.annualFraction||0)*100)}%`:"—",sublabel:"Paying subs on annual plan",details:[{label:"Annual",value:pr(k.annualSubscribers)},{label:"Monthly",value:pr(Math.max(0,(k.payingSubscribers||0)-(k.annualSubscribers||0)))},{label:"Total contracts",value:pr(k.payingSubscribers)}]}),u.jsx(ed,{label:"Monthly Active",value:pr(k.mau),sublabel:"Signed in, last 30 days",details:[{label:"Active, 7 days",value:pr(k.wau)},{label:"Active, 30 days",value:pr(k.mau)},{label:"% of B2C",value:k.totalUsers>0?YN(k.mau/k.totalUsers):"—"}]}),u.jsx(ed,{label:"Conversion",value:YN($),sublabel:"B2C paid / B2C signups",details:[{label:"B2C paid",value:pr(T)},{label:"B2C signups",value:pr(k.totalUsers)},{label:"Ratio",value:YN($)}]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"B2B Pipeline"}),u.jsxs("div",{className:"grid md:grid-cols-2 gap-4 md:gap-5",children:[u.jsx(sF,{name:"Vudy",logo:c0,href:"https://vudy.app/",value:"$100/mo",status:"paying",note:"First B2B contract · 300 seats · $300 paid"}),u.jsx(sF,{name:"Pinyahta",logo:d0,href:"https://www.pinyahta.com/",value:"Commission",status:"signed",note:"Marketplace commission model"})]})]}),b.length>0&&u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"font-serif text-2xl text-[#1B4D1B] mb-4",children:"Qualitative Wins"}),u.jsx("div",{className:"grid md:grid-cols-2 gap-3",children:b.map((O,z)=>u.jsxs("div",{className:"bg-white border border-[#1B4D1B]/10 rounded-xl p-4 text-sm text-[#1B4D1B]/85 flex gap-3",children:[u.jsx("span",{className:"text-[#F4A28C] font-bold leading-none",children:"·"}),u.jsx("span",{children:O})]},z))})]})]})})(),u.jsxs("footer",{className:"mt-14 pt-6 border-t border-[#1B4D1B]/10 flex items-center justify-between text-xs text-[#1B4D1B]/55 flex-wrap gap-2",children:[u.jsx("a",{href:"mailto:[email protected]",className:"hover:text-[#F4A28C]",children:"[email protected]"}),u.jsx("span",{className:"italic",children:"Data pulled live from Stripe and Supabase. Not a forecast."}),u.jsx("span",{children:"SoltaAI.com"})]})]})]})}const kf=816,hv=1056;function iF(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return t();const a=document.createElement("script");a.src=e,a.onload=()=>t(),a.onerror=()=>n(new Error(`Failed to load ${e}`)),document.head.appendChild(a)})}const n7e=[{label:"Target raise",value:"$1M"},{label:"Maximum raise",value:"$1.5M"},{label:"Valuation cap",value:"$15M post-money"},{label:"Minimum check",value:"$25K"},{label:"Round type",value:"Institutional pre-seed"},{label:"Instrument",value:"Post-money SAFE"},{label:"Close type",value:"Rolling"},{label:"Conversion",value:"Next priced round"}],a7e=[{holder:"Sofia Muller (Common)",shares:"9,000,000",pct:"90.0%"},{holder:"Option Pool (reserved)",shares:"1,000,000",pct:"10.0%"}],r7e="10,000,000",s7e=[{title:"Cap-only structure",body:"Each SAFE converts to equity at the lower of the $15M post-money cap or the next round's price — locking the maximum effective valuation for investors at this round."},{title:"Document",body:"Standard YC post-money SAFE template, cap-only. No side letters or custom modifications; all investors in this round receive identical terms."}];function i7e({versionDate:e}){return u.jsx("div",{className:"relative",style:{width:kf,height:hv,background:"linear-gradient(135deg, #FAF3E8 0%, #F4F1EA 100%)",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",color:"#1B4D1B"},children:u.jsxs("div",{className:"w-full h-full flex flex-col",style:{padding:"44px 52px"},children:[u.jsxs("div",{className:"flex items-start justify-between pb-5 border-b border-[#1B4D1B]/15",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"font-serif leading-none whitespace-nowrap",style:{fontSize:48},children:[u.jsx("span",{className:"text-[#1B4D1B]",children:"Solta"}),u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx("p",{className:"font-serif italic text-[#1B4D1B]/70 mt-2 whitespace-nowrap",style:{fontSize:16},children:"Pre-Seed Round · SAFE Terms"})]}),u.jsxs("div",{className:"text-right flex-shrink-0",children:[u.jsx("p",{className:"font-semibold tracking-[0.18em] uppercase whitespace-nowrap text-[#1B4D1B]/50",style:{fontSize:9},children:"Version"}),u.jsx("p",{className:"font-serif text-[#1B4D1B]/80 mt-1 whitespace-nowrap",style:{fontSize:15},children:e})]})]}),u.jsxs("div",{className:"mt-6",children:[u.jsx("h2",{className:"font-serif text-[#1B4D1B] mb-3",style:{fontSize:22},children:"The Round"}),u.jsx("div",{className:"bg-white/70 rounded-2xl border border-[#1B4D1B]/10 px-6 py-5 shadow-sm grid grid-cols-4 gap-x-5 gap-y-5",children:n7e.map(t=>u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]/55 tracking-[0.14em] uppercase whitespace-nowrap",style:{fontSize:9},children:t.label}),u.jsx("p",{className:"font-serif font-bold text-[#1B4D1B] mt-1",style:{fontSize:17,lineHeight:1.15},children:t.value})]},t.label))})]}),u.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-5 flex-1 min-h-0",children:[u.jsxs("div",{className:"bg-white/70 rounded-2xl border border-[#1B4D1B]/10 px-6 py-5 shadow-sm flex flex-col",children:[u.jsx("h2",{className:"font-serif text-[#1B4D1B] mb-4",style:{fontSize:22},children:"SAFE Terms"}),u.jsx("div",{className:"flex flex-col gap-5",children:s7e.map(t=>u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]",style:{fontSize:14},children:t.title}),u.jsx("p",{className:"text-[#1B4D1B]/80 mt-1.5",style:{fontSize:12,lineHeight:1.5},children:t.body})]},t.title))})]}),u.jsxs("div",{className:"bg-white/70 rounded-2xl border border-[#1B4D1B]/10 px-6 py-5 shadow-sm flex flex-col",children:[u.jsx("h2",{className:"font-serif text-[#1B4D1B] mb-4",style:{fontSize:22},children:"Capitalization"}),u.jsxs("div",{children:[u.jsxs("div",{className:"grid gap-2 px-2 py-1.5 text-[#1B4D1B]/55 font-semibold tracking-[0.14em] uppercase",style:{fontSize:9,gridTemplateColumns:"1fr auto auto"},children:[u.jsx("span",{children:"Holder"}),u.jsx("span",{className:"text-right",children:"Shares"}),u.jsx("span",{className:"text-right",style:{minWidth:48},children:"%"})]}),u.jsx("div",{className:"space-y-1.5 mt-1",children:a7e.map(t=>u.jsxs("div",{className:"grid gap-2 px-2 py-2.5 bg-white rounded-md border border-[#1B4D1B]/8 items-center",style:{fontSize:12,gridTemplateColumns:"1fr auto auto"},children:[u.jsx("span",{className:"font-medium text-[#1B4D1B] whitespace-nowrap",children:t.holder}),u.jsx("span",{className:"text-right text-[#1B4D1B]/80 whitespace-nowrap",style:{fontVariantNumeric:"tabular-nums"},children:t.shares}),u.jsx("span",{className:"text-right font-bold text-[#1B4D1B] whitespace-nowrap",style:{minWidth:48},children:t.pct})]},t.holder))}),u.jsxs("div",{className:"grid gap-2 px-2 pt-2.5 mt-2 border-t border-[#1B4D1B]/15 text-[#1B4D1B] font-semibold",style:{fontSize:12,gridTemplateColumns:"1fr auto auto"},children:[u.jsx("span",{children:"Total issued + reserved"}),u.jsx("span",{className:"text-right whitespace-nowrap",style:{fontVariantNumeric:"tabular-nums"},children:r7e}),u.jsx("span",{className:"text-right",style:{minWidth:48},children:"100%"})]})]}),u.jsxs("div",{className:"mt-5 pt-3 border-t border-[#1B4D1B]/10",children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]/55 tracking-[0.14em] uppercase whitespace-nowrap",style:{fontSize:9},children:"Outstanding SAFE"}),u.jsx("p",{className:"text-[#1B4D1B]/80 mt-1",style:{fontSize:12,lineHeight:1.5},children:"$5K CREATE-X (Georgia Tech) — no MFN, no discount, no cap. Converts at next priced round."})]}),u.jsxs("div",{className:"mt-4 pt-3 border-t border-[#1B4D1B]/10",children:[u.jsx("p",{className:"font-semibold text-[#1B4D1B]/55 tracking-[0.14em] uppercase whitespace-nowrap",style:{fontSize:9},children:"Founder vesting"}),u.jsx("p",{className:"text-[#1B4D1B]/80 mt-1",style:{fontSize:12,lineHeight:1.5},children:"4-year vesting with 1-year cliff. Commencement date October 21, 2025."})]}),u.jsx("p",{className:"italic text-[#1B4D1B]/55 mt-auto pt-3",style:{fontSize:10,lineHeight:1.4},children:"Clean cap table: founder + reserved option pool only."})]})]}),u.jsxs("div",{className:"mt-5 pt-4 border-t border-[#1B4D1B]/15",children:[u.jsxs("div",{className:"flex items-end justify-between gap-4",children:[u.jsx("p",{className:"font-serif italic text-[#1B4D1B]/85 whitespace-nowrap",style:{fontSize:16},children:"[email protected]"}),u.jsx("p",{className:"font-serif text-[#1B4D1B]/60 whitespace-nowrap",style:{fontSize:13},children:"SoltaAI.com"})]}),u.jsx("p",{className:"italic text-[#1B4D1B]/45 mt-2.5",style:{fontSize:9,lineHeight:1.45},children:"Not an offer to sell securities. Provided for informational purposes only. Investment requires execution of the standard YC post-money SAFE template (cap-only). All figures and timelines are projections and subject to change."})]})]})})}function o7e(){const e=Us(),t=Vl(),[n]=D.useState(()=>localStorage.getItem("investor_access")==="true");D.useEffect(()=>{n||e(`/investors?redirect=${encodeURIComponent(t.pathname)}`,{replace:!0})},[n,e,t.pathname]);const a=D.useRef(null),[r,s]=D.useState(1),[i,o]=D.useState(!1),[l,d]=D.useState(""),c=new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"});D.useEffect(()=>{const m=()=>{const x=window.innerWidth,y=Math.min(x-32,kf);s(y/kf)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const f=async()=>
5093{if(!(i||!a.current)){o(!0),d("Loading…");try{await iF("https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"),await iF("https://cdn.jsdelivr.net/npm/[email protected]/dist/jspdf.umd.min.js");const m=window.modernScreenshot,x=window.jspdf&&window.jspdf.jsPDF;if(!m?.domToPng||!x)throw new Error("PDF libraries did not load");document.fonts&&document.fonts.ready&&await document.fonts.ready,d("Rendering page…");const y=await m.domToPng(a.current,{backgroundColor:"#FAF3E8",scale:2,width:kf,height:hv});d("Building PDF…");const b=new x({orientation:"portrait",unit:"in",format:"letter"});b.addImage(y,"PNG",0,0,8.5,11,void 0,"FAST");const w=new Date,S=`${String(w.getFullYear()).slice(-2)}${String(w.getMonth()+1).padStart(2,"0")}${String(w.getDate()).padStart(2,"0")}`;b.save(`SoltaAI_SAFE_Terms_${S}.pdf`),console.log("[safe-terms] exported",{version:c,targetRaise:"$1M",maximumRaise:"$1.5M",cap:"$15M post-money",minimumCheck:"$25K",instrument:"Post-money SAFE (cap-only)",targetClose:"Mid-Sep – mid-Oct 2026"})}catch(m){console.error("PDF export failed:",m),alert(`Export failed: ${m.message||m}`)}finally{o(!1),d("")}}};return n?u.jsxs("div",{className:"min-h-screen bg-[#F4F1EA] py-6 px-4 overflow-x-hidden",children:[u.jsx(vs,{title:"Solta AI — SAFE Terms",description:"Investor SAFE terms for Solta AI institutional pre-seed.",path:"/investors/safe",noindex:!0}),u.jsxs("div",{className:"max-w-3xl mx-auto mb-5 flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-serif text-xl md:text-2xl text-[#1B4D1B]",children:"SAFE Terms"}),u.jsx("p",{className:"text-xs md:text-sm text-[#1B4D1B]/60",children:"US Letter (8.5 × 11 in), portrait."}),u.jsxs("p",{className:"text-[11px] text-[#1B4D1B]/50 md:hidden mt-1",children:["Preview below scales to fit your screen — tap ",u.jsx("b",{children:"Export PDF"})," for a full-size readable version."]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[i&&u.jsx("span",{className:"text-xs text-[#1B4D1B]/70",children:l}),u.jsx("button",{onClick:f,disabled:i,className:"px-4 py-2 bg-[#1B4D1B] hover:bg-[#7C9885] disabled:opacity-50 text-white rounded-full text-sm font-medium tracking-wide transition-colors",children:i?"Exporting…":"Export PDF"})]})]}),u.jsx("div",{className:"max-w-3xl mx-auto",children:u.jsx("div",{style:{width:kf*r,height:hv*r},className:"overflow-hidden mx-auto shadow-xl rounded-md",children:u.jsx("div",{style:{transform:`scale(${r})`,transformOrigin:"top left",width:kf,height:hv},className:"bg-[#FAF3E8]",children:u.jsx("div",{ref:a,children:u.jsx(i7e,{versionDate:c})})})})})]}):null}function l7e(){return u.jsxs("div",{className:"min-h-screen bg-[#FAF3E8] flex flex-col",children:[u.jsx(vs,{title:"Page Not Found – Solta AI",description:"The page you're looking for doesn't exist. Head back home or get in touch with us.",path:"/404",noindex:!0}),u.jsx(Vs,{showJoinButton:!1}),u.jsx("main",{className:"flex-1 pt-24 flex items-center justify-center",children:u.jsx("section",{className:"w-full px-6 py-16 md:py-24",children:u.jsxs(qe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"max-w-2xl mx-auto bg-white/50 rounded-lg p-10 md:p-14 text-center",children:[u.jsx("p",{className:"text-sm md:text-base font-medium tracking-[0.2em] uppercase text-[#1B4D1B]/70",children:"Error 404"}),u.jsx("h1",{className:"mt-4 text-5xl md:text-7xl font-light text-[#1B4D1B]",children:"Page not found"}),u.jsx("p",{className:"mt-6 text-base md:text-lg text-[#1B4D1B]/80 leading-relaxed",children:"The page you're looking for doesn't exist or may have moved. Let's get you back on track."}),u.jsxs("div",{className:"mt-10 flex flex-col sm:flex-row gap-3 justify-center",children:[u.jsx(fv,{to:"/",className:"inline-block px-8 py-4 text-base font-medium text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md transition-colors tracking-wide",children:"Back to home"}),u.jsx(fv,{to:"/contact",className:"inline-block px-8 py-4 text-base font-medium text-[#1B4D1B] border border-[#1B4D1B]/30 hover:border-[#1B4D1B] rounded-full transition-colors tracking-wide",children:"Contact us"})]})]})})}),u.jsx(ui,{})]})}function u7e(){const{t:e}=Ws(),t=D.useRef(null),n=D.useRef(null),[a,r]=D.useState(!1),s=D.useRef(null);D.useEffect(()=>(s.current=setTimeout(()=>r(!0),5250),()=>clearTimeout(s.current)),[]);const i=l=>{s.current&&(clearTimeout(s.current),s.current=null),r(l)};D.useEffect(()=>{const l=t.current,d=n.current;if(!l||!d)return;const c=80;let f=d.offsetWidth-c,m=document.getElementById("hero-dot-keyframes");m||(m=document.createElement("style"),m.id="hero-dot-keyframes",document.head.appendChild(m)),m.textContent=`
5094      @keyframes heroDotSwing {
5095        0%, 100% { transform: translateY(-50%) translateX(0); }
5096        50% { transform: translateY(-50%) translateX(${f}px); }
5097      }
5098    `,l.style.animationName="heroDotSwing",l.style.animationDuration="6s",l.style.animationTimingFunction="ease-in-out",l.style.animationIterationCount="infinite";const x=new ResizeObserver(()=>{const y=d.offsetWidth-c;m&&(m.textContent=`
5099          @keyframes heroDotSwing {
5100            0%, 100% { transform: translateY(-50%) translateX(0); }
5101            50% { transform: translateY(-50%) translateX(${y}px); }
5102          }
5103        `)});return x.observe(d),()=>{x.disconnect(),l.style.animation="none"}},[]);const o={"@context":"https://schema.org","@type":"SoftwareApplication",name:"Solta AI",applicationCategory:"HealthApplication",description:e("home.seo.jsonLdDescription"),url:"https://soltaai.com",offers:{"@type":"Offer",price:"1.00",priceCurrency:"USD",description:e("home.seo.jsonLdOfferDescription")},operatingSystem:"Web"};return u.jsxs("div",{className:"relative bg-[#FAF3E8] text-[#7C9885] font-sans overflow-x-hidden selection:bg-[#F4A28C]/40",children:[u.jsx(vs,{title:e("home.seo.title"),description:e("home.seo.description"),path:"/",jsonLd:o}),u.jsx("div",{className:"absolute -top-24 -left-24 -z-10 w-80 h-80 bg-[#7C9885]/20 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute bottom-0 right-0 -z-10 w-[28rem] h-[28rem] bg-[#F4A28C]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx(Vs,{}),u.jsxs("main",{id:"main-content",className:"relative overflow-hidden bg-[#FAF3E8]",children:[u.jsx("div",{className:"absolute -top-24 -left-24 w-80 h-80 bg-[#7C9885]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute top-[40vh] right-0 w-[28rem] h-[28rem] bg-[#F4A28C]/30 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute top-[120vh] -left-20 w-[24rem] h-[24rem] bg-[#F4A28C]/20 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsx("div",{className:"absolute top-[140vh] -right-24 w-80 h-80 bg-[#7C9885]/20 rounded-full blur-3xl pointer-events-none","aria-hidden":"true"}),u.jsxs("section",{ref:n,className:"relative min-h-screen flex items-center justify-center pt-20 pb-12","aria-label":e("a11y.hero"),children:[u.jsxs("div",{className:"relative z-10 w-full flex flex-col items-center text-center px-6",children:[u.jsx("div",{className:"relative w-full max-w-6xl mx-auto md:min-
5103h-[500px]",children:u.jsx(CI,{mode:"wait",children:a?u.jsx(qe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.9,ease:"easeInOut"},className:"md:absolute md:inset-0 flex flex-col items-center justify-center",children:u.jsx(d7e,{})},"howitworks"):u.jsxs(qe.div,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:{duration:.9,ease:"easeInOut"},className:"min-h-[400px] md:absolute md:inset-0 md:min-h-0 flex flex-col items-center justify-center",children:[u.jsxs(qe.h1,{initial:{opacity:0,y:100},animate:{opacity:1,y:0},transition:{duration:1,ease:"easeOut"},className:"text-6xl md:text-8xl lg:text-9xl font-serif tracking-wider text-[#1B4D1B] mb-6 relative",children:["Solta",u.jsx("span",{className:"text-[#F4A28C]",children:"AI"})]}),u.jsx(qe.p,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:1,delay:.3,ease:"easeOut"},className:"text-xl md:text-2xl lg:text-3xl text-[#1B4D1B] font-light tracking-wide",children:e("home.tagline")}),u.jsx(qe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:1,delay:.6,ease:"easeOut"},className:"mt-2",children:u.jsx("span",{className:"text-base md:text-lg text-[#1B4D1B] font-serif italic tracking-widest",style:{backgroundColor:"rgba(124, 152, 133, 0.1)",padding:"2px 8px",borderRadius:"4px"},children:e("home.emdrInspired")})})]},"splash")})}),u.jsx(qe.a,{href:"/bls",initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:1,delay:.6,ease:"easeOut"},className:"mt-8 inline-block px-8 py-4 text-lg font-medium text-white bg-[#7C9885] hover:bg-[#F4A28C] hover:text-[#1B4D1B] rounded-full shadow-md transition-colors tracking-wide",children:e("home.cta")}),u.jsx(qe.div,{initial:{opacity:0}
5103,animate:{opacity:1},transition:{duration:1,delay:1.2,ease:"easeOut"},className:"mt-5 flex items-center justify-center gap-2",role:"tablist","aria-label":e("a11y.heroView"),children:[{active:!a,label:e("a11y.showIntro"),target:!1},{active:a,label:e("a11y.showHowItWorks"),target:!0}].map((l,d)=>u.jsx("button",{role:"tab","aria-selected":l.active,"aria-label":l.label,onClick:()=>i(l.target),className:`h-2 rounded-full transition-all ${l.active?"w-5 bg-[#7C9885]":"w-2 bg-[#7C9885]/30 hover:bg-[#7C9885]/50"}`},d))})]}),u.jsx(qe.div,{ref:t,className:"absolute w-20 h-20 bg-[#7C9885] rounded-full shadow-lg pointer-events-none",style:{left:0,top:"calc(50% - 60px)",transform:"translateY(-50%)"},animate:{opacity:a?0:.8},transition:{duration:2.2,ease:"easeOut"}})]})]}),u.jsx(ui,{})]})}function c7e({url:e}){return D.useEffect(()=>{window.location.replace(e)},[e]),null}function d7e(){const{t:e}=Ws();return u.jsxs("div",{className:"w-full text-center space-y-20 md:space-y-24 pt-12 md:pt-16 pb-8 md:pb-12",children:[u.jsxs("h2",{className:"font-serif text-3xl md:text-4xl text-[#1B4D1B]",children:[e("home.howHeading"),[0,1,2].map(t=>u.jsx(qe.span,{initial:{opacity:0}
5103,animate:{opacity:1},transition:{duration:.6,delay:.7+t*.6,ease:"easeOut"},children:"."},t))]}),u.jsxs("div",{className:"grid md:grid-cols-3 gap-10",children:[u.jsxs("div",{className:"space-y-4 text-center",children:[u.jsx("div",{className:"w-14 h-14 bg-[#7C9885] rounded-full flex items-center justify-center mx-auto shadow-md",children:u.jsx("span",{className:"text-white font-bold text-xl",children:"1"})}),u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B]",children:e("home.step1.title")}),u.jsx("div",{className:"relative w-full h-32 bg-white/60 rounded-2xl overflow-hidden border border-[#7C9885]/20 shadow-inner",children:u.jsx(qe.div,{className:"absolute top-1/2 -translate-y-1/2 w-7 h-7 rounded-full bg-[#7C9885] shadow-lg",animate:{left:["8%","84%","8%"]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}})}),u.jsx("p",{className:"text-[#1B4D1B]/80 leading-relaxed text-sm md:text-base",children:e("home.step1.body")})]}),u.jsxs("div",{className:"space-y-4 text-center",children:[u.jsx("div",{className:"w-14 h-14 bg-[#F4A28C] rounded-full flex items-center justify-center mx-auto shadow-md",children:u.jsx("span",{className:"text-white font-bold text-xl",children:"2"})}),u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B]",children:e("home.step2.title")}),u.jsxs("div",{className:"relative w-full h-32 bg-white/60 rounded-2xl overflow-hidden border border-[#F4A28C]/20 shadow-inner flex items-center justify-center gap-4 px-5",children:[u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("svg",{width:"64",height:"76",viewBox:"0 0 64 76",children:[u.jsx("circle",{cx:"32",cy:"32",r:"22",fill:"#F4A28C",opacity:"0.3"}),u.jsx("path",{d:"M12,28 Q12,8 32,8 Q52,8 52,28",fill:"#1B4D1B",opacity:"0.2"}),u.jsx("circle",{cx:"24",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"40",cy:"30",r:"2.5",fill:"#1B4D1B",opacity:"0.5"}),u.jsx("circle",{cx:"25",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("circle",{cx:"41",cy:"29",r:"0.8",fill:"white",opacity:"0.8"}),u.jsx("path",{d:"M24,40 Q32,47 40,40",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.8",strokeLinecap:"round",opacity:"0.4"}),u.jsx("circle",{cx:"32",cy:"35",r:"1.5",fill:"#1B4D1B",opacity:"0.15"}),u.jsx("rect",{x:"28",y:"53",width:"8",height:"8",rx:"2",fill:"#F4A28C",opacity:"0.2"}),u.jsx("path",{d:"M16,68 Q20,60 28,60 L36,60 Q44,60 48,68",fill:"#7C9885",opacity:"0.2"}),[[24,30],[40,30],[32,35],[24,40],[40,40],[32,44],[18,30],[30,30],[34,30],[46,30],[14,24],[50,24],[32,10],[22,14],[42,14],[16,40],[48,40],[32,52],[20,50],[44,50]].map(([t,n],a)=>u.jsx("circle",{cx:t,cy:n,r:"1.3",fill:"#7C9885",opacity:"0.65"},a)),u.jsxs("g",{stroke:"#7C9885",strokeWidth:"0.6",opacity:"0.3",children:[u.jsx("line",{x1:"18",y1:"30",x2:"24",y2:"30"}),u.jsx("line",{x1:"24",y1:"30",x2:"30",y2:"30"}),u.jsx("line",{x1:"34",y1:"30",x2:"40",y2:"30"}),u.jsx("line",{x1:"40",y1:"30",x2:"46",y2:"30"}),u.jsx("line",{x1:"32",y1:"10",x2:"32",y2:"35"}),u.jsx("line",{x1:"24",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"40",y1:"30",x2:"32",y2:"35"}),u.jsx("line",{x1:"14",y1:"24",x2:"16",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"20",y2:"50"}),u.jsx("line",{x1:"20",y1:"50",x2:"32",y2:"52"}),u.jsx("line",{x1:"32",y1:"52",x2:"44",y2:"50"}),u.jsx("line",{x1:"44",y1:"50",x2:"48",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"50",y2:"24"}),u.jsx("line",{x1:"22",y1:"14",x2:"32",y2:"10"}),u.jsx("line",{x1:"32",y1:"10",x2:"42",y2:"14"}),u.jsx("line",{x1:"24",y1:"40",x2:"32",y2:"44"}),u.jsx("line",{x1:"32",y1:"44",x2:"40",y2:"40"}),u.jsx("line",{x1:"16",y1:"40",x2:"24",y2:"40"}),u.jsx("line",{x1:"48",y1:"40",x2:"40",y2:"40"})]})]}),u.jsx(qe.div,{className:"absolute inset-x-0 h-0.5 bg-[#7C9885]/60",animate:{top:["5%","90%","5%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]}),u.jsx(h7e,{})]}),u.jsx("p",{className:"text-[#1B4D1B]/80 leading-relaxed text-sm md:text-base",children:e("home.step2.body")})]}),u.jsxs("div",{className:"space-y-4 text-center",children:[u.jsx("div",{className:"w-14 h-14 bg-[#7C9885] rounded-full flex items-center justify-center mx-auto shadow-md",children:u.jsx("span",{className:"text-white font-bold text-xl",children:"3"})}),u.jsx("h3",{className:"font-semibold text-xl text-[#1B4D1B]",children:e("home.step3.title")}),u.jsx("div",{className:"relative w-full h-32 bg-white/60 rounded-2xl overflow-hidden border border-[#7C9885]/20 shadow-inner flex items-center justify-center",children:u.jsxs("svg",{width:"240",height:"100",viewBox:"0 0 240 100",className:"text-[#1B4D1B]",children:[u.jsx("rect",{x:"8",y:"32",width:"60",height:"32",rx:"8",fill:"#7C9885"}),u.jsx("text",{x:"38",y:"52",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:e("home.loop.emotion")}),u.jsx("rect",{x:"90",y:"32",width:"60",height:"32",rx:"8",fill:"#F4A28C"}),u.jsx("text",{x:"120",y:"52",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:e("home.loop.ai")}),u.jsx("rect",{x:"172",y:"32",width:"60",height:"32",rx:"8",fill:"#7C9885"}),u.jsx("text",{x:"202",y:"52",textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"600",children:e("home.loop.bls")}),u.jsx("line",{x1:"70",y1:"48",x2:"88",y2:"48",stroke:"#1B4D1B",strokeWidth:"1.5",markerEnd:"url(#arrowLanding)"}),u.jsx("line",{x1:"152",y1:"48",x2:"170",y2:"48",stroke:"#1B4D1B",strokeWidth:"1.5",markerEnd:"url(#arrowLanding)"}),u.jsx("path",{d:"M202,66 C202,90 38,90 38,66",fill:"none",stroke:"#1B4D1B",strokeWidth:"1.5",strokeDasharray:"4 3",markerEnd:"url(#arrowLanding)"}),u.jsx("text",{x:"120",y:"92",textAnchor:"middle",fill:"#1B4D1B",fontSize:"9",opacity:"0.5",children:e("home.loop.repeat")}),u.jsx(qe.circle,{r:"6",fill:"#3B82F6",animate:{cx:[38,79,120,161,202,202,120,38,38],cy:[48,48,48,48,48,66,86,66,48]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut"}}),u.jsx("defs",{children:u.jsx("marker",{id:"arrowLanding",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:u.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#1B4D1B"})})})]})}),u.jsx("p",{className:"text-[#1B4D1B]/80 leading-relaxed text-sm md:text-base",children:e("home.step3.body")})]})]})]})}const oF=[{happy:72,sad:12,surprised:16},{happy:35,sad:48,surprised:17},{happy:20,sad:15,surprised:65},{happy:55,sad:30,surprised:15}];function h7e({compact:e=!1}){const{t}=Ws(),[n,a]=D.useState(0);D.useEffect(()=>{const i=setInterval(()=>a(o=>(o+1)%oF.length),2e3);return()=>clearInterval(i)},[]);const r=oF[n],s=[{label:t("home.emotion.happy"),value:r.happy,color:"bg-[#7C9885]"},{label:t("home.emotion.sad"),value:r.sad,color:"bg-[#F4A28C]"},{label:t("home.emotion.surprised"),value:r.surprised,color:"bg-[#1B4D1B]/40"}];return u.jsx("div",{className:`flex flex-col text-left ${e?"gap-1":"gap-2"}`,children:s.map(i=>u.jsxs("div",{className:`flex items-center ${e?"gap-1.5":"gap-2"}`,children:[u.jsx("span",{className:`text-[#1B4D1B]/60 text-right ${e?"text-[8px] md:text-[10px] w-10 md:w-14":"text-[11px] w-20"}`,children:i.label}),u.jsx("div",{className:`bg-[#1B4D1B]/10 rounded-full overflow-hidden ${e?"w-10 md:w-16 h-1.5 md:h-2":"w-24 h-2.5"}`,children:u.jsx(qe.div,{className:`h-full rounded-full ${i.color}`,animate:{width:`${i.value}%`},transition:{duration:.6,ease:"easeOut"}})})]},i.label))})}function p7e(){return u.jsxs(u.Fragment,{children:[u.jsx(GPe,{}),u.jsxs(CK,{children:[u.jsx(ma,{path:"/",element:u.jsx(u7e,{})},"home"),u.jsx(ma,{path:"/about",element:u.jsx(Gne,{})},"about"),u.jsx(ma,{path:"/bls",element:u.jsx(MPe,{})},"demo"),u.jsx(ma,{path:"/contact",element:u.jsx(qne,{})},"contact"),u.jsx(ma,{path:"/faqs",element:u.jsx($Pe,{})},"faqs"),u.jsx(ma,{path:"/account",element:u.jsx(OPe,{})},"account"),u.jsx(ma,{path:"/reset-password",element:u.jsx(KPe,{})},"reset-password"),u.jsx(ma,{path:"/login",element:u.jsx(WPe,{})},"login"),u.jsx(ma,{path:"/signup",element:u.jsx(HPe,{})},"signup"),u.jsx(ma,{path:"/auth/callback",element:u.jsx(zPe,{})},"auth-callback"),u.jsx(ma,{path:"/privacy",element:u.jsx(YPe,{})},"privacy"),u.jsx(ma,{path:"/success",element:u.jsx(QPe,{})},"success"),u.jsx(ma,{path:"/investors",element:u.jsx(i6e,{})},"investors"),u.jsx(ma,{path:"/investors/pitch",element:u.jsx(qze,{})},"pitch"),u.jsx(ma,{path:"/investors/onepager",element:u.jsx(p6e,{})},"onepager"),u.jsx(ma,{path:"/investors/safe",element:u.jsx(o7e,{})},"investors-safe"),u.jsx(ma,{path:"/investors/traction",element:u.jsx(t7e,{})},"investors-traction"),u.jsx(ma,{path:"/runway",element:u.jsx(b6e,{})},"runway"),u.jsx(ma,{path:"/subscribe",element:u.jsx(k6e,{})},"subscribe"),u.jsx(ma,{path:"/unsubscribe",element:u.jsx(C6e,{})},"unsubscribe"),u.jsx(ma,{path:"/join/:code",element:u.jsx(E6e,{})},"join-enterprise"),u.jsx(ma,{path:"/roadmap",element:u.jsx(_6e,{})},"roadmap"),u.jsx(ma,{path:"/30wSofia",element:u.jsx(c7e,{url:"https://calendar.notion.so/meet/sofia-czsjz29w0/at2bq4oxk"})},"30wSofia"),u.jsx(ma,{path:"*",element:u.jsx(l7e,{})},"not-found")]})]})}const KE="solta.lang",VH="solta.geoLang",f7e="/api/geo-language";function HH(){if(typeof window>"u")return null;try{const e=new URLSearchParams(window.location.search).get("lang");if(e&&Sy.includes(e))return e}catch{}return null}function XE(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(KE);if(e&&Sy.includes(e))return e}catch{}return null}function GH(){if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(VH);if(e&&Sy.includes(e))return e}catch{}return null}function m7e(){return typeof window>"u"?ky:(window.navigator?.language?.toLowerCase()||"").startsWith("es")?"es":ky}function g7e(){return HH()||XE()||GH()||m7e()}function x7e({children:e}){const[t,n]=D.useState(g7e);D.useEffect(()=>{const i=HH();if(i)try{window.localStorage.setItem(KE,i)}catch{}},[]),D.useEffect(()=>{if(XE()||GH())return;let i=!1;const o=new AbortController;return fetch(f7e,{signal:o.signal}).then(l=>l.ok?l.json():null).then(l=>{if(!(i||!l?.lang)&&Sy.includes(l.lang)){try{window.sessionStorage.setItem(VH,l.lang)}catch{}XE()||n(l.lang)}}).catch(()=>{}),()=>{i=!0,o.abort()}},[]);const a=D.useCallback(i=>{if(Sy.includes(i)){n(i);try{window.localStorage.setItem(KE,i)}catch{}}},[]);D.useEffect(()=>{typeof document<"u"&&(document.documentElement.lang=t)},[t]);const r=D.useCallback(i=>(lN[t]||lN[ky])[i]??lN[ky][i]??i,[t]),s=D.useMemo(()=>({lang:t,setLang:a,t:r}),[t,a,r]);return u.jsx(e8.Provider,{value:s,children:e})}jq.createRoot(document.getElementById("root")).render(u.jsx(uF.StrictMode,{children:u.jsx(RK,{future:{v7_startTransition:!0},children:u.jsx(x7e,{children:u.jsx(p7e,{})})})}));export{uF as R,w7e as _,b7e as a,y7e as c,lF as g,u as j};

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.