diff --git a/assets/index-2f40beb2.js b/assets/index-2f40beb2.js new file mode 100644 index 0000000000000000000000000000000000000000..ba3aba7561e504cbdeec54a00197efa14444690f --- /dev/null +++ b/assets/index-2f40beb2.js @@ -0,0 +1,45 @@ +function qd(e,t){for(var n=0;nr[l]})}}}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 l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Zd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ba={exports:{}},lo={},ec={exports:{}},D={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jr=Symbol.for("react.element"),bd=Symbol.for("react.portal"),ep=Symbol.for("react.fragment"),tp=Symbol.for("react.strict_mode"),np=Symbol.for("react.profiler"),rp=Symbol.for("react.provider"),lp=Symbol.for("react.context"),op=Symbol.for("react.forward_ref"),ip=Symbol.for("react.suspense"),up=Symbol.for("react.memo"),sp=Symbol.for("react.lazy"),_s=Symbol.iterator;function ap(e){return e===null||typeof e!="object"?null:(e=_s&&e[_s]||e["@@iterator"],typeof e=="function"?e:null)}var tc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nc=Object.assign,rc={};function Hn(e,t,n){this.props=e,this.context=t,this.refs=rc,this.updater=n||tc}Hn.prototype.isReactComponent={};Hn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lc(){}lc.prototype=Hn.prototype;function ku(e,t,n){this.props=e,this.context=t,this.refs=rc,this.updater=n||tc}var xu=ku.prototype=new lc;xu.constructor=ku;nc(xu,Hn.prototype);xu.isPureReactComponent=!0;var Ls=Array.isArray,oc=Object.prototype.hasOwnProperty,Cu={current:null},ic={key:!0,ref:!0,__self:!0,__source:!0};function uc(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)oc.call(t,r)&&!ic.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,b=T[j];if(0>>1;jl(W,F))eel(K,W)?(T[j]=K,T[ee]=F,j=ee):(T[j]=W,T[st]=F,j=st);else if(eel(K,F))T[j]=K,T[ee]=F,j=ee;else break e}}return O}function l(T,O){var F=T.sortIndex-O.sortIndex;return F!==0?F:T.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var s=[],a=[],c=1,d=null,v=3,y=!1,h=!1,g=!1,N=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(T){for(var O=n(a);O!==null;){if(O.callback===null)r(a);else if(O.startTime<=T)r(a),O.sortIndex=O.expirationTime,t(s,O);else break;O=n(a)}}function E(T){if(g=!1,m(T),!h)if(n(s)!==null)h=!0,ut(x);else{var O=n(a);O!==null&&Kt(E,O.startTime-T)}}function x(T,O){h=!1,g&&(g=!1,p(R),R=-1),y=!0;var F=v;try{for(m(O),d=n(s);d!==null&&(!(d.expirationTime>O)||T&&!ne());){var j=d.callback;if(typeof j=="function"){d.callback=null,v=d.priorityLevel;var b=j(d.expirationTime<=O);O=e.unstable_now(),typeof b=="function"?d.callback=b:d===n(s)&&r(s),m(O)}else r(s);d=n(s)}if(d!==null)var Gt=!0;else{var st=n(a);st!==null&&Kt(E,st.startTime-O),Gt=!1}return Gt}finally{d=null,v=F,y=!1}}var _=!1,P=null,R=-1,I=5,A=-1;function ne(){return!(e.unstable_now()-AT||125j?(T.sortIndex=F,t(a,T),n(s)===null&&T===n(a)&&(g?(p(R),R=-1):g=!0,Kt(E,F-j))):(T.sortIndex=b,t(s,T),h||y||(h=!0,ut(x))),T},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(T){var O=v;return function(){var F=v;v=O;try{return T.apply(this,arguments)}finally{v=F}}}})(fc);cc.exports=fc;var Sp=cc.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dc=w,Re=Sp;function k(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wi=Object.prototype.hasOwnProperty,Ep=/^[: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]*$/,Os={},Fs={};function kp(e){return wi.call(Fs,e)?!0:wi.call(Os,e)?!1:Ep.test(e)?Fs[e]=!0:(Os[e]=!0,!1)}function xp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Cp(e,t,n,r){if(t===null||typeof t>"u"||xp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Se(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var fe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){fe[e]=new Se(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];fe[t]=new Se(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){fe[e]=new Se(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){fe[e]=new Se(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){fe[e]=new Se(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){fe[e]=new Se(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){fe[e]=new Se(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){fe[e]=new Se(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){fe[e]=new Se(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pu=/[\-:]([a-z])/g;function _u(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Pu,_u);fe[t]=new Se(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Pu,_u);fe[t]=new Se(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Pu,_u);fe[t]=new Se(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){fe[e]=new Se(e,1,!1,e.toLowerCase(),null,!1,!1)});fe.xlinkHref=new Se("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){fe[e]=new Se(e,1,!1,e.toLowerCase(),null,!0,!0)});function Lu(e,t,n,r){var l=fe.hasOwnProperty(t)?fe[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` +`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{Ao=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ir(e):""}function Tp(e){switch(e.tag){case 5:return ir(e.type);case 16:return ir("Lazy");case 13:return ir("Suspense");case 19:return ir("SuspenseList");case 0:case 2:case 15:return e=Do(e.type,!1),e;case 11:return e=Do(e.type.render,!1),e;case 1:return e=Do(e.type,!0),e;default:return""}}function xi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vn:return"Fragment";case hn:return"Portal";case Si:return"Profiler";case Ru:return"StrictMode";case Ei:return"Suspense";case ki:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hc:return(e.displayName||"Context")+".Consumer";case mc:return(e._context.displayName||"Context")+".Provider";case Ou:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Fu:return t=e.displayName||null,t!==null?t:xi(e.type)||"Memo";case Nt:t=e._payload,e=e._init;try{return xi(e(t))}catch{}}return null}function Np(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xi(t);case 8:return t===Ru?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Pp(e){var t=gc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qr(e){e._valueTracker||(e._valueTracker=Pp(e))}function yc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=gc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Rl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ci(e,t){var n=t.checked;return J({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ds(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Bt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wc(e,t){t=t.checked,t!=null&&Lu(e,"checked",t,!1)}function Ti(e,t){wc(e,t);var n=Bt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ni(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ni(e,t.type,Bt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $s(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ni(e,t,n){(t!=="number"||Rl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ur=Array.isArray;function Pn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Zr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Er(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_p=["Webkit","ms","Moz","O"];Object.keys(fr).forEach(function(e){_p.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fr[t]=fr[e]})});function xc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fr.hasOwnProperty(e)&&fr[e]?(""+t).trim():t+"px"}function Cc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=xc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Lp=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Li(e,t){if(t){if(Lp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function Ri(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Oi=null;function Au(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fi=null,_n=null,Ln=null;function js(e){if(e=Br(e)){if(typeof Fi!="function")throw Error(k(280));var t=e.stateNode;t&&(t=ao(t),Fi(e.stateNode,e.type,t))}}function Tc(e){_n?Ln?Ln.push(e):Ln=[e]:_n=e}function Nc(){if(_n){var e=_n,t=Ln;if(Ln=_n=null,js(e),t)for(e=0;e>>=0,e===0?32:31-(Ip(e)/Bp|0)|0}var br=64,el=4194304;function sr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=sr(u):(o&=i,o!==0&&(r=sr(o)))}else i=n&~l,i!==0?r=sr(i):o!==0&&(r=sr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Ur(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ye(t),e[t]=n}function Qp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=pr),Gs=String.fromCharCode(32),Ys=!1;function Kc(e,t){switch(e){case"keyup":return wm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gn=!1;function Em(e,t){switch(e){case"compositionend":return Gc(t);case"keypress":return t.which!==32?null:(Ys=!0,Gs);case"textInput":return e=t.data,e===Gs&&Ys?null:e;default:return null}}function km(e,t){if(gn)return e==="compositionend"||!Bu&&Kc(e,t)?(e=Wc(),vl=ju=Ot=null,gn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Zs(n)}}function qc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zc(){for(var e=window,t=Rl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rl(e.document)}return t}function Hu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Om(e){var t=Zc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&qc(n.ownerDocument.documentElement,n)){if(r!==null&&Hu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=bs(n,o);var i=bs(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,yn=null,ji=null,hr=null,Ui=!1;function ea(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ui||yn==null||yn!==Rl(r)||(r=yn,"selectionStart"in r&&Hu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),hr&&Pr(hr,r)||(hr=r,r=zl(ji,"onSelect"),0En||(e.current=Qi[En],Qi[En]=null,En--)}function B(e,t){En++,Qi[En]=e.current,e.current=t}var Ht={},ve=Wt(Ht),xe=Wt(!1),on=Ht;function $n(e,t){var n=e.type.contextTypes;if(!n)return Ht;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Ce(e){return e=e.childContextTypes,e!=null}function Ul(){V(xe),V(ve)}function ua(e,t,n){if(ve.current!==Ht)throw Error(k(168));B(ve,t),B(xe,n)}function sf(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,Np(e)||"Unknown",l));return J({},n,r)}function Il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ht,on=ve.current,B(ve,e),B(xe,xe.current),!0}function sa(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=sf(e,t,on),r.__reactInternalMemoizedMergedChildContext=e,V(xe),V(ve),B(ve,e)):V(xe),B(xe,n)}var ct=null,co=!1,Yo=!1;function af(e){ct===null?ct=[e]:ct.push(e)}function Vm(e){co=!0,af(e)}function Qt(){if(!Yo&&ct!==null){Yo=!0;var e=0,t=U;try{var n=ct;for(U=1;e>=i,l-=i,ft=1<<32-Ye(t)+l|n<R?(I=P,P=null):I=P.sibling;var A=v(p,P,m[R],E);if(A===null){P===null&&(P=I);break}e&&P&&A.alternate===null&&t(p,P),f=o(A,f,R),_===null?x=A:_.sibling=A,_=A,P=I}if(R===m.length)return n(p,P),Q&&Xt(p,R),x;if(P===null){for(;RR?(I=P,P=null):I=P.sibling;var ne=v(p,P,A.value,E);if(ne===null){P===null&&(P=I);break}e&&P&&ne.alternate===null&&t(p,P),f=o(ne,f,R),_===null?x=ne:_.sibling=ne,_=ne,P=I}if(A.done)return n(p,P),Q&&Xt(p,R),x;if(P===null){for(;!A.done;R++,A=m.next())A=d(p,A.value,E),A!==null&&(f=o(A,f,R),_===null?x=A:_.sibling=A,_=A);return Q&&Xt(p,R),x}for(P=r(p,P);!A.done;R++,A=m.next())A=y(P,p,R,A.value,E),A!==null&&(e&&A.alternate!==null&&P.delete(A.key===null?R:A.key),f=o(A,f,R),_===null?x=A:_.sibling=A,_=A);return e&&P.forEach(function(He){return t(p,He)}),Q&&Xt(p,R),x}function N(p,f,m,E){if(typeof m=="object"&&m!==null&&m.type===vn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Jr:e:{for(var x=m.key,_=f;_!==null;){if(_.key===x){if(x=m.type,x===vn){if(_.tag===7){n(p,_.sibling),f=l(_,m.props.children),f.return=p,p=f;break e}}else if(_.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Nt&&ha(x)===_.type){n(p,_.sibling),f=l(_,m.props),f.ref=er(p,_,m),f.return=p,p=f;break e}n(p,_);break}else t(p,_);_=_.sibling}m.type===vn?(f=rn(m.props.children,p.mode,E,m.key),f.return=p,p=f):(E=Cl(m.type,m.key,m.props,null,p.mode,E),E.ref=er(p,f,m),E.return=p,p=E)}return i(p);case hn:e:{for(_=m.key;f!==null;){if(f.key===_)if(f.tag===4&&f.stateNode.containerInfo===m.containerInfo&&f.stateNode.implementation===m.implementation){n(p,f.sibling),f=l(f,m.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=ni(m,p.mode,E),f.return=p,p=f}return i(p);case Nt:return _=m._init,N(p,f,_(m._payload),E)}if(ur(m))return h(p,f,m,E);if(Xn(m))return g(p,f,m,E);ul(p,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,f!==null&&f.tag===6?(n(p,f.sibling),f=l(f,m),f.return=p,p=f):(n(p,f),f=ti(m,p.mode,E),f.return=p,p=f),i(p)):n(p,f)}return N}var zn=gf(!0),yf=gf(!1),Hr={},rt=Wt(Hr),Or=Wt(Hr),Fr=Wt(Hr);function en(e){if(e===Hr)throw Error(k(174));return e}function qu(e,t){switch(B(Fr,t),B(Or,e),B(rt,Hr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_i(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_i(t,e)}V(rt),B(rt,t)}function jn(){V(rt),V(Or),V(Fr)}function wf(e){en(Fr.current);var t=en(rt.current),n=_i(t,e.type);t!==n&&(B(Or,e),B(rt,n))}function Zu(e){Or.current===e&&(V(rt),V(Or))}var G=Wt(0);function Kl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Xo=[];function bu(){for(var e=0;en?n:4,e(!0);var r=Jo.transition;Jo.transition={};try{e(!1),t()}finally{U=n,Jo.transition=r}}function $f(){return Ie().memoizedState}function Gm(e,t,n){var r=Ut(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Mf(e))zf(t,n);else if(n=pf(e,t,n,r),n!==null){var l=ye();Xe(n,e,r,l),jf(n,t,r)}}function Ym(e,t,n){var r=Ut(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Mf(e))zf(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,Je(u,i)){var s=t.interleaved;s===null?(l.next=l,Xu(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=pf(e,t,l,r),n!==null&&(l=ye(),Xe(n,e,r,l),jf(n,t,r))}}function Mf(e){var t=e.alternate;return e===X||t!==null&&t===X}function zf(e,t){vr=Gl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function jf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$u(e,n)}}var Yl={readContext:Ue,useCallback:de,useContext:de,useEffect:de,useImperativeHandle:de,useInsertionEffect:de,useLayoutEffect:de,useMemo:de,useReducer:de,useRef:de,useState:de,useDebugValue:de,useDeferredValue:de,useTransition:de,useMutableSource:de,useSyncExternalStore:de,useId:de,unstable_isNewReconciler:!1},Xm={readContext:Ue,useCallback:function(e,t){return be().memoizedState=[e,t===void 0?null:t],e},useContext:Ue,useEffect:ga,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Sl(4194308,4,Rf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sl(4,2,e,t)},useMemo:function(e,t){var n=be();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=be();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Gm.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=be();return e={current:e},t.memoizedState=e},useState:va,useDebugValue:ls,useDeferredValue:function(e){return be().memoizedState=e},useTransition:function(){var e=va(!1),t=e[0];return e=Km.bind(null,e[1]),be().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=X,l=be();if(Q){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),se===null)throw Error(k(349));sn&30||kf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,ga(Cf.bind(null,r,o,e),[e]),r.flags|=2048,$r(9,xf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=be(),t=se.identifierPrefix;if(Q){var n=dt,r=ft;n=(r&~(1<<32-Ye(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ar++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[et]=t,e[Rr]=r,Gf(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ri(n,r),n){case"dialog":H("cancel",e),H("close",e),l=r;break;case"iframe":case"object":case"embed":H("load",e),l=r;break;case"video":case"audio":for(l=0;lIn&&(t.flags|=128,r=!0,tr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Kl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),tr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Q)return pe(t),null}else 2*Z()-o.renderingStartTime>In&&n!==1073741824&&(t.flags|=128,r=!0,tr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Z(),t.sibling=null,n=G.current,B(G,r?n&1|2:n&1),t):(pe(t),null);case 22:case 23:return cs(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ne&1073741824&&(pe(t),t.subtreeFlags&6&&(t.flags|=8192)):pe(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function rh(e,t){switch(Wu(t),t.tag){case 1:return Ce(t.type)&&Ul(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jn(),V(xe),V(ve),bu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zu(t),null;case 13:if(V(G),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));Mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(G),null;case 4:return jn(),null;case 10:return Yu(t.type._context),null;case 22:case 23:return cs(),null;case 24:return null;default:return null}}var al=!1,me=!1,lh=typeof WeakSet=="function"?WeakSet:Set,L=null;function Tn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){q(e,t,r)}else n.current=null}function ru(e,t,n){try{n()}catch(r){q(e,t,r)}}var Na=!1;function oh(e,t){if(Ii=$l,e=Zc(),Hu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,c=0,d=e,v=null;t:for(;;){for(var y;d!==n||l!==0&&d.nodeType!==3||(u=i+l),d!==o||r!==0&&d.nodeType!==3||(s=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(y=d.firstChild)!==null;)v=d,d=y;for(;;){if(d===e)break t;if(v===n&&++a===l&&(u=i),v===o&&++c===r&&(s=i),(y=d.nextSibling)!==null)break;d=v,v=d.parentNode}d=y}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bi={focusedElem:e,selectionRange:n},$l=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,N=h.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?g:Qe(t.type,g),N);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(E){q(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return h=Na,Na=!1,h}function gr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&ru(t,n,o)}l=l.next}while(l!==r)}}function mo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function lu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Jf(e){var t=e.alternate;t!==null&&(e.alternate=null,Jf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[et],delete t[Rr],delete t[Wi],delete t[Bm],delete t[Hm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qf(e){return e.tag===5||e.tag===3||e.tag===4}function Pa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ou(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=jl));else if(r!==4&&(e=e.child,e!==null))for(ou(e,t,n),e=e.sibling;e!==null;)ou(e,t,n),e=e.sibling}function iu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(iu(e,t,n),e=e.sibling;e!==null;)iu(e,t,n),e=e.sibling}var ae=null,Ke=!1;function Ct(e,t,n){for(n=n.child;n!==null;)Zf(e,t,n),n=n.sibling}function Zf(e,t,n){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(oo,n)}catch{}switch(n.tag){case 5:me||Tn(n,t);case 6:var r=ae,l=Ke;ae=null,Ct(e,t,n),ae=r,Ke=l,ae!==null&&(Ke?(e=ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ae.removeChild(n.stateNode));break;case 18:ae!==null&&(Ke?(e=ae,n=n.stateNode,e.nodeType===8?Go(e.parentNode,n):e.nodeType===1&&Go(e,n),Tr(e)):Go(ae,n.stateNode));break;case 4:r=ae,l=Ke,ae=n.stateNode.containerInfo,Ke=!0,Ct(e,t,n),ae=r,Ke=l;break;case 0:case 11:case 14:case 15:if(!me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ru(n,t,i),l=l.next}while(l!==r)}Ct(e,t,n);break;case 1:if(!me&&(Tn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){q(n,t,u)}Ct(e,t,n);break;case 21:Ct(e,t,n);break;case 22:n.mode&1?(me=(r=me)||n.memoizedState!==null,Ct(e,t,n),me=r):Ct(e,t,n);break;default:Ct(e,t,n)}}function _a(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lh),t.forEach(function(r){var l=mh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function We(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*uh(r/1960))-r,10e?16:e,Ft===null)var r=!1;else{if(e=Ft,Ft=null,ql=0,z&6)throw Error(k(331));var l=z;for(z|=4,L=e.current;L!==null;){var o=L,i=o.child;if(L.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sZ()-ss?nn(e,0):us|=n),Te(e,t)}function id(e,t){t===0&&(e.mode&1?(t=el,el<<=1,!(el&130023424)&&(el=4194304)):t=1);var n=ye();e=Et(e,t),e!==null&&(Ur(e,t,n),Te(e,n))}function ph(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),id(e,n)}function mh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),id(e,n)}var ud;ud=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xe.current)ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ke=!1,th(e,t,n);ke=!!(e.flags&131072)}else ke=!1,Q&&t.flags&1048576&&cf(t,Hl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;El(e,t),e=t.pendingProps;var l=$n(t,ve.current);On(t,n),l=ts(null,t,r,e,l,n);var o=ns();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ce(r)?(o=!0,Il(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ju(t),l.updater=fo,t.stateNode=l,l._reactInternals=t,Ji(t,r,e,n),t=bi(null,t,r,!0,o,n)):(t.tag=0,Q&&o&&Vu(t),ge(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(El(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=vh(r),e=Qe(r,e),l){case 0:t=Zi(null,t,r,e,n);break e;case 1:t=xa(null,t,r,e,n);break e;case 11:t=Ea(null,t,r,e,n);break e;case 14:t=ka(null,t,r,Qe(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Qe(r,l),Zi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Qe(r,l),xa(e,t,r,l,n);case 3:e:{if(Wf(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,mf(e,t),Ql(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Un(Error(k(423)),t),t=Ca(e,t,r,n,l);break e}else if(r!==l){l=Un(Error(k(424)),t),t=Ca(e,t,r,n,l);break e}else for(_e=Mt(t.stateNode.containerInfo.firstChild),Le=t,Q=!0,Ge=null,n=yf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mn(),r===l){t=kt(e,t,n);break e}ge(e,t,r,n)}t=t.child}return t;case 5:return wf(t),e===null&&Gi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Hi(r,l)?i=null:o!==null&&Hi(r,o)&&(t.flags|=32),Vf(e,t),ge(e,t,i,n),t.child;case 6:return e===null&&Gi(t),null;case 13:return Qf(e,t,n);case 4:return qu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zn(t,null,r,n):ge(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Qe(r,l),Ea(e,t,r,l,n);case 7:return ge(e,t,t.pendingProps,n),t.child;case 8:return ge(e,t,t.pendingProps.children,n),t.child;case 12:return ge(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,B(Vl,r._currentValue),r._currentValue=i,o!==null)if(Je(o.value,i)){if(o.children===l.children&&!xe.current){t=kt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=mt(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?s.next=s:(s.next=c.next,c.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),Yi(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(k(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Yi(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ge(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,On(t,n),l=Ue(l),r=r(l),t.flags|=1,ge(e,t,r,n),t.child;case 14:return r=t.type,l=Qe(r,t.pendingProps),l=Qe(r.type,l),ka(e,t,r,l,n);case 15:return Bf(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Qe(r,l),El(e,t),t.tag=1,Ce(r)?(e=!0,Il(t)):e=!1,On(t,n),vf(t,r,l),Ji(t,r,l,n),bi(null,t,r,!0,e,n);case 19:return Kf(e,t,n);case 22:return Hf(e,t,n)}throw Error(k(156,t.tag))};function sd(e,t){return Ac(e,t)}function hh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Me(e,t,n,r){return new hh(e,t,n,r)}function ds(e){return e=e.prototype,!(!e||!e.isReactComponent)}function vh(e){if(typeof e=="function")return ds(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ou)return 11;if(e===Fu)return 14}return 2}function It(e,t){var n=e.alternate;return n===null?(n=Me(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Cl(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ds(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case vn:return rn(n.children,l,o,t);case Ru:i=8,l|=8;break;case Si:return e=Me(12,n,t,l|2),e.elementType=Si,e.lanes=o,e;case Ei:return e=Me(13,n,t,l),e.elementType=Ei,e.lanes=o,e;case ki:return e=Me(19,n,t,l),e.elementType=ki,e.lanes=o,e;case vc:return vo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case mc:i=10;break e;case hc:i=9;break e;case Ou:i=11;break e;case Fu:i=14;break e;case Nt:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=Me(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function rn(e,t,n,r){return e=Me(7,e,r,t),e.lanes=n,e}function vo(e,t,n,r){return e=Me(22,e,r,t),e.elementType=vc,e.lanes=n,e.stateNode={isHidden:!1},e}function ti(e,t,n){return e=Me(6,e,null,t),e.lanes=n,e}function ni(e,t,n){return t=Me(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mo(0),this.expirationTimes=Mo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ps(e,t,n,r,l,o,i,u,s){return e=new gh(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Me(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ju(o),e}function yh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dd)}catch(e){console.error(e)}}dd(),ac.exports=Oe;var pd=ac.exports,Ma=pd;yi.createRoot=Ma.createRoot,yi.hydrateRoot=Ma.hydrateRoot;const An={SAMPLING_RATE:16e3,DEFAULT_AUDIO_URL:"https://xenova.github.io/transformers.js/audio/jfk.wav",DEFAULT_MODEL:"whisper-tiny.en",DEFAULT_SUBTASK:"transcribe",DEFAULT_LANGUAGE:"english"};var xh=Object.defineProperty,Ch=(e,t,n)=>t in e?xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ri=(e,t,n)=>(Ch(e,typeof t!="symbol"?t+"":t,n),n);let Th=class{constructor(){ri(this,"current",this.detect()),ri(this,"handoffState","pending"),ri(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},ht=new Th,lt=(e,t)=>{ht.isServer?w.useEffect(e,t):w.useLayoutEffect(e,t)};function vt(e){let t=w.useRef(e);return lt(()=>{t.current=e},[e]),t}function Vr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Qn(){let e=[],t={addEventListener(n,r,l,o){return n.addEventListener(r,l,o),t.add(()=>n.removeEventListener(r,l,o))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Vr(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let o=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:o})})},group(n){let r=Qn();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let l of e.splice(r,1))l()}},dispose(){for(let n of e.splice(0))n()}};return t}function gs(){let[e]=w.useState(Qn);return w.useEffect(()=>()=>e.dispose(),[e]),e}let ue=function(e){let t=vt(e);return $.useCallback((...n)=>t.current(...n),[t])};function Kn(){let[e,t]=w.useState(ht.isHandoffComplete);return e&&ht.isHandoffComplete===!1&&t(!1),w.useEffect(()=>{e!==!0&&t(!0)},[e]),w.useEffect(()=>ht.handoff(),[]),e}var za;let Gn=(za=$.useId)!=null?za:function(){let e=Kn(),[t,n]=$.useState(e?()=>ht.nextId():null);return lt(()=>{t===null&&n(ht.nextId())},[t]),t!=null?""+t:void 0};function he(e,t,...n){if(e in t){let l=t[e];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,he),r}function md(e){return ht.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let fu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var qt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(qt||{}),hd=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(hd||{}),Nh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Nh||{});function Ph(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(fu)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var vd=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(vd||{});function _h(e,t=0){var n;return e===((n=md(e))==null?void 0:n.body)?!1:he(t,{[0](){return e.matches(fu)},[1](){let r=e;for(;r!==null;){if(r.matches(fu))return!0;r=r.parentElement}return!1}})}var Lh=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Lh||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ln(e){e==null||e.focus({preventScroll:!0})}let Rh=["textarea","input"].join(",");function Oh(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Rh))!=null?n:!1}function Fh(e,t=n=>n){return e.slice().sort((n,r)=>{let l=t(n),o=t(r);if(l===null||o===null)return 0;let i=l.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Tl(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Fh(e):e:Ph(e);l.length>0&&i.length>1&&(i=i.filter(y=>!l.includes(y))),r=r??o.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},c=0,d=i.length,v;do{if(c>=d||c+d<=0)return 0;let y=s+c;if(t&16)y=(y+d)%d;else{if(y<0)return 3;if(y>=d)return 1}v=i[y],v==null||v.focus(a),c+=u}while(v!==o.activeElement);return t&6&&Oh(v)&&v.select(),2}function li(e,t,n){let r=vt(t);w.useEffect(()=>{function l(o){r.current(o)}return document.addEventListener(e,l,n),()=>document.removeEventListener(e,l,n)},[e,n])}function Ah(e,t,n=!0){let r=w.useRef(!1);w.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function l(i,u){if(!r.current||i.defaultPrevented)return;let s=function c(d){return typeof d=="function"?c(d()):Array.isArray(d)||d instanceof Set?d:[d]}(e),a=u(i);if(a!==null&&a.getRootNode().contains(a)){for(let c of s){if(c===null)continue;let d=c instanceof HTMLElement?c:c.current;if(d!=null&&d.contains(a)||i.composed&&i.composedPath().includes(d))return}return!_h(a,vd.Loose)&&a.tabIndex!==-1&&i.preventDefault(),t(i,a)}}let o=w.useRef(null);li("mousedown",i=>{var u,s;r.current&&(o.current=((s=(u=i.composedPath)==null?void 0:u.call(i))==null?void 0:s[0])||i.target)},!0),li("click",i=>{o.current&&(l(i,()=>o.current),o.current=null)},!0),li("blur",i=>l(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}let gd=Symbol();function Dh(e,t=!0){return Object.assign(e,{[gd]:t})}function qe(...e){let t=w.useRef(e);w.useEffect(()=>{t.current=e},[e]);let n=ue(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return e.every(r=>r==null||(r==null?void 0:r[gd]))?void 0:n}function du(...e){return e.filter(Boolean).join(" ")}var eo=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(eo||{}),pt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(pt||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:o=!0,name:i}){let u=yd(t,e);if(o)return dl(u,n,r,i);let s=l??0;if(s&2){let{static:a=!1,...c}=u;if(a)return dl(c,n,r,i)}if(s&1){let{unmount:a=!0,...c}=u;return he(a?0:1,{[0](){return null},[1](){return dl({...c,hidden:!0,style:{display:"none"}},n,r,i)}})}return dl(u,n,r,i)}function dl(e,t={},n,r){let{as:l=n,children:o,refName:i="ref",...u}=oi(e,["unmount","static"]),s=e.ref!==void 0?{[i]:e.ref}:{},a=typeof o=="function"?o(t):o;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(t));let c={};if(t){let d=!1,v=[];for(let[y,h]of Object.entries(t))typeof h=="boolean"&&(d=!0),h===!0&&v.push(y);d&&(c["data-headlessui-state"]=v.join(" "))}if(l===w.Fragment&&Object.keys(ja(u)).length>0){if(!w.isValidElement(a)||Array.isArray(a)&&a.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(u).map(h=>` - ${h}`).join(` +`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(` +`)].join(` +`));let d=a.props,v=typeof(d==null?void 0:d.className)=="function"?(...h)=>du(d==null?void 0:d.className(...h),u.className):du(d==null?void 0:d.className,u.className),y=v?{className:v}:{};return w.cloneElement(a,Object.assign({},yd(a.props,ja(oi(u,["ref"]))),c,s,$h(a.ref,s.ref),y))}return w.createElement(l,Object.assign({},oi(u,["ref"]),l!==w.Fragment&&s,l!==w.Fragment&&c),a)}function $h(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function yd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](l,...o){let i=n[r];for(let u of i){if((l instanceof Event||(l==null?void 0:l.nativeEvent)instanceof Event)&&l.defaultPrevented)return;u(l,...o)}}});return t}function Ae(e){var t;return Object.assign(w.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ja(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function oi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Mh(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&zh(n)?!1:r}function zh(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let jh="div";var to=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(to||{});function Uh(e,t){let{features:n=1,...r}=e,l={ref:t,"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Be({ourProps:l,theirProps:r,slot:{},defaultTag:jh,name:"Hidden"})}let pu=Ae(Uh),ys=w.createContext(null);ys.displayName="OpenClosedContext";var Pe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Pe||{});function ws(){return w.useContext(ys)}function Ih({value:e,children:t}){return $.createElement(ys.Provider,{value:e},t)}var wd=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(wd||{});function Ss(e,t){let n=w.useRef([]),r=ue(e);w.useEffect(()=>{let l=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let u=r(t,l);return n.current=t,u}},[r,...t])}function Bh(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Hh(e,t,n){let r=vt(t);w.useEffect(()=>{function l(o){r.current(o)}return window.addEventListener(e,l,n),()=>window.removeEventListener(e,l,n)},[e,n])}var cr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(cr||{});function Vh(){let e=w.useRef(0);return Hh("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Wr(){let e=w.useRef(!1);return lt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Eo(...e){return w.useMemo(()=>md(...e),[...e])}function Sd(e,t,n,r){let l=vt(n);w.useEffect(()=>{e=e??window;function o(i){l.current(i)}return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)},[e,t,r])}function Wh(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}function Ed(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}let Qh="div";var kd=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(kd||{});function Kh(e,t){let n=w.useRef(null),r=qe(n,t),{initialFocus:l,containers:o,features:i=30,...u}=e;Kn()||(i=1);let s=Eo(n);Xh({ownerDocument:s},!!(i&16));let a=Jh({ownerDocument:s,container:n,initialFocus:l},!!(i&2));qh({ownerDocument:s,container:n,containers:o,previousActiveElement:a},!!(i&8));let c=Vh(),d=ue(g=>{let N=n.current;N&&(p=>p())(()=>{he(c.current,{[cr.Forwards]:()=>{Tl(N,qt.First,{skipElements:[g.relatedTarget]})},[cr.Backwards]:()=>{Tl(N,qt.Last,{skipElements:[g.relatedTarget]})}})})}),v=gs(),y=w.useRef(!1),h={ref:r,onKeyDown(g){g.key=="Tab"&&(y.current=!0,v.requestAnimationFrame(()=>{y.current=!1}))},onBlur(g){let N=Ed(o);n.current instanceof HTMLElement&&N.add(n.current);let p=g.relatedTarget;p instanceof HTMLElement&&p.dataset.headlessuiFocusGuard!=="true"&&(xd(N,p)||(y.current?Tl(n.current,he(c.current,{[cr.Forwards]:()=>qt.Next,[cr.Backwards]:()=>qt.Previous})|qt.WrapAround,{relativeTo:g.target}):g.target instanceof HTMLElement&&ln(g.target)))}};return $.createElement($.Fragment,null,!!(i&4)&&$.createElement(pu,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:to.Focusable}),Be({ourProps:h,theirProps:u,defaultTag:Qh,name:"FocusTrap"}),!!(i&4)&&$.createElement(pu,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:to.Focusable}))}let Gh=Ae(Kh),rr=Object.assign(Gh,{features:kd}),Rt=[];Wh(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Rt[0]!==t.target&&(Rt.unshift(t.target),Rt=Rt.filter(n=>n!=null&&n.isConnected),Rt.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Yh(e=!0){let t=w.useRef(Rt.slice());return Ss(([n],[r])=>{r===!0&&n===!1&&Vr(()=>{t.current.splice(0)}),r===!1&&n===!0&&(t.current=Rt.slice())},[e,Rt,t]),ue(()=>{var n;return(n=t.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function Xh({ownerDocument:e},t){let n=Yh(t);Ss(()=>{t||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&ln(n())},[t]);let r=w.useRef(!1);w.useEffect(()=>(r.current=!1,()=>{r.current=!0,Vr(()=>{r.current&&ln(n())})}),[])}function Jh({ownerDocument:e,container:t,initialFocus:n},r){let l=w.useRef(null),o=Wr();return Ss(()=>{if(!r)return;let i=t.current;i&&Vr(()=>{if(!o.current)return;let u=e==null?void 0:e.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===u){l.current=u;return}}else if(i.contains(u)){l.current=u;return}n!=null&&n.current?ln(n.current):Tl(i,qt.First)===hd.Error&&console.warn("There are no focusable elements inside the "),l.current=e==null?void 0:e.activeElement})},[r]),l}function qh({ownerDocument:e,container:t,containers:n,previousActiveElement:r},l){let o=Wr();Sd(e==null?void 0:e.defaultView,"focus",i=>{if(!l||!o.current)return;let u=Ed(n);t.current instanceof HTMLElement&&u.add(t.current);let s=r.current;if(!s)return;let a=i.target;a&&a instanceof HTMLElement?xd(u,a)?(r.current=a,ln(a)):(i.preventDefault(),i.stopPropagation(),ln(s)):ln(r.current)},!0)}function xd(e,t){for(let n of e)if(n.contains(t))return!0;return!1}let Cd=w.createContext(!1);function Zh(){return w.useContext(Cd)}function mu(e){return $.createElement(Cd.Provider,{value:e.force},e.children)}function bh(e){let t=Zh(),n=w.useContext(Td),r=Eo(e),[l,o]=w.useState(()=>{if(!t&&n!==null||ht.isServer)return null;let i=r==null?void 0:r.getElementById("headlessui-portal-root");if(i)return i;if(r===null)return null;let u=r.createElement("div");return u.setAttribute("id","headlessui-portal-root"),r.body.appendChild(u)});return w.useEffect(()=>{l!==null&&(r!=null&&r.body.contains(l)||r==null||r.body.appendChild(l))},[l,r]),w.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),l}let e0=w.Fragment;function t0(e,t){let n=e,r=w.useRef(null),l=qe(Dh(c=>{r.current=c}),t),o=Eo(r),i=bh(r),[u]=w.useState(()=>{var c;return ht.isServer?null:(c=o==null?void 0:o.createElement("div"))!=null?c:null}),s=Kn(),a=w.useRef(!1);return lt(()=>{if(a.current=!1,!(!i||!u))return i.contains(u)||(u.setAttribute("data-headlessui-portal",""),i.appendChild(u)),()=>{a.current=!0,Vr(()=>{var c;a.current&&(!i||!u||(u instanceof Node&&i.contains(u)&&i.removeChild(u),i.childNodes.length<=0&&((c=i.parentElement)==null||c.removeChild(i))))})}},[i,u]),s?!i||!u?null:pd.createPortal(Be({ourProps:{ref:l},theirProps:n,defaultTag:e0,name:"Portal"}),u):null}let n0=w.Fragment,Td=w.createContext(null);function r0(e,t){let{target:n,...r}=e,l={ref:qe(t)};return $.createElement(Td.Provider,{value:n},Be({ourProps:l,theirProps:r,defaultTag:n0,name:"Popover.Group"}))}let l0=Ae(t0),o0=Ae(r0),hu=Object.assign(l0,{Group:o0}),Nd=w.createContext(null);function Pd(){let e=w.useContext(Nd);if(e===null){let t=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Pd),t}return e}function i0(){let[e,t]=w.useState([]);return[e.length>0?e.join(" "):void 0,w.useMemo(()=>function(n){let r=ue(o=>(t(i=>[...i,o]),()=>t(i=>{let u=i.slice(),s=u.indexOf(o);return s!==-1&&u.splice(s,1),u}))),l=w.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return $.createElement(Nd.Provider,{value:l},n.children)},[t])]}let u0="p";function s0(e,t){let n=Gn(),{id:r=`headlessui-description-${n}`,...l}=e,o=Pd(),i=qe(t);lt(()=>o.register(r),[r,o.register]);let u={ref:i,...o.props,id:r};return Be({ourProps:u,theirProps:l,slot:o.slot||{},defaultTag:u0,name:o.name||"Description"})}let a0=Ae(s0),c0=Object.assign(a0,{}),Es=w.createContext(()=>{});Es.displayName="StackContext";var vu=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(vu||{});function f0(){return w.useContext(Es)}function d0({children:e,onUpdate:t,type:n,element:r,enabled:l}){let o=f0(),i=ue((...u)=>{t==null||t(...u),o(...u)});return lt(()=>{let u=l===void 0||l===!0;return u&&i(0,n,r),()=>{u&&i(1,n,r)}},[i,n,r,l]),$.createElement(Es.Provider,{value:i},e)}function p0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}const m0=typeof Object.is=="function"?Object.is:p0,{useState:h0,useEffect:v0,useLayoutEffect:g0,useDebugValue:y0}=gi;function w0(e,t,n){const r=t(),[{inst:l},o]=h0({inst:{value:r,getSnapshot:t}});return g0(()=>{l.value=r,l.getSnapshot=t,ii(l)&&o({inst:l})},[e,r,t]),v0(()=>(ii(l)&&o({inst:l}),e(()=>{ii(l)&&o({inst:l})})),[e]),y0(r),r}function ii(e){const t=e.getSnapshot,n=e.value;try{const r=t();return!m0(n,r)}catch{return!0}}function S0(e,t,n){return t()}const E0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",k0=!E0,x0=k0?S0:w0,C0="useSyncExternalStore"in gi?(e=>e.useSyncExternalStore)(gi):x0;function T0(e){return C0(e.subscribe,e.getSnapshot,e.getSnapshot)}function N0(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...o){let i=t[l].call(n,...o);i&&(n=i,r.forEach(u=>u()))}}}function P0(){let e;return{before({doc:t}){var n;let r=t.documentElement;e=((n=t.defaultView)!=null?n:window).innerWidth-r.clientWidth},after({doc:t,d:n}){let r=t.documentElement,l=r.clientWidth-r.offsetWidth,o=e-l;n.style(r,"paddingRight",`${o}px`)}}}function _0(){if(!Bh())return{};let e;return{before(){e=window.pageYOffset},after({doc:t,d:n,meta:r}){function l(i){return r.containers.flatMap(u=>u()).some(u=>u.contains(i))}n.style(t.body,"marginTop",`-${e}px`),window.scrollTo(0,0);let o=null;n.addEventListener(t,"click",i=>{if(i.target instanceof HTMLElement)try{let u=i.target.closest("a");if(!u)return;let{hash:s}=new URL(u.href),a=t.querySelector(s);a&&!l(a)&&(o=a)}catch{}},!0),n.addEventListener(t,"touchmove",i=>{i.target instanceof HTMLElement&&!l(i.target)&&i.preventDefault()},{passive:!1}),n.add(()=>{window.scrollTo(0,window.pageYOffset+e),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})}}}function L0(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function R0(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let tn=N0(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Qn(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:R0(n)},l=[_0(),P0(),L0()];l.forEach(({before:o})=>o==null?void 0:o(r)),l.forEach(({after:o})=>o==null?void 0:o(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});tn.subscribe(()=>{let e=tn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",l=n.count!==0;(l&&!r||!l&&r)&&tn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&tn.dispatch("TEARDOWN",n)}});function O0(e,t,n){let r=T0(tn),l=e?r.get(e):void 0,o=l?l.count>0:!1;return lt(()=>{if(!(!e||!t))return tn.dispatch("PUSH",e,n),()=>tn.dispatch("POP",e,n)},[t,e]),o}let ui=new Map,lr=new Map;function Ua(e,t=!0){lt(()=>{var n;if(!t)return;let r=typeof e=="function"?e():e.current;if(!r)return;function l(){var i;if(!r)return;let u=(i=lr.get(r))!=null?i:1;if(u===1?lr.delete(r):lr.set(r,u-1),u!==1)return;let s=ui.get(r);s&&(s["aria-hidden"]===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",s["aria-hidden"]),r.inert=s.inert,ui.delete(r))}let o=(n=lr.get(r))!=null?n:0;return lr.set(r,o+1),o!==0||(ui.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),l},[e,t])}var F0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(F0||{}),A0=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(A0||{});let D0={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},no=w.createContext(null);no.displayName="DialogContext";function Qr(e){let t=w.useContext(no);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qr),n}return t}function $0(e,t,n=()=>[document.body]){O0(e,t,r=>{var l;return{containers:[...(l=r.containers)!=null?l:[],n]}})}function M0(e,t){return he(t.type,D0,e,t)}let z0="div",j0=eo.RenderStrategy|eo.Static;function U0(e,t){let n=Gn(),{id:r=`headlessui-dialog-${n}`,open:l,onClose:o,initialFocus:i,__demoMode:u=!1,...s}=e,[a,c]=w.useState(0),d=ws();l===void 0&&d!==null&&(l=(d&Pe.Open)===Pe.Open);let v=w.useRef(null),y=qe(v,t),h=w.useRef(null),g=Eo(v),N=e.hasOwnProperty("open")||d!==null,p=e.hasOwnProperty("onClose");if(!N&&!p)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!N)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!p)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof l!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${l}`);if(typeof o!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o}`);let f=l?0:1,[m,E]=w.useReducer(M0,{titleId:null,descriptionId:null,panelRef:w.createRef()}),x=ue(()=>o(!1)),_=ue(W=>E({type:0,id:W})),P=Kn()?u?!1:f===0:!1,R=a>1,I=w.useContext(no)!==null,A=R?"parent":"leaf",ne=d!==null?(d&Pe.Closing)===Pe.Closing:!1,He=(()=>I||ne?!1:P)(),Ve=w.useCallback(()=>{var W,ee;return(ee=Array.from((W=g==null?void 0:g.querySelectorAll("body > *"))!=null?W:[]).find(K=>K.id==="headlessui-portal-root"?!1:K.contains(h.current)&&K instanceof HTMLElement))!=null?ee:null},[h]);Ua(Ve,He);let pn=(()=>R?!0:P)(),it=w.useCallback(()=>{var W,ee;return(ee=Array.from((W=g==null?void 0:g.querySelectorAll("[data-headlessui-portal]"))!=null?W:[]).find(K=>K.contains(h.current)&&K instanceof HTMLElement))!=null?ee:null},[h]);Ua(it,pn);let ut=ue(()=>{var W,ee;return[...Array.from((W=g==null?void 0:g.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))!=null?W:[]).filter(K=>!(K===document.body||K===document.head||!(K instanceof HTMLElement)||K.contains(h.current)||m.panelRef.current&&K.contains(m.panelRef.current))),(ee=m.panelRef.current)!=null?ee:v.current]}),Kt=(()=>!(!P||R))();Ah(()=>ut(),x,Kt);let T=(()=>!(R||f!==0))();Sd(g==null?void 0:g.defaultView,"keydown",W=>{T&&(W.defaultPrevented||W.key===wd.Escape&&(W.preventDefault(),W.stopPropagation(),x()))});let O=(()=>!(ne||f!==0||I))();$0(g,O,ut),w.useEffect(()=>{if(f!==0||!v.current)return;let W=new ResizeObserver(ee=>{for(let K of ee){let Yr=K.target.getBoundingClientRect();Yr.x===0&&Yr.y===0&&Yr.width===0&&Yr.height===0&&x()}});return W.observe(v.current),()=>W.disconnect()},[f,v,x]);let[F,j]=i0(),b=w.useMemo(()=>[{dialogState:f,close:x,setTitleId:_},m],[f,m,x,_]),Gt=w.useMemo(()=>({open:f===0}),[f]),st={ref:y,id:r,role:"dialog","aria-modal":f===0?!0:void 0,"aria-labelledby":m.titleId,"aria-describedby":F};return $.createElement(d0,{type:"Dialog",enabled:f===0,element:v,onUpdate:ue((W,ee)=>{ee==="Dialog"&&he(W,{[vu.Add]:()=>c(K=>K+1),[vu.Remove]:()=>c(K=>K-1)})})},$.createElement(mu,{force:!0},$.createElement(hu,null,$.createElement(no.Provider,{value:b},$.createElement(hu.Group,{target:v},$.createElement(mu,{force:!1},$.createElement(j,{slot:Gt,name:"Dialog.Description"},$.createElement(rr,{initialFocus:i,containers:ut,features:P?he(A,{parent:rr.features.RestoreFocus,leaf:rr.features.All&~rr.features.FocusLock}):rr.features.None},Be({ourProps:st,theirProps:s,slot:Gt,defaultTag:z0,features:j0,visible:f===0,name:"Dialog"})))))))),$.createElement(pu,{features:to.Hidden,ref:h}))}let I0="div";function B0(e,t){let n=Gn(),{id:r=`headlessui-dialog-overlay-${n}`,...l}=e,[{dialogState:o,close:i}]=Qr("Dialog.Overlay"),u=qe(t),s=ue(c=>{if(c.target===c.currentTarget){if(Mh(c.currentTarget))return c.preventDefault();c.preventDefault(),c.stopPropagation(),i()}}),a=w.useMemo(()=>({open:o===0}),[o]);return Be({ourProps:{ref:u,id:r,"aria-hidden":!0,onClick:s},theirProps:l,slot:a,defaultTag:I0,name:"Dialog.Overlay"})}let H0="div";function V0(e,t){let n=Gn(),{id:r=`headlessui-dialog-backdrop-${n}`,...l}=e,[{dialogState:o},i]=Qr("Dialog.Backdrop"),u=qe(t);w.useEffect(()=>{if(i.panelRef.current===null)throw new Error("A component is being used, but a component is missing.")},[i.panelRef]);let s=w.useMemo(()=>({open:o===0}),[o]);return $.createElement(mu,{force:!0},$.createElement(hu,null,Be({ourProps:{ref:u,id:r,"aria-hidden":!0},theirProps:l,slot:s,defaultTag:H0,name:"Dialog.Backdrop"})))}let W0="div";function Q0(e,t){let n=Gn(),{id:r=`headlessui-dialog-panel-${n}`,...l}=e,[{dialogState:o},i]=Qr("Dialog.Panel"),u=qe(t,i.panelRef),s=w.useMemo(()=>({open:o===0}),[o]),a=ue(c=>{c.stopPropagation()});return Be({ourProps:{ref:u,id:r,onClick:a},theirProps:l,slot:s,defaultTag:W0,name:"Dialog.Panel"})}let K0="h2";function G0(e,t){let n=Gn(),{id:r=`headlessui-dialog-title-${n}`,...l}=e,[{dialogState:o,setTitleId:i}]=Qr("Dialog.Title"),u=qe(t);w.useEffect(()=>(i(r),()=>i(null)),[r,i]);let s=w.useMemo(()=>({open:o===0}),[o]);return Be({ourProps:{ref:u,id:r},theirProps:l,slot:s,defaultTag:K0,name:"Dialog.Title"})}let Y0=Ae(U0),X0=Ae(V0),J0=Ae(Q0),q0=Ae(B0),Z0=Ae(G0),si=Object.assign(Y0,{Backdrop:X0,Panel:J0,Overlay:q0,Title:Z0,Description:c0});function b0(e=0){let[t,n]=w.useState(e),r=Wr(),l=w.useCallback(s=>{r.current&&n(a=>a|s)},[t,r]),o=w.useCallback(s=>!!(t&s),[t]),i=w.useCallback(s=>{r.current&&n(a=>a&~s)},[n,r]),u=w.useCallback(s=>{r.current&&n(a=>a^s)},[n]);return{flags:t,addFlag:l,hasFlag:o,removeFlag:i,toggleFlag:u}}function e1(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ai(e,...t){e&&t.length>0&&e.classList.add(...t)}function ci(e,...t){e&&t.length>0&&e.classList.remove(...t)}function t1(e,t){let n=Qn();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:l}=getComputedStyle(e),[o,i]=[r,l].map(s=>{let[a=0]=s.split(",").filter(Boolean).map(c=>c.includes("ms")?parseFloat(c):parseFloat(c)*1e3).sort((c,d)=>d-c);return a}),u=o+i;if(u!==0){n.group(a=>{a.setTimeout(()=>{t(),a.dispose()},u),a.addEventListener(e,"transitionrun",c=>{c.target===c.currentTarget&&a.dispose()})});let s=n.addEventListener(e,"transitionend",a=>{a.target===a.currentTarget&&(t(),s())})}else t();return n.add(()=>t()),n.dispose}function n1(e,t,n,r){let l=n?"enter":"leave",o=Qn(),i=r!==void 0?e1(r):()=>{};l==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let u=he(l,{enter:()=>t.enter,leave:()=>t.leave}),s=he(l,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),a=he(l,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return ci(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ai(e,...u,...a),o.nextFrame(()=>{ci(e,...a),ai(e,...s),t1(e,()=>(ci(e,...u),ai(e,...t.entered),i()))}),o.dispose}function r1({container:e,direction:t,classes:n,onStart:r,onStop:l}){let o=Wr(),i=gs(),u=vt(t);lt(()=>{let s=Qn();i.add(s.dispose);let a=e.current;if(a&&u.current!=="idle"&&o.current)return s.dispose(),r.current(u.current),s.add(n1(a,n.current,u.current==="enter",()=>{s.dispose(),l.current(u.current)})),s.dispose},[t])}function Yt(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let ko=w.createContext(null);ko.displayName="TransitionContext";var l1=(e=>(e.Visible="visible",e.Hidden="hidden",e))(l1||{});function o1(){let e=w.useContext(ko);if(e===null)throw new Error("A is used but it is missing a parent or .");return e}function i1(){let e=w.useContext(xo);if(e===null)throw new Error("A is used but it is missing a parent or .");return e}let xo=w.createContext(null);xo.displayName="NestingContext";function Co(e){return"children"in e?Co(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function _d(e,t){let n=vt(e),r=w.useRef([]),l=Wr(),o=gs(),i=ue((y,h=pt.Hidden)=>{let g=r.current.findIndex(({el:N})=>N===y);g!==-1&&(he(h,{[pt.Unmount](){r.current.splice(g,1)},[pt.Hidden](){r.current[g].state="hidden"}}),o.microTask(()=>{var N;!Co(r)&&l.current&&((N=n.current)==null||N.call(n))}))}),u=ue(y=>{let h=r.current.find(({el:g})=>g===y);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:y,state:"visible"}),()=>i(y,pt.Unmount)}),s=w.useRef([]),a=w.useRef(Promise.resolve()),c=w.useRef({enter:[],leave:[],idle:[]}),d=ue((y,h,g)=>{s.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([N])=>N!==y)),t==null||t.chains.current[h].push([y,new Promise(N=>{s.current.push(N)})]),t==null||t.chains.current[h].push([y,new Promise(N=>{Promise.all(c.current[h].map(([p,f])=>f)).then(()=>N())})]),h==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(h)):g(h)}),v=ue((y,h,g)=>{Promise.all(c.current[h].splice(0).map(([N,p])=>p)).then(()=>{var N;(N=s.current.shift())==null||N()}).then(()=>g(h))});return w.useMemo(()=>({children:r,register:u,unregister:i,onStart:d,onStop:v,wait:a,chains:c}),[u,i,r,d,v,c,a])}function u1(){}let s1=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Ia(e){var t;let n={};for(let r of s1)n[r]=(t=e[r])!=null?t:u1;return n}function a1(e){let t=w.useRef(Ia(e));return w.useEffect(()=>{t.current=Ia(e)},[e]),t}let c1="div",Ld=eo.RenderStrategy;function f1(e,t){let{beforeEnter:n,afterEnter:r,beforeLeave:l,afterLeave:o,enter:i,enterFrom:u,enterTo:s,entered:a,leave:c,leaveFrom:d,leaveTo:v,...y}=e,h=w.useRef(null),g=qe(h,t),N=y.unmount?pt.Unmount:pt.Hidden,{show:p,appear:f,initial:m}=o1(),[E,x]=w.useState(p?"visible":"hidden"),_=i1(),{register:P,unregister:R}=_,I=w.useRef(null);w.useEffect(()=>P(h),[P,h]),w.useEffect(()=>{if(N===pt.Hidden&&h.current){if(p&&E!=="visible"){x("visible");return}return he(E,{hidden:()=>R(h),visible:()=>P(h)})}},[E,h,P,R,p,N]);let A=vt({enter:Yt(i),enterFrom:Yt(u),enterTo:Yt(s),entered:Yt(a),leave:Yt(c),leaveFrom:Yt(d),leaveTo:Yt(v)}),ne=a1({beforeEnter:n,afterEnter:r,beforeLeave:l,afterLeave:o}),He=Kn();w.useEffect(()=>{if(He&&E==="visible"&&h.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[h,E,He]);let Ve=m&&!f,pn=(()=>!He||Ve||I.current===p?"idle":p?"enter":"leave")(),it=b0(0),ut=ue(j=>he(j,{enter:()=>{it.addFlag(Pe.Opening),ne.current.beforeEnter()},leave:()=>{it.addFlag(Pe.Closing),ne.current.beforeLeave()},idle:()=>{}})),Kt=ue(j=>he(j,{enter:()=>{it.removeFlag(Pe.Opening),ne.current.afterEnter()},leave:()=>{it.removeFlag(Pe.Closing),ne.current.afterLeave()},idle:()=>{}})),T=_d(()=>{x("hidden"),R(h)},_);r1({container:h,classes:A,direction:pn,onStart:vt(j=>{T.onStart(h,j,ut)}),onStop:vt(j=>{T.onStop(h,j,Kt),j==="leave"&&!Co(T)&&(x("hidden"),R(h))})}),w.useEffect(()=>{Ve&&(N===pt.Hidden?I.current=null:I.current=p)},[p,Ve,E]);let O=y,F={ref:g};return f&&p&&(O={...O,className:du(y.className,...A.current.enter,...A.current.enterFrom)}),$.createElement(xo.Provider,{value:T},$.createElement(Ih,{value:he(E,{visible:Pe.Open,hidden:Pe.Closed})|it.flags},Be({ourProps:F,theirProps:O,defaultTag:c1,features:Ld,visible:E==="visible",name:"Transition.Child"})))}function d1(e,t){let{show:n,appear:r=!1,unmount:l,...o}=e,i=w.useRef(null),u=qe(i,t);Kn();let s=ws();if(n===void 0&&s!==null&&(n=(s&Pe.Open)===Pe.Open),![!0,!1].includes(n))throw new Error("A is used but it is missing a `show={true | false}` prop.");let[a,c]=w.useState(n?"visible":"hidden"),d=_d(()=>{c("hidden")}),[v,y]=w.useState(!0),h=w.useRef([n]);lt(()=>{v!==!1&&h.current[h.current.length-1]!==n&&(h.current.push(n),y(!1))},[h,n]);let g=w.useMemo(()=>({show:n,appear:r,initial:v}),[n,r,v]);w.useEffect(()=>{if(n)c("visible");else if(!Co(d))c("hidden");else{let p=i.current;if(!p)return;let f=p.getBoundingClientRect();f.x===0&&f.y===0&&f.width===0&&f.height===0&&c("hidden")}},[n,d]);let N={unmount:l};return $.createElement(xo.Provider,{value:d},$.createElement(ko.Provider,{value:g},Be({ourProps:{...N,as:w.Fragment,children:$.createElement(Rd,{ref:u,...N,...o})},theirProps:{},defaultTag:w.Fragment,features:Ld,visible:a==="visible",name:"Transition"})))}function p1(e,t){let n=w.useContext(ko)!==null,r=ws()!==null;return $.createElement($.Fragment,null,!n&&r?$.createElement(gu,{ref:t,...e}):$.createElement(Rd,{ref:t,...e}))}let gu=Ae(d1),Rd=Ae(f1),m1=Ae(p1),fi=Object.assign(gu,{Child:m1,Root:gu});function Od({show:e,onClose:t,onSubmit:n,title:r,content:l,submitText:o}){return C(fi,{appear:!0,show:e,as:w.Fragment,children:Y(si,{as:"div",className:"relative z-10",onClose:t,children:[C(fi.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:C("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),C("div",{className:"fixed inset-0 overflow-y-auto",children:C("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:C(fi.Child,{as:w.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:Y(si.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all",children:[C(si.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:r}),C("div",{className:"mt-3 text-sm text-gray-500",children:l}),Y("div",{className:"mt-4 flex flex-row-reverse",children:[o&&C("button",{type:"button",className:"inline-flex ml-4 justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-indigo-100 hover:bg-indigo-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-300",onClick:n,children:o}),C("button",{type:"button",className:"inline-flex justify-center rounded-md border border-transparent bg-indigo-100 px-4 py-2 text-sm font-medium text-indigo-900 hover:bg-indigo-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 transition-all duration-300",onClick:t,children:"Close"})]})]})})})})]})})}function h1(e){return C("div",{children:C("input",{...e,type:"url",className:"my-2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"www.example.com",required:!0})})}function v1(e){return Y(yt,{children:[C("label",{children:"Select the model to use."}),Y("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.model,onChange:t=>{e.transcriber.onModelChange(t.target.value)},children:[C("option",{value:"whisper-tiny.en",children:"whisper-tiny.en (61MB)"}),C("option",{value:"whisper-tiny",children:"whisper-tiny (61MB)"}),C("option",{value:"whisper-base.en",children:"whisper-base.en (103MB)"}),C("option",{value:"whisper-base",children:"whisper-base (103MB)"}),C("option",{value:"whisper-small.en",children:"whisper-small.en (290MB)"}),C("option",{value:"whisper-small",children:"whisper-small (290MB)"})]})]})}function g1(e){return e=e.toLowerCase(),(e.match(/\w+.?/g)||[]).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}const Ba={en:"english",zh:"chinese",de:"german",es:"spanish/castilian",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan/valencian",nl:"dutch/flemish",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian/moldavian/moldovan",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi/panjabi",si:"sinhala/sinhalese",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole/haitian",ps:"pashto/pushto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish/letzeburgesch",my:"myanmar/burmese",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese"};function y1(e){const t=Object.values(Ba).map(g1);return Y(yt,{children:[C("label",{children:"Select the task to perform. (Coming soon)"}),Y("select",{disabled:!0,className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.subtask,onChange:n=>{e.transcriber.onSubtaskChange(n.target.value)},children:[C("option",{children:"Transcribe"}),C("option",{children:"Translate"})]}),e.transcriber.subtask==="Translate"&&Y(yt,{children:[C("label",{children:"Select the source language."}),C("select",{className:"mt-1 mb-3 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",defaultValue:e.transcriber.language,onChange:n=>{e.transcriber.onLanguageChange(n.target.value)},children:Object.keys(Ba).map((n,r)=>C("option",{value:n,children:t[r]},n))})]})]})}function Fd(e,t){return function(){return e.apply(t,arguments)}}const{toString:w1}=Object.prototype,{getPrototypeOf:ks}=Object,To=(e=>t=>{const n=w1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ot=e=>(e=e.toLowerCase(),t=>To(t)===e),No=e=>t=>typeof t===e,{isArray:Yn}=Array,zr=No("undefined");function S1(e){return e!==null&&!zr(e)&&e.constructor!==null&&!zr(e.constructor)&&je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ad=ot("ArrayBuffer");function E1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ad(e.buffer),t}const k1=No("string"),je=No("function"),Dd=No("number"),Po=e=>e!==null&&typeof e=="object",x1=e=>e===!0||e===!1,Nl=e=>{if(To(e)!=="object")return!1;const t=ks(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},C1=ot("Date"),T1=ot("File"),N1=ot("Blob"),P1=ot("FileList"),_1=e=>Po(e)&&je(e.pipe),L1=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||je(e.append)&&((t=To(e))==="formdata"||t==="object"&&je(e.toString)&&e.toString()==="[object FormData]"))},R1=ot("URLSearchParams"),O1=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,l;if(typeof e!="object"&&(e=[e]),Yn(e))for(r=0,l=e.length;r0;)if(l=n[r],t===l.toLowerCase())return l;return null}const Md=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),zd=e=>!zr(e)&&e!==Md;function yu(){const{caseless:e}=zd(this)&&this||{},t={},n=(r,l)=>{const o=e&&$d(t,l)||l;Nl(t[o])&&Nl(r)?t[o]=yu(t[o],r):Nl(r)?t[o]=yu({},r):Yn(r)?t[o]=r.slice():t[o]=r};for(let r=0,l=arguments.length;r(Kr(t,(l,o)=>{n&&je(l)?e[o]=Fd(l,n):e[o]=l},{allOwnKeys:r}),e),A1=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),D1=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},$1=(e,t,n,r)=>{let l,o,i;const u={};if(t=t||{},e==null)return t;do{for(l=Object.getOwnPropertyNames(e),o=l.length;o-- >0;)i=l[o],(!r||r(i,e,t))&&!u[i]&&(t[i]=e[i],u[i]=!0);e=n!==!1&&ks(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},M1=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},z1=e=>{if(!e)return null;if(Yn(e))return e;let t=e.length;if(!Dd(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},j1=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ks(Uint8Array)),U1=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let l;for(;(l=r.next())&&!l.done;){const o=l.value;t.call(e,o[0],o[1])}},I1=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},B1=ot("HTMLFormElement"),H1=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,l){return r.toUpperCase()+l}),Ha=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),V1=ot("RegExp"),jd=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Kr(n,(l,o)=>{t(l,o,e)!==!1&&(r[o]=l)}),Object.defineProperties(e,r)},W1=e=>{jd(e,(t,n)=>{if(je(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(je(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Q1=(e,t)=>{const n={},r=l=>{l.forEach(o=>{n[o]=!0})};return Yn(e)?r(e):r(String(e).split(t)),n},K1=()=>{},G1=(e,t)=>(e=+e,Number.isFinite(e)?e:t),di="abcdefghijklmnopqrstuvwxyz",Va="0123456789",Ud={DIGIT:Va,ALPHA:di,ALPHA_DIGIT:di+di.toUpperCase()+Va},Y1=(e=16,t=Ud.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function X1(e){return!!(e&&je(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const J1=e=>{const t=new Array(10),n=(r,l)=>{if(Po(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[l]=r;const o=Yn(r)?[]:{};return Kr(r,(i,u)=>{const s=n(i,l+1);!zr(s)&&(o[u]=s)}),t[l]=void 0,o}}return r};return n(e,0)},q1=ot("AsyncFunction"),Z1=e=>e&&(Po(e)||je(e))&&je(e.then)&&je(e.catch),S={isArray:Yn,isArrayBuffer:Ad,isBuffer:S1,isFormData:L1,isArrayBufferView:E1,isString:k1,isNumber:Dd,isBoolean:x1,isObject:Po,isPlainObject:Nl,isUndefined:zr,isDate:C1,isFile:T1,isBlob:N1,isRegExp:V1,isFunction:je,isStream:_1,isURLSearchParams:R1,isTypedArray:j1,isFileList:P1,forEach:Kr,merge:yu,extend:F1,trim:O1,stripBOM:A1,inherits:D1,toFlatObject:$1,kindOf:To,kindOfTest:ot,endsWith:M1,toArray:z1,forEachEntry:U1,matchAll:I1,isHTMLForm:B1,hasOwnProperty:Ha,hasOwnProp:Ha,reduceDescriptors:jd,freezeMethods:W1,toObjectSet:Q1,toCamelCase:H1,noop:K1,toFiniteNumber:G1,findKey:$d,global:Md,isContextDefined:zd,ALPHABET:Ud,generateString:Y1,isSpecCompliantForm:X1,toJSONObject:J1,isAsyncFn:q1,isThenable:Z1};function M(e,t,n,r,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),l&&(this.response=l)}S.inherits(M,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:S.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Id=M.prototype,Bd={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Bd[e]={value:e}});Object.defineProperties(M,Bd);Object.defineProperty(Id,"isAxiosError",{value:!0});M.from=(e,t,n,r,l,o)=>{const i=Object.create(Id);return S.toFlatObject(e,i,function(s){return s!==Error.prototype},u=>u!=="isAxiosError"),M.call(i,e.message,t,n,r,l),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const b1=null;function wu(e){return S.isPlainObject(e)||S.isArray(e)}function Hd(e){return S.endsWith(e,"[]")?e.slice(0,-2):e}function Wa(e,t,n){return e?e.concat(t).map(function(l,o){return l=Hd(l),!n&&o?"["+l+"]":l}).join(n?".":""):t}function ev(e){return S.isArray(e)&&!e.some(wu)}const tv=S.toFlatObject(S,{},null,function(t){return/^is[A-Z]/.test(t)});function _o(e,t,n){if(!S.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=S.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,N){return!S.isUndefined(N[g])});const r=n.metaTokens,l=n.visitor||c,o=n.dots,i=n.indexes,s=(n.Blob||typeof Blob<"u"&&Blob)&&S.isSpecCompliantForm(t);if(!S.isFunction(l))throw new TypeError("visitor must be a function");function a(h){if(h===null)return"";if(S.isDate(h))return h.toISOString();if(!s&&S.isBlob(h))throw new M("Blob is not supported. Use a Buffer instead.");return S.isArrayBuffer(h)||S.isTypedArray(h)?s&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function c(h,g,N){let p=h;if(h&&!N&&typeof h=="object"){if(S.endsWith(g,"{}"))g=r?g:g.slice(0,-2),h=JSON.stringify(h);else if(S.isArray(h)&&ev(h)||(S.isFileList(h)||S.endsWith(g,"[]"))&&(p=S.toArray(h)))return g=Hd(g),p.forEach(function(m,E){!(S.isUndefined(m)||m===null)&&t.append(i===!0?Wa([g],E,o):i===null?g:g+"[]",a(m))}),!1}return wu(h)?!0:(t.append(Wa(N,g,o),a(h)),!1)}const d=[],v=Object.assign(tv,{defaultVisitor:c,convertValue:a,isVisitable:wu});function y(h,g){if(!S.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(h),S.forEach(h,function(p,f){(!(S.isUndefined(p)||p===null)&&l.call(t,p,S.isString(f)?f.trim():f,g,v))===!0&&y(p,g?g.concat(f):[f])}),d.pop()}}if(!S.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Qa(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function xs(e,t){this._pairs=[],e&&_o(e,this,t)}const Vd=xs.prototype;Vd.append=function(t,n){this._pairs.push([t,n])};Vd.toString=function(t){const n=t?function(r){return t.call(this,r,Qa)}:Qa;return this._pairs.map(function(l){return n(l[0])+"="+n(l[1])},"").join("&")};function nv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wd(e,t,n){if(!t)return e;const r=n&&n.encode||nv,l=n&&n.serialize;let o;if(l?o=l(t,n):o=S.isURLSearchParams(t)?t.toString():new xs(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class rv{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){S.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Ka=rv,Qd={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lv=typeof URLSearchParams<"u"?URLSearchParams:xs,ov=typeof FormData<"u"?FormData:null,iv=typeof Blob<"u"?Blob:null,uv=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),sv=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),tt={isBrowser:!0,classes:{URLSearchParams:lv,FormData:ov,Blob:iv},isStandardBrowserEnv:uv,isStandardBrowserWebWorkerEnv:sv,protocols:["http","https","file","blob","url","data"]};function av(e,t){return _o(e,new tt.classes.URLSearchParams,Object.assign({visitor:function(n,r,l,o){return tt.isNode&&S.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function cv(e){return S.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function fv(e){const t={},n=Object.keys(e);let r;const l=n.length;let o;for(r=0;r=n.length;return i=!i&&S.isArray(l)?l.length:i,s?(S.hasOwnProp(l,i)?l[i]=[l[i],r]:l[i]=r,!u):((!l[i]||!S.isObject(l[i]))&&(l[i]=[]),t(n,r,l[i],o)&&S.isArray(l[i])&&(l[i]=fv(l[i])),!u)}if(S.isFormData(e)&&S.isFunction(e.entries)){const n={};return S.forEachEntry(e,(r,l)=>{t(cv(r),l,n,0)}),n}return null}const dv={"Content-Type":void 0};function pv(e,t,n){if(S.isString(e))try{return(t||JSON.parse)(e),S.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Lo={transitional:Qd,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",l=r.indexOf("application/json")>-1,o=S.isObject(t);if(o&&S.isHTMLForm(t)&&(t=new FormData(t)),S.isFormData(t))return l&&l?JSON.stringify(Kd(t)):t;if(S.isArrayBuffer(t)||S.isBuffer(t)||S.isStream(t)||S.isFile(t)||S.isBlob(t))return t;if(S.isArrayBufferView(t))return t.buffer;if(S.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return av(t,this.formSerializer).toString();if((u=S.isFileList(t))||r.indexOf("multipart/form-data")>-1){const s=this.env&&this.env.FormData;return _o(u?{"files[]":t}:t,s&&new s,this.formSerializer)}}return o||l?(n.setContentType("application/json",!1),pv(t)):t}],transformResponse:[function(t){const n=this.transitional||Lo.transitional,r=n&&n.forcedJSONParsing,l=this.responseType==="json";if(t&&S.isString(t)&&(r&&!this.responseType||l)){const i=!(n&&n.silentJSONParsing)&&l;try{return JSON.parse(t)}catch(u){if(i)throw u.name==="SyntaxError"?M.from(u,M.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tt.classes.FormData,Blob:tt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};S.forEach(["delete","get","head"],function(t){Lo.headers[t]={}});S.forEach(["post","put","patch"],function(t){Lo.headers[t]=S.merge(dv)});const Cs=Lo,mv=S.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),hv=e=>{const t={};let n,r,l;return e&&e.split(` +`).forEach(function(i){l=i.indexOf(":"),n=i.substring(0,l).trim().toLowerCase(),r=i.substring(l+1).trim(),!(!n||t[n]&&mv[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ga=Symbol("internals");function or(e){return e&&String(e).trim().toLowerCase()}function Pl(e){return e===!1||e==null?e:S.isArray(e)?e.map(Pl):String(e)}function vv(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const gv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function pi(e,t,n,r,l){if(S.isFunction(r))return r.call(this,t,n);if(l&&(t=n),!!S.isString(t)){if(S.isString(r))return t.indexOf(r)!==-1;if(S.isRegExp(r))return r.test(t)}}function yv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function wv(e,t){const n=S.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(l,o,i){return this[r].call(this,t,l,o,i)},configurable:!0})})}class Ro{constructor(t){t&&this.set(t)}set(t,n,r){const l=this;function o(u,s,a){const c=or(s);if(!c)throw new Error("header name must be a non-empty string");const d=S.findKey(l,c);(!d||l[d]===void 0||a===!0||a===void 0&&l[d]!==!1)&&(l[d||s]=Pl(u))}const i=(u,s)=>S.forEach(u,(a,c)=>o(a,c,s));return S.isPlainObject(t)||t instanceof this.constructor?i(t,n):S.isString(t)&&(t=t.trim())&&!gv(t)?i(hv(t),n):t!=null&&o(n,t,r),this}get(t,n){if(t=or(t),t){const r=S.findKey(this,t);if(r){const l=this[r];if(!n)return l;if(n===!0)return vv(l);if(S.isFunction(n))return n.call(this,l,r);if(S.isRegExp(n))return n.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=or(t),t){const r=S.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||pi(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let l=!1;function o(i){if(i=or(i),i){const u=S.findKey(r,i);u&&(!n||pi(r,r[u],u,n))&&(delete r[u],l=!0)}}return S.isArray(t)?t.forEach(o):o(t),l}clear(t){const n=Object.keys(this);let r=n.length,l=!1;for(;r--;){const o=n[r];(!t||pi(this,this[o],o,t,!0))&&(delete this[o],l=!0)}return l}normalize(t){const n=this,r={};return S.forEach(this,(l,o)=>{const i=S.findKey(r,o);if(i){n[i]=Pl(l),delete n[o];return}const u=t?yv(o):String(o).trim();u!==o&&delete n[o],n[u]=Pl(l),r[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return S.forEach(this,(r,l)=>{r!=null&&r!==!1&&(n[l]=t&&S.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(l=>r.set(l)),r}static accessor(t){const r=(this[Ga]=this[Ga]={accessors:{}}).accessors,l=this.prototype;function o(i){const u=or(i);r[u]||(wv(l,i),r[u]=!0)}return S.isArray(t)?t.forEach(o):o(t),this}}Ro.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);S.freezeMethods(Ro.prototype);S.freezeMethods(Ro);const gt=Ro;function mi(e,t){const n=this||Cs,r=t||n,l=gt.from(r.headers);let o=r.data;return S.forEach(e,function(u){o=u.call(n,o,l.normalize(),t?t.status:void 0)}),l.normalize(),o}function Gd(e){return!!(e&&e.__CANCEL__)}function Gr(e,t,n){M.call(this,e??"canceled",M.ERR_CANCELED,t,n),this.name="CanceledError"}S.inherits(Gr,M,{__CANCEL__:!0});function Sv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new M("Request failed with status code "+n.status,[M.ERR_BAD_REQUEST,M.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Ev=tt.isStandardBrowserEnv?function(){return{write:function(n,r,l,o,i,u){const s=[];s.push(n+"="+encodeURIComponent(r)),S.isNumber(l)&&s.push("expires="+new Date(l).toGMTString()),S.isString(o)&&s.push("path="+o),S.isString(i)&&s.push("domain="+i),u===!0&&s.push("secure"),document.cookie=s.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function kv(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function xv(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Yd(e,t){return e&&!kv(t)?xv(e,t):t}const Cv=tt.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function l(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=l(window.location.href),function(i){const u=S.isString(i)?l(i):i;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}();function Tv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nv(e,t){e=e||10;const n=new Array(e),r=new Array(e);let l=0,o=0,i;return t=t!==void 0?t:1e3,function(s){const a=Date.now(),c=r[o];i||(i=a),n[l]=s,r[l]=a;let d=o,v=0;for(;d!==l;)v+=n[d++],d=d%e;if(l=(l+1)%e,l===o&&(o=(o+1)%e),a-i{const o=l.loaded,i=l.lengthComputable?l.total:void 0,u=o-n,s=r(u),a=o<=i;n=o;const c={loaded:o,total:i,progress:i?o/i:void 0,bytes:u,rate:s||void 0,estimated:s&&i&&a?(i-o)/s:void 0,event:l};c[t?"download":"upload"]=!0,e(c)}}const Pv=typeof XMLHttpRequest<"u",_v=Pv&&function(e){return new Promise(function(n,r){let l=e.data;const o=gt.from(e.headers).normalize(),i=e.responseType;let u;function s(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}S.isFormData(l)&&(tt.isStandardBrowserEnv||tt.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.setContentType("multipart/form-data;",!1));let a=new XMLHttpRequest;if(e.auth){const y=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(y+":"+h))}const c=Yd(e.baseURL,e.url);a.open(e.method.toUpperCase(),Wd(c,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function d(){if(!a)return;const y=gt.from("getAllResponseHeaders"in a&&a.getAllResponseHeaders()),g={data:!i||i==="text"||i==="json"?a.responseText:a.response,status:a.status,statusText:a.statusText,headers:y,config:e,request:a};Sv(function(p){n(p),s()},function(p){r(p),s()},g),a=null}if("onloadend"in a?a.onloadend=d:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(d)},a.onabort=function(){a&&(r(new M("Request aborted",M.ECONNABORTED,e,a)),a=null)},a.onerror=function(){r(new M("Network Error",M.ERR_NETWORK,e,a)),a=null},a.ontimeout=function(){let h=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const g=e.transitional||Qd;e.timeoutErrorMessage&&(h=e.timeoutErrorMessage),r(new M(h,g.clarifyTimeoutError?M.ETIMEDOUT:M.ECONNABORTED,e,a)),a=null},tt.isStandardBrowserEnv){const y=(e.withCredentials||Cv(c))&&e.xsrfCookieName&&Ev.read(e.xsrfCookieName);y&&o.set(e.xsrfHeaderName,y)}l===void 0&&o.setContentType(null),"setRequestHeader"in a&&S.forEach(o.toJSON(),function(h,g){a.setRequestHeader(g,h)}),S.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),i&&i!=="json"&&(a.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&a.addEventListener("progress",Ya(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",Ya(e.onUploadProgress)),(e.cancelToken||e.signal)&&(u=y=>{a&&(r(!y||y.type?new Gr(null,e,a):y),a.abort(),a=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u)));const v=Tv(c);if(v&&tt.protocols.indexOf(v)===-1){r(new M("Unsupported protocol "+v+":",M.ERR_BAD_REQUEST,e));return}a.send(l||null)})},_l={http:b1,xhr:_v};S.forEach(_l,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Lv={getAdapter:e=>{e=S.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let l=0;le instanceof gt?e.toJSON():e;function Bn(e,t){t=t||{};const n={};function r(a,c,d){return S.isPlainObject(a)&&S.isPlainObject(c)?S.merge.call({caseless:d},a,c):S.isPlainObject(c)?S.merge({},c):S.isArray(c)?c.slice():c}function l(a,c,d){if(S.isUndefined(c)){if(!S.isUndefined(a))return r(void 0,a,d)}else return r(a,c,d)}function o(a,c){if(!S.isUndefined(c))return r(void 0,c)}function i(a,c){if(S.isUndefined(c)){if(!S.isUndefined(a))return r(void 0,a)}else return r(void 0,c)}function u(a,c,d){if(d in t)return r(a,c);if(d in e)return r(void 0,a)}const s={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:u,headers:(a,c)=>l(Ja(a),Ja(c),!0)};return S.forEach(Object.keys(Object.assign({},e,t)),function(c){const d=s[c]||l,v=d(e[c],t[c],c);S.isUndefined(v)&&d!==u||(n[c]=v)}),n}const Xd="1.4.0",Ts={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ts[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const qa={};Ts.transitional=function(t,n,r){function l(o,i){return"[Axios v"+Xd+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,u)=>{if(t===!1)throw new M(l(i," has been removed"+(n?" in "+n:"")),M.ERR_DEPRECATED);return n&&!qa[i]&&(qa[i]=!0,console.warn(l(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,u):!0}};function Rv(e,t,n){if(typeof e!="object")throw new M("options must be an object",M.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let l=r.length;for(;l-- >0;){const o=r[l],i=t[o];if(i){const u=e[o],s=u===void 0||i(u,o,e);if(s!==!0)throw new M("option "+o+" must be "+s,M.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new M("Unknown option "+o,M.ERR_BAD_OPTION)}}const Su={assertOptions:Rv,validators:Ts},Tt=Su.validators;class ro{constructor(t){this.defaults=t,this.interceptors={request:new Ka,response:new Ka}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Bn(this.defaults,n);const{transitional:r,paramsSerializer:l,headers:o}=n;r!==void 0&&Su.assertOptions(r,{silentJSONParsing:Tt.transitional(Tt.boolean),forcedJSONParsing:Tt.transitional(Tt.boolean),clarifyTimeoutError:Tt.transitional(Tt.boolean)},!1),l!=null&&(S.isFunction(l)?n.paramsSerializer={serialize:l}:Su.assertOptions(l,{encode:Tt.function,serialize:Tt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i;i=o&&S.merge(o.common,o[n.method]),i&&S.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),n.headers=gt.concat(i,o);const u=[];let s=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(s=s&&g.synchronous,u.unshift(g.fulfilled,g.rejected))});const a=[];this.interceptors.response.forEach(function(g){a.push(g.fulfilled,g.rejected)});let c,d=0,v;if(!s){const h=[Xa.bind(this),void 0];for(h.unshift.apply(h,u),h.push.apply(h,a),v=h.length,c=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](l);r._listeners=null}),this.promise.then=l=>{let o;const i=new Promise(u=>{r.subscribe(u),o=u}).then(l);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,u){r.reason||(r.reason=new Gr(o,i,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Ns(function(l){t=l}),cancel:t}}}const Ov=Ns;function Fv(e){return function(n){return e.apply(null,n)}}function Av(e){return S.isObject(e)&&e.isAxiosError===!0}const Eu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Eu).forEach(([e,t])=>{Eu[t]=e});const Dv=Eu;function Jd(e){const t=new Ll(e),n=Fd(Ll.prototype.request,t);return S.extend(n,Ll.prototype,t,{allOwnKeys:!0}),S.extend(n,t,null,{allOwnKeys:!0}),n.create=function(l){return Jd(Bn(e,l))},n}const oe=Jd(Cs);oe.Axios=Ll;oe.CanceledError=Gr;oe.CancelToken=Ov;oe.isCancel=Gd;oe.VERSION=Xd;oe.toFormData=_o;oe.AxiosError=M;oe.Cancel=oe.CanceledError;oe.all=function(t){return Promise.all(t)};oe.spread=Fv;oe.isAxiosError=Av;oe.mergeConfig=Bn;oe.AxiosHeaders=gt;oe.formToJSON=e=>Kd(S.isHTMLForm(e)?new FormData(e):e);oe.HttpStatusCode=Dv;oe.default=oe;const $v=oe;function Mv(e){const{isModelLoading:t,isTranscribing:n,onClick:r,...l}=e;return C("button",{...l,onClick:o=>{r&&!n&&!t&&r(o)},disabled:n,className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mr-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 inline-flex items-center",children:t?C(Za,{text:"Loading model..."}):n?C(Za,{text:"Transcribing..."}):"Transcribe Audio"})}function Za(e){return Y("div",{role:"status",children:[Y("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 mr-3 text-white animate-spin",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#E5E7EB"}),C("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]}),e.text]})}function zv(e){const[t,n]=w.useState("INIT"),r=w.useRef(null);return w.useEffect(()=>{r.current&&(r.current.src=e.audioUrl,r.current.load()),n("INIT")},[e.audioUrl]),w.useEffect(()=>{if(r.current===null)return;let l=r.current;if(t==="ENDED"){l.currentTime=0,n("RESET");return}},[t]),C("div",{className:"flex relative z-10 p-4 w-full",children:C("audio",{ref:r,controls:!0,className:"w-full h-14 rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10"})})}function jv(e){const[t,n]=w.useState(void 0),[r,l]=w.useState(void 0),[o,i]=w.useState(void 0),u=t!==void 0,s=async c=>{const d=new AudioContext({sampleRate:An.SAMPLING_RATE}),v=URL.createObjectURL(new Blob([c],{type:"audio/*"})),y=await d.decodeAudioData(c);l({buffer:y,url:v,source:"URL"})},a=async c=>{if(o)try{l(void 0),n(0);const{data:d}=await $v.get(o,{signal:c.signal,responseType:"arraybuffer",onDownloadProgress(v){n(v.progress||0)}});s(d)}catch(d){console.log("Request failed or aborted",d)}finally{n(void 0)}};return w.useEffect(()=>{if(o){const c=new AbortController;return a(c),()=>{c.abort()}}},[o]),Y(yt,{children:[Y("div",{className:"flex flex-col justify-center items-center rounded-lg bg-white shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[Y("div",{className:"flex flex-row space-x-2 py-2 w-full px-2",children:[C(Wv,{icon:C(Gv,{}),text:"From URL",onUrlUpdate:c=>{e.transcriber.onInputChange(),i(c)}}),C(Bv,{}),C(Kv,{icon:C(Yv,{}),text:"From file",onFileUpdate:(c,d)=>{e.transcriber.onInputChange(),l({buffer:c,url:d,source:"FILE"})}})]}),C(Hv,{progress:u?t:+!!r})]}),r&&Y(yt,{children:[C(zv,{audioUrl:r.url}),Y("div",{className:"relative w-full flex justify-center items-center",children:[C(Mv,{onClick:()=>{e.transcriber.start(r.buffer)},isModelLoading:e.transcriber.isModelLoading,isTranscribing:e.transcriber.isBusy}),C(Uv,{className:"absolute right-4",transcriber:e.transcriber,icon:C(Xv,{})})]})]})]})}function Uv(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},l=()=>{n(!1)},o=i=>{l()};return Y("div",{className:e.className,children:[C(Ps,{icon:e.icon,onClick:r}),C(Iv,{show:t,onSubmit:o,onClose:l,transcriber:e.transcriber})]})}function Iv(e){return C(Od,{show:e.show,title:"Settings",content:Y(yt,{children:[C(v1,{transcriber:e.transcriber}),C(y1,{transcriber:e.transcriber})]}),onClose:e.onClose,onSubmit:()=>{}})}function Bv(){return C("div",{className:"w-[1px] bg-slate-200"})}function Hv(e){return C(Vv,{progress:`${Math.round(e.progress*100)}%`})}function Vv(e){return C("div",{className:"w-full bg-gray-200 rounded-full h-1 dark:bg-gray-700",children:C("div",{className:"bg-blue-600 h-1 rounded-full transition-all duration-100",style:{width:e.progress}})})}function Wv(e){const[t,n]=w.useState(!1),r=()=>{n(!0)},l=()=>{n(!1)},o=i=>{e.onUrlUpdate(i),l()};return Y(yt,{children:[C(Ps,{icon:e.icon,text:e.text,onClick:r}),C(Qv,{show:t,onSubmit:o,onClose:l})]})}function Qv(e){const[t,n]=w.useState(An.DEFAULT_AUDIO_URL),r=o=>{n(o.target.value)},l=()=>{e.onSubmit(t)};return C(Od,{show:e.show,title:"From URL",content:Y(yt,{children:["Enter the URL of the audio file you want to load.",C(h1,{onChange:r,value:t})]}),onClose:e.onClose,submitText:"Load",onSubmit:l})}function Kv(e){let t=document.createElement("input");return t.type="file",t.oninput=n=>{let r=n.target.files;if(!r)return;const l=URL.createObjectURL(r[0]),o=new FileReader;o.addEventListener("load",async i=>{var c;const u=(c=i.target)==null?void 0:c.result;if(!u)return;const a=await new AudioContext({sampleRate:An.SAMPLING_RATE}).decodeAudioData(u);e.onFileUpdate(a,l)}),o.readAsArrayBuffer(r[0]),t.value=""},C(yt,{children:C(Ps,{icon:e.icon,text:e.text,onClick:()=>t.click()})})}function Ps(e){return Y("button",{onClick:e.onClick,className:"flex items-center justify-center rounded-lg p-2 bg-blue text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 transition-all duration-200",children:[C("div",{className:"w-7 h-7",children:e.icon}),e.text&&C("div",{className:"ml-2 break-text text-center text-md w-30",children:e.text})]})}function Gv(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})})}function Yv(){return C("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})})}function Xv(){return Y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.25",stroke:"currentColor",children:[C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function vi(e){return String(e).padStart(2,"0")}function Jv(e){const t=e/3600|0;e-=t*(60*60);const n=e/60|0;e-=n*60;const r=e|0;return`${t?vi(t)+":":""}${vi(n)}:${vi(r)}`}function qv({transcribedData:e}){return C("div",{className:"w-full flex flex-col my-2 p-4 max-h-[20rem] overflow-y-auto",children:e&&e.chunks.map(t=>Y("div",{className:"w-full flex flex-row mb-2 bg-white rounded-lg p-4 shadow-xl shadow-black/5 ring-1 ring-slate-700/10",children:[C("div",{className:"mr-5",children:Jv(t.timestamp[0])}),t.text]},t.text))})}function Zv(e){const[t]=w.useState(()=>bv(e));return t}function bv(e){const t=new Worker(new URL("/assets/worker-aae0055c.js",self.location),{type:"module"});return t.addEventListener("message",e),t}function eg(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),[l,o]=w.useState(!1),i=Zv(m=>{const E=m.data;switch(E.status){case"progress":break;case"update":const x=E;t({text:x.data[0],chunks:x.data[1].chunks});break;case"complete":const _=E;t({text:_.data.text,chunks:_.data.chunks}),r(!1);break;case"initiate":o(!0);break;case"ready":o(!1);break}}),[u,s]=w.useState(An.DEFAULT_MODEL),[a,c]=w.useState(An.DEFAULT_SUBTASK),[d,v]=w.useState(An.DEFAULT_LANGUAGE),y=w.useCallback(m=>{s(m)},[]),h=w.useCallback(m=>{c(m)},[]),g=w.useCallback(m=>{v(m)},[]),N=w.useCallback(()=>{t(void 0)},[]),p=w.useCallback(async m=>{m&&(t(void 0),r(!0),i.postMessage({audio:m.getChannelData(0),model:u,subtask:a,language:d}))},[i,u,a,d]);return w.useMemo(()=>({onInputChange:N,isBusy:n,isModelLoading:l,start:p,output:e,model:u,onModelChange:y,subtask:a,onSubtaskChange:h,language:d,onLanguageChange:g}),[n,l,p,e,u,a,d])}function tg(){const e=eg();return C("div",{className:"flex justify-center items-center min-h-screen",children:Y("div",{className:"container flex flex-col justify-center items-center",children:[C("h1",{className:"text-5xl font-extrabold tracking-tight text-slate-900 sm:text-7xl",children:"Whisper Web"}),C("h2",{className:"mt-3 mb-5 px-4 text-center text-1xl font-semibold tracking-tight text-slate-900 sm:text-2xl",children:"ML-powered speech recognition directly in your browser"}),C(jv,{transcriber:e}),C(qv,{transcribedData:e.output})]})})}yi.createRoot(document.getElementById("root")).render(C($.StrictMode,{children:C(tg,{})})); diff --git a/assets/index-53524ce4.css b/assets/index-53524ce4.css new file mode 100644 index 0000000000000000000000000000000000000000..8f0589b6ad4a94f2f48248f70c8c630ee968285e --- /dev/null +++ b/assets/index-53524ce4.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0px}.right-4{right:1rem}.z-10{z-index:10}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-5{margin-bottom:1.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-5{margin-right:1.25rem}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-1{height:.25rem}.h-14{height:3.5rem}.h-4{height:1rem}.h-7{height:1.75rem}.max-h-\[20rem\]{max-height:20rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-4{width:1rem}.w-7{width:1.75rem}.w-\[1px\]{width:1px}.w-full{width:100%}.max-w-md{max-width:28rem}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-blue-700{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity))}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-25{--tw-bg-opacity: .25}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-6{line-height:1.5rem}.tracking-tight{letter-spacing:-.025em}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-indigo-100{--tw-text-opacity: 1;color:rgb(224 231 255 / var(--tw-text-opacity))}.text-indigo-900{--tw-text-opacity: 1;color:rgb(49 46 129 / var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/5{--tw-shadow-color: rgb(0 0 0 / .05);--tw-shadow: var(--tw-shadow-colored)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-slate-700\/10{--tw-ring-color: rgb(51 65 85 / .1)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}html,body,#root{height:100%}audio::-webkit-media-controls-panel{background-color:#fff}.container{width:41rem;max-width:95vw}.hover\:bg-blue-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity))}.hover\:bg-indigo-200:hover{--tw-bg-opacity: 1;background-color:rgb(199 210 254 / var(--tw-bg-opacity))}.hover\:bg-indigo-50:hover{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity))}.hover\:text-indigo-600:hover{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-4:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity))}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-indigo-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity))}.dark\:bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.dark\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}.dark\:placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}.dark\:hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity))}.dark\:focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.dark\:focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}.dark\:focus\:ring-blue-800:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity))}}@media (min-width: 640px){.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-7xl{font-size:4.5rem;line-height:1}} diff --git a/assets/worker-aae0055c.js b/assets/worker-aae0055c.js new file mode 100644 index 0000000000000000000000000000000000000000..9ee0a01fa08e9959545b6784b828273100244062 --- /dev/null +++ b/assets/worker-aae0055c.js @@ -0,0 +1,1790 @@ +var gn=Object.defineProperty;var mn=(rt,Xe,_)=>Xe in rt?gn(rt,Xe,{enumerable:!0,configurable:!0,writable:!0,value:_}):rt[Xe]=_;var de=(rt,Xe,_)=>(mn(rt,typeof Xe!="symbol"?Xe+"":Xe,_),_);(function(){var rt;"use strict";function _mergeNamespaces(_,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(c){if(c!=="default"&&!(c in _)){var l=Object.getOwnPropertyDescriptor(s,c);Object.defineProperty(_,c,l.get?l:{enumerable:!0,get:function(){return s[c]}})}})}),Object.freeze(_)}function dispatchCallback(_,n){_!==null&&_(n)}function reverseDictionary(_){return Object.fromEntries(Object.entries(_).map(([n,s])=>[s,n]))}function escapeRegExp(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Callable=class{constructor(){let _=function(...n){return _._call(...n)};return Object.setPrototypeOf(_,new.target.prototype)}_call(..._){throw Error("Must implement _call method in subclass")}};function isString(_){return typeof _=="string"||_ instanceof String}function isTypedArray(_){var n,s,c;return((c=(s=(n=_==null?void 0:_.prototype)==null?void 0:n.__proto__)==null?void 0:s.constructor)==null?void 0:c.name)==="TypedArray"}function isIntegralNumber(_){return Number.isInteger(_)||typeof _=="bigint"}function exists(_){return _!=null}function calculateDimensions(_){const n=[];let s=_;for(;Array.isArray(s);)n.push(s.length),s=s[0];return n}var fs={},ONNX_NODE=Object.freeze({__proto__:null,default:fs});function getDefaultExportFromCjs(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function getAugmentedNamespace(_){if(_.__esModule)return _;var n=_.default;if(typeof n=="function"){var s=function c(){if(this instanceof c){var l=[null];l.push.apply(l,arguments);var p=Function.bind.apply(n,l);return new p}return n.apply(this,arguments)};s.prototype=n.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(_).forEach(function(c){var l=Object.getOwnPropertyDescriptor(_,c);Object.defineProperty(s,c,l.get?l:{enumerable:!0,get:function(){return _[c]}})}),s}var ortWeb_min$1={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(_,n,s)=>{if(n&&typeof n.init=="function"&&typeof n.createSessionHandler=="function"){const c=backends[_];if(c===void 0)backends[_]={backend:n,priority:s};else{if(c.priority>s)return;if(c.priority===s&&c.backend!==n)throw new Error(`cannot register backend "${_}" using priority ${s}`)}if(s>=0){const l=backendsSortedByPriority.indexOf(_);l!==-1&&backendsSortedByPriority.splice(l,1);for(let p=0;p{const n=_.length===0?backendsSortedByPriority:_,s=[];for(const c of n){const l=backends[c];if(l){if(l.initialized)return l.backend;if(l.aborted)continue;const p=!!l.initPromise;try{return p||(l.initPromise=l.backend.init()),await l.initPromise,l.initialized=!0,l.backend}catch(a){p||s.push({name:c,err:a}),l.aborted=!0}finally{delete l.initPromise}}}throw new Error(`no available backend found. ERR: ${s.map(c=>`[${c.name}] ${c.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(n){if(n!==void 0){if(typeof n!="string"||["verbose","info","warning","error","fatal"].indexOf(n)===-1)throw new Error(`Unsupported logging level: ${n}`);this.logLevelInternal=n}}get logLevel(){return this.logLevelInternal}}const env$1=new EnvImpl,isBigInt64ArrayAvailable=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",isBigUint64ArrayAvailable=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function",NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);isBigInt64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64",BigInt64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array,"int64")),isBigUint64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64",BigUint64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array,"uint64"));const calculateSize=_=>{let n=1;for(let s=0;s<_.length;s++){const c=_[s];if(typeof c!="number"||!Number.isSafeInteger(c))throw new TypeError(`dims[${s}] must be an integer, got: ${c}`);if(c<0)throw new RangeError(`dims[${s}] must be a non-negative integer, got: ${c}`);n*=c}return n};let Tensor$2=class lt{constructor(n,s,c){let l,p,a;if(typeof n=="string")if(l=n,a=c,n==="string"){if(!Array.isArray(s))throw new TypeError("A string tensor's data must be a string array.");p=s}else{const f=NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(n);if(f===void 0)throw new TypeError(`Unsupported tensor type: ${n}.`);if(Array.isArray(s))p=f.from(s);else if(s instanceof f)p=s;else throw new TypeError(`A ${l} tensor's data must be type of ${f}`)}else if(a=s,Array.isArray(n)){if(n.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const f=typeof n[0];if(f==="string")l="string",p=n;else if(f==="boolean")l="bool",p=Uint8Array.from(n);else throw new TypeError(`Invalid element type of data array: ${f}.`)}else{const f=NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(n.constructor);if(f===void 0)throw new TypeError(`Unsupported type for tensor data: ${n.constructor}.`);l=f,p=n}if(a===void 0)a=[p.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");const h=calculateSize(a);if(h!==p.length)throw new Error(`Tensor's size(${h}) does not match data length(${p.length}).`);this.dims=a,this.type=l,this.data=p,this.size=h}static bufferToTensor(n,s){if(n===void 0)throw new Error("Image buffer must be defined");if(s.height===void 0||s.width===void 0)throw new Error("Image height and width must be defined");const{height:c,width:l}=s,p=s.norm;let a,h;p===void 0||p.mean===void 0?a=255:a=p.mean,p===void 0||p.bias===void 0?h=0:h=p.bias;const f=s.bitmapFormat!==void 0?s.bitmapFormat:"RGBA",u=s.tensorFormat!==void 0&&s.tensorFormat!==void 0?s.tensorFormat:"RGB",o=c*l,t=u==="RGBA"?new Float32Array(o*4):new Float32Array(o*3);let e=4,r=0,i=1,d=2,g=3,m=0,b=o,y=o*2,v=-1;f==="RGB"&&(e=3,r=0,i=1,d=2,g=-1),u==="RGBA"?v=o*3:u==="RBG"?(m=0,y=o,b=o*2):u==="BGR"&&(y=0,b=o,m=o*2);for(let S=0;S{const t=document.createElement("canvas"),e=t.getContext("2d");if(!n||!e)return o();const r=new Image;r.crossOrigin="Anonymous",r.src=n,r.onload=()=>{t.width=r.width,t.height=r.height,e.drawImage(r,0,0,t.width,t.height);const i=e.getImageData(0,0,t.width,t.height);if(s!==void 0){if(s.height!==void 0&&s.height!==t.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(f.height=t.height,s.width!==void 0&&s.width!==t.width)throw new Error("Image input config width doesn't match ImageBitmap width");f.width=t.width}else f.height=t.height,f.width=t.width;u(lt.bufferToTensor(i.data,f))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(h!==void 0)return lt.bufferToTensor(h,f);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(n){var s,c;const l=document.createElement("canvas").getContext("2d");let p;if(l!=null){const a=this.dims[3],h=this.dims[2],f=this.dims[1],u=n!==void 0&&n.format!==void 0?n.format:"RGB",o=n!==void 0&&((s=n.norm)===null||s===void 0?void 0:s.mean)!==void 0?n.norm.mean:255,t=n!==void 0&&((c=n.norm)===null||c===void 0?void 0:c.bias)!==void 0?n.norm.bias:0,e=h*a;if(n!==void 0){if(n.height!==void 0&&n.height!==h)throw new Error("Image output config height doesn't match tensor height");if(n.width!==void 0&&n.width!==a)throw new Error("Image output config width doesn't match tensor width");if(n.format!==void 0&&f===4&&n.format!=="RGBA"||f===3&&n.format!=="RGB"&&n.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const r=4;let i=0,d=1,g=2,m=3,b=0,y=e,v=e*2,w=-1;u==="RGBA"?(b=0,y=e,v=e*2,w=e*3):u==="RGB"?(b=0,y=e,v=e*2):u==="RBG"&&(b=0,v=e,y=e*2),p=l.createImageData(a,h);for(let S=0;S"u")throw new Error(`input '${u}' is missing in 'feeds'.`);if(a)for(const u of this.outputNames)l[u]=null;const h=await this.handler.run(n,l,p),f={};for(const u in h)Object.hasOwnProperty.call(h,u)&&(f[u]=new Tensor$1(h[u].type,h[u].data,h[u].dims));return f}static async create(n,s,c,l){let p,a={};if(typeof n=="string"){if(p=n,typeof s=="object"&&s!==null)a=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else if(n instanceof Uint8Array){if(p=n,typeof s=="object"&&s!==null)a=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else if(n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer){const t=n;let e=0,r=n.byteLength;if(typeof s=="object"&&s!==null)a=s;else if(typeof s=="number"){if(e=s,!Number.isSafeInteger(e))throw new RangeError("'byteOffset' must be an integer.");if(e<0||e>=t.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${t.byteLength}).`);if(r=n.byteLength-e,typeof c=="number"){if(r=c,!Number.isSafeInteger(r))throw new RangeError("'byteLength' must be an integer.");if(r<=0||e+r>t.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${t.byteLength-e}].`);if(typeof l=="object"&&l!==null)a=l;else if(typeof l<"u")throw new TypeError("'options' must be an object.")}else if(typeof c<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof s<"u")throw new TypeError("'options' must be an object.");p=new Uint8Array(t,e,r)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const f=(a.executionProviders||[]).map(t=>typeof t=="string"?t:t.name),o=await(await resolveBackend(f)).createSessionHandler(p,a);return new hn(o)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const InferenceSession$1=InferenceSession$2;var lib=Object.freeze({__proto__:null,InferenceSession:InferenceSession$1,Tensor:Tensor$1,env:env$1,registerBackend}),require$$0=getAugmentedNamespace(lib);/*! +* ONNX Runtime Web v1.14.0 +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. +*/(function(module,exports){(function(_,n){module.exports=n(require$$0)})(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(_,n,s)=>{var c,l=(c=(c=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(p){function a(){return X.buffer!=ee&&Ee(X.buffer),ue}function h(){return X.buffer!=ee&&Ee(X.buffer),Ae}function f(){return X.buffer!=ee&&Ee(X.buffer),xe}function u(){return X.buffer!=ee&&Ee(X.buffer),oe}function o(){return X.buffer!=ee&&Ee(X.buffer),we}var t,e,r;p=p||{},t||(t=p!==void 0?p:{}),t.ready=new Promise(function(T,E){e=T,r=E});var i,d,g,m,b,y,v=Object.assign({},t),w="./this.program",S=(T,E)=>{throw E},A=typeof window=="object",O=typeof importScripts=="function",x=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",I=t.ENVIRONMENT_IS_PTHREAD||!1,$="";function z(T){return t.locateFile?t.locateFile(T,$):$+T}if(x){let T;$=O?s(908).dirname($)+"/":"//",y=()=>{b||(m=s(1384),b=s(908))},i=function(E,k){return y(),E=b.normalize(E),m.readFileSync(E,k?void 0:"utf8")},g=E=>((E=i(E,!0)).buffer||(E=new Uint8Array(E)),E),d=(E,k,C)=>{y(),E=b.normalize(E),m.readFile(E,function(B,V){B?C(B):k(V.buffer)})},1{if(qe())throw process.exitCode=E,k;k instanceof Qe||j("exiting due to exception: "+k),process.exit(E)},t.inspect=function(){return"[Emscripten Module object]"};try{T=s(9925)}catch(E){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),E}s.g.Worker=T.Worker}else(A||O)&&(O?$=self.location.href:typeof document<"u"&&document.currentScript&&($=document.currentScript.src),c&&($=c),$=$.indexOf("blob:")!==0?$.substr(0,$.replace(/[?#].*/,"").lastIndexOf("/")+1):"",x||(i=T=>{var E=new XMLHttpRequest;return E.open("GET",T,!1),E.send(null),E.responseText},O&&(g=T=>{var E=new XMLHttpRequest;return E.open("GET",T,!1),E.responseType="arraybuffer",E.send(null),new Uint8Array(E.response)}),d=(T,E,k)=>{var C=new XMLHttpRequest;C.open("GET",T,!0),C.responseType="arraybuffer",C.onload=()=>{C.status==200||C.status==0&&C.response?E(C.response):k()},C.onerror=k,C.send(null)}));x&&typeof performance>"u"&&(s.g.performance=s(6953).performance);var L=console.log.bind(console),N=console.warn.bind(console);x&&(y(),L=T=>m.writeSync(1,T+` +`),N=T=>m.writeSync(2,T+` +`));var H,M=t.print||L,j=t.printErr||N;Object.assign(t,v),v=null,t.thisProgram&&(w=t.thisProgram),t.quit&&(S=t.quit),t.wasmBinary&&(H=t.wasmBinary);var Z=t.noExitRuntime||!1;typeof WebAssembly!="object"&&ge("no native wasm support detected");var X,Q,ee,ue,Ae,xe,oe,we,ye=!1,ke=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ne(T,E,k){var C=(E>>>=0)+k;for(k=E;T[k]&&!(k>=C);)++k;if(16(B=(240&B)==224?(15&B)<<12|V<<6|K:(7&B)<<18|V<<12|K<<6|63&T[E++])?C+=String.fromCharCode(B):(B-=65536,C+=String.fromCharCode(55296|B>>10,56320|1023&B))}}else C+=String.fromCharCode(B)}return C}function Te(T,E){return(T>>>=0)?Ne(h(),T,E):""}function $e(T,E,k,C){if(!(0>>=0;C=k+C-1;for(var V=0;V=K&&(K=65536+((1023&K)<<10)|1023&T.charCodeAt(++V)),127>=K){if(k>=C)break;E[k++>>>0]=K}else{if(2047>=K){if(k+1>=C)break;E[k++>>>0]=192|K>>6}else{if(65535>=K){if(k+2>=C)break;E[k++>>>0]=224|K>>12}else{if(k+3>=C)break;E[k++>>>0]=240|K>>18,E[k++>>>0]=128|K>>12&63}E[k++>>>0]=128|K>>6&63}E[k++>>>0]=128|63&K}}return E[k>>>0]=0,k-B}function Ce(T){for(var E=0,k=0;k=C?E++:2047>=C?E+=2:55296<=C&&57343>=C?(E+=4,++k):E+=3}return E}function Ee(T){ee=T,t.HEAP8=ue=new Int8Array(T),t.HEAP16=new Int16Array(T),t.HEAP32=xe=new Int32Array(T),t.HEAPU8=Ae=new Uint8Array(T),t.HEAPU16=new Uint16Array(T),t.HEAPU32=oe=new Uint32Array(T),t.HEAPF32=new Float32Array(T),t.HEAPF64=we=new Float64Array(T)}I&&(ee=t.buffer);var Oe=t.INITIAL_MEMORY||16777216;if(I)X=t.wasmMemory,ee=t.buffer;else if(t.wasmMemory)X=t.wasmMemory;else if(!((X=new WebAssembly.Memory({initial:Oe/65536,maximum:65536,shared:!0})).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 need to set a flag"),x&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");X&&(ee=X.buffer),Oe=ee.byteLength,Ee(ee);var ze,Ve=[],Ge=[],Ye=[],Je=[];function qe(){return Z||!1}function Ue(){var T=t.preRun.shift();Ve.unshift(T)}var Ie,je=0,Ke=null;function ge(T){throw I?postMessage({cmd:"onAbort",arg:T}):t.onAbort&&t.onAbort(T),j(T="Aborted("+T+")"),ye=!0,T=new WebAssembly.RuntimeError(T+". Build with -sASSERTIONS for more info."),r(T),T}function ft(){return Ie.startsWith("data:application/octet-stream;base64,")}function ct(){var T=Ie;try{if(T==Ie&&H)return new Uint8Array(H);if(g)return g(T);throw"both async and sync fetching of the wasm failed"}catch(E){ge(E)}}Ie="ort-wasm-threaded.wasm",ft()||(Ie=z(Ie));var It={};function Qe(T){this.name="ExitStatus",this.message="Program terminated with exit("+T+")",this.status=T}function dt(T){(T=re.Vb[T])||ge(),re.mc(T)}function ht(T){var E=re.Cc();if(!E)return 6;re.ac.push(E),re.Vb[T.Ub]=E,E.Ub=T.Ub;var k={cmd:"run",start_routine:T.Ic,arg:T.zc,pthread_ptr:T.Ub};return E.$b=()=>{k.time=performance.now(),E.postMessage(k,T.Nc)},E.loaded&&(E.$b(),delete E.$b),0}function Re(T){if(I)return J(1,1,T);qe()||(re.oc(),t.onExit&&t.onExit(T),ye=!0),S(T,new Qe(T))}function ot(T,E){if(!E&&I)throw Dt(T),"unwind";qe()||I||(Ht(),it(Ye),Wt(0),Nt[1].length&&Lt(1,10),Nt[2].length&&Lt(2,10),re.oc()),Re(T)}var re={Yb:[],ac:[],qc:[],Vb:{},fc:function(){I&&re.Ec()},Pc:function(){},Ec:function(){re.receiveObjectTransfer=re.Gc,re.threadInitTLS=re.pc,re.setExitStatus=re.nc,Z=!1},nc:function(){},oc:function(){for(var T of Object.values(re.Vb))re.mc(T);for(T of re.Yb)T.terminate();re.Yb=[]},mc:function(T){var E=T.Ub;delete re.Vb[E],re.Yb.push(T),re.ac.splice(re.ac.indexOf(T),1),T.Ub=0,jt(E)},Gc:function(){},pc:function(){re.qc.forEach(T=>T())},Fc:function(T,E){T.onmessage=k=>{var C=(k=k.data).cmd;if(T.Ub&&(re.Bc=T.Ub),k.targetThread&&k.targetThread!=Ct()){var B=re.Vb[k.Qc];B?B.postMessage(k,k.transferList):j('Internal error! Worker sent a message "'+C+'" to target pthread '+k.targetThread+", but that thread no longer exists!")}else C==="processProxyingQueue"?F(k.queue):C==="spawnThread"?ht(k):C==="cleanupThread"?dt(k.thread):C==="killThread"?(k=k.thread,C=re.Vb[k],delete re.Vb[k],C.terminate(),jt(k),re.ac.splice(re.ac.indexOf(C),1),C.Ub=0):C==="cancelThread"?re.Vb[k.thread].postMessage({cmd:"cancel"}):C==="loaded"?(T.loaded=!0,E&&E(T),T.$b&&(T.$b(),delete T.$b)):C==="print"?M("Thread "+k.threadId+": "+k.text):C==="printErr"?j("Thread "+k.threadId+": "+k.text):C==="alert"?alert("Thread "+k.threadId+": "+k.text):k.target==="setimmediate"?T.postMessage(k):C==="onAbort"?t.onAbort&&t.onAbort(k.arg):C&&j("worker sent an unknown command "+C);re.Bc=void 0},T.onerror=k=>{throw j("worker sent an error! "+k.filename+":"+k.lineno+": "+k.message),k},x&&(T.on("message",function(k){T.onmessage({data:k})}),T.on("error",function(k){T.onerror(k)}),T.on("detachedExit",function(){})),T.postMessage({cmd:"load",urlOrBlob:t.mainScriptUrlOrBlob||c,wasmMemory:X,wasmModule:Q})},yc:function(){var T=z("ort-wasm-threaded.worker.js");re.Yb.push(new Worker(T))},Cc:function(){return re.Yb.length==0&&(re.yc(),re.Fc(re.Yb[0])),re.Yb.pop()}};function it(T){for(;0>2>>>0];T=f()[T+48>>2>>>0],Jt(E,E-T),ce(E)};var et=[];function ve(T){var E=et[T];return E||(T>=et.length&&(et.length=T+1),et[T]=E=ze.get(T)),E}t.invokeEntryPoint=function(T,E){T=ve(T)(E),qe()?re.nc(T):Zt(T)};var st,gt,at=[],ae=0,ie=0;function se(T){this.Zb=T,this.Sb=T-24,this.xc=function(E){u()[this.Sb+4>>2>>>0]=E},this.bc=function(){return u()[this.Sb+4>>2>>>0]},this.wc=function(E){u()[this.Sb+8>>2>>>0]=E},this.Dc=function(){return u()[this.Sb+8>>2>>>0]},this.rc=function(){f()[this.Sb>>2>>>0]=0},this.hc=function(E){E=E?1:0,a()[this.Sb+12>>0>>>0]=E},this.uc=function(){return a()[this.Sb+12>>0>>>0]!=0},this.ic=function(E){E=E?1:0,a()[this.Sb+13>>0>>>0]=E},this.kc=function(){return a()[this.Sb+13>>0>>>0]!=0},this.fc=function(E,k){this.cc(0),this.xc(E),this.wc(k),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(f(),this.Sb>>2,1)},this.Hc=function(){return Atomics.sub(f(),this.Sb>>2,1)===1},this.cc=function(E){u()[this.Sb+16>>2>>>0]=E},this.tc=function(){return u()[this.Sb+16>>2>>>0]},this.vc=function(){if(Qt(this.bc()))return u()[this.Zb>>2>>>0];var E=this.tc();return E!==0?E:this.Zb}}function mt(T){return qt(new se(T).Sb)}function ut(T,E,k,C){return I?J(3,1,T,E,k,C):bt(T,E,k,C)}function bt(T,E,k,C){if(typeof SharedArrayBuffer>"u")return j("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var B=[];return I&&B.length===0?ut(T,E,k,C):(T={Ic:k,Ub:T,zc:C,Nc:B},I?(T.Oc="spawnThread",postMessage(T,B),0):ht(T))}function yt(T,E,k){return I?J(4,1,T,E,k):0}function _t(T,E){if(I)return J(5,1,T,E)}function wt(T,E){if(I)return J(6,1,T,E)}function vt(T,E,k){if(I)return J(7,1,T,E,k)}function xt(T,E,k){return I?J(8,1,T,E,k):0}function Tt(T,E){if(I)return J(9,1,T,E)}function St(T,E,k){if(I)return J(10,1,T,E,k)}function At(T,E,k,C){if(I)return J(11,1,T,E,k,C)}function Ot(T,E,k,C){if(I)return J(12,1,T,E,k,C)}function Et(T,E,k,C){if(I)return J(13,1,T,E,k,C)}function Pt(T){if(I)return J(14,1,T)}function P(T,E){if(I)return J(15,1,T,E)}function D(T,E,k){if(I)return J(16,1,T,E,k)}function F(T){Atomics.store(f(),T>>2,1),Ct()&&Kt(T),Atomics.compareExchange(f(),T>>2,1,0)}function R(T){return u()[T>>>2]+4294967296*f()[T+4>>>2]}function U(T,E,k,C,B,V){return I?J(17,1,T,E,k,C,B,V):-52}function W(T,E,k,C,B,V){if(I)return J(18,1,T,E,k,C,B,V)}function Y(T){var E=Ce(T)+1,k=Rt(E);return k&&$e(T,a(),k,E),k}function te(T,E,k){function C(me){return(me=me.toTimeString().match(/\(([A-Za-z ]+)\)$/))?me[1]:"GMT"}if(I)return J(19,1,T,E,k);var B=new Date().getFullYear(),V=new Date(B,0,1),K=new Date(B,6,1);B=V.getTimezoneOffset();var ne=K.getTimezoneOffset(),fe=Math.max(B,ne);f()[T>>2>>>0]=60*fe,f()[E>>2>>>0]=+(B!=ne),T=C(V),E=C(K),T=Y(T),E=Y(E),ne>2>>>0]=T,u()[k+4>>2>>>0]=E):(u()[k>>2>>>0]=E,u()[k+4>>2>>>0]=T)}function J(T,E){var k=arguments.length-2,C=arguments;return kt(()=>{for(var B=Bt(8*k),V=B>>3,K=0;K>>0]=ne}return Yt(T,k,B,E)})}t.executeNotifiedProxyingQueue=F,gt=x?()=>{var T=process.hrtime();return 1e3*T[0]+T[1]/1e6}:I?()=>performance.now()-t.__performance_now_clock_drift:()=>performance.now();var le,Se=[],Le={};function Fe(){if(!le){var T,E={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:w||"./this.program"};for(T in Le)Le[T]===void 0?delete E[T]:E[T]=Le[T];var k=[];for(T in E)k.push(T+"="+E[T]);le=k}return le}function G(T,E){if(I)return J(20,1,T,E);var k=0;return Fe().forEach(function(C,B){var V=E+k;for(B=u()[T+4*B>>2>>>0]=V,V=0;V>0>>>0]=C.charCodeAt(V);a()[B>>0>>>0]=0,k+=C.length+1}),0}function be(T,E){if(I)return J(21,1,T,E);var k=Fe();u()[T>>2>>>0]=k.length;var C=0;return k.forEach(function(B){C+=B.length+1}),u()[E>>2>>>0]=C,0}function Pe(T){return I?J(22,1,T):52}function We(T,E,k,C){return I?J(23,1,T,E,k,C):52}function tt(T,E,k,C,B){return I?J(24,1,T,E,k,C,B):70}var Nt=[null,[],[]];function Lt(T,E){var k=Nt[T];E===0||E===10?((T===1?M:j)(Ne(k,0)),k.length=0):k.push(E)}function zt(T,E,k,C){if(I)return J(25,1,T,E,k,C);for(var B=0,V=0;V>2>>>0],ne=u()[E+4>>2>>>0];E+=8;for(var fe=0;fe>>0]);B+=ne}return u()[C>>2>>>0]=B,0}var Be=0;function Mt(T){return T%4==0&&(T%100!=0||T%400==0)}var Ut=[31,29,31,30,31,30,31,31,30,31,30,31],Vt=[31,28,31,30,31,30,31,31,30,31,30,31];function Gt(T,E,k,C){function B(q,_e,De){for(q=typeof q=="number"?q.toString():q||"";q.length<_e;)q=De[0]+q;return q}function V(q,_e){return B(q,_e,"0")}function K(q,_e){function De(pt){return 0>pt?-1:0nt-q.getDate())){q.setDate(q.getDate()+_e);break}_e-=nt-q.getDate()+1,q.setDate(1),11>De?q.setMonth(De+1):(q.setMonth(0),q.setFullYear(q.getFullYear()+1))}return De=new Date(q.getFullYear()+1,0,4),_e=ne(new Date(q.getFullYear(),0,4)),De=ne(De),0>=K(_e,q)?0>=K(De,q)?q.getFullYear()+1:q.getFullYear():q.getFullYear()-1}var me=f()[C+40>>2>>>0];for(var Me in C={Lc:f()[C>>2>>>0],Kc:f()[C+4>>2>>>0],dc:f()[C+8>>2>>>0],jc:f()[C+12>>2>>>0],ec:f()[C+16>>2>>>0],Xb:f()[C+20>>2>>>0],Tb:f()[C+24>>2>>>0],Wb:f()[C+28>>2>>>0],Rc:f()[C+32>>2>>>0],Jc:f()[C+36>>2>>>0],Mc:me?Te(me):""},k=Te(k),me={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})k=k.replace(new RegExp(Me,"g"),me[Me]);var Ze="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),He="January February March April May June July August September October November December".split(" ");for(Me in me={"%a":function(q){return Ze[q.Tb].substring(0,3)},"%A":function(q){return Ze[q.Tb]},"%b":function(q){return He[q.ec].substring(0,3)},"%B":function(q){return He[q.ec]},"%C":function(q){return V((q.Xb+1900)/100|0,2)},"%d":function(q){return V(q.jc,2)},"%e":function(q){return B(q.jc,2," ")},"%g":function(q){return fe(q).toString().substring(2)},"%G":function(q){return fe(q)},"%H":function(q){return V(q.dc,2)},"%I":function(q){return(q=q.dc)==0?q=12:12q.dc?"AM":"PM"},"%S":function(q){return V(q.Lc,2)},"%t":function(){return" "},"%u":function(q){return q.Tb||7},"%U":function(q){return V(Math.floor((q.Wb+7-q.Tb)/7),2)},"%V":function(q){var _e=Math.floor((q.Wb+7-(q.Tb+6)%7)/7);if(2>=(q.Tb+371-q.Wb-2)%7&&_e++,_e)_e==53&&((De=(q.Tb+371-q.Wb)%7)==4||De==3&&Mt(q.Xb)||(_e=1));else{_e=52;var De=(q.Tb+7-q.Wb-1)%7;(De==4||De==5&&Mt(q.Xb%400-1))&&_e++}return V(_e,2)},"%w":function(q){return q.Tb},"%W":function(q){return V(Math.floor((q.Wb+7-(q.Tb+6)%7)/7),2)},"%y":function(q){return(q.Xb+1900).toString().substring(2)},"%Y":function(q){return q.Xb+1900},"%z":function(q){var _e=0<=(q=q.Jc);return q=Math.abs(q)/60,(_e?"+":"-")+("0000"+(q/60*100+q%60)).slice(-4)},"%Z":function(q){return q.Mc},"%%":function(){return"%"}},k=k.replace(/%%/g,"\0\0"),me)k.includes(Me)&&(k=k.replace(new RegExp(Me,"g"),me[Me](C)));return Me=function(q){var _e=Array(Ce(q)+1);return $e(q,_e,0,_e.length),_e}(k=k.replace(/\0\0/g,"%")),Me.length>E?0:(function(q,_e){a().set(q,_e>>>0)}(Me,T),Me.length-1)}re.fc();var pn=[null,Re,Dt,ut,yt,_t,wt,vt,xt,Tt,St,At,Ot,Et,Pt,P,D,U,W,te,G,be,Pe,We,tt,zt],fn={b:function(T){return Rt(T+24)+24},n:function(T){return(T=new se(T)).uc()||(T.hc(!0),ae--),T.ic(!1),at.push(T),T.sc(),T.vc()},ma:function(T){throw j("Unexpected exception thrown, this is not properly supported - aborting"),ye=!0,T},x:function(){pe(0);var T=at.pop();if(T.Hc()&&!T.kc()){var E=T.Dc();E&&ve(E)(T.Zb),mt(T.Zb)}ie=0},e:function(){var T=ie;if(!T)return Be=0;var E=new se(T);E.cc(T);var k=E.bc();if(!k)return Be=0,T;for(var C=Array.prototype.slice.call(arguments),B=0;BF(C));else if(I)postMessage({targetThread:T,cmd:"processProxyingQueue",queue:C});else{if(!(T=re.Vb[T]))return;T.postMessage({cmd:"processProxyingQueue",queue:C})}return 1},Ea:function(){return-1},Pa:function(T,E){T=new Date(1e3*R(T)),f()[E>>2>>>0]=T.getUTCSeconds(),f()[E+4>>2>>>0]=T.getUTCMinutes(),f()[E+8>>2>>>0]=T.getUTCHours(),f()[E+12>>2>>>0]=T.getUTCDate(),f()[E+16>>2>>>0]=T.getUTCMonth(),f()[E+20>>2>>>0]=T.getUTCFullYear()-1900,f()[E+24>>2>>>0]=T.getUTCDay(),T=(T.getTime()-Date.UTC(T.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,f()[E+28>>2>>>0]=T},Qa:function(T,E){T=new Date(1e3*R(T)),f()[E>>2>>>0]=T.getSeconds(),f()[E+4>>2>>>0]=T.getMinutes(),f()[E+8>>2>>>0]=T.getHours(),f()[E+12>>2>>>0]=T.getDate(),f()[E+16>>2>>>0]=T.getMonth(),f()[E+20>>2>>>0]=T.getFullYear()-1900,f()[E+24>>2>>>0]=T.getDay();var k=new Date(T.getFullYear(),0,1),C=(T.getTime()-k.getTime())/864e5|0;f()[E+28>>2>>>0]=C,f()[E+36>>2>>>0]=-60*T.getTimezoneOffset(),C=new Date(T.getFullYear(),6,1).getTimezoneOffset(),T=0|(C!=(k=k.getTimezoneOffset())&&T.getTimezoneOffset()==Math.min(k,C)),f()[E+32>>2>>>0]=T},Ra:function(T){var E=new Date(f()[T+20>>2>>>0]+1900,f()[T+16>>2>>>0],f()[T+12>>2>>>0],f()[T+8>>2>>>0],f()[T+4>>2>>>0],f()[T>>2>>>0],0),k=f()[T+32>>2>>>0],C=E.getTimezoneOffset(),B=new Date(E.getFullYear(),0,1),V=new Date(E.getFullYear(),6,1).getTimezoneOffset(),K=B.getTimezoneOffset(),ne=Math.min(K,V);return 0>k?f()[T+32>>2>>>0]=+(V!=K&&ne==C):0>2>>>0]=E.getDay(),k=(E.getTime()-B.getTime())/864e5|0,f()[T+28>>2>>>0]=k,f()[T>>2>>>0]=E.getSeconds(),f()[T+4>>2>>>0]=E.getMinutes(),f()[T+8>>2>>>0]=E.getHours(),f()[T+12>>2>>>0]=E.getDate(),f()[T+16>>2>>>0]=E.getMonth(),E.getTime()/1e3|0},Aa:U,Ba:W,Sa:function T(E,k,C){T.Ac||(T.Ac=!0,te(E,k,C))},y:function(){ge("")},U:function(){if(!x&&!O){var T="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";st||(st={}),st[T]||(st[T]=1,x&&(T="warning: "+T),j(T))}},ra:function(){return 4294901760},B:gt,Ia:function(T,E,k){h().copyWithin(T>>>0,E>>>0,E+k>>>0)},F:function(){return x?s(3993).cpus().length:navigator.hardwareConcurrency},Da:function(T,E,k){Se.length=E,k>>=3;for(var C=0;C>>0];return(0>T?It[-T-1]:pn[T]).apply(null,Se)},qa:function(T){var E=h().length;if((T>>>=0)<=E||4294901760=k;k*=2){var C=E*(1+.2/k);C=Math.min(C,T+100663296);var B=Math;C=Math.max(T,C),B=B.min.call(B,4294901760,C+(65536-C%65536)%65536);e:{try{X.grow(B-ee.byteLength+65535>>>16),Ee(X.buffer);var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},Na:function(){throw"unwind"},Ga:G,Ha:be,J:ot,I:Pe,S:We,ga:tt,R:zt,d:function(){return Be},na:function T(E,k){T.lc||(T.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var B=new Uint8Array(1);return()=>(crypto.getRandomValues(B),B[0])}if(x)try{var V=s(Object(function(){var K=new Error("Cannot find module 'crypto'");throw K.code="MODULE_NOT_FOUND",K}()));return()=>V.randomBytes(1)[0]}catch{}return()=>ge("randomDevice")}());for(var C=0;C>0>>>0]=T.lc();return 0},ia:function(T,E,k){var C=he();try{return ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},ja:function(T,E,k){var C=he();try{return ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},K:function(T){var E=he();try{return ve(T)()}catch(k){if(ce(E),k!==k+0)throw k;pe(1,0)}},f:function(T,E){var k=he();try{return ve(T)(E)}catch(C){if(ce(k),C!==C+0)throw C;pe(1,0)}},P:function(T,E,k){var C=he();try{return ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},Q:function(T,E,k){var C=he();try{return ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},k:function(T,E,k){var C=he();try{return ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},p:function(T,E,k,C){var B=he();try{return ve(T)(E,k,C)}catch(V){if(ce(B),V!==V+0)throw V;pe(1,0)}},q:function(T,E,k,C,B){var V=he();try{return ve(T)(E,k,C,B)}catch(K){if(ce(V),K!==K+0)throw K;pe(1,0)}},N:function(T,E,k,C,B,V){var K=he();try{return ve(T)(E,k,C,B,V)}catch(ne){if(ce(K),ne!==ne+0)throw ne;pe(1,0)}},s:function(T,E,k,C,B,V){var K=he();try{return ve(T)(E,k,C,B,V)}catch(ne){if(ce(K),ne!==ne+0)throw ne;pe(1,0)}},w:function(T,E,k,C,B,V,K){var ne=he();try{return ve(T)(E,k,C,B,V,K)}catch(fe){if(ce(ne),fe!==fe+0)throw fe;pe(1,0)}},L:function(T,E,k,C,B,V,K,ne){var fe=he();try{return ve(T)(E,k,C,B,V,K,ne)}catch(me){if(ce(fe),me!==me+0)throw me;pe(1,0)}},E:function(T,E,k,C,B,V,K,ne,fe,me,Me,Ze){var He=he();try{return ve(T)(E,k,C,B,V,K,ne,fe,me,Me,Ze)}catch(q){if(ce(He),q!==q+0)throw q;pe(1,0)}},aa:function(T,E,k,C,B,V,K,ne){var fe=he();try{return ln(T,E,k,C,B,V,K,ne)}catch(me){if(ce(fe),me!==me+0)throw me;pe(1,0)}},_:function(T,E,k,C,B,V,K){var ne=he();try{return tn(T,E,k,C,B,V,K)}catch(fe){if(ce(ne),fe!==fe+0)throw fe;pe(1,0)}},Z:function(T,E,k,C,B){var V=he();try{return cn(T,E,k,C,B)}catch(K){if(ce(V),K!==K+0)throw K;pe(1,0)}},ca:function(T,E,k,C){var B=he();try{return an(T,E,k,C)}catch(V){if(ce(B),V!==V+0)throw V;pe(1,0)}},$:function(T){var E=he();try{return en(T)}catch(k){if(ce(E),k!==k+0)throw k;pe(1,0)}},ba:function(T,E){var k=he();try{return un(T,E)}catch(C){if(ce(k),C!==C+0)throw C;pe(1,0)}},Y:function(T,E,k){var C=he();try{return nn(T,E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},g:function(T){var E=he();try{ve(T)()}catch(k){if(ce(E),k!==k+0)throw k;pe(1,0)}},r:function(T,E){var k=he();try{ve(T)(E)}catch(C){if(ce(k),C!==C+0)throw C;pe(1,0)}},i:function(T,E,k){var C=he();try{ve(T)(E,k)}catch(B){if(ce(C),B!==B+0)throw B;pe(1,0)}},ha:function(T,E,k,C){var B=he();try{ve(T)(E,k,C)}catch(V){if(ce(B),V!==V+0)throw V;pe(1,0)}},m:function(T,E,k,C){var B=he();try{ve(T)(E,k,C)}catch(V){if(ce(B),V!==V+0)throw V;pe(1,0)}},v:function(T,E,k,C,B){var V=he();try{ve(T)(E,k,C,B)}catch(K){if(ce(V),K!==K+0)throw K;pe(1,0)}},u:function(T,E,k,C,B,V){var K=he();try{ve(T)(E,k,C,B,V)}catch(ne){if(ce(K),ne!==ne+0)throw ne;pe(1,0)}},O:function(T,E,k,C,B,V,K){var ne=he();try{ve(T)(E,k,C,B,V,K)}catch(fe){if(ce(ne),fe!==fe+0)throw fe;pe(1,0)}},A:function(T,E,k,C,B,V,K,ne){var fe=he();try{ve(T)(E,k,C,B,V,K,ne)}catch(me){if(ce(fe),me!==me+0)throw me;pe(1,0)}},ka:function(T,E,k,C,B,V,K,ne,fe){var me=he();try{ve(T)(E,k,C,B,V,K,ne,fe)}catch(Me){if(ce(me),Me!==Me+0)throw Me;pe(1,0)}},C:function(T,E,k,C,B,V,K,ne,fe,me,Me){var Ze=he();try{ve(T)(E,k,C,B,V,K,ne,fe,me,Me)}catch(He){if(ce(Ze),He!==He+0)throw He;pe(1,0)}},D:function(T,E,k,C,B,V,K,ne,fe,me,Me,Ze,He,q,_e,De){var nt=he();try{ve(T)(E,k,C,B,V,K,ne,fe,me,Me,Ze,He,q,_e,De)}catch(pt){if(ce(nt),pt!==pt+0)throw pt;pe(1,0)}},fa:function(T,E,k,C,B,V,K,ne){var fe=he();try{rn(T,E,k,C,B,V,K,ne)}catch(me){if(ce(fe),me!==me+0)throw me;pe(1,0)}},da:function(T,E,k,C,B,V,K,ne,fe,me,Me,Ze){var He=he();try{sn(T,E,k,C,B,V,K,ne,fe,me,Me,Ze)}catch(q){if(ce(He),q!==q+0)throw q;pe(1,0)}},ea:function(T,E,k,C,B,V){var K=he();try{on(T,E,k,C,B,V)}catch(ne){if(ce(K),ne!==ne+0)throw ne;pe(1,0)}},o:function(T){return T},a:X||t.wasmMemory,G:function(T){Be=T},la:Gt,z:function(T,E,k,C){return Gt(T,E,k,C)}};(function(){function T(B,V){t.asm=B.exports,re.qc.push(t.asm.sb),ze=t.asm.ub,Ge.unshift(t.asm.Va),Q=V,I||(je--,t.monitorRunDependencies&&t.monitorRunDependencies(je),je==0&&Ke&&(B=Ke,Ke=null,B()))}function E(B){T(B.instance,B.module)}function k(B){return function(){if(!H&&(A||O)){if(typeof fetch=="function"&&!Ie.startsWith("file://"))return fetch(Ie,{credentials:"same-origin"}).then(function(V){if(!V.ok)throw"failed to load wasm binary file at '"+Ie+"'";return V.arrayBuffer()}).catch(function(){return ct()});if(d)return new Promise(function(V,K){d(Ie,function(ne){V(new Uint8Array(ne))},K)})}return Promise.resolve().then(function(){return ct()})}().then(function(V){return WebAssembly.instantiate(V,C)}).then(function(V){return V}).then(B,function(V){j("failed to asynchronously prepare wasm: "+V),ge(V)})}var C={a:fn};if(I||(je++,t.monitorRunDependencies&&t.monitorRunDependencies(je)),t.instantiateWasm)try{return t.instantiateWasm(C,T)}catch(B){return j("Module.instantiateWasm callback failed with error: "+B),!1}(H||typeof WebAssembly.instantiateStreaming!="function"||ft()||Ie.startsWith("file://")||x||typeof fetch!="function"?k(E):fetch(Ie,{credentials:"same-origin"}).then(function(B){return WebAssembly.instantiateStreaming(B,C).then(E,function(V){return j("wasm streaming compile failed: "+V),j("falling back to ArrayBuffer instantiation"),k(E)})})).catch(r)})(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.Va).apply(null,arguments)},t._OrtInit=function(){return(t._OrtInit=t.asm.Wa).apply(null,arguments)},t._OrtCreateSessionOptions=function(){return(t._OrtCreateSessionOptions=t.asm.Xa).apply(null,arguments)},t._OrtAppendExecutionProvider=function(){return(t._OrtAppendExecutionProvider=t.asm.Ya).apply(null,arguments)},t._OrtAddSessionConfigEntry=function(){return(t._OrtAddSessionConfigEntry=t.asm.Za).apply(null,arguments)},t._OrtReleaseSessionOptions=function(){return(t._OrtReleaseSessionOptions=t.asm._a).apply(null,arguments)},t._OrtCreateSession=function(){return(t._OrtCreateSession=t.asm.$a).apply(null,arguments)},t._OrtReleaseSession=function(){return(t._OrtReleaseSession=t.asm.ab).apply(null,arguments)},t._OrtGetInputCount=function(){return(t._OrtGetInputCount=t.asm.bb).apply(null,arguments)},t._OrtGetOutputCount=function(){return(t._OrtGetOutputCount=t.asm.cb).apply(null,arguments)},t._OrtGetInputName=function(){return(t._OrtGetInputName=t.asm.db).apply(null,arguments)},t._OrtGetOutputName=function(){return(t._OrtGetOutputName=t.asm.eb).apply(null,arguments)},t._OrtFree=function(){return(t._OrtFree=t.asm.fb).apply(null,arguments)},t._OrtCreateTensor=function(){return(t._OrtCreateTensor=t.asm.gb).apply(null,arguments)},t._OrtGetTensorData=function(){return(t._OrtGetTensorData=t.asm.hb).apply(null,arguments)},t._OrtReleaseTensor=function(){return(t._OrtReleaseTensor=t.asm.ib).apply(null,arguments)},t._OrtCreateRunOptions=function(){return(t._OrtCreateRunOptions=t.asm.jb).apply(null,arguments)},t._OrtAddRunConfigEntry=function(){return(t._OrtAddRunConfigEntry=t.asm.kb).apply(null,arguments)},t._OrtReleaseRunOptions=function(){return(t._OrtReleaseRunOptions=t.asm.lb).apply(null,arguments)},t._OrtRun=function(){return(t._OrtRun=t.asm.mb).apply(null,arguments)},t._OrtEndProfiling=function(){return(t._OrtEndProfiling=t.asm.nb).apply(null,arguments)};var Ct=t._pthread_self=function(){return(Ct=t._pthread_self=t.asm.ob).apply(null,arguments)},Rt=t._malloc=function(){return(Rt=t._malloc=t.asm.pb).apply(null,arguments)},qt=t._free=function(){return(qt=t._free=t.asm.qb).apply(null,arguments)},Wt=t._fflush=function(){return(Wt=t._fflush=t.asm.rb).apply(null,arguments)};t.__emscripten_tls_init=function(){return(t.__emscripten_tls_init=t.asm.sb).apply(null,arguments)};var Ht=t.___funcs_on_exit=function(){return(Ht=t.___funcs_on_exit=t.asm.tb).apply(null,arguments)},Xt=t.__emscripten_thread_init=function(){return(Xt=t.__emscripten_thread_init=t.asm.vb).apply(null,arguments)};t.__emscripten_thread_crashed=function(){return(t.__emscripten_thread_crashed=t.asm.wb).apply(null,arguments)};var $t,Yt=t._emscripten_run_in_main_runtime_thread_js=function(){return(Yt=t._emscripten_run_in_main_runtime_thread_js=t.asm.xb).apply(null,arguments)},Kt=t.__emscripten_proxy_execute_task_queue=function(){return(Kt=t.__emscripten_proxy_execute_task_queue=t.asm.yb).apply(null,arguments)},jt=t.__emscripten_thread_free_data=function(){return(jt=t.__emscripten_thread_free_data=t.asm.zb).apply(null,arguments)},Zt=t.__emscripten_thread_exit=function(){return(Zt=t.__emscripten_thread_exit=t.asm.Ab).apply(null,arguments)},pe=t._setThrew=function(){return(pe=t._setThrew=t.asm.Bb).apply(null,arguments)},Jt=t._emscripten_stack_set_limits=function(){return(Jt=t._emscripten_stack_set_limits=t.asm.Cb).apply(null,arguments)},he=t.stackSave=function(){return(he=t.stackSave=t.asm.Db).apply(null,arguments)},ce=t.stackRestore=function(){return(ce=t.stackRestore=t.asm.Eb).apply(null,arguments)},Bt=t.stackAlloc=function(){return(Bt=t.stackAlloc=t.asm.Fb).apply(null,arguments)},Ft=t.___cxa_can_catch=function(){return(Ft=t.___cxa_can_catch=t.asm.Gb).apply(null,arguments)},Qt=t.___cxa_is_pointer_type=function(){return(Qt=t.___cxa_is_pointer_type=t.asm.Hb).apply(null,arguments)},en=t.dynCall_j=function(){return(en=t.dynCall_j=t.asm.Ib).apply(null,arguments)},tn=t.dynCall_iiiiij=function(){return(tn=t.dynCall_iiiiij=t.asm.Jb).apply(null,arguments)},nn=t.dynCall_jii=function(){return(nn=t.dynCall_jii=t.asm.Kb).apply(null,arguments)},rn=t.dynCall_viiiiij=function(){return(rn=t.dynCall_viiiiij=t.asm.Lb).apply(null,arguments)},on=t.dynCall_vjji=function(){return(on=t.dynCall_vjji=t.asm.Mb).apply(null,arguments)},sn=t.dynCall_viiijjjii=function(){return(sn=t.dynCall_viiijjjii=t.asm.Nb).apply(null,arguments)},an=t.dynCall_iij=function(){return(an=t.dynCall_iij=t.asm.Ob).apply(null,arguments)},un=t.dynCall_ji=function(){return(un=t.dynCall_ji=t.asm.Pb).apply(null,arguments)},ln=t.dynCall_iiiiiij=function(){return(ln=t.dynCall_iiiiiij=t.asm.Qb).apply(null,arguments)},cn=t.dynCall_iiij=function(){return(cn=t.dynCall_iiij=t.asm.Rb).apply(null,arguments)};function dn(){function T(){if(!$t&&($t=!0,t.calledRun=!0,!ye)&&(I||it(Ge),e(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),!I)){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;){var E=t.postRun.shift();Je.unshift(E)}it(Je)}}if(!(0{var c,l=(c=(c=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(p){var a,h,f;p=p||{},a||(a=p!==void 0?p:{}),a.ready=new Promise(function(P,D){h=P,f=D});var u,o,t,e,r,i,d=Object.assign({},a),g="./this.program",m=(P,D)=>{throw D},b=typeof window=="object",y=typeof importScripts=="function",v=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w="";v?(w=y?s(908).dirname(w)+"/":"//",i=()=>{r||(e=s(1384),r=s(908))},u=function(P,D){return i(),P=r.normalize(P),e.readFileSync(P,D?void 0:"utf8")},t=P=>((P=u(P,!0)).buffer||(P=new Uint8Array(P)),P),o=(P,D,F)=>{i(),P=r.normalize(P),e.readFile(P,function(R,U){R?F(R):D(U.buffer)})},1{if(x||0{var D=new XMLHttpRequest;return D.open("GET",P,!1),D.send(null),D.responseText},y&&(t=P=>{var D=new XMLHttpRequest;return D.open("GET",P,!1),D.responseType="arraybuffer",D.send(null),new Uint8Array(D.response)}),o=(P,D,F)=>{var R=new XMLHttpRequest;R.open("GET",P,!0),R.responseType="arraybuffer",R.onload=()=>{R.status==200||R.status==0&&R.response?D(R.response):F()},R.onerror=F,R.send(null)});var S,A=a.print||console.log.bind(console),O=a.printErr||console.warn.bind(console);Object.assign(a,d),d=null,a.thisProgram&&(g=a.thisProgram),a.quit&&(m=a.quit),a.wasmBinary&&(S=a.wasmBinary);var x=a.noExitRuntime||!1;typeof WebAssembly!="object"&&Ee("no native wasm support detected");var I,$,z,L,N,H,M=!1,j=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Z(P,D,F){var R=(D>>>=0)+F;for(F=D;P[F]&&!(F>=R);)++F;if(16(U=(240&U)==224?(15&U)<<12|W<<6|Y:(7&U)<<18|W<<12|Y<<6|63&P[D++])?R+=String.fromCharCode(U):(U-=65536,R+=String.fromCharCode(55296|U>>10,56320|1023&U))}}else R+=String.fromCharCode(U)}return R}function X(P,D){return(P>>>=0)?Z(L,P,D):""}function Q(P,D,F,R){if(!(0>>=0;R=F+R-1;for(var W=0;W=Y&&(Y=65536+((1023&Y)<<10)|1023&P.charCodeAt(++W)),127>=Y){if(F>=R)break;D[F++>>>0]=Y}else{if(2047>=Y){if(F+1>=R)break;D[F++>>>0]=192|Y>>6}else{if(65535>=Y){if(F+2>=R)break;D[F++>>>0]=224|Y>>12}else{if(F+3>=R)break;D[F++>>>0]=240|Y>>18,D[F++>>>0]=128|Y>>12&63}D[F++>>>0]=128|Y>>6&63}D[F++>>>0]=128|63&Y}}return D[F>>>0]=0,F-U}function ee(P){for(var D=0,F=0;F=R?D++:2047>=R?D+=2:55296<=R&&57343>=R?(D+=4,++F):D+=3}return D}function ue(){var P=I.buffer;$=P,a.HEAP8=z=new Int8Array(P),a.HEAP16=new Int16Array(P),a.HEAP32=N=new Int32Array(P),a.HEAPU8=L=new Uint8Array(P),a.HEAPU16=new Uint16Array(P),a.HEAPU32=H=new Uint32Array(P),a.HEAPF32=new Float32Array(P),a.HEAPF64=new Float64Array(P)}var Ae,xe=[],oe=[],we=[],ye=[],ke=0;function Ne(){var P=a.preRun.shift();xe.unshift(P)}var Te,$e=0,Ce=null;function Ee(P){throw a.onAbort&&a.onAbort(P),O(P="Aborted("+P+")"),M=!0,P=new WebAssembly.RuntimeError(P+". Build with -sASSERTIONS for more info."),f(P),P}function Oe(){return Te.startsWith("data:application/octet-stream;base64,")}if(Te="ort-wasm.wasm",!Oe()){var ze=Te;Te=a.locateFile?a.locateFile(ze,w):w+ze}function Ve(){var P=Te;try{if(P==Te&&S)return new Uint8Array(S);if(t)return t(P);throw"both async and sync fetching of the wasm failed"}catch(D){Ee(D)}}function Ge(P){this.name="ExitStatus",this.message="Program terminated with exit("+P+")",this.status=P}function Ye(P){for(;0>2>>>0]=D},this.Eb=function(){return H[this.zb+4>>2>>>0]},this.Sb=function(D){H[this.zb+8>>2>>>0]=D},this.Wb=function(){return H[this.zb+8>>2>>>0]},this.Tb=function(){N[this.zb>>2>>>0]=0},this.Ib=function(D){z[this.zb+12>>0>>>0]=D?1:0},this.Pb=function(){return z[this.zb+12>>0>>>0]!=0},this.Jb=function(D){z[this.zb+13>>0>>>0]=D?1:0},this.Lb=function(){return z[this.zb+13>>0>>>0]!=0},this.Rb=function(D,F){this.Fb(0),this.Ub(D),this.Sb(F),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){N[this.zb>>2>>>0]+=1},this.Xb=function(){var D=N[this.zb>>2>>>0];return N[this.zb>>2>>>0]=D-1,D===1},this.Fb=function(D){H[this.zb+16>>2>>>0]=D},this.Ob=function(){return H[this.zb+16>>2>>>0]},this.Qb=function(){if(bt(this.Eb()))return H[this.Db>>2>>>0];var D=this.Ob();return D!==0?D:this.Db}}function je(P){return st(new Ie(P).zb)}var Ke=[];function ge(P){var D=Ke[P];return D||(P>=Ke.length&&(Ke.length=P+1),Ke[P]=D=Ae.get(P)),D}function ft(P){var D=ee(P)+1,F=ve(D);return F&&Q(P,z,F,D),F}var ct={};function It(){if(!Qe){var P,D={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(P in ct)ct[P]===void 0?delete D[P]:D[P]=ct[P];var F=[];for(P in D)F.push(P+"="+D[P]);Qe=F}return Qe}var Qe,dt=[null,[],[]];function ht(P,D){var F=dt[P];D===0||D===10?((P===1?A:O)(Z(F,0)),F.length=0):F.push(D)}var Re=0;function ot(P){return P%4==0&&(P%100!=0||P%400==0)}var re=[31,29,31,30,31,30,31,31,30,31,30,31],it=[31,28,31,30,31,30,31,31,30,31,30,31];function kt(P,D,F,R){function U(G,be,Pe){for(G=typeof G=="number"?G.toString():G||"";G.lengthtt?-1:0We-G.getDate())){G.setDate(G.getDate()+be);break}be-=We-G.getDate()+1,G.setDate(1),11>Pe?G.setMonth(Pe+1):(G.setMonth(0),G.setFullYear(G.getFullYear()+1))}return Pe=new Date(G.getFullYear()+1,0,4),be=te(new Date(G.getFullYear(),0,4)),Pe=te(Pe),0>=Y(be,G)?0>=Y(Pe,G)?G.getFullYear()+1:G.getFullYear():G.getFullYear()-1}var le=N[R+40>>2>>>0];for(var Se in R={$b:N[R>>2>>>0],Zb:N[R+4>>2>>>0],Gb:N[R+8>>2>>>0],Kb:N[R+12>>2>>>0],Hb:N[R+16>>2>>>0],Cb:N[R+20>>2>>>0],Ab:N[R+24>>2>>>0],Bb:N[R+28>>2>>>0],bc:N[R+32>>2>>>0],Yb:N[R+36>>2>>>0],ac:le?X(le):""},F=X(F),le={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})F=F.replace(new RegExp(Se,"g"),le[Se]);var Le="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Fe="January February March April May June July August September October November December".split(" ");for(Se in le={"%a":function(G){return Le[G.Ab].substring(0,3)},"%A":function(G){return Le[G.Ab]},"%b":function(G){return Fe[G.Hb].substring(0,3)},"%B":function(G){return Fe[G.Hb]},"%C":function(G){return W((G.Cb+1900)/100|0,2)},"%d":function(G){return W(G.Kb,2)},"%e":function(G){return U(G.Kb,2," ")},"%g":function(G){return J(G).toString().substring(2)},"%G":function(G){return J(G)},"%H":function(G){return W(G.Gb,2)},"%I":function(G){return(G=G.Gb)==0?G=12:12G.Gb?"AM":"PM"},"%S":function(G){return W(G.$b,2)},"%t":function(){return" "},"%u":function(G){return G.Ab||7},"%U":function(G){return W(Math.floor((G.Bb+7-G.Ab)/7),2)},"%V":function(G){var be=Math.floor((G.Bb+7-(G.Ab+6)%7)/7);if(2>=(G.Ab+371-G.Bb-2)%7&&be++,be)be==53&&((Pe=(G.Ab+371-G.Bb)%7)==4||Pe==3&&ot(G.Cb)||(be=1));else{be=52;var Pe=(G.Ab+7-G.Bb-1)%7;(Pe==4||Pe==5&&ot(G.Cb%400-1))&&be++}return W(be,2)},"%w":function(G){return G.Ab},"%W":function(G){return W(Math.floor((G.Bb+7-(G.Ab+6)%7)/7),2)},"%y":function(G){return(G.Cb+1900).toString().substring(2)},"%Y":function(G){return G.Cb+1900},"%z":function(G){var be=0<=(G=G.Yb);return G=Math.abs(G)/60,(be?"+":"-")+("0000"+(G/60*100+G%60)).slice(-4)},"%Z":function(G){return G.ac},"%%":function(){return"%"}},F=F.replace(/%%/g,"\0\0"),le)F.includes(Se)&&(F=F.replace(new RegExp(Se,"g"),le[Se](R)));return Se=function(G){var be=Array(ee(G)+1);return Q(G,be,0,be.length),be}(F=F.replace(/\0\0/g,"%")),Se.length>D?0:(z.set(Se,P>>>0),Se.length-1)}var Dt={a:function(P){return ve(P+24)+24},m:function(P){return(P=new Ie(P)).Pb()||(P.Ib(!0),qe--),P.Jb(!1),Je.push(P),P.Nb(),P.Qb()},ia:function(P){throw O("Unexpected exception thrown, this is not properly supported - aborting"),M=!0,P},w:function(){ae(0);var P=Je.pop();if(P.Xb()&&!P.Lb()){var D=P.Wb();D&&ge(D)(P.Db),je(P.Db)}Ue=0},d:function(){var P=Ue;if(!P)return Re=0;var D=new Ie(P);D.Fb(P);var F=D.Eb();if(!F)return Re=0,P;for(var R=Array.prototype.slice.call(arguments),U=0;U>>2]+4294967296*N[P+4>>>2])),N[D>>2>>>0]=P.getUTCSeconds(),N[D+4>>2>>>0]=P.getUTCMinutes(),N[D+8>>2>>>0]=P.getUTCHours(),N[D+12>>2>>>0]=P.getUTCDate(),N[D+16>>2>>>0]=P.getUTCMonth(),N[D+20>>2>>>0]=P.getUTCFullYear()-1900,N[D+24>>2>>>0]=P.getUTCDay(),N[D+28>>2>>>0]=(P.getTime()-Date.UTC(P.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(P,D){P=new Date(1e3*(H[P>>>2]+4294967296*N[P+4>>>2])),N[D>>2>>>0]=P.getSeconds(),N[D+4>>2>>>0]=P.getMinutes(),N[D+8>>2>>>0]=P.getHours(),N[D+12>>2>>>0]=P.getDate(),N[D+16>>2>>>0]=P.getMonth(),N[D+20>>2>>>0]=P.getFullYear()-1900,N[D+24>>2>>>0]=P.getDay();var F=new Date(P.getFullYear(),0,1);N[D+28>>2>>>0]=(P.getTime()-F.getTime())/864e5|0,N[D+36>>2>>>0]=-60*P.getTimezoneOffset();var R=new Date(P.getFullYear(),6,1).getTimezoneOffset();F=F.getTimezoneOffset(),N[D+32>>2>>>0]=0|(R!=F&&P.getTimezoneOffset()==Math.min(F,R))},Fa:function(P){var D=new Date(N[P+20>>2>>>0]+1900,N[P+16>>2>>>0],N[P+12>>2>>>0],N[P+8>>2>>>0],N[P+4>>2>>>0],N[P>>2>>>0],0),F=N[P+32>>2>>>0],R=D.getTimezoneOffset(),U=new Date(D.getFullYear(),0,1),W=new Date(D.getFullYear(),6,1).getTimezoneOffset(),Y=U.getTimezoneOffset(),te=Math.min(Y,W);return 0>F?N[P+32>>2>>>0]=+(W!=Y&&te==R):0>2>>>0]=D.getDay(),N[P+28>>2>>>0]=(D.getTime()-U.getTime())/864e5|0,N[P>>2>>>0]=D.getSeconds(),N[P+4>>2>>>0]=D.getMinutes(),N[P+8>>2>>>0]=D.getHours(),N[P+12>>2>>>0]=D.getDate(),N[P+16>>2>>>0]=D.getMonth(),D.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function P(D,F,R){P.Vb||(P.Vb=!0,function(U,W,Y){function te(Fe){return(Fe=Fe.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Fe[1]:"GMT"}var J=new Date().getFullYear(),le=new Date(J,0,1),Se=new Date(J,6,1);J=le.getTimezoneOffset();var Le=Se.getTimezoneOffset();N[U>>2>>>0]=60*Math.max(J,Le),N[W>>2>>>0]=+(J!=Le),U=te(le),W=te(Se),U=ft(U),W=ft(W),Le>2>>>0]=U,H[Y+4>>2>>>0]=W):(H[Y>>2>>>0]=W,H[Y+4>>2>>>0]=U)}(D,F,R))},B:function(){Ee("")},ma:function(){return 4294901760},I:v?()=>{var P=process.hrtime();return 1e3*P[0]+P[1]/1e6}:()=>performance.now(),xa:function(P,D,F){L.copyWithin(P>>>0,D>>>0,D+F>>>0)},G:function(P){var D=L.length;if(4294901760<(P>>>=0))return!1;for(var F=1;4>=F;F*=2){var R=D*(1+.2/F);R=Math.min(R,P+100663296);var U=Math;R=Math.max(P,R),U=U.min.call(U,4294901760,R+(65536-R%65536)%65536);e:{try{I.grow(U-$.byteLength+65535>>>16),ue();var W=1;break e}catch{}W=void 0}if(W)return!0}return!1},va:function(P,D){var F=0;return It().forEach(function(R,U){var W=D+F;for(U=H[P+4*U>>2>>>0]=W,W=0;W>0>>>0]=R.charCodeAt(W);z[U>>0>>>0]=0,F+=R.length+1}),0},wa:function(P,D){var F=It();H[P>>2>>>0]=F.length;var R=0;return F.forEach(function(U){R+=U.length+1}),H[D>>2>>>0]=R,0},ba:function(P){x||0>2>>>0],te=H[D+4>>2>>>0];D+=8;for(var J=0;J>>0]);U+=te}return H[R>>2>>>0]=U,0},c:function(){return Re},ja:function P(D,F){P.Mb||(P.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var U=new Uint8Array(1);return()=>(crypto.getRandomValues(U),U[0])}if(v)try{var W=s(Object(function(){var Y=new Error("Cannot find module 'crypto'");throw Y.code="MODULE_NOT_FOUND",Y}()));return()=>W.randomBytes(1)[0]}catch{}return()=>Ee("randomDevice")}());for(var R=0;R>0>>>0]=P.Mb();return 0},ea:function(P,D,F){var R=ie();try{return ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},fa:function(P,D,F){var R=ie();try{return ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},J:function(P){var D=ie();try{return ge(P)()}catch(F){if(se(D),F!==F+0)throw F;ae(1,0)}},e:function(P,D){var F=ie();try{return ge(P)(D)}catch(R){if(se(F),R!==R+0)throw R;ae(1,0)}},N:function(P,D,F){var R=ie();try{return ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},O:function(P,D,F){var R=ie();try{return ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},j:function(P,D,F){var R=ie();try{return ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},o:function(P,D,F,R){var U=ie();try{return ge(P)(D,F,R)}catch(W){if(se(U),W!==W+0)throw W;ae(1,0)}},p:function(P,D,F,R,U){var W=ie();try{return ge(P)(D,F,R,U)}catch(Y){if(se(W),Y!==Y+0)throw Y;ae(1,0)}},M:function(P,D,F,R,U,W){var Y=ie();try{return ge(P)(D,F,R,U,W)}catch(te){if(se(Y),te!==te+0)throw te;ae(1,0)}},r:function(P,D,F,R,U,W){var Y=ie();try{return ge(P)(D,F,R,U,W)}catch(te){if(se(Y),te!==te+0)throw te;ae(1,0)}},v:function(P,D,F,R,U,W,Y){var te=ie();try{return ge(P)(D,F,R,U,W,Y)}catch(J){if(se(te),J!==J+0)throw J;ae(1,0)}},K:function(P,D,F,R,U,W,Y,te){var J=ie();try{return ge(P)(D,F,R,U,W,Y,te)}catch(le){if(se(J),le!==le+0)throw le;ae(1,0)}},D:function(P,D,F,R,U,W,Y,te,J,le,Se,Le){var Fe=ie();try{return ge(P)(D,F,R,U,W,Y,te,J,le,Se,Le)}catch(G){if(se(Fe),G!==G+0)throw G;ae(1,0)}},X:function(P,D,F,R,U,W,Y,te){var J=ie();try{return Ot(P,D,F,R,U,W,Y,te)}catch(le){if(se(J),le!==le+0)throw le;ae(1,0)}},V:function(P,D,F,R,U,W,Y){var te=ie();try{return _t(P,D,F,R,U,W,Y)}catch(J){if(se(te),J!==J+0)throw J;ae(1,0)}},U:function(P,D,F,R,U){var W=ie();try{return Et(P,D,F,R,U)}catch(Y){if(se(W),Y!==Y+0)throw Y;ae(1,0)}},Z:function(P,D,F,R){var U=ie();try{return St(P,D,F,R)}catch(W){if(se(U),W!==W+0)throw W;ae(1,0)}},W:function(P){var D=ie();try{return yt(P)}catch(F){if(se(D),F!==F+0)throw F;ae(1,0)}},Y:function(P,D){var F=ie();try{return At(P,D)}catch(R){if(se(F),R!==R+0)throw R;ae(1,0)}},T:function(P,D,F){var R=ie();try{return wt(P,D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},f:function(P){var D=ie();try{ge(P)()}catch(F){if(se(D),F!==F+0)throw F;ae(1,0)}},q:function(P,D){var F=ie();try{ge(P)(D)}catch(R){if(se(F),R!==R+0)throw R;ae(1,0)}},h:function(P,D,F){var R=ie();try{ge(P)(D,F)}catch(U){if(se(R),U!==U+0)throw U;ae(1,0)}},da:function(P,D,F,R){var U=ie();try{ge(P)(D,F,R)}catch(W){if(se(U),W!==W+0)throw W;ae(1,0)}},l:function(P,D,F,R){var U=ie();try{ge(P)(D,F,R)}catch(W){if(se(U),W!==W+0)throw W;ae(1,0)}},t:function(P,D,F,R,U){var W=ie();try{ge(P)(D,F,R,U)}catch(Y){if(se(W),Y!==Y+0)throw Y;ae(1,0)}},u:function(P,D,F,R,U,W){var Y=ie();try{ge(P)(D,F,R,U,W)}catch(te){if(se(Y),te!==te+0)throw te;ae(1,0)}},x:function(P,D,F,R,U,W,Y){var te=ie();try{ge(P)(D,F,R,U,W,Y)}catch(J){if(se(te),J!==J+0)throw J;ae(1,0)}},z:function(P,D,F,R,U,W,Y,te){var J=ie();try{ge(P)(D,F,R,U,W,Y,te)}catch(le){if(se(J),le!==le+0)throw le;ae(1,0)}},ga:function(P,D,F,R,U,W,Y,te,J){var le=ie();try{ge(P)(D,F,R,U,W,Y,te,J)}catch(Se){if(se(le),Se!==Se+0)throw Se;ae(1,0)}},A:function(P,D,F,R,U,W,Y,te,J,le,Se){var Le=ie();try{ge(P)(D,F,R,U,W,Y,te,J,le,Se)}catch(Fe){if(se(Le),Fe!==Fe+0)throw Fe;ae(1,0)}},C:function(P,D,F,R,U,W,Y,te,J,le,Se,Le,Fe,G,be,Pe){var We=ie();try{ge(P)(D,F,R,U,W,Y,te,J,le,Se,Le,Fe,G,be,Pe)}catch(tt){if(se(We),tt!==tt+0)throw tt;ae(1,0)}},aa:function(P,D,F,R,U,W,Y,te){var J=ie();try{vt(P,D,F,R,U,W,Y,te)}catch(le){if(se(J),le!==le+0)throw le;ae(1,0)}},_:function(P,D,F,R,U,W,Y,te,J,le,Se,Le){var Fe=ie();try{Tt(P,D,F,R,U,W,Y,te,J,le,Se,Le)}catch(G){if(se(Fe),G!==G+0)throw G;ae(1,0)}},$:function(P,D,F,R,U,W){var Y=ie();try{xt(P,D,F,R,U,W)}catch(te){if(se(Y),te!==te+0)throw te;ae(1,0)}},n:function(P){return P},F:function(P){Re=P},ha:kt,y:function(P,D,F,R){return kt(P,D,F,R)}};(function(){function P(U){a.asm=U.exports,I=a.asm.Ka,ue(),Ae=a.asm.ib,oe.unshift(a.asm.La),$e--,a.monitorRunDependencies&&a.monitorRunDependencies($e),$e==0&&Ce&&(U=Ce,Ce=null,U())}function D(U){P(U.instance)}function F(U){return function(){if(!S&&(b||y)){if(typeof fetch=="function"&&!Te.startsWith("file://"))return fetch(Te,{credentials:"same-origin"}).then(function(W){if(!W.ok)throw"failed to load wasm binary file at '"+Te+"'";return W.arrayBuffer()}).catch(function(){return Ve()});if(o)return new Promise(function(W,Y){o(Te,function(te){W(new Uint8Array(te))},Y)})}return Promise.resolve().then(function(){return Ve()})}().then(function(W){return WebAssembly.instantiate(W,R)}).then(function(W){return W}).then(U,function(W){O("failed to asynchronously prepare wasm: "+W),Ee(W)})}var R={a:Dt};if($e++,a.monitorRunDependencies&&a.monitorRunDependencies($e),a.instantiateWasm)try{return a.instantiateWasm(R,P)}catch(U){return O("Module.instantiateWasm callback failed with error: "+U),!1}(S||typeof WebAssembly.instantiateStreaming!="function"||Oe()||Te.startsWith("file://")||v||typeof fetch!="function"?F(D):fetch(Te,{credentials:"same-origin"}).then(function(U){return WebAssembly.instantiateStreaming(U,R).then(D,function(W){return O("wasm streaming compile failed: "+W),O("falling back to ArrayBuffer instantiation"),F(D)})})).catch(f)})(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.La).apply(null,arguments)},a._OrtInit=function(){return(a._OrtInit=a.asm.Ma).apply(null,arguments)},a._OrtCreateSessionOptions=function(){return(a._OrtCreateSessionOptions=a.asm.Na).apply(null,arguments)},a._OrtAppendExecutionProvider=function(){return(a._OrtAppendExecutionProvider=a.asm.Oa).apply(null,arguments)},a._OrtAddSessionConfigEntry=function(){return(a._OrtAddSessionConfigEntry=a.asm.Pa).apply(null,arguments)},a._OrtReleaseSessionOptions=function(){return(a._OrtReleaseSessionOptions=a.asm.Qa).apply(null,arguments)},a._OrtCreateSession=function(){return(a._OrtCreateSession=a.asm.Ra).apply(null,arguments)},a._OrtReleaseSession=function(){return(a._OrtReleaseSession=a.asm.Sa).apply(null,arguments)},a._OrtGetInputCount=function(){return(a._OrtGetInputCount=a.asm.Ta).apply(null,arguments)},a._OrtGetOutputCount=function(){return(a._OrtGetOutputCount=a.asm.Ua).apply(null,arguments)},a._OrtGetInputName=function(){return(a._OrtGetInputName=a.asm.Va).apply(null,arguments)},a._OrtGetOutputName=function(){return(a._OrtGetOutputName=a.asm.Wa).apply(null,arguments)},a._OrtFree=function(){return(a._OrtFree=a.asm.Xa).apply(null,arguments)},a._OrtCreateTensor=function(){return(a._OrtCreateTensor=a.asm.Ya).apply(null,arguments)},a._OrtGetTensorData=function(){return(a._OrtGetTensorData=a.asm.Za).apply(null,arguments)},a._OrtReleaseTensor=function(){return(a._OrtReleaseTensor=a.asm._a).apply(null,arguments)},a._OrtCreateRunOptions=function(){return(a._OrtCreateRunOptions=a.asm.$a).apply(null,arguments)},a._OrtAddRunConfigEntry=function(){return(a._OrtAddRunConfigEntry=a.asm.ab).apply(null,arguments)},a._OrtReleaseRunOptions=function(){return(a._OrtReleaseRunOptions=a.asm.bb).apply(null,arguments)},a._OrtRun=function(){return(a._OrtRun=a.asm.cb).apply(null,arguments)},a._OrtEndProfiling=function(){return(a._OrtEndProfiling=a.asm.db).apply(null,arguments)};var et,ve=a._malloc=function(){return(ve=a._malloc=a.asm.eb).apply(null,arguments)},st=a._free=function(){return(st=a._free=a.asm.fb).apply(null,arguments)},gt=a._fflush=function(){return(gt=a._fflush=a.asm.gb).apply(null,arguments)},at=a.___funcs_on_exit=function(){return(at=a.___funcs_on_exit=a.asm.hb).apply(null,arguments)},ae=a._setThrew=function(){return(ae=a._setThrew=a.asm.jb).apply(null,arguments)},ie=a.stackSave=function(){return(ie=a.stackSave=a.asm.kb).apply(null,arguments)},se=a.stackRestore=function(){return(se=a.stackRestore=a.asm.lb).apply(null,arguments)},mt=a.stackAlloc=function(){return(mt=a.stackAlloc=a.asm.mb).apply(null,arguments)},ut=a.___cxa_can_catch=function(){return(ut=a.___cxa_can_catch=a.asm.nb).apply(null,arguments)},bt=a.___cxa_is_pointer_type=function(){return(bt=a.___cxa_is_pointer_type=a.asm.ob).apply(null,arguments)},yt=a.dynCall_j=function(){return(yt=a.dynCall_j=a.asm.pb).apply(null,arguments)},_t=a.dynCall_iiiiij=function(){return(_t=a.dynCall_iiiiij=a.asm.qb).apply(null,arguments)},wt=a.dynCall_jii=function(){return(wt=a.dynCall_jii=a.asm.rb).apply(null,arguments)},vt=a.dynCall_viiiiij=function(){return(vt=a.dynCall_viiiiij=a.asm.sb).apply(null,arguments)},xt=a.dynCall_vjji=function(){return(xt=a.dynCall_vjji=a.asm.tb).apply(null,arguments)},Tt=a.dynCall_viiijjjii=function(){return(Tt=a.dynCall_viiijjjii=a.asm.ub).apply(null,arguments)},St=a.dynCall_iij=function(){return(St=a.dynCall_iij=a.asm.vb).apply(null,arguments)},At=a.dynCall_ji=function(){return(At=a.dynCall_ji=a.asm.wb).apply(null,arguments)},Ot=a.dynCall_iiiiiij=function(){return(Ot=a.dynCall_iiiiiij=a.asm.xb).apply(null,arguments)},Et=a.dynCall_iiij=function(){return(Et=a.dynCall_iiij=a.asm.yb).apply(null,arguments)};function Pt(){function P(){if(!et&&(et=!0,a.calledRun=!0,!M)){if(Ye(oe),h(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;){var D=a.postRun.shift();ye.unshift(D)}Ye(ye)}}if(!(0<$e)){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)Ne();Ye(xe),0<$e||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),P()},1)):P())}}if(a.UTF8ToString=X,a.stringToUTF8=function(P,D,F){return Q(P,L,D,F)},a.lengthBytesUTF8=ee,a.stackSave=ie,a.stackRestore=se,a.stackAlloc=mt,Ce=function P(){et||Pt(),et||(Ce=P)},a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);0{_.exports=function(n,s){for(var c=new Array(arguments.length-1),l=0,p=2,a=!0;p{var s=n;s.length=function(h){var f=h.length;if(!f)return 0;for(var u=0;--f%4>1&&h.charAt(f)==="=";)++u;return Math.ceil(3*h.length)/4-u};for(var c=new Array(64),l=new Array(123),p=0;p<64;)l[c[p]=p<26?p+65:p<52?p+71:p<62?p-4:p-59|43]=p++;s.encode=function(h,f,u){for(var o,t=null,e=[],r=0,i=0;f>2],o=(3&d)<<4,i=1;break;case 1:e[r++]=c[o|d>>4],o=(15&d)<<2,i=2;break;case 2:e[r++]=c[o|d>>6],e[r++]=c[63&d],i=0}r>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),r=0)}return i&&(e[r++]=c[o],e[r++]=61,i===1&&(e[r++]=61)),t?(r&&t.push(String.fromCharCode.apply(String,e.slice(0,r))),t.join("")):String.fromCharCode.apply(String,e.slice(0,r))};var a="invalid encoding";s.decode=function(h,f,u){for(var o,t=u,e=0,r=0;r1)break;if((i=l[i])===void 0)throw Error(a);switch(e){case 0:o=i,e=1;break;case 1:f[u++]=o<<2|(48&i)>>4,o=i,e=2;break;case 2:f[u++]=(15&o)<<4|(60&i)>>2,o=i,e=3;break;case 3:f[u++]=(3&o)<<6|i,e=0}}if(e===1)throw Error(a);return u-t},s.test=function(h){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(h)}},9211:_=>{function n(){this._listeners={}}_.exports=n,n.prototype.on=function(s,c,l){return(this._listeners[s]||(this._listeners[s]=[])).push({fn:c,ctx:l||this}),this},n.prototype.off=function(s,c){if(s===void 0)this._listeners={};else if(c===void 0)this._listeners[s]=[];else for(var l=this._listeners[s],p=0;p{function n(a){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),f=new Uint8Array(h.buffer),u=f[3]===128;function o(i,d,g){h[0]=i,d[g]=f[0],d[g+1]=f[1],d[g+2]=f[2],d[g+3]=f[3]}function t(i,d,g){h[0]=i,d[g]=f[3],d[g+1]=f[2],d[g+2]=f[1],d[g+3]=f[0]}function e(i,d){return f[0]=i[d],f[1]=i[d+1],f[2]=i[d+2],f[3]=i[d+3],h[0]}function r(i,d){return f[3]=i[d],f[2]=i[d+1],f[1]=i[d+2],f[0]=i[d+3],h[0]}a.writeFloatLE=u?o:t,a.writeFloatBE=u?t:o,a.readFloatLE=u?e:r,a.readFloatBE=u?r:e}():function(){function h(u,o,t,e){var r=o<0?1:0;if(r&&(o=-o),o===0)u(1/o>0?0:2147483648,t,e);else if(isNaN(o))u(2143289344,t,e);else if(o>34028234663852886e22)u((r<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)u((r<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var i=Math.floor(Math.log(o)/Math.LN2);u((r<<31|i+127<<23|8388607&Math.round(o*Math.pow(2,-i)*8388608))>>>0,t,e)}}function f(u,o,t){var e=u(o,t),r=2*(e>>31)+1,i=e>>>23&255,d=8388607&e;return i===255?d?NaN:r*(1/0):i===0?1401298464324817e-60*r*d:r*Math.pow(2,i-150)*(d+8388608)}a.writeFloatLE=h.bind(null,s),a.writeFloatBE=h.bind(null,c),a.readFloatLE=f.bind(null,l),a.readFloatBE=f.bind(null,p)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),f=new Uint8Array(h.buffer),u=f[7]===128;function o(i,d,g){h[0]=i,d[g]=f[0],d[g+1]=f[1],d[g+2]=f[2],d[g+3]=f[3],d[g+4]=f[4],d[g+5]=f[5],d[g+6]=f[6],d[g+7]=f[7]}function t(i,d,g){h[0]=i,d[g]=f[7],d[g+1]=f[6],d[g+2]=f[5],d[g+3]=f[4],d[g+4]=f[3],d[g+5]=f[2],d[g+6]=f[1],d[g+7]=f[0]}function e(i,d){return f[0]=i[d],f[1]=i[d+1],f[2]=i[d+2],f[3]=i[d+3],f[4]=i[d+4],f[5]=i[d+5],f[6]=i[d+6],f[7]=i[d+7],h[0]}function r(i,d){return f[7]=i[d],f[6]=i[d+1],f[5]=i[d+2],f[4]=i[d+3],f[3]=i[d+4],f[2]=i[d+5],f[1]=i[d+6],f[0]=i[d+7],h[0]}a.writeDoubleLE=u?o:t,a.writeDoubleBE=u?t:o,a.readDoubleLE=u?e:r,a.readDoubleBE=u?r:e}():function(){function h(u,o,t,e,r,i){var d=e<0?1:0;if(d&&(e=-e),e===0)u(0,r,i+o),u(1/e>0?0:2147483648,r,i+t);else if(isNaN(e))u(0,r,i+o),u(2146959360,r,i+t);else if(e>17976931348623157e292)u(0,r,i+o),u((d<<31|2146435072)>>>0,r,i+t);else{var g;if(e<22250738585072014e-324)u((g=e/5e-324)>>>0,r,i+o),u((d<<31|g/4294967296)>>>0,r,i+t);else{var m=Math.floor(Math.log(e)/Math.LN2);m===1024&&(m=1023),u(4503599627370496*(g=e*Math.pow(2,-m))>>>0,r,i+o),u((d<<31|m+1023<<20|1048576*g&1048575)>>>0,r,i+t)}}}function f(u,o,t,e,r){var i=u(e,r+o),d=u(e,r+t),g=2*(d>>31)+1,m=d>>>20&2047,b=4294967296*(1048575&d)+i;return m===2047?b?NaN:g*(1/0):m===0?5e-324*g*b:g*Math.pow(2,m-1075)*(b+4503599627370496)}a.writeDoubleLE=h.bind(null,s,0,4),a.writeDoubleBE=h.bind(null,c,4,0),a.readDoubleLE=f.bind(null,l,0,4),a.readDoubleBE=f.bind(null,p,4,0)}(),a}function s(a,h,f){h[f]=255&a,h[f+1]=a>>>8&255,h[f+2]=a>>>16&255,h[f+3]=a>>>24}function c(a,h,f){h[f]=a>>>24,h[f+1]=a>>>16&255,h[f+2]=a>>>8&255,h[f+3]=255&a}function l(a,h){return(a[h]|a[h+1]<<8|a[h+2]<<16|a[h+3]<<24)>>>0}function p(a,h){return(a[h]<<24|a[h+1]<<16|a[h+2]<<8|a[h+3])>>>0}_.exports=n(n)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(_){}return null}module.exports=inquire},6662:_=>{_.exports=function(n,s,c){var l=c||8192,p=l>>>1,a=null,h=l;return function(f){if(f<1||f>p)return n(f);h+f>l&&(a=n(l),h=0);var u=s.call(a,h,h+=f);return 7&h&&(h=1+(7|h)),u}}},4997:(_,n)=>{var s=n;s.length=function(c){for(var l=0,p=0,a=0;a191&&a<224?f[u++]=(31&a)<<6|63&c[l++]:a>239&&a<365?(a=((7&a)<<18|(63&c[l++])<<12|(63&c[l++])<<6|63&c[l++])-65536,f[u++]=55296+(a>>10),f[u++]=56320+(1023&a)):f[u++]=(15&a)<<12|(63&c[l++])<<6|63&c[l++],u>8191&&((h||(h=[])).push(String.fromCharCode.apply(String,f)),u=0);return h?(u&&h.push(String.fromCharCode.apply(String,f.slice(0,u))),h.join("")):String.fromCharCode.apply(String,f.slice(0,u))},s.write=function(c,l,p){for(var a,h,f=p,u=0;u>6|192,l[p++]=63&a|128):(64512&a)==55296&&(64512&(h=c.charCodeAt(u+1)))==56320?(a=65536+((1023&a)<<10)+(1023&h),++u,l[p++]=a>>18|240,l[p++]=a>>12&63|128,l[p++]=a>>6&63|128,l[p++]=63&a|128):(l[p++]=a>>12|224,l[p++]=a>>6&63|128,l[p++]=63&a|128);return p-f}},3442:(_,n)=>{n.__esModule=!0;var s=function(){function c(l){if(!l)throw new TypeError("Invalid argument; `value` has no value.");this.value=c.EMPTY,l&&c.isGuid(l)&&(this.value=l)}return c.isGuid=function(l){var p=l.toString();return l&&(l instanceof c||c.validator.test(p))},c.create=function(){return new c([c.gen(2),c.gen(1),c.gen(1),c.gen(1),c.gen(3)].join("-"))},c.createEmpty=function(){return new c("emptyguid")},c.parse=function(l){return new c(l)},c.raw=function(){return[c.gen(2),c.gen(1),c.gen(1),c.gen(1),c.gen(3)].join("-")},c.gen=function(l){for(var p="",a=0;a{_.exports=s;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 s(x,I,$){this.low=0|x,this.high=0|I,this.unsigned=!!$}function c(x){return(x&&x.__isLong__)===!0}s.prototype.__isLong__,Object.defineProperty(s.prototype,"__isLong__",{value:!0}),s.isLong=c;var l={},p={};function a(x,I){var $,z,L;return I?(L=0<=(x>>>=0)&&x<256)&&(z=p[x])?z:($=f(x,(0|x)<0?-1:0,!0),L&&(p[x]=$),$):(L=-128<=(x|=0)&&x<128)&&(z=l[x])?z:($=f(x,x<0?-1:0,!1),L&&(l[x]=$),$)}function h(x,I){if(isNaN(x))return I?m:g;if(I){if(x<0)return m;if(x>=r)return S}else{if(x<=-i)return A;if(x+1>=i)return w}return x<0?h(-x,I).neg():f(x%e|0,x/e|0,I)}function f(x,I,$){return new s(x,I,$)}s.fromInt=a,s.fromNumber=h,s.fromBits=f;var u=Math.pow;function o(x,I,$){if(x.length===0)throw Error("empty string");if(x==="NaN"||x==="Infinity"||x==="+Infinity"||x==="-Infinity")return g;if(typeof I=="number"?($=I,I=!1):I=!!I,($=$||10)<2||36<$)throw RangeError("radix");var z;if((z=x.indexOf("-"))>0)throw Error("interior hyphen");if(z===0)return o(x.substring(1),I,$).neg();for(var L=h(u($,8)),N=g,H=0;H>>0:this.low},O.toNumber=function(){return this.unsigned?(this.high>>>0)*e+(this.low>>>0):this.high*e+(this.low>>>0)},O.toString=function(x){if((x=x||10)<2||36>>0).toString(x);if((N=M).isZero())return j+H;for(;j.length<6;)j="0"+j;H=""+j+H}},O.getHighBits=function(){return this.high},O.getHighBitsUnsigned=function(){return this.high>>>0},O.getLowBits=function(){return this.low},O.getLowBitsUnsigned=function(){return this.low>>>0},O.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var x=this.high!=0?this.high:this.low,I=31;I>0&&!(x&1<=0},O.isOdd=function(){return(1&this.low)==1},O.isEven=function(){return(1&this.low)==0},O.equals=function(x){return c(x)||(x=t(x)),(this.unsigned===x.unsigned||this.high>>>31!=1||x.high>>>31!=1)&&this.high===x.high&&this.low===x.low},O.eq=O.equals,O.notEquals=function(x){return!this.eq(x)},O.neq=O.notEquals,O.ne=O.notEquals,O.lessThan=function(x){return this.comp(x)<0},O.lt=O.lessThan,O.lessThanOrEqual=function(x){return this.comp(x)<=0},O.lte=O.lessThanOrEqual,O.le=O.lessThanOrEqual,O.greaterThan=function(x){return this.comp(x)>0},O.gt=O.greaterThan,O.greaterThanOrEqual=function(x){return this.comp(x)>=0},O.gte=O.greaterThanOrEqual,O.ge=O.greaterThanOrEqual,O.compare=function(x){if(c(x)||(x=t(x)),this.eq(x))return 0;var I=this.isNegative(),$=x.isNegative();return I&&!$?-1:!I&&$?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},O.comp=O.compare,O.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(b)},O.neg=O.negate,O.add=function(x){c(x)||(x=t(x));var I=this.high>>>16,$=65535&this.high,z=this.low>>>16,L=65535&this.low,N=x.high>>>16,H=65535&x.high,M=x.low>>>16,j=0,Z=0,X=0,Q=0;return X+=(Q+=L+(65535&x.low))>>>16,Z+=(X+=z+M)>>>16,j+=(Z+=$+H)>>>16,j+=I+N,f((X&=65535)<<16|(Q&=65535),(j&=65535)<<16|(Z&=65535),this.unsigned)},O.subtract=function(x){return c(x)||(x=t(x)),this.add(x.neg())},O.sub=O.subtract,O.multiply=function(x){if(this.isZero())return g;if(c(x)||(x=t(x)),n)return f(n.mul(this.low,this.high,x.low,x.high),n.get_high(),this.unsigned);if(x.isZero())return g;if(this.eq(A))return x.isOdd()?A:g;if(x.eq(A))return this.isOdd()?A:g;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(d)&&x.lt(d))return h(this.toNumber()*x.toNumber(),this.unsigned);var I=this.high>>>16,$=65535&this.high,z=this.low>>>16,L=65535&this.low,N=x.high>>>16,H=65535&x.high,M=x.low>>>16,j=65535&x.low,Z=0,X=0,Q=0,ee=0;return Q+=(ee+=L*j)>>>16,X+=(Q+=z*j)>>>16,Q&=65535,X+=(Q+=L*M)>>>16,Z+=(X+=$*j)>>>16,X&=65535,Z+=(X+=z*M)>>>16,X&=65535,Z+=(X+=L*H)>>>16,Z+=I*j+$*M+z*H+L*N,f((Q&=65535)<<16|(ee&=65535),(Z&=65535)<<16|(X&=65535),this.unsigned)},O.mul=O.multiply,O.divide=function(x){if(c(x)||(x=t(x)),x.isZero())throw Error("division by zero");var I,$,z;if(n)return this.unsigned||this.high!==-2147483648||x.low!==-1||x.high!==-1?f((this.unsigned?n.div_u:n.div_s)(this.low,this.high,x.low,x.high),n.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return m;if(x.gt(this.shru(1)))return y;z=m}else{if(this.eq(A))return x.eq(b)||x.eq(v)?A:x.eq(A)?b:(I=this.shr(1).div(x).shl(1)).eq(g)?x.isNegative()?b:v:($=this.sub(x.mul(I)),z=I.add($.div(x)));if(x.eq(A))return this.unsigned?m:g;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();z=g}for($=this;$.gte(x);){I=Math.max(1,Math.floor($.toNumber()/x.toNumber()));for(var L=Math.ceil(Math.log(I)/Math.LN2),N=L<=48?1:u(2,L-48),H=h(I),M=H.mul(x);M.isNegative()||M.gt($);)M=(H=h(I-=N,this.unsigned)).mul(x);H.isZero()&&(H=b),z=z.add(H),$=$.sub(M)}return z},O.div=O.divide,O.modulo=function(x){return c(x)||(x=t(x)),n?f((this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,x.low,x.high),n.get_high(),this.unsigned):this.sub(this.div(x).mul(x))},O.mod=O.modulo,O.rem=O.modulo,O.not=function(){return f(~this.low,~this.high,this.unsigned)},O.and=function(x){return c(x)||(x=t(x)),f(this.low&x.low,this.high&x.high,this.unsigned)},O.or=function(x){return c(x)||(x=t(x)),f(this.low|x.low,this.high|x.high,this.unsigned)},O.xor=function(x){return c(x)||(x=t(x)),f(this.low^x.low,this.high^x.high,this.unsigned)},O.shiftLeft=function(x){return c(x)&&(x=x.toInt()),(x&=63)==0?this:x<32?f(this.low<>>32-x,this.unsigned):f(0,this.low<>>x|this.high<<32-x,this.high>>x,this.unsigned):f(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},O.shr=O.shiftRight,O.shiftRightUnsigned=function(x){if(c(x)&&(x=x.toInt()),(x&=63)==0)return this;var I=this.high;return x<32?f(this.low>>>x|I<<32-x,I>>>x,this.unsigned):f(x===32?I:I>>>x-32,0,this.unsigned)},O.shru=O.shiftRightUnsigned,O.shr_u=O.shiftRightUnsigned,O.toSigned=function(){return this.unsigned?f(this.low,this.high,!1):this},O.toUnsigned=function(){return this.unsigned?this:f(this.low,this.high,!0)},O.toBytes=function(x){return x?this.toBytesLE():this.toBytesBE()},O.toBytesLE=function(){var x=this.high,I=this.low;return[255&I,I>>>8&255,I>>>16&255,I>>>24,255&x,x>>>8&255,x>>>16&255,x>>>24]},O.toBytesBE=function(){var x=this.high,I=this.low;return[x>>>24,x>>>16&255,x>>>8&255,255&x,I>>>24,I>>>16&255,I>>>8&255,255&I]},s.fromBytes=function(x,I,$){return $?s.fromBytesLE(x,I):s.fromBytesBE(x,I)},s.fromBytesLE=function(x,I){return new s(x[0]|x[1]<<8|x[2]<<16|x[3]<<24,x[4]|x[5]<<8|x[6]<<16|x[7]<<24,I)},s.fromBytesBE=function(x,I){return new s(x[4]<<24|x[5]<<16|x[6]<<8|x[7],x[0]<<24|x[1]<<16|x[2]<<8|x[3],I)}},1446:(_,n,s)=>{var c,l,p,a=s(2100),h=a.Reader,f=a.Writer,u=a.util,o=a.roots.default||(a.roots.default={});o.onnx=((p={}).Version=(c={},(l=Object.create(c))[c[0]="_START_VERSION"]=0,l[c[1]="IR_VERSION_2017_10_10"]=1,l[c[2]="IR_VERSION_2017_10_30"]=2,l[c[3]="IR_VERSION_2017_11_3"]=3,l[c[4]="IR_VERSION_2019_1_22"]=4,l[c[5]="IR_VERSION"]=5,l),p.AttributeProto=function(){function t(e){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:d.name=e.string();break;case 21:d.refAttrName=e.string();break;case 13:d.docString=e.string();break;case 20:d.type=e.int32();break;case 2:d.f=e.float();break;case 3:d.i=e.int64();break;case 4:d.s=e.bytes();break;case 5:d.t=o.onnx.TensorProto.decode(e,e.uint32());break;case 6:d.g=o.onnx.GraphProto.decode(e,e.uint32());break;case 7:if(d.floats&&d.floats.length||(d.floats=[]),(7&g)==2)for(var m=e.uint32()+e.pos;e.pos>>0,e.i.high>>>0).toNumber())),e.s!=null&&(typeof e.s=="string"?u.base64.decode(e.s,r.s=u.newBuffer(u.base64.length(e.s)),0):e.s.length&&(r.s=e.s)),e.t!=null){if(typeof e.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");r.t=o.onnx.TensorProto.fromObject(e.t)}if(e.g!=null){if(typeof e.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");r.g=o.onnx.GraphProto.fromObject(e.g)}if(e.floats){if(!Array.isArray(e.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");r.floats=[];for(var i=0;i>>0,e.ints[i].high>>>0).toNumber())}if(e.strings){if(!Array.isArray(e.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(r.strings=[],i=0;i>>0,e.i.high>>>0).toNumber():e.i),e.s!=null&&e.hasOwnProperty("s")&&(i.s=r.bytes===String?u.base64.encode(e.s,0,e.s.length):r.bytes===Array?Array.prototype.slice.call(e.s):e.s),e.t!=null&&e.hasOwnProperty("t")&&(i.t=o.onnx.TensorProto.toObject(e.t,r)),e.g!=null&&e.hasOwnProperty("g")&&(i.g=o.onnx.GraphProto.toObject(e.g,r)),e.floats&&e.floats.length){i.floats=[];for(var g=0;g>>0,e.ints[g].high>>>0).toNumber():e.ints[g];if(e.strings&&e.strings.length)for(i.strings=[],g=0;g>>3){case 1:d.name=e.string();break;case 2:d.type=o.onnx.TypeProto.decode(e,e.uint32());break;case 3:d.docString=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(e.type!=null&&e.hasOwnProperty("type")){var r=o.onnx.TypeProto.verify(e.type);if(r)return"type."+r}return e.docString!=null&&e.hasOwnProperty("docString")&&!u.isString(e.docString)?"docString: string expected":null},t.fromObject=function(e){if(e instanceof o.onnx.ValueInfoProto)return e;var r=new o.onnx.ValueInfoProto;if(e.name!=null&&(r.name=String(e.name)),e.type!=null){if(typeof e.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");r.type=o.onnx.TypeProto.fromObject(e.type)}return e.docString!=null&&(r.docString=String(e.docString)),r},t.toObject=function(e,r){r||(r={});var i={};return r.defaults&&(i.name="",i.type=null,i.docString=""),e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.type!=null&&e.hasOwnProperty("type")&&(i.type=o.onnx.TypeProto.toObject(e.type,r)),e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),p.NodeProto=function(){function t(e){if(this.input=[],this.output=[],this.attribute=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:d.input&&d.input.length||(d.input=[]),d.input.push(e.string());break;case 2:d.output&&d.output.length||(d.output=[]),d.output.push(e.string());break;case 3:d.name=e.string();break;case 4:d.opType=e.string();break;case 7:d.domain=e.string();break;case 5:d.attribute&&d.attribute.length||(d.attribute=[]),d.attribute.push(o.onnx.AttributeProto.decode(e,e.uint32()));break;case 6:d.docString=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var r=0;r>>3){case 1:d.irVersion=e.int64();break;case 8:d.opsetImport&&d.opsetImport.length||(d.opsetImport=[]),d.opsetImport.push(o.onnx.OperatorSetIdProto.decode(e,e.uint32()));break;case 2:d.producerName=e.string();break;case 3:d.producerVersion=e.string();break;case 4:d.domain=e.string();break;case 5:d.modelVersion=e.int64();break;case 6:d.docString=e.string();break;case 7:d.graph=o.onnx.GraphProto.decode(e,e.uint32());break;case 14:d.metadataProps&&d.metadataProps.length||(d.metadataProps=[]),d.metadataProps.push(o.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&!(u.isInteger(e.irVersion)||e.irVersion&&u.isInteger(e.irVersion.low)&&u.isInteger(e.irVersion.high)))return"irVersion: integer|Long expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var r=0;r>>0,e.irVersion.high>>>0).toNumber())),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");r.opsetImport=[];for(var i=0;i>>0,e.modelVersion.high>>>0).toNumber())),e.docString!=null&&(r.docString=String(e.docString)),e.graph!=null){if(typeof e.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");r.graph=o.onnx.GraphProto.fromObject(e.graph)}if(e.metadataProps){if(!Array.isArray(e.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(r.metadataProps=[],i=0;i>>0,e.irVersion.high>>>0).toNumber():e.irVersion),e.producerName!=null&&e.hasOwnProperty("producerName")&&(i.producerName=e.producerName),e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&(i.producerVersion=e.producerVersion),e.domain!=null&&e.hasOwnProperty("domain")&&(i.domain=e.domain),e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&(typeof e.modelVersion=="number"?i.modelVersion=r.longs===String?String(e.modelVersion):e.modelVersion:i.modelVersion=r.longs===String?u.Long.prototype.toString.call(e.modelVersion):r.longs===Number?new u.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber():e.modelVersion),e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),e.graph!=null&&e.hasOwnProperty("graph")&&(i.graph=o.onnx.GraphProto.toObject(e.graph,r)),e.opsetImport&&e.opsetImport.length){i.opsetImport=[];for(var g=0;g>>3){case 1:d.key=e.string();break;case 2:d.value=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":e.key!=null&&e.hasOwnProperty("key")&&!u.isString(e.key)?"key: string expected":e.value!=null&&e.hasOwnProperty("value")&&!u.isString(e.value)?"value: string expected":null},t.fromObject=function(e){if(e instanceof o.onnx.StringStringEntryProto)return e;var r=new o.onnx.StringStringEntryProto;return e.key!=null&&(r.key=String(e.key)),e.value!=null&&(r.value=String(e.value)),r},t.toObject=function(e,r){r||(r={});var i={};return r.defaults&&(i.key="",i.value=""),e.key!=null&&e.hasOwnProperty("key")&&(i.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(i.value=e.value),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),p.TensorAnnotation=function(){function t(e){if(this.quantParameterTensorNames=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:d.tensorName=e.string();break;case 2:d.quantParameterTensorNames&&d.quantParameterTensorNames.length||(d.quantParameterTensorNames=[]),d.quantParameterTensorNames.push(o.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.tensorName!=null&&e.hasOwnProperty("tensorName")&&!u.isString(e.tensorName))return"tensorName: string expected";if(e.quantParameterTensorNames!=null&&e.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(e.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var r=0;r>>3){case 1:d.node&&d.node.length||(d.node=[]),d.node.push(o.onnx.NodeProto.decode(e,e.uint32()));break;case 2:d.name=e.string();break;case 5:d.initializer&&d.initializer.length||(d.initializer=[]),d.initializer.push(o.onnx.TensorProto.decode(e,e.uint32()));break;case 10:d.docString=e.string();break;case 11:d.input&&d.input.length||(d.input=[]),d.input.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 12:d.output&&d.output.length||(d.output=[]),d.output.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 13:d.valueInfo&&d.valueInfo.length||(d.valueInfo=[]),d.valueInfo.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 14:d.quantizationAnnotation&&d.quantizationAnnotation.length||(d.quantizationAnnotation=[]),d.quantizationAnnotation.push(o.onnx.TensorAnnotation.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var r=0;r>>3){case 1:if(d.dims&&d.dims.length||(d.dims=[]),(7&g)==2)for(var m=e.uint32()+e.pos;e.pos>>0,e.dims[i].high>>>0).toNumber())}if(e.dataType!=null&&(r.dataType=0|e.dataType),e.segment!=null){if(typeof e.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");r.segment=o.onnx.TensorProto.Segment.fromObject(e.segment)}if(e.floatData){if(!Array.isArray(e.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(r.floatData=[],i=0;i>>0,e.int64Data[i].high>>>0).toNumber())}if(e.name!=null&&(r.name=String(e.name)),e.docString!=null&&(r.docString=String(e.docString)),e.rawData!=null&&(typeof e.rawData=="string"?u.base64.decode(e.rawData,r.rawData=u.newBuffer(u.base64.length(e.rawData)),0):e.rawData.length&&(r.rawData=e.rawData)),e.externalData){if(!Array.isArray(e.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(r.externalData=[],i=0;i>>0,e.uint64Data[i].high>>>0).toNumber(!0))}return r},t.toObject=function(e,r){r||(r={});var i={};if((r.arrays||r.defaults)&&(i.dims=[],i.floatData=[],i.int32Data=[],i.stringData=[],i.int64Data=[],i.doubleData=[],i.uint64Data=[],i.externalData=[]),r.defaults&&(i.dataType=0,i.segment=null,i.name="",r.bytes===String?i.rawData="":(i.rawData=[],r.bytes!==Array&&(i.rawData=u.newBuffer(i.rawData))),i.docString="",i.dataLocation=r.enums===String?"DEFAULT":0),e.dims&&e.dims.length){i.dims=[];for(var d=0;d>>0,e.dims[d].high>>>0).toNumber():e.dims[d]}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&(i.dataType=e.dataType),e.segment!=null&&e.hasOwnProperty("segment")&&(i.segment=o.onnx.TensorProto.Segment.toObject(e.segment,r)),e.floatData&&e.floatData.length)for(i.floatData=[],d=0;d>>0,e.int64Data[d].high>>>0).toNumber():e.int64Data[d];if(e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.rawData!=null&&e.hasOwnProperty("rawData")&&(i.rawData=r.bytes===String?u.base64.encode(e.rawData,0,e.rawData.length):r.bytes===Array?Array.prototype.slice.call(e.rawData):e.rawData),e.doubleData&&e.doubleData.length)for(i.doubleData=[],d=0;d>>0,e.uint64Data[d].high>>>0).toNumber(!0):e.uint64Data[d];if(e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),e.externalData&&e.externalData.length)for(i.externalData=[],d=0;d>>3){case 1:g.begin=r.int64();break;case 2:g.end=r.int64();break;default:r.skipType(7&m)}}return g},e.decodeDelimited=function(r){return r instanceof h||(r=new h(r)),this.decode(r,r.uint32())},e.verify=function(r){return typeof r!="object"||r===null?"object expected":r.begin!=null&&r.hasOwnProperty("begin")&&!(u.isInteger(r.begin)||r.begin&&u.isInteger(r.begin.low)&&u.isInteger(r.begin.high))?"begin: integer|Long expected":r.end!=null&&r.hasOwnProperty("end")&&!(u.isInteger(r.end)||r.end&&u.isInteger(r.end.low)&&u.isInteger(r.end.high))?"end: integer|Long expected":null},e.fromObject=function(r){if(r instanceof o.onnx.TensorProto.Segment)return r;var i=new o.onnx.TensorProto.Segment;return r.begin!=null&&(u.Long?(i.begin=u.Long.fromValue(r.begin)).unsigned=!1:typeof r.begin=="string"?i.begin=parseInt(r.begin,10):typeof r.begin=="number"?i.begin=r.begin:typeof r.begin=="object"&&(i.begin=new u.LongBits(r.begin.low>>>0,r.begin.high>>>0).toNumber())),r.end!=null&&(u.Long?(i.end=u.Long.fromValue(r.end)).unsigned=!1:typeof r.end=="string"?i.end=parseInt(r.end,10):typeof r.end=="number"?i.end=r.end:typeof r.end=="object"&&(i.end=new u.LongBits(r.end.low>>>0,r.end.high>>>0).toNumber())),i},e.toObject=function(r,i){i||(i={});var d={};if(i.defaults){if(u.Long){var g=new u.Long(0,0,!1);d.begin=i.longs===String?g.toString():i.longs===Number?g.toNumber():g}else d.begin=i.longs===String?"0":0;u.Long?(g=new u.Long(0,0,!1),d.end=i.longs===String?g.toString():i.longs===Number?g.toNumber():g):d.end=i.longs===String?"0":0}return r.begin!=null&&r.hasOwnProperty("begin")&&(typeof r.begin=="number"?d.begin=i.longs===String?String(r.begin):r.begin:d.begin=i.longs===String?u.Long.prototype.toString.call(r.begin):i.longs===Number?new u.LongBits(r.begin.low>>>0,r.begin.high>>>0).toNumber():r.begin),r.end!=null&&r.hasOwnProperty("end")&&(typeof r.end=="number"?d.end=i.longs===String?String(r.end):r.end:d.end=i.longs===String?u.Long.prototype.toString.call(r.end):i.longs===Number?new u.LongBits(r.end.low>>>0,r.end.high>>>0).toNumber():r.end),d},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),t.DataLocation=function(){var e={},r=Object.create(e);return r[e[0]="DEFAULT"]=0,r[e[1]="EXTERNAL"]=1,r}(),t}(),p.TensorShapeProto=function(){function t(e){if(this.dim=[],e)for(var r=Object.keys(e),i=0;i>>3==1?(d.dim&&d.dim.length||(d.dim=[]),d.dim.push(o.onnx.TensorShapeProto.Dimension.decode(e,e.uint32()))):e.skipType(7&g)}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dim!=null&&e.hasOwnProperty("dim")){if(!Array.isArray(e.dim))return"dim: array expected";for(var r=0;r>>3){case 1:m.dimValue=i.int64();break;case 2:m.dimParam=i.string();break;case 3:m.denotation=i.string();break;default:i.skipType(7&b)}}return m},e.decodeDelimited=function(i){return i instanceof h||(i=new h(i)),this.decode(i,i.uint32())},e.verify=function(i){if(typeof i!="object"||i===null)return"object expected";var d={};if(i.dimValue!=null&&i.hasOwnProperty("dimValue")&&(d.value=1,!(u.isInteger(i.dimValue)||i.dimValue&&u.isInteger(i.dimValue.low)&&u.isInteger(i.dimValue.high))))return"dimValue: integer|Long expected";if(i.dimParam!=null&&i.hasOwnProperty("dimParam")){if(d.value===1)return"value: multiple values";if(d.value=1,!u.isString(i.dimParam))return"dimParam: string expected"}return i.denotation!=null&&i.hasOwnProperty("denotation")&&!u.isString(i.denotation)?"denotation: string expected":null},e.fromObject=function(i){if(i instanceof o.onnx.TensorShapeProto.Dimension)return i;var d=new o.onnx.TensorShapeProto.Dimension;return i.dimValue!=null&&(u.Long?(d.dimValue=u.Long.fromValue(i.dimValue)).unsigned=!1:typeof i.dimValue=="string"?d.dimValue=parseInt(i.dimValue,10):typeof i.dimValue=="number"?d.dimValue=i.dimValue:typeof i.dimValue=="object"&&(d.dimValue=new u.LongBits(i.dimValue.low>>>0,i.dimValue.high>>>0).toNumber())),i.dimParam!=null&&(d.dimParam=String(i.dimParam)),i.denotation!=null&&(d.denotation=String(i.denotation)),d},e.toObject=function(i,d){d||(d={});var g={};return d.defaults&&(g.denotation=""),i.dimValue!=null&&i.hasOwnProperty("dimValue")&&(typeof i.dimValue=="number"?g.dimValue=d.longs===String?String(i.dimValue):i.dimValue:g.dimValue=d.longs===String?u.Long.prototype.toString.call(i.dimValue):d.longs===Number?new u.LongBits(i.dimValue.low>>>0,i.dimValue.high>>>0).toNumber():i.dimValue,d.oneofs&&(g.value="dimValue")),i.dimParam!=null&&i.hasOwnProperty("dimParam")&&(g.dimParam=i.dimParam,d.oneofs&&(g.value="dimParam")),i.denotation!=null&&i.hasOwnProperty("denotation")&&(g.denotation=i.denotation),g},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),t}(),p.TypeProto=function(){function t(r){if(r)for(var i=Object.keys(r),d=0;d>>3){case 1:g.tensorType=o.onnx.TypeProto.Tensor.decode(r,r.uint32());break;case 6:g.denotation=r.string();break;default:r.skipType(7&m)}}return g},t.decodeDelimited=function(r){return r instanceof h||(r=new h(r)),this.decode(r,r.uint32())},t.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.tensorType!=null&&r.hasOwnProperty("tensorType")){var i=o.onnx.TypeProto.Tensor.verify(r.tensorType);if(i)return"tensorType."+i}return r.denotation!=null&&r.hasOwnProperty("denotation")&&!u.isString(r.denotation)?"denotation: string expected":null},t.fromObject=function(r){if(r instanceof o.onnx.TypeProto)return r;var i=new o.onnx.TypeProto;if(r.tensorType!=null){if(typeof r.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");i.tensorType=o.onnx.TypeProto.Tensor.fromObject(r.tensorType)}return r.denotation!=null&&(i.denotation=String(r.denotation)),i},t.toObject=function(r,i){i||(i={});var d={};return i.defaults&&(d.denotation=""),r.tensorType!=null&&r.hasOwnProperty("tensorType")&&(d.tensorType=o.onnx.TypeProto.Tensor.toObject(r.tensorType,i),i.oneofs&&(d.value="tensorType")),r.denotation!=null&&r.hasOwnProperty("denotation")&&(d.denotation=r.denotation),d},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t.Tensor=function(){function r(i){if(i)for(var d=Object.keys(i),g=0;g>>3){case 1:m.elemType=i.int32();break;case 2:m.shape=o.onnx.TensorShapeProto.decode(i,i.uint32());break;default:i.skipType(7&b)}}return m},r.decodeDelimited=function(i){return i instanceof h||(i=new h(i)),this.decode(i,i.uint32())},r.verify=function(i){if(typeof i!="object"||i===null)return"object expected";if(i.elemType!=null&&i.hasOwnProperty("elemType")&&!u.isInteger(i.elemType))return"elemType: integer expected";if(i.shape!=null&&i.hasOwnProperty("shape")){var d=o.onnx.TensorShapeProto.verify(i.shape);if(d)return"shape."+d}return null},r.fromObject=function(i){if(i instanceof o.onnx.TypeProto.Tensor)return i;var d=new o.onnx.TypeProto.Tensor;if(i.elemType!=null&&(d.elemType=0|i.elemType),i.shape!=null){if(typeof i.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");d.shape=o.onnx.TensorShapeProto.fromObject(i.shape)}return d},r.toObject=function(i,d){d||(d={});var g={};return d.defaults&&(g.elemType=0,g.shape=null),i.elemType!=null&&i.hasOwnProperty("elemType")&&(g.elemType=i.elemType),i.shape!=null&&i.hasOwnProperty("shape")&&(g.shape=o.onnx.TensorShapeProto.toObject(i.shape,d)),g},r.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},r}(),t}(),p.OperatorSetIdProto=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:d.domain=e.string();break;case 2:d.version=e.int64();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":e.domain!=null&&e.hasOwnProperty("domain")&&!u.isString(e.domain)?"domain: string expected":e.version!=null&&e.hasOwnProperty("version")&&!(u.isInteger(e.version)||e.version&&u.isInteger(e.version.low)&&u.isInteger(e.version.high))?"version: integer|Long expected":null},t.fromObject=function(e){if(e instanceof o.onnx.OperatorSetIdProto)return e;var r=new o.onnx.OperatorSetIdProto;return e.domain!=null&&(r.domain=String(e.domain)),e.version!=null&&(u.Long?(r.version=u.Long.fromValue(e.version)).unsigned=!1:typeof e.version=="string"?r.version=parseInt(e.version,10):typeof e.version=="number"?r.version=e.version:typeof e.version=="object"&&(r.version=new u.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber())),r},t.toObject=function(e,r){r||(r={});var i={};if(r.defaults)if(i.domain="",u.Long){var d=new u.Long(0,0,!1);i.version=r.longs===String?d.toString():r.longs===Number?d.toNumber():d}else i.version=r.longs===String?"0":0;return e.domain!=null&&e.hasOwnProperty("domain")&&(i.domain=e.domain),e.version!=null&&e.hasOwnProperty("version")&&(typeof e.version=="number"?i.version=r.longs===String?String(e.version):e.version:i.version=r.longs===String?u.Long.prototype.toString.call(e.version):r.longs===Number?new u.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber():e.version),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),p),_.exports=o},2100:(_,n,s)=>{_.exports=s(9482)},9482:(_,n,s)=>{var c=n;function l(){c.util._configure(),c.Writer._configure(c.BufferWriter),c.Reader._configure(c.BufferReader)}c.build="minimal",c.Writer=s(1173),c.BufferWriter=s(3155),c.Reader=s(1408),c.BufferReader=s(593),c.util=s(9693),c.rpc=s(5994),c.roots=s(5054),c.configure=l,l()},1408:(_,n,s)=>{_.exports=f;var c,l=s(9693),p=l.LongBits,a=l.utf8;function h(d,g){return RangeError("index out of range: "+d.pos+" + "+(g||1)+" > "+d.len)}function f(d){this.buf=d,this.pos=0,this.len=d.length}var u,o=typeof Uint8Array<"u"?function(d){if(d instanceof Uint8Array||Array.isArray(d))return new f(d);throw Error("illegal buffer")}:function(d){if(Array.isArray(d))return new f(d);throw Error("illegal buffer")},t=function(){return l.Buffer?function(d){return(f.create=function(g){return l.Buffer.isBuffer(g)?new c(g):o(g)})(d)}:o};function e(){var d=new p(0,0),g=0;if(!(this.len-this.pos>4)){for(;g<3;++g){if(this.pos>=this.len)throw h(this);if(d.lo=(d.lo|(127&this.buf[this.pos])<<7*g)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(127&this.buf[this.pos++])<<7*g)>>>0,d}for(;g<4;++g)if(d.lo=(d.lo|(127&this.buf[this.pos])<<7*g)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(127&this.buf[this.pos])<<28)>>>0,d.hi=(d.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return d;if(g=0,this.len-this.pos>4){for(;g<5;++g)if(d.hi=(d.hi|(127&this.buf[this.pos])<<7*g+3)>>>0,this.buf[this.pos++]<128)return d}else for(;g<5;++g){if(this.pos>=this.len)throw h(this);if(d.hi=(d.hi|(127&this.buf[this.pos])<<7*g+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}function r(d,g){return(d[g-4]|d[g-3]<<8|d[g-2]<<16|d[g-1]<<24)>>>0}function i(){if(this.pos+8>this.len)throw h(this,8);return new p(r(this.buf,this.pos+=4),r(this.buf,this.pos+=4))}f.create=t(),f.prototype._slice=l.Array.prototype.subarray||l.Array.prototype.slice,f.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return u;if((this.pos+=5)>this.len)throw this.pos=this.len,h(this,10);return u}),f.prototype.int32=function(){return 0|this.uint32()},f.prototype.sint32=function(){var d=this.uint32();return d>>>1^-(1&d)|0},f.prototype.bool=function(){return this.uint32()!==0},f.prototype.fixed32=function(){if(this.pos+4>this.len)throw h(this,4);return r(this.buf,this.pos+=4)},f.prototype.sfixed32=function(){if(this.pos+4>this.len)throw h(this,4);return 0|r(this.buf,this.pos+=4)},f.prototype.float=function(){if(this.pos+4>this.len)throw h(this,4);var d=l.float.readFloatLE(this.buf,this.pos);return this.pos+=4,d},f.prototype.double=function(){if(this.pos+8>this.len)throw h(this,4);var d=l.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,d},f.prototype.bytes=function(){var d=this.uint32(),g=this.pos,m=this.pos+d;if(m>this.len)throw h(this,d);return this.pos+=d,Array.isArray(this.buf)?this.buf.slice(g,m):g===m?new this.buf.constructor(0):this._slice.call(this.buf,g,m)},f.prototype.string=function(){var d=this.bytes();return a.read(d,0,d.length)},f.prototype.skip=function(d){if(typeof d=="number"){if(this.pos+d>this.len)throw h(this,d);this.pos+=d}else do if(this.pos>=this.len)throw h(this);while(128&this.buf[this.pos++]);return this},f.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=7&this.uint32())!=4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},f._configure=function(d){c=d,f.create=t(),c._configure();var g=l.Long?"toLong":"toNumber";l.merge(f.prototype,{int64:function(){return e.call(this)[g](!1)},uint64:function(){return e.call(this)[g](!0)},sint64:function(){return e.call(this).zzDecode()[g](!1)},fixed64:function(){return i.call(this)[g](!0)},sfixed64:function(){return i.call(this)[g](!1)}})}},593:(_,n,s)=>{_.exports=p;var c=s(1408);(p.prototype=Object.create(c.prototype)).constructor=p;var l=s(9693);function p(a){c.call(this,a)}p._configure=function(){l.Buffer&&(p.prototype._slice=l.Buffer.prototype.slice)},p.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+a,this.len))},p._configure()},5054:_=>{_.exports={}},5994:(_,n,s)=>{n.Service=s(7948)},7948:(_,n,s)=>{_.exports=l;var c=s(9693);function l(p,a,h){if(typeof p!="function")throw TypeError("rpcImpl must be a function");c.EventEmitter.call(this),this.rpcImpl=p,this.requestDelimited=!!a,this.responseDelimited=!!h}(l.prototype=Object.create(c.EventEmitter.prototype)).constructor=l,l.prototype.rpcCall=function p(a,h,f,u,o){if(!u)throw TypeError("request must be specified");var t=this;if(!o)return c.asPromise(p,t,a,h,f,u);if(t.rpcImpl)try{return t.rpcImpl(a,h[t.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(e,r){if(e)return t.emit("error",e,a),o(e);if(r!==null){if(!(r instanceof f))try{r=f[t.responseDelimited?"decodeDelimited":"decode"](r)}catch(i){return t.emit("error",i,a),o(i)}return t.emit("data",r,a),o(null,r)}t.end(!0)})}catch(e){return t.emit("error",e,a),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},l.prototype.end=function(p){return this.rpcImpl&&(p||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(_,n,s)=>{_.exports=l;var c=s(9693);function l(f,u){this.lo=f>>>0,this.hi=u>>>0}var p=l.zero=new l(0,0);p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1};var a=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=function(f){if(f===0)return p;var u=f<0;u&&(f=-f);var o=f>>>0,t=(f-o)/4294967296>>>0;return u&&(t=~t>>>0,o=~o>>>0,++o>4294967295&&(o=0,++t>4294967295&&(t=0))),new l(o,t)},l.from=function(f){if(typeof f=="number")return l.fromNumber(f);if(c.isString(f)){if(!c.Long)return l.fromNumber(parseInt(f,10));f=c.Long.fromString(f)}return f.low||f.high?new l(f.low>>>0,f.high>>>0):p},l.prototype.toNumber=function(f){if(!f&&this.hi>>>31){var u=1+~this.lo>>>0,o=~this.hi>>>0;return u||(o=o+1>>>0),-(u+4294967296*o)}return this.lo+4294967296*this.hi},l.prototype.toLong=function(f){return c.Long?new c.Long(0|this.lo,0|this.hi,!!f):{low:0|this.lo,high:0|this.hi,unsigned:!!f}};var h=String.prototype.charCodeAt;l.fromHash=function(f){return f===a?p:new l((h.call(f,0)|h.call(f,1)<<8|h.call(f,2)<<16|h.call(f,3)<<24)>>>0,(h.call(f,4)|h.call(f,5)<<8|h.call(f,6)<<16|h.call(f,7)<<24)>>>0)},l.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},l.prototype.zzEncode=function(){var f=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^f)>>>0,this.lo=(this.lo<<1^f)>>>0,this},l.prototype.zzDecode=function(){var f=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^f)>>>0,this.hi=(this.hi>>>1^f)>>>0,this},l.prototype.length=function(){var f=this.lo,u=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?u===0?f<16384?f<128?1:2:f<2097152?3:4:u<16384?u<128?5:6:u<2097152?7:8:o<128?9:10}},9693:function(_,n,s){var c=n;function l(a,h,f){for(var u=Object.keys(h),o=0;o0)},c.Buffer=function(){try{var a=c.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}}(),c._Buffer_from=null,c._Buffer_allocUnsafe=null,c.newBuffer=function(a){return typeof a=="number"?c.Buffer?c._Buffer_allocUnsafe(a):new c.Array(a):c.Buffer?c._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},c.Array=typeof Uint8Array<"u"?Uint8Array:Array,c.Long=c.global.dcodeIO&&c.global.dcodeIO.Long||c.global.Long||c.inquire("long"),c.key2Re=/^true|false|0|1$/,c.key32Re=/^-?(?:0|[1-9][0-9]*)$/,c.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,c.longToHash=function(a){return a?c.LongBits.from(a).toHash():c.LongBits.zeroHash},c.longFromHash=function(a,h){var f=c.LongBits.fromHash(a);return c.Long?c.Long.fromBits(f.lo,f.hi,h):f.toNumber(!!h)},c.merge=l,c.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)},c.newError=p,c.ProtocolError=p("ProtocolError"),c.oneOfGetter=function(a){for(var h={},f=0;f-1;--o)if(h[u[o]]===1&&this[u[o]]!==void 0&&this[u[o]]!==null)return u[o]}},c.oneOfSetter=function(a){return function(h){for(var f=0;f{_.exports=t;var c,l=s(9693),p=l.LongBits,a=l.base64,h=l.utf8;function f(b,y,v){this.fn=b,this.len=y,this.next=void 0,this.val=v}function u(){}function o(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function t(){this.len=0,this.head=new f(u,0,0),this.tail=this.head,this.states=null}var e=function(){return l.Buffer?function(){return(t.create=function(){return new c})()}:function(){return new t}};function r(b,y,v){y[v]=255&b}function i(b,y){this.len=b,this.next=void 0,this.val=y}function d(b,y,v){for(;b.hi;)y[v++]=127&b.lo|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)y[v++]=127&b.lo|128,b.lo=b.lo>>>7;y[v++]=b.lo}function g(b,y,v){y[v]=255&b,y[v+1]=b>>>8&255,y[v+2]=b>>>16&255,y[v+3]=b>>>24}t.create=e(),t.alloc=function(b){return new l.Array(b)},l.Array!==Array&&(t.alloc=l.pool(t.alloc,l.Array.prototype.subarray)),t.prototype._push=function(b,y,v){return this.tail=this.tail.next=new f(b,y,v),this.len+=y,this},i.prototype=Object.create(f.prototype),i.prototype.fn=function(b,y,v){for(;b>127;)y[v++]=127&b|128,b>>>=7;y[v]=b},t.prototype.uint32=function(b){return this.len+=(this.tail=this.tail.next=new i((b>>>=0)<128?1:b<16384?2:b<2097152?3:b<268435456?4:5,b)).len,this},t.prototype.int32=function(b){return b<0?this._push(d,10,p.fromNumber(b)):this.uint32(b)},t.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)},t.prototype.uint64=function(b){var y=p.from(b);return this._push(d,y.length(),y)},t.prototype.int64=t.prototype.uint64,t.prototype.sint64=function(b){var y=p.from(b).zzEncode();return this._push(d,y.length(),y)},t.prototype.bool=function(b){return this._push(r,1,b?1:0)},t.prototype.fixed32=function(b){return this._push(g,4,b>>>0)},t.prototype.sfixed32=t.prototype.fixed32,t.prototype.fixed64=function(b){var y=p.from(b);return this._push(g,4,y.lo)._push(g,4,y.hi)},t.prototype.sfixed64=t.prototype.fixed64,t.prototype.float=function(b){return this._push(l.float.writeFloatLE,4,b)},t.prototype.double=function(b){return this._push(l.float.writeDoubleLE,8,b)};var m=l.Array.prototype.set?function(b,y,v){y.set(b,v)}:function(b,y,v){for(var w=0;w>>0;if(!y)return this._push(r,1,0);if(l.isString(b)){var v=t.alloc(y=a.length(b));a.decode(b,v,0),b=v}return this.uint32(y)._push(m,y,b)},t.prototype.string=function(b){var y=h.length(b);return y?this.uint32(y)._push(h.write,y,b):this._push(r,1,0)},t.prototype.fork=function(){return this.states=new o(this),this.head=this.tail=new f(u,0,0),this.len=0,this},t.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new f(u,0,0),this.len=0),this},t.prototype.ldelim=function(){var b=this.head,y=this.tail,v=this.len;return this.reset().uint32(v),v&&(this.tail.next=b.next,this.tail=y,this.len+=v),this},t.prototype.finish=function(){for(var b=this.head.next,y=this.constructor.alloc(this.len),v=0;b;)b.fn(b.val,y,v),v+=b.len,b=b.next;return y},t._configure=function(b){c=b,t.create=e(),c._configure()}},3155:(_,n,s)=>{_.exports=p;var c=s(1173);(p.prototype=Object.create(c.prototype)).constructor=p;var l=s(9693);function p(){c.call(this)}function a(h,f,u){h.length<40?l.utf8.write(h,f,u):f.utf8Write?f.utf8Write(h,u):f.write(h,u)}p._configure=function(){p.alloc=l._Buffer_allocUnsafe,p.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&l.Buffer.prototype.set.name==="set"?function(h,f,u){f.set(h,u)}:function(h,f,u){if(h.copy)h.copy(f,u,0,h.length);else for(var o=0;o>>0;return this.uint32(f),f&&this._push(p.writeBytesBuffer,f,h),this},p.prototype.string=function(h){var f=l.Buffer.byteLength(h);return this.uint32(f),f&&this._push(a,f,h),this},p._configure()},7714:(_,n,s)=>{n.R=void 0;const c=s(6919),l=s(7448);n.R=new class{async init(){}async createSessionHandler(p,a){const h=new c.Session(a);return await h.loadModel(p),new l.OnnxjsSessionHandler(h)}}},4200:(_,n,s)=>{n.c8=n.rX=void 0;const c=s(1670),l=s(5381),p=s(2157),a=s(2306);n.rX=()=>{if((typeof c.env.wasm.initTimeout!="number"||c.env.wasm.initTimeout<0)&&(c.env.wasm.initTimeout=0),typeof c.env.wasm.simd!="boolean"&&(c.env.wasm.simd=!0),typeof c.env.wasm.proxy!="boolean"&&(c.env.wasm.proxy=!1),typeof c.env.wasm.numThreads!="number"||!Number.isInteger(c.env.wasm.numThreads)||c.env.wasm.numThreads<=0){const h=typeof navigator>"u"?(0,l.cpus)().length:navigator.hardwareConcurrency;c.env.wasm.numThreads=Math.min(4,Math.ceil((h||1)/2))}},n.c8=new class{async init(){(0,n.rX)(),await(0,p.initWasm)()}async createSessionHandler(h,f){const u=new a.OnnxruntimeWebAssemblySessionHandler;return await u.loadModel(h,f),Promise.resolve(u)}}},6018:function(_,n,s){var c=this&&this.__createBinding||(Object.create?function(a,h,f,u){u===void 0&&(u=f);var o=Object.getOwnPropertyDescriptor(h,f);o&&!("get"in o?!h.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return h[f]}}),Object.defineProperty(a,u,o)}:function(a,h,f,u){u===void 0&&(u=f),a[u]=h[f]}),l=this&&this.__exportStar||function(a,h){for(var f in a)f==="default"||Object.prototype.hasOwnProperty.call(h,f)||c(h,a,f)};Object.defineProperty(n,"__esModule",{value:!0}),l(s(1670),n);const p=s(1670);{const a=s(7714).R;(0,p.registerBackend)("webgl",a,-10)}{const a=s(4200).c8;(0,p.registerBackend)("cpu",a,10),(0,p.registerBackend)("wasm",a,10),(0,p.registerBackend)("xnnpack",a,9)}},246:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createAttributeWithCacheKey=void 0;class s{constructor(l){Object.assign(this,l)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(l=>`${this[l]}`).join(";")),this._cacheKey}}n.createAttributeWithCacheKey=c=>new s(c)},7778:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Attribute=void 0;const c=s(1446),l=s(9395),p=s(9162),a=s(2517);var h=l.onnxruntime.experimental.fbs;class f{constructor(o){if(this._attributes=new Map,o!=null){for(const t of o)t instanceof c.onnx.AttributeProto?this._attributes.set(t.name,[f.getValue(t),f.getType(t)]):t instanceof h.Attribute&&this._attributes.set(t.name(),[f.getValue(t),f.getType(t)]);if(this._attributes.sizep.Tensor.fromProto(r));if(o instanceof h.Attribute)return e.map(r=>p.Tensor.fromOrtTensor(r))}if(t===c.onnx.AttributeProto.AttributeType.STRING&&o instanceof c.onnx.AttributeProto){const r=e;return(0,a.decodeUtf8String)(r)}return t===c.onnx.AttributeProto.AttributeType.STRINGS&&o instanceof c.onnx.AttributeProto?e.map(a.decodeUtf8String):e}static getValueNoCheck(o){return o instanceof c.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(o):this.getValueNoCheckFromOrtFormat(o)}static getValueNoCheckFromOnnxFormat(o){switch(o.type){case c.onnx.AttributeProto.AttributeType.FLOAT:return o.f;case c.onnx.AttributeProto.AttributeType.INT:return o.i;case c.onnx.AttributeProto.AttributeType.STRING:return o.s;case c.onnx.AttributeProto.AttributeType.TENSOR:return o.t;case c.onnx.AttributeProto.AttributeType.GRAPH:return o.g;case c.onnx.AttributeProto.AttributeType.FLOATS:return o.floats;case c.onnx.AttributeProto.AttributeType.INTS:return o.ints;case c.onnx.AttributeProto.AttributeType.STRINGS:return o.strings;case c.onnx.AttributeProto.AttributeType.TENSORS:return o.tensors;case c.onnx.AttributeProto.AttributeType.GRAPHS:return o.graphs;default:throw new Error(`unsupported attribute type: ${c.onnx.AttributeProto.AttributeType[o.type]}`)}}static getValueNoCheckFromOrtFormat(o){switch(o.type()){case h.AttributeType.FLOAT:return o.f();case h.AttributeType.INT:return o.i();case h.AttributeType.STRING:return o.s();case h.AttributeType.TENSOR:return o.t();case h.AttributeType.GRAPH:return o.g();case h.AttributeType.FLOATS:return o.floatsArray();case h.AttributeType.INTS:{const t=[];for(let e=0;e{Object.defineProperty(n,"__esModule",{value:!0}),n.resolveBackend=n.backend=void 0;const c=s(5038),l=new Map;async function p(a){const h=n.backend;if(h[a]!==void 0&&function(f){const u=f;return"initialize"in u&&typeof u.initialize=="function"&&"createSessionHandler"in u&&typeof u.createSessionHandler=="function"&&"dispose"in u&&typeof u.dispose=="function"}(h[a])){const f=h[a];let u=f.initialize();if(typeof u=="object"&&"then"in u&&(u=await u),u)return l.set(a,f),f}}n.backend={webgl:new c.WebGLBackend},n.resolveBackend=async function a(h){if(!h)return a(["webgl"]);{const f=typeof h=="string"?[h]:h;for(const u of f){const o=l.get(u);if(o)return o;const t=await p(u);if(t)return t}}throw new Error("no available backend to use")}},5038:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLBackend=void 0;const c=s(1670),l=s(6231),p=s(6416),a=s(7305);n.WebGLBackend=class{get contextId(){return c.env.webgl.contextId}set contextId(h){c.env.webgl.contextId=h}get matmulMaxBatchSize(){return c.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(h){c.env.webgl.matmulMaxBatchSize=h}get textureCacheMode(){return c.env.webgl.textureCacheMode}set textureCacheMode(h){c.env.webgl.textureCacheMode=h}get pack(){return c.env.webgl.pack}set pack(h){c.env.webgl.pack=h}get async(){return c.env.webgl.async}set async(h){c.env.webgl.async=h}initialize(){try{return this.glContext=(0,a.createWebGLContext)(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),l.Logger.setWithEnv(c.env),l.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(h){return l.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${h}`),!1}}createSessionHandler(h){return new p.WebGLSessionHandler(this,h)}dispose(){this.glContext.dispose()}}},5107:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoordsGlslLib=void 0;const c=s(2517),l=s(8520),p=s(5060),a=s(7859),h=s(9390);class f extends l.GlslLib{constructor(o){super(o)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new l.GlslLibRoutine(` + vec2 offsetToCoords(int offset, int width, int height) { + int t = offset / width; + int s = offset - t*width; + vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); + return coords; + } + `)}}coordsToOffset(){return{coordsToOffset:new l.GlslLibRoutine(` + int coordsToOffset(vec2 coords, int width, int height) { + float s = coords.s * float(width); + float t = coords.t * float(height); + int offset = int(t) * width + int(s); + return offset; + } + `)}}getOutputSamplingSnippet(){const o=this.context.outputTextureLayout;return o.isPacked?this.getPackedOutputSamplingSnippet(o):this.getUnpackedOutputSamplingSnippet(o)}getPackedOutputSamplingSnippet(o){const t=o.unpackedShape,e=[o.width,o.height],r={},i="getOutputCoords";switch(t.length){case 0:r[i]=this.getOutputScalarCoords();break;case 1:r[i]=this.getOutputPacked1DCoords(t,e);break;case 2:r[i]=this.getOutputPacked2DCoords(t,e);break;case 3:r[i]=this.getOutputPacked3DCoords(t,e);break;default:r[i]=this.getOutputPackedNDCoords(t,e)}const d=` + void setOutput(vec4 val) { + ${(0,p.getGlsl)(this.context.glContext.version).output} = val; + } + `;return r.floatTextureSetRGBA=new l.GlslLibRoutine(d),r}getUnpackedOutputSamplingSnippet(o){const t=o.unpackedShape,e=[o.width,o.height],r={},i="getOutputCoords";switch(t.length){case 0:r[i]=this.getOutputScalarCoords();break;case 1:r[i]=this.getOutputUnpacked1DCoords(t,e);break;case 2:r[i]=this.getOutputUnpacked2DCoords(t,e);break;case 3:r[i]=this.getOutputUnpacked3DCoords(t,e);break;case 4:r[i]=this.getOutputUnpacked4DCoords(t,e);break;case 5:r[i]=this.getOutputUnpacked5DCoords(t,e);break;case 6:r[i]=this.getOutputUnpacked6DCoords(t,e);break;default:throw new Error(`Unsupported output dimensionality: ${t.length}`)}const d=` + void setOutput(float val) { + ${(0,p.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); + } + `;return r.floatTextureSetR=new l.GlslLibRoutine(d),r}getOutputScalarCoords(){return new l.GlslLibRoutine(` + int getOutputCoords() { + return 0; + } + `)}getOutputPacked1DCoords(o,t){const e=t;let r="";return e[0]===1?(r=` + int getOutputCoords() { + return 2 * int(TexCoords.y * ${e[1]}.0); + } + `,new l.GlslLibRoutine(r)):e[1]===1?(r=` + int getOutputCoords() { + return 2 * int(TexCoords.x * ${e[0]}.0); + } + `,new l.GlslLibRoutine(r)):(r=` + int getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + return 2 * (resTexRC.y * ${e[0]} + resTexRC.x); + } + `,new l.GlslLibRoutine(r))}getOutputPacked2DCoords(o,t){let e="";if(c.ArrayUtil.arraysEqual(o,t))return e=` + ivec2 getOutputCoords() { + return 2 * ivec2(TexCoords.xy * vec2(${t[0]}, ${t[1]})); + } + `,new l.GlslLibRoutine(e);const r=t,i=Math.ceil(o[1]/2);return e=` + ivec2 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${r[0]}, ${r[1]})); + + int index = resTexRC.y * ${r[0]} + resTexRC.x; + + // reverse r and c order for packed texture + int r = imod(index, ${i}) * 2; + int c = 2 * (index / ${i}); + + return ivec2(r, c); + } + `,new l.GlslLibRoutine(e)}getOutputPacked3DCoords(o,t){const e=[t[0],t[1]],r=Math.ceil(o[2]/2),i=r*Math.ceil(o[1]/2),d=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + int index = resTexRC.y * ${e[0]} + resTexRC.x; + + int b = index / ${i}; + index -= b * ${i}; + + // reverse r and c order for packed texture + int r = imod(index, ${r}) * 2; + int c = 2 * (index / ${r}); + + return ivec3(b, r, c); + } + `;return new l.GlslLibRoutine(d)}getOutputPackedNDCoords(o,t){const e=[t[0],t[1]],r=Math.ceil(o[o.length-1]/2),i=r*Math.ceil(o[o.length-2]/2);let d=i,g="",m="b, r, c";for(let y=2;y=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d"],g=i.map((m,b)=>`int ${d[b]} = index / ${m}; ${b===i.length-1?`int ${d[b+1]} = index - ${d[b]} * ${m}`:`index -= ${d[b]} * ${m}`};`).join("");return e=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + int index = resTexRC.y * ${t[0]} + resTexRC.x; + ${g} + return ivec3(r, c, d); + } + `,new l.GlslLibRoutine(e)}getOutputUnpacked4DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2"],g=i.map((m,b)=>`int ${d[b]} = index / ${m}; ${b===i.length-1?`int ${d[b+1]} = index - ${d[b]} * ${m}`:`index -= ${d[b]} * ${m}`};`).join("");return e=` + ivec4 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + int index = resTexRC.y * ${t[0]} + resTexRC.x; + ${g} + return ivec4(r, c, d, d2); + } + `,new l.GlslLibRoutine(e)}getOutputUnpacked5DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2","d3"],g=i.map((m,b)=>`int ${d[b]} = index / ${m}; ${b===i.length-1?`int ${d[b+1]} = index - ${d[b]} * ${m}`:`index -= ${d[b]} * ${m}`};`).join("");return e=` + ivec5 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + int index = resTexRC.y * ${t[0]} + resTexRC.x; + ${g} + return ivec5(r, c, d, d2, d3); + } + `,new l.GlslLibRoutine(e)}getOutputUnpacked6DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2","d3","d4"],g=i.map((m,b)=>`int ${d[b]} = index / ${m}; ${b===i.length-1?`int ${d[b+1]} = index - ${d[b]} * ${m}`:`index -= ${d[b]} * ${m}`};`).join("");return e=` + ivec6 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + int index = resTexRC.y * ${t[0]} + resTexRC.x; + ${g} + return ivec6(r, c, d, d2, d3, d4); + } + `,new l.GlslLibRoutine(e)}getCommonUtilFuncs(){const o={};let t="uvFromFlat";o[t]=new l.GlslLibRoutine(` + vec2 uvFromFlat(int texNumR, int texNumC, int index) { + int texC = index / texNumR; + int texR = index - texC * texNumR; + // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to + // v. + return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); + } + `),t="packedUVfrom1D",o[t]=new l.GlslLibRoutine(` + vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { + int texelIndex = index / 2; + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),t="packedUVfrom2D",o[t]=new l.GlslLibRoutine(` + vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { + int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),t="packedUVfrom3D",o[t]=new l.GlslLibRoutine(` + vec2 packedUVfrom3D(int texNumR, int texNumC, + int texelsInBatch, int texelsInLogicalRow, int b, + int row, int col) { + int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); + int texR = index / texNumC; + int texC = index - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),t="sampleTexture";const e=(0,p.getGlsl)(this.context.glContext.version);return o[t]=new l.GlslLibRoutine(` + float sampleTexture(sampler2D textureSampler, vec2 uv) { + return ${e.texture2D}(textureSampler, uv).r; + }`),o}getInputsSamplingSnippets(){const o={},t=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((e,r)=>{const i=this.context.inputTextureLayouts[r],d=(0,h.generateShaderFuncNameFromInputSamplerName)(e);i.isPacked?o[d]=this.getPackedSamplerFromInput(d,e,i):o[d]=this.getUnpackedSamplerFromInput(d,e,i);const g=(0,h.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(e);i.unpackedShape.length<=t.unpackedShape.length&&(i.isPacked?o[g]=this.getPackedSamplerAtOutputCoords(g,i,t,e):o[g]=this.getUnpackedSamplerAtOutputCoords(g,i,t,e))}),o}getPackedSamplerAtOutputCoords(o,t,e,r){const i=t.unpackedShape,d=e.unpackedShape,g=r,m=(0,h.generateShaderFuncNameFromInputSamplerName)(g),b=i.length,y=d.length,v=c.BroadcastUtil.getBroadcastDims(i,d),w=(0,h.getCoordsDataType)(y),S=y-b;let A;const O=(0,h.getGlChannels)();A=b===0?"":y<2&&v.length>=1?"coords = 0;":v.map(N=>`coords.${O[N+S]} = 0;`).join(` +`);let x="";x=y<2&&b>0?"coords":i.map((N,H)=>`coords.${O[H+S]}`).join(", ");let I="return outputValue;";const $=c.ShapeUtil.size(i)===1,z=c.ShapeUtil.size(d)===1;if(b!==1||$||z){if($&&!z)I=y===1?` + return vec4(outputValue.x, outputValue.x, 0., 0.); + `:` + return vec4(outputValue.x); + `;else if(v.length){const N=b-2,H=b-1;v.indexOf(N)>-1&&v.indexOf(H)>-1?I="return vec4(outputValue.x);":v.indexOf(N)>-1?I="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":v.indexOf(H)>-1&&(I="return vec4(outputValue.xx, outputValue.zz);")}}else I=` + return vec4(outputValue.xy, outputValue.xy); + `;const L=` + vec4 ${o}() { + ${w} coords = getOutputCoords(); + + int lastDim = coords.${O[y-1]}; + coords.${O[y-1]} = coords.${O[y-2]}; + coords.${O[y-2]} = lastDim; + + ${A} + vec4 outputValue = ${m}(${x}); + ${I} + } + `;return new l.GlslLibRoutine(L,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(o,t,e,r){const i=[e.width,e.height],d=[t.width,t.height],g=t.unpackedShape.length,m=e.unpackedShape.length,b=t.unpackedShape,y=e.unpackedShape,v=(0,h.generateShaderFuncNameFromInputSamplerName)(r);if(g===m&&c.ArrayUtil.arraysEqual(d,i)){const z=` + float ${o}() { + return sampleTexture(${r}, TexCoords); + } + `;return new l.GlslLibRoutine(z,["coordinates.sampleTexture"])}const w=(0,h.getCoordsDataType)(m),S=c.BroadcastUtil.getBroadcastDims(b,y),A=m-g;let O;const x=(0,h.getGlChannels)();O=g===0?"":m<2&&S.length>=1?"coords = 0;":S.map(z=>`coords.${x[z+A]} = 0;`).join(` +`);let I="";I=m<2&&g>0?"coords":t.unpackedShape.map((z,L)=>`coords.${x[L+A]}`).join(", ");const $=` + float ${o}() { + ${w} coords = getOutputCoords(); + ${O} + return ${v}(${I}); + } + `;return new l.GlslLibRoutine($,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(o,t,e){switch(e.unpackedShape.length){case 0:return this.getPackedSamplerScalar(o,t);case 1:return this.getPackedSampler1D(o,t,e);case 2:return this.getPackedSampler2D(o,t,e);case 3:return this.getPackedSampler3D(o,t,e);default:return this.getPackedSamplerND(o,t,e)}}getUnpackedSamplerFromInput(o,t,e){const r=e.unpackedShape;switch(r.length){case 0:return this.getUnpackedSamplerScalar(o,t,e);case 1:return this.getUnpackedSampler1D(o,t,e);case 2:return this.getUnpackedSampler2D(o,t,e);case 3:return this.getUnpackedSampler3D(o,t,e);case 4:return this.getUnpackedSampler4D(o,t,e);case 5:return this.getUnpackedSampler5D(o,t,e);case 6:return this.getUnpackedSampler6D(o,t,e);default:throw new Error(`Unsupported dimension ${r.length}-D`)}}getPackedSamplerScalar(o,t){const e=` + vec4 ${o}() { + return ${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${t}, halfCR); + } + `;return new l.GlslLibRoutine(e)}getPackedSampler1D(o,t,e){const r=[e.width,e.height],i=[r[1],r[0]],d=(0,p.getGlsl)(this.context.glContext.version),g=`vec4 ${o}(int index) { + vec2 uv = packedUVfrom1D( + ${i[0]}, ${i[1]}, index); + return ${d.texture2D}(${t}, uv); + }`;return new l.GlslLibRoutine(g,["coordinates.packedUVfrom1D"])}getPackedSampler2D(o,t,e){const r=e.unpackedShape,i=[e.width,e.height],d=(0,p.getGlsl)(this.context.glContext.version),g=i[0],m=i[1];if(i!=null&&c.ArrayUtil.arraysEqual(r,i)){const w=`vec4 ${o}(int row, int col) { + vec2 uv = (vec2(col, row) + halfCR) / vec2(${m}.0, ${g}.0); + return ${d.texture2D}(${t}, uv); + }`;return new l.GlslLibRoutine(w)}const b=i,y=Math.ceil(r[1]/2),v=`vec4 ${o}(int row, int col) { + vec2 uv = packedUVfrom2D(${b[1]}, ${b[0]}, ${y}, row, col); + return ${d.texture2D}(${t}, uv); + }`;return new l.GlslLibRoutine(v,["coordinates.packedUVfrom2D"])}getPackedSampler3D(o,t,e){const r=e.unpackedShape,i=[e.width,e.height],d=[i[0],i[1]],g=(0,p.getGlsl)(this.context.glContext.version);if(r[0]===1){const w=r.slice(1),S=[1,2],A=(0,h.squeezeInputShape)(r,w),O=["b","row","col"],x=JSON.parse(JSON.stringify(e));x.unpackedShape=A;const I=this.getPackedSamplerFromInput(o,t,x),$=`${I.routineBody} + vec4 ${o}(int b, int row, int col) { + return ${o}(${(0,h.getSqueezedParams)(O,S)}); + } `;return new l.GlslLibRoutine($,I.dependencies)}const m=d[0],b=d[1],y=Math.ceil(r[2]/2),v=`vec4 ${o}(int b, int row, int col) { + vec2 uv = packedUVfrom3D( + ${b}, ${m}, ${y*Math.ceil(r[1]/2)}, ${y}, b, row, col); + return ${g.texture2D}(${t}, uv);}`;return new l.GlslLibRoutine(v,["coordinates.packedUVfrom3D"])}getPackedSamplerND(o,t,e){const r=e.unpackedShape,i=r.length,d=[e.width,e.height],g=(0,p.getGlsl)(this.context.glContext.version),m=[d[0],d[1]],b=m[1],y=m[0],v=Math.ceil(r[i-1]/2);let w=v*Math.ceil(r[i-2]/2),S="int b, int row, int col",A=`b * ${w} + (row / 2) * ${v} + (col / 2)`;for(let x=2;x{const r=this.context.inputTextureLayouts[e],i=(r.unpackedShape.length>0?r.unpackedShape:r.shape).length;let d=`_${t}`;o[d]=new l.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!1),[`shapeUtils.indicesToOffset${d}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),d+="_T",o[d]=new l.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!0),[`shapeUtils.indicesToOffset${d}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),o}getValueFromSingle(o,t,e,r,i){let d=`_${o}`;return i&&(d+="_T"),` + float ${d}(int m[${t}]) { + int offset = indicesToOffset${d}(m); + vec2 coords = offsetToCoords(offset, ${e}, ${r}); + float value = getColorAsFloat(${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords)); + return value; + } + `}getPackedValueFrom(o,t,e,r,i){let d=`_${o}_Pack`;return i&&(d+="_T"),` + vec4 ${d}(int m[${t}]) { + int offset = indicesToOffset_${o}(m); + vec2 coords = offsetToCoords(offset, ${e}, ${r}); + return ${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords); + } + `}}n.CoordsGlslLib=f},8520:(_,n)=>{var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TopologicalSortGlslRoutines=n.GlslLibRoutineNode=n.GlslLibRoutine=n.GlslLib=n.GlslContext=n.FunctionType=void 0,(s=n.FunctionType||(n.FunctionType={}))[s.ValueBased=0]="ValueBased",s[s.Positional=1]="Positional",n.GlslContext=class{constructor(c,l,p,a){this.glContext=c,this.programInfo=l,this.inputTextureLayouts=p,this.outputTextureLayout=a}},n.GlslLib=class{constructor(c){this.context=c}},n.GlslLibRoutine=class{constructor(c,l){this.routineBody=c,this.dependencies=l}},n.GlslLibRoutineNode=class{constructor(c,l,p){this.name=c,this.dependencies=p||[],l&&(this.routineBody=l)}addDependency(c){c&&this.dependencies.push(c)}},n.TopologicalSortGlslRoutines=class{static returnOrderedNodes(c){if(!c||c.length===0)return[];if(c.length===1)return c;const l=new Set,p=new Set,a=new Array;return this.createOrderedNodes(c,l,p,a),a}static createOrderedNodes(c,l,p,a){for(let h=0;h0)for(let f=0;f{Object.defineProperty(n,"__esModule",{value:!0}),n.EncodingGlslLib=void 0;const c=s(8520);class l extends c.GlslLib{constructor(a){super(a)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new c.GlslLibRoutine(`highp vec4 encode(highp float f) { + return vec4(f, 0.0, 0.0, 0.0); + } + `)}}decodeFloat32(){return{decode:new c.GlslLibRoutine(`highp float decode(highp vec4 rgba) { + return rgba.r; + } + `)}}encodeUint8(){const a=l.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new c.GlslLibRoutine(` + highp vec4 encode(highp float f) { + highp float F = abs(f); + highp float Sign = step(0.0,-f); + highp float Exponent = floor(log2(F)); + highp float Mantissa = (exp2(- Exponent) * F); + Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); + highp vec4 rgba; + rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); + rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); + rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); + rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); + ${a} + rgba = rgba / 255.0; // values need to be normalized to [0,1] + return rgba; + } + `)}}decodeUint8(){const a=l.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new c.GlslLibRoutine(` + highp float decode(highp vec4 rgba) { + rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] + ${a} + highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; + highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; + highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); + highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); + return Result; + } + `)}}static isLittleEndian(){const a=new ArrayBuffer(4),h=new Uint32Array(a),f=new Uint8Array(a);if(h[0]=3735928559,f[0]===239)return!0;if(f[0]===222)return!1;throw new Error("unknown endianness")}}n.EncodingGlslLib=l},9894:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FragColorGlslLib=void 0;const c=s(8520),l=s(5060);class p extends c.GlslLib{constructor(h){super(h)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const h=(0,l.getGlsl)(this.context.glContext.version);return{setFragColor:new c.GlslLibRoutine(` + void setFragColor(float value) { + ${h.output} = encode(value); + } + `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new c.GlslLibRoutine(` + float getColorAsFloat(vec4 color) { + return decode(color); + } + `,["encoding.decode"])}}}n.FragColorGlslLib=p},2848:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.replaceInlines=void 0;const s=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;n.replaceInlines=function(c){const l={};let p;for(;(p=s.exec(c))!==null;){const a=p[3].split(",").map(h=>{const f=h.trim().split(" ");return f&&f.length===2?{type:f[0],name:f[1]}:null}).filter(h=>h!==null);l[p[2]]={params:a,body:p[4]}}for(const a in l){const h="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",a),f=new RegExp(h,"gm");for(;(p=f.exec(c))!==null;){const u=p[1],o=p[2],t=p[3].split(","),e=u?`${u} ${o};`:"";let r=l[a].body,i="";l[a].params.forEach((g,m)=>{g&&(i+=`${g.type} ${g.name} = ${t[m]}; +`)}),r=`${i} + ${r}`,r=r.replace("return",`${o} = `);const d=` + ${e} + { + ${r} + } + `;c=c.replace(p[0],d)}}return c.replace(s,"")}},8879:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GlslPreprocessor=void 0;const c=s(8520),l=s(2848),p=s(5483),a=s(5060);n.GlslPreprocessor=class{constructor(h,f,u,o){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new c.GlslContext(h,f,u,o),Object.keys(p.glslRegistry).forEach(e=>{const r=new p.glslRegistry[e](this.context);this.libs[e]=r});const t=this.glslLibRoutineDependencyGraph;for(const e in this.libs){const r=this.libs[e].getFunctions();for(const i in r){const d=e+"."+i;let g;t[d]?(g=t[d],g.routineBody=r[i].routineBody):(g=new c.GlslLibRoutineNode(d,r[i].routineBody),t[d]=g);const m=r[i].dependencies;if(m)for(let b=0;b{const o=u.split(".")[1];h.indexOf(o)!==-1&&f.push(this.glslLibRoutineDependencyGraph[u])}),c.TopologicalSortGlslRoutines.returnOrderedNodes(f)}getUniforms(h,f){const u=[];if(h)for(const o of h)u.push(`uniform sampler2D ${o};`);if(f)for(const o of f)u.push(`uniform ${o.type} ${o.name}${o.arrayLength?`[${o.arrayLength}]`:""};`);return u.join(` +`)}}},5483:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.glslRegistry=void 0;const c=s(5107),l=s(7341),p=s(9894),a=s(2655),h=s(3891);n.glslRegistry={encoding:l.EncodingGlslLib,fragcolor:p.FragColorGlslLib,vec:h.VecGlslLib,shapeUtils:a.ShapeUtilsGlslLib,coordinates:c.CoordsGlslLib}},2655:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ShapeUtilsGlslLib=void 0;const c=s(8520);class l extends c.GlslLib{constructor(a){super(a)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const a=this.context.outputTextureLayout.shape.length,h={};return this.context.programInfo.inputNames.forEach((f,u)=>{const o=this.context.inputTextureLayouts[u].unpackedShape;if(o.length<=a){const t=o.length,e=a-t,r=`bcastIndices_${f}`;let i="";for(let g=0;g{const o=this.context.inputTextureLayouts[u].shape;if(!(o.length<2||o.length>a)){const t=o.length,e=a-t,r=`bcastMatmulIndices_${f}`;let i="";for(let g=0;g{const u=this.context.inputTextureLayouts[f].shape,o=this.context.inputTextureLayouts[f].strides,t=u.length;let e=`indicesToOffset_${h}`;a[e]=new c.GlslLibRoutine(l.indexToOffsetSingle(e,t,o)),e=`indicesToOffset_${h}_T`,a[e]=new c.GlslLibRoutine(l.indexToOffsetSingle(e,t,o.slice().reverse()))}),a}static indexToOffsetSingle(a,h,f){let u="";for(let o=h-1;o>=0;--o)u+=` + offset += indices[${o}] * ${f[o]}; + `;return` + int ${a}(int indices[${h}]) { + int offset = 0; + ${u} + return offset; + } + `}offsetToIndices(){const a={};return this.context.programInfo.inputNames.forEach((h,f)=>{const u=this.context.inputTextureLayouts[f].shape,o=this.context.inputTextureLayouts[f].strides,t=u.length;let e=`offsetToIndices_${h}`;a[e]=new c.GlslLibRoutine(l.offsetToIndicesSingle(e,t,o)),e=`offsetToIndices_${h}_T`,a[e]=new c.GlslLibRoutine(l.offsetToIndicesSingle(e,t,o.slice().reverse()))}),a}static offsetToIndicesSingle(a,h,f){const u=[];for(let o=0;o{const u=this.context.inputTextureLayouts[f].shape,o=u.length,t=`incrementIndices_${h}`;let e="";for(let i=0;i= 0; --i) { + if(i > axis) continue; + indices[i] += 1; + if(indices[i] < shape[i]) { + break; + } + indices[i] = 0; + } + } + `;a[t]=new c.GlslLibRoutine(r)}),a}}n.ShapeUtilsGlslLib=l},5060:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultFragShaderMain=n.getFragShaderPreamble=n.getVertexShaderSource=n.getGlsl=void 0;const s={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},c={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function l(p){return p===1?s:c}n.getGlsl=l,n.getVertexShaderSource=function(p){const a=l(p);return`${a.version} + precision highp float; + ${a.attribute} vec3 position; + ${a.attribute} vec2 textureCoord; + + ${a.varyingVertex} vec2 TexCoords; + + void main() + { + gl_Position = vec4(position, 1.0); + TexCoords = textureCoord; + }`},n.getFragShaderPreamble=function(p){const a=l(p);return`${a.version} + precision highp float; + precision highp int; + precision highp sampler2D; + ${a.varyingFrag} vec2 TexCoords; + ${a.outputDeclaration} + const vec2 halfCR = vec2(0.5, 0.5); + + // Custom vector types to handle higher dimenalities. + struct ivec5 + { + int x; + int y; + int z; + int w; + int u; + }; + + struct ivec6 + { + int x; + int y; + int z; + int w; + int u; + int v; + }; + + int imod(int x, int y) { + return x - y * (x / y); + } + + `},n.getDefaultFragShaderMain=function(p,a){return` + void main() { + int indices[${a}]; + toVec(TexCoords, indices); + vec4 result = vec4(process(indices)); + ${l(p).output} = result; + } + `}},3891:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VecGlslLib=void 0;const c=s(8520);class l extends c.GlslLib{constructor(a){super(a)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const a=this.context.outputTextureLayout.shape.length,h={add:"+=",sub:"-=",mul:"*=",div:"/="},f={};for(const u in h){const o=`${u}Vec`;let t="";for(let r=0;r{Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLInferenceHandler=void 0;const c=s(6231),l=s(9162),p=s(2517),a=s(2403),h=s(7019),f=s(8710),u=s(5611),o=s(4057),t=s(2039);n.WebGLInferenceHandler=class{constructor(e){this.session=e,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(e,r){return(0,o.calculateTextureWidthAndHeight)(this.session.layoutStrategy,e,r)}executeProgram(e,r){if(r.length{const S=w.map(O=>`${O.unpackedShape.join(",")};${O.width}x${O.height}`).join("_");let A=v.name;return v.cacheHint&&(A+="["+v.cacheHint+"]"),A+=":"+S,A})(e,i);let g=this.session.programManager.getArtifact(d);const m=g?g.programInfo:typeof e.get=="function"?e.get():e,b=(0,o.createTextureLayoutFromTextureType)(this.session.layoutStrategy,m.output.dims,m.output.textureType),y=this.createTextureData(b,m.output.type);return g||(g=this.session.programManager.build(m,i,y),this.session.programManager.setArtifact(d,g)),this.runProgram(g,i,y),y}run(e,r){return this.executeProgram(e,r).tensor}runProgram(e,r,i){for(let d=0;dthis.readTexture(m),async b=>this.readTextureAsync(m),void 0,g),texture:i});return this.setTextureData(m.tensor.dataId,m,e.isPacked),m}getTextureData(e,r=!1){return this.session.isInitializer(e)?this.session.getTextureData(e,r):r?this.packedTextureDataCache.get(e):this.unpackedTextureDataCache.get(e)}setTextureData(e,r,i=!1){this.session.isInitializer(e)?this.session.setTextureData(e,r,i):(i?this.packedTextureDataCache:this.unpackedTextureDataCache).set(e,r)}isTextureLayoutCached(e,r=!1){return!!this.getTextureData(e.dataId,r)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(e=>this.session.textureManager.releaseTexture(e)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(e=>this.session.textureManager.releaseTexture(e)),this.unpackedTextureDataCache=new Map}readTexture(e){return e.isPacked?this.readTexture(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,f.encodeAsUint8)(this,e))}async readTextureAsync(e){return e.isPacked?this.readTextureAsync(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,f.encodeAsUint8)(this,e))}pack(e){return this.executeProgram((0,a.createPackProgramInfoLoader)(this,e.tensor),[e.tensor])}unpack(e){return this.executeProgram((0,u.createUnpackProgramInfoLoader)(this,e.tensor),[e.tensor])}}},1640:function(_,n,s){var c=this&&this.__createBinding||(Object.create?function(X,Q,ee,ue){ue===void 0&&(ue=ee);var Ae=Object.getOwnPropertyDescriptor(Q,ee);Ae&&!("get"in Ae?!Q.__esModule:Ae.writable||Ae.configurable)||(Ae={enumerable:!0,get:function(){return Q[ee]}}),Object.defineProperty(X,ue,Ae)}:function(X,Q,ee,ue){ue===void 0&&(ue=ee),X[ue]=Q[ee]}),l=this&&this.__setModuleDefault||(Object.create?function(X,Q){Object.defineProperty(X,"default",{enumerable:!0,value:Q})}:function(X,Q){X.default=Q}),p=this&&this.__importStar||function(X){if(X&&X.__esModule)return X;var Q={};if(X!=null)for(var ee in X)ee!=="default"&&Object.prototype.hasOwnProperty.call(X,ee)&&c(Q,X,ee);return l(Q,X),Q};Object.defineProperty(n,"__esModule",{value:!0}),n.WEBGL_OP_RESOLVE_RULES=void 0;const a=s(2898),h=p(s(7839)),f=s(4196),u=s(2069),o=s(8138),t=s(9663),e=s(5193),r=s(7992),i=s(1253),d=s(4776),g=s(6572),m=s(3346),b=s(5623),y=s(2870),v=s(2143),w=s(4939),S=s(718),A=s(2268),O=s(8117),x=s(2278),I=s(5524),$=s(5975),z=s(3933),L=s(6558),N=s(5723),H=s(3738),M=p(s(4909)),j=s(8428),Z=s(9793);n.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",M.abs],["Acos","","7+",M.acos],["Add","","7+",h.add],["And","","7+",h.and],["Asin","","7+",M.asin],["Atan","","7+",M.atan],["AveragePool","","7+",v.averagePool,v.parseAveragePoolAttributes],["BatchNormalization","","7+",a.batchNormalization,a.parseBatchNormalizationAttributes],["Cast","","6+",f.cast,f.parseCastAttributes],["Ceil","","6+",M.ceil],["Clip","","6-10",M.clip,M.parseClipAttributes],["Clip","","11+",M.clipV11],["Concat","","4+",u.concat,u.parseConcatAttributes],["Conv","","1+",o.conv,o.parseConvAttributes],["ConvTranspose","","1+",t.convTranspose,t.parseConvTransposeAttributes],["Cos","","7+",M.cos],["Div","","7+",h.div],["Dropout","","7+",M.identity],["DepthToSpace","","1+",e.depthToSpace,e.parseDepthToSpaceAttributes],["Equal","","7+",h.equal],["Elu","","6+",M.elu,M.parseEluAttributes],["Exp","","6+",M.exp],["Flatten","","1+",r.flatten,r.parseFlattenAttributes],["Floor","","6+",M.floor],["FusedConv","com.microsoft","1+",o.conv,o.parseConvAttributes],["Gather","","1+",i.gather,i.parseGatherAttributes],["Gemm","","7-10",d.gemm,d.parseGemmAttributesV7],["Gemm","","11+",d.gemm,d.parseGemmAttributesV11],["GlobalAveragePool","","1+",v.globalAveragePool,v.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",v.globalMaxPool],["Greater","","7+",h.greater],["Identity","","1+",M.identity],["ImageScaler","","1+",g.imageScaler,g.parseImageScalerAttributes],["InstanceNormalization","","6+",m.instanceNormalization,m.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",M.leakyRelu,M.parseLeakyReluAttributes],["Less","","7+",h.less],["Log","","6+",M.log],["MatMul","","1+",b.matMul,b.parseMatMulAttributes],["MaxPool","","1+",v.maxPool,v.parseMaxPoolAttributes],["Mul","","7+",h.mul],["Neg","","6+",M.neg],["Not","","1+",M.not],["Or","","7+",h.or],["Pad","","2-10",y.padV2,y.parsePadAttributesV2],["Pad","","11+",y.padV11,y.parsePadAttributesV11],["Pow","","7+",h.pow],["PRelu","","7+",h.pRelu],["ReduceLogSum","","1+",w.reduceLogSum,w.parseReduceAttributes],["ReduceMax","","1+",w.reduceMax,w.parseReduceAttributes],["ReduceMean","","1+",w.reduceMean,w.parseReduceAttributes],["ReduceMin","","1+",w.reduceMin,w.parseReduceAttributes],["ReduceProd","","1+",w.reduceProd,w.parseReduceAttributes],["ReduceSum","","1-12",w.reduceSum,w.parseReduceAttributes],["ReduceSumSquare","","1+",w.reduceLogSumSquare,w.parseReduceAttributes],["Relu","","6+",M.relu],["Reshape","","5+",S.reshape],["Resize","","10",A.resize,A.parseResizeAttributesV10],["Resize","","11+",A.resize,A.parseResizeAttributesV11],["Shape","","1+",O.shape],["Sigmoid","","6+",M.sigmoid],["Sin","","7+",M.sin],["Slice","","10+",x.sliceV10],["Slice","","1-9",x.slice,x.parseSliceAttributes],["Softmax","","1-12",I.softmax,I.parseSoftmaxAttributes],["Softmax","","13+",I.softmaxV13,I.parseSoftmaxAttributesV13],["Split","","2-12",$.split,$.parseSplitAttributes],["Sqrt","","6+",M.sqrt],["Squeeze","","1-12",z.squeeze,z.parseSqueezeAttributes],["Squeeze","","13+",z.squeezeV13],["Sub","","7+",h.sub],["Sum","","6+",L.sum],["Tan","","7+",M.tan],["Tanh","","6+",M.tanh],["Tile","","6+",N.tile],["Transpose","","1+",H.transpose,H.parseTransposeAttributes],["Upsample","","7-8",Z.upsample,Z.parseUpsampleAttributesV7],["Upsample","","9",Z.upsample,Z.parseUpsampleAttributesV9],["Unsqueeze","","1-12",j.unsqueeze,j.parseUnsqueezeAttributes],["Unsqueeze","","13+",j.unsqueezeV13],["Xor","","7+",h.xor]]},2898:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseBatchNormalizationAttributes=n.batchNormalization=void 0;const c=s(246),l=s(5060),p=s(2039),a={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]};n.batchNormalization=(u,o,t)=>(f(o),[u.run(Object.assign(Object.assign({},a),{cacheHint:t.cacheKey,get:()=>h(u,o,t)}),o)]),n.parseBatchNormalizationAttributes=u=>{const o=u.attributes.getFloat("epsilon",1e-5),t=u.attributes.getFloat("momentum",.9),e=u.attributes.getInt("spatial",1);return(0,c.createAttributeWithCacheKey)({epsilon:o,momentum:t,spatial:e})};const h=(u,o,t)=>{const e=(0,l.getGlsl)(u.session.backend.glContext.version),r=o[0].dims.length,[i,d]=u.calculateTextureWidthAndHeight(o[1].dims,p.TextureType.unpacked),g=` + float process(int[${r}] indices) { + vec2 position = offsetToCoords(indices[1], ${i}, ${d}); + float scale = getColorAsFloat(${e.texture2D}(Scale, position)); + float mean = getColorAsFloat(${e.texture2D}(Mean, position)); + float variance = getColorAsFloat(${e.texture2D}(Variance, position)); + float b = getColorAsFloat(${e.texture2D}(B, position)); + + return scale * ( (_A(indices) - mean) / sqrt(variance + float(${t.epsilon})) ) + b; + }`;return Object.assign(Object.assign({},a),{output:{dims:o[0].dims,type:o[0].type,textureType:p.TextureType.unpacked},shaderSource:g})},f=u=>{if(!u||u.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const o=u[0],t=u[1],e=u[2],r=u[3],i=u[4];if(o.dims.length<3||t.dims.length!==1||e.dims.length!==1||r.dims.length!==1||i.dims.length!==1)throw new Error("invalid input shape.");if(t.dims[0]!==o.dims[1]||e.dims[0]!==o.dims[1]||r.dims[0]!==o.dims[1]||i.dims[0]!==o.dims[1])throw new Error("invalid input shape.");if(o.type!=="float32"&&o.type!=="float64"||t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64"||r.type!=="float32"&&r.type!=="float64"||i.type!=="float32"&&i.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.xor=n.sub=n.pRelu=n.pow=n.or=n.mul=n.less=n.greater=n.equal=n.div=n.and=n.add=n.glslPRelu=n.glslPow=n.glslXor=n.glslOr=n.glslAnd=n.glslLess=n.glslGreater=n.glslEqual=n.glslSub=n.glslMul=n.glslDiv=n.glslAdd=void 0;const c=s(2517),l=s(8520),p=s(5060),a=s(2039);function h(){const w="add_";return{body:` + float ${w}(float a, float b) { + return a + b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 + v2; + } + `,name:w,type:l.FunctionType.ValueBased}}function f(){const w="div_";return{body:` + float ${w}(float a, float b) { + return a / b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 / v2; + } + `,name:w,type:l.FunctionType.ValueBased}}function u(){const w="mul_";return{body:` + float ${w}(float a, float b) { + return a * b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 * v2; + } + `,name:w,type:l.FunctionType.ValueBased}}function o(){const w="sub_";return{body:` + float ${w}(float a, float b) { + return a - b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 - v2; + } + `,name:w,type:l.FunctionType.ValueBased}}function t(){const w="equal_";return{body:` + float ${w}(float a, float b) { + return float(a == b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4(equal(v1, v2)); + } + `,name:w,type:l.FunctionType.ValueBased}}function e(){const w="greater_";return{body:` + float ${w}(float a, float b) { + return float(a > b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( v1.r > v2.r , + v1.g > v2.g, + v1.b > v2.b, + v1.a > v2.a ); + } + `,name:w,type:l.FunctionType.ValueBased}}function r(){const w="less_";return{body:` + float ${w}(float a, float b) { + return float(a < b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( v1.r < v2.r , + v1.g < v2.g, + v1.b < v2.b, + v1.a < v2.a ); + } + `,name:w,type:l.FunctionType.ValueBased}}function i(){const w="and_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) && bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r && b2.r , + b1.g && b2.g, + b1.b && b2.b, + b1.a && b2.a ); + } + `,name:w,type:l.FunctionType.ValueBased}}function d(){const w="or_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) || bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r || b2.r , + b1.g || b2.g, + b1.b || b2.b, + b1.a || b2.a ); + } + `,name:w,type:l.FunctionType.ValueBased}}function g(){const w="xor_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) ^^ bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r ^^ b2.r , + b1.g ^^ b2.g, + b1.b ^^ b2.b, + b1.a ^^ b2.a ); + } + `,name:w,type:l.FunctionType.ValueBased}}function m(){return function(w){const S=`${w}_`;return{body:` + float ${S}(float a, float b) { + return ${w}(a, b); + } + vec4 ${S}(vec4 v1, vec4 v2) { + return ${w}(v1, v2); + } + `,name:S,type:l.FunctionType.ValueBased}}("pow")}function b(){const w="prelu_";return{body:` + float ${w}(float a, float b) { + return a < 0.0 ? a * b: a; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( + v1.r < 0.0 ? v1.r * v2.r: v1.r, + v1.g < 0.0 ? v1.g * v2.g: v1.g, + v1.b < 0.0 ? v1.b * v2.b: v1.b, + v1.a < 0.0 ? v1.a * v2.a: v1.a + ); + } + `,name:w,type:l.FunctionType.ValueBased}}n.glslAdd=h,n.glslDiv=f,n.glslMul=u,n.glslSub=o,n.glslEqual=t,n.glslGreater=e,n.glslLess=r,n.glslAnd=i,n.glslOr=d,n.glslXor=g,n.glslPow=m,n.glslPRelu=b;const y=(w,S,A,O=S[0].type,x)=>{const I=w.session.pack?a.TextureType.packed:a.TextureType.unpacked;return{name:A.name,inputNames:["A","B"],inputTypes:[I,I],cacheHint:x,get:()=>v(w,S,A,O)}},v=(w,S,A,O=S[0].type)=>{const x=w.session.pack?a.TextureType.packed:a.TextureType.unpacked,I=!c.ShapeUtil.areEqual(S[0].dims,S[1].dims);let $=S[0].dims;const z=w.session.pack;if(I){const H=c.BroadcastUtil.calcShape(S[0].dims,S[1].dims,!1);if(!H)throw new Error("Can't perform binary op on the given tensors");$=H;const M=$.length,j=S[0].dims.length!==0?S[0].dims.length:1,Z=S[1].dims.length!==0?S[1].dims.length:1,X=S[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",Q=S[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",ee=(0,p.getGlsl)(w.session.backend.glContext.version),ue=z?` + ${A.body} + void main() { + vec4 a = getAAtOutCoords(); + vec4 b = getBAtOutCoords(); + vec4 result = ${A.name}(a, b); + ${ee.output} = result; + }`:` + ${A.body} + float process(int indices[${M}]) { + int aindices[${j}]; + int bindices[${Z}]; + ${X} + ${Q} + return ${A.name}(_A(aindices), _B(bindices)); + }`;return{name:A.name,inputNames:["A","B"],inputTypes:[x,x],output:{dims:$,type:O,textureType:x},shaderSource:ue,hasMain:z}}const L=(0,p.getGlsl)(w.session.backend.glContext.version),N=` + ${A.body} + void main() { + vec4 v1 = ${L.texture2D}(A, TexCoords); + vec4 v2 = ${L.texture2D}(B, TexCoords); + vec4 result = ${A.name}(v1, v2); + ${L.output} = result; + } + `;return{name:A.name,inputNames:["A","B"],inputTypes:[x,x],output:{dims:S[0].dims,type:O,textureType:x},shaderSource:N,hasMain:!0}};n.add=(w,S)=>[w.run(y(w,S,h()),S)],n.and=(w,S)=>[w.run(y(w,S,i(),"bool"),S)],n.div=(w,S)=>[w.run(y(w,S,f()),S)],n.equal=(w,S)=>[w.run(y(w,S,t(),"bool"),S)],n.greater=(w,S)=>[w.run(y(w,S,e(),"bool"),S)],n.less=(w,S)=>[w.run(y(w,S,r(),"bool"),S)],n.mul=(w,S)=>[w.run(y(w,S,u()),S)],n.or=(w,S)=>[w.run(y(w,S,d(),"bool"),S)],n.pow=(w,S)=>[w.run(y(w,S,m()),S)],n.pRelu=(w,S)=>[w.run(y(w,S,b()),S)],n.sub=(w,S)=>[w.run(y(w,S,o()),S)],n.xor=(w,S)=>[w.run(y(w,S,g(),"bool"),S)]},4196:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseCastAttributes=n.cast=void 0;const c=s(2517);n.cast=(p,a,h)=>(l(a),[p.cast(a[0],h)]),n.parseCastAttributes=p=>c.ProtoUtil.tensorDataTypeFromProto(p.attributes.getInt("to"));const l=p=>{if(!p||p.length!==1)throw new Error("Cast requires 1 input.");if(p[0].type==="string")throw new Error("Invalid input type.")}},1163:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedConcatProgramInfoLoader=void 0;const c=s(5060),l=s(2039),p=s(9390),a=s(2827);n.createPackedConcatProgramInfoLoader=(f,u,o)=>{const t=(e=u.length,r=o.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:e},(i,d)=>`X${d}`),inputTypes:Array(e).fill(l.TextureType.packed),cacheHint:r});var e,r;return Object.assign(Object.assign({},t),{get:()=>((i,d,g,m)=>{const b=g[0].dims.slice();if(m>=b.length||m<-1*b.length)throw new Error("axis specified for concat doesn't match input dimensionality");m<0&&(m=b.length+m);const y=b.slice(0);for(let X=1;XX.dims),x=(0,p.getGlChannels)(v),I=new Array(O.length-1);I[0]=O[0][m];for(let X=1;X= ${I[X-1]}) { + return getChannel( + getX${X}(${h(x,$,Q)}), + vec2(${h(z,$,Q)})); + }`}const H=I.length,M=I[I.length-1];N+=` + return getChannel( + getX${H}(${h(x,$,M)}), + vec2(${h(z,$,M)}));`;const j=(0,c.getGlsl)(i.session.backend.glContext.version),Z=` + ${A} + float getValue(${x.map(X=>"int "+X)}) { + ${N} + } + + void main() { + ${S} coords = getOutputCoords(); + int lastDim = coords.${x[v-1]}; + coords.${x[v-1]} = coords.${x[v-2]}; + coords.${x[v-2]} = lastDim; + + vec4 result = vec4(getValue(${w}), 0., 0., 0.); + + ${w[v-1]} = ${w[v-1]} + 1; + if (${w[v-1]} < ${y[v-1]}) { + result.g = getValue(${w}); + } + + ${w[v-2]} = ${w[v-2]} + 1; + if (${w[v-2]} < ${y[v-2]}) { + result.a = getValue(${w}); + } + + ${w[v-1]} = ${w[v-1]} - 1; + if (${w[v-2]} < ${y[v-2]} && + ${w[v-1]} < ${y[v-1]}) { + result.b = getValue(${w}); + } + ${j.output} = result; + } + `;return Object.assign(Object.assign({},d),{output:{dims:y,type:g[0].type,textureType:l.TextureType.packed},shaderSource:Z,hasMain:!0})})(f,t,u,o.axis)})};const h=(f,u,o)=>{const t=f.indexOf(u);return f.map((e,r)=>r===t?`${e} - ${o}`:e).join()}},2069:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConcatAttributes=n.concat=void 0;const c=s(246),l=s(2039),p=s(1163);n.concat=(e,r,i)=>(t(r),e.session.pack&&r[0].dims.length>1?[e.run((0,p.createPackedConcatProgramInfoLoader)(e,r,i),r)]:[e.run(a(e,r,i),r)]);const a=(e,r,i)=>{const d=(g=r.length,m=i.cacheKey,{name:"Concat",inputNames:Array.from({length:g},(b,y)=>`X${y}`),inputTypes:Array(g).fill(l.TextureType.unpacked),cacheHint:m});var g,m;return Object.assign(Object.assign({},d),{get:()=>((b,y,v,w)=>{const S=v[0].dims.slice();if(w>=S.length||w<-1*S.length)throw new Error("axis specified for concat doesn't match input dimensionality");w<0&&(w=S.length+w);const A=S.slice(0);for(let L=1;L`int getTextureWhereDataResides(int index) { + ${e.map((r,i)=>`if(index<${r}) {return ${i};} +`).join("")} + }`,f=e=>h(e),u=(e,r)=>{const i=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${r}]) {`];for(let d=0;d{const r=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let i=0;i(0,c.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis")});const t=e=>{if(!e||e.length<1)throw new Error("too few inputs");const r=e[0].type,i=e[0].dims.length;if(r==="string")throw new Error("string tensor is not supported yet");for(const d of e){if(d.type!==r)throw new Error("input tensors should be one type");if(d.dims.length!==i)throw new Error("input tensors should have the same shape")}}},4770:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createUnpackedGroupedConvProgramInfoLoader=void 0;const c=s(6231),l=s(5060),p=s(2039),a=s(8138),h=s(2823);n.createUnpackedGroupedConvProgramInfoLoader=(f,u,o)=>{const t=(e=u.length>2,r=o.cacheKey,{name:"GroupedConv",inputNames:e?["X","W","Bias"]:["X","W"],inputTypes:e?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],cacheHint:r});var e,r;return Object.assign(Object.assign({},t),{get:()=>((i,d,g,m)=>{const b=d.length>2?"value += getBias(output_channel);":"",y=d[0].dims.slice(),v=d[1].dims.slice(),w=v[0]/m.group;c.Logger.verbose("GroupedConv",`autpPad:${m.autoPad}, dilations:${m.dilations}, group:${m.group}, kernelShape:${m.kernelShape}, pads:${m.pads}, strides:${m.strides}`);const S=(0,a.calculateOutputShape)(y,v,m.dilations,m.pads,m.strides),A=(0,l.getGlsl)(i.session.backend.glContext.version),{activationFunction:O,applyActivation:x}=(0,h.getActivationSnippet)(m),I=` + const ivec2 strides = ivec2(${m.strides[0]}, ${m.strides[1]}); + const ivec2 pads = ivec2(${m.pads[0]}, ${m.pads[1]}); + ${O} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + ivec2 xRCCorner = coords.zw * strides - pads; + int group_id = output_channel / ${w}; + + float value = 0.0; + for (int wInChannel = 0; wInChannel < ${v[1]}; wInChannel++) { + int input_channel = group_id * ${v[1]} + wInChannel; + for (int wHeight = 0; wHeight < ${v[2]}; wHeight++) { + int xHeight = xRCCorner.x + wHeight * ${m.dilations[0]}; + + if (xHeight < 0 || xHeight >= ${y[2]}) { + continue; + } + + for (int wWidth = 0; wWidth < ${v[3]}; wWidth++) { + int xWidth = xRCCorner.y + wWidth * ${m.dilations[1]}; + if (xWidth < 0 || xWidth >= ${y[3]}) { + continue; + } + + float xVal = getX(batch, input_channel, xWidth, xHeight); + float wVal = getW(output_channel, wInChannel, wWidth, wHeight); + value += xVal*wVal; + } + } + } + ${b} + ${x} + ${A.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},g),{output:{dims:S,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:I,hasMain:!0})})(f,u,t,o)})}},1386:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.conv2DPacked=n.conv2DPackedPointwise=void 0;const c=s(8138),l=s(8555),p=s(708);n.conv2DPackedPointwise=(a,h,f)=>{const u=h[0].dims,o=h[1].dims,t=(0,c.calculateOutputShape)(u,o,f.dilations,f.pads,f.strides),e=a.reshapePacked(h[0],[u[1],u[2]*u[3]]),r=a.reshapePacked(h[1],[o[0],o[1]]),i=h.length>2?[r,e,h[2]]:[r,e],d=a.run((0,p.createPackedMatmulProgramInfoLoader)(a,i,f),i);return a.reshapePacked(d,t)},n.conv2DPacked=(a,h,f)=>{const u=h[0].dims,o=h[1].dims,t=(0,c.calculateOutputShape)(u,o,f.dilations,f.pads,f.strides),e=a.run((0,l.createPackedIm2ColProgramInfoLoader)(a,h[0],h[1],t,f),[h[0]]),r=a.reshapePacked(h[1],[o[0],o[1]*o[2]*o[3]]),i=h.length===3?[r,e,h[2]]:[r,e],d=a.run((0,p.createPackedMatmulProgramInfoLoader)(a,i,f),i);return a.reshapePacked(d,t)}},9663:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConvTransposeAttributes=n.convTranspose=void 0;const c=s(246),l=s(5060),p=s(2039),a=s(2823),h=(r,i,d,g,m,b)=>(r-1)*i+d+(g-1)*m+1-b,f=(r,i,d,g,m)=>{const b=Math.floor(r/2);i==="SAME_UPPER"?(d[g]=b,d[m]=r-b):i==="SAME_LOWER"&&(d[g]=r-b,d[m]=b)};n.convTranspose=(r,i,d)=>(e(i,d),u(r,i,d));const u=(r,i,d)=>{const g=t(d,i);return[o(r,i,g)]},o=(r,i,d)=>r.run(((g,m,b)=>{const y=(v=m.length>2,w=b.cacheKey,{name:"ConvTranspose",inputNames:v?["X","W","B"]:["X","W"],inputTypes:v?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],cacheHint:w});var v,w;return Object.assign(Object.assign({},y),{get:()=>((S,A,O,x)=>{const I=A.length>2?"getB(output_channel)":"0.0",$=A[0].dims,z=A[1].dims,L=z[1],N=z[0]/x.group,H=[A[0].dims[0],A[1].dims[1]*x.group,...x.outputShape],M=(0,l.getGlsl)(S.session.backend.glContext.version),{activationFunction:j,applyActivation:Z}=(0,a.getActivationSnippet)(x),X=` + const ivec2 strides = ivec2(${x.strides[0]}, ${x.strides[1]}); + const ivec2 pads = ivec2(${x.pads[0]}, ${x.pads[1]}); + ${j} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + + ivec2 loc = coords.zw + pads; + + int group_id = output_channel / ${L}; + int wOutChannel = output_channel - group_id * ${L}; + + float value = ${I}; + for (int inChannelOffset = 0; inChannelOffset < ${N}; inChannelOffset++) { + int input_channel = group_id * ${N} + inChannelOffset; + for (int wWOff = 0; wWOff < ${z[2]}; wWOff++) { + for (int wHOff = 0; wHOff < ${z[3]}; wHOff++) { + ivec2 wOff = ivec2(wWOff * ${x.dilations[0]}, wHOff * ${x.dilations[1]}); + ivec2 wLoc = loc - wOff; + ivec2 wLocIn = wLoc / strides; + if ( + wLocIn * strides == wLoc && + wLocIn.x >= 0 && wLocIn.x < ${$[2]} && + wLocIn.y >= 0 && wLocIn.y < ${$[3]} + ) { + float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); + float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); + value += xVal * wVal; + } + } + } + } + ${Z} + ${M.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},O),{output:{dims:H,type:A[0].type,textureType:p.TextureType.unpacked},shaderSource:X,hasMain:!0})})(g,m,y,b)})})(r,i,d),i),t=(r,i)=>{const d=r.kernelShape.slice();if(r.kernelShape.length===0)for(let y=2;y{const $=y.length-2,z=I.length===0;for(let L=0;L<$;++L){const N=z?y[L+2]*O[L]:I[L],H=h(y[L+2],O[L],A[L],v[L],w[L],N);f(H,S,A,L,L+$),z&&I.push(O[L]*(y[L+2]-1)+x[L]+(v[L]-1)*w[L]+1-A[L]-A[L+$])}})(i[0].dims,d,r.dilations,r.autoPad,g,r.strides,r.outputPadding,m);const b=Object.assign({},r);return Object.assign(b,{kernelShape:d,pads:g,outputShape:m,cacheKey:r.cacheKey}),b};n.parseConvTransposeAttributes=r=>{const i=r.attributes,d=(0,a.parseInternalActivationAttributes)(i),g=i.getString("auto_pad","NOTSET"),m=i.getInts("dilations",[1,1]),b=i.getInt("group",1),y=i.getInts("kernel_shape",[]),v=i.getInts("output_padding",[0,0]),w=i.getInts("output_shape",[]),S=i.getInts("pads",[0,0,0,0]),A=i.getInts("strides",[1,1]);return(0,c.createAttributeWithCacheKey)(Object.assign({autoPad:g,dilations:m,group:b,kernelShape:y,outputPadding:v,outputShape:w,pads:S,strides:A},d))};const e=(r,i)=>{if(!r||r.length!==2&&r.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(r[0].dims.length!==4||r[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(r[0].dims[1]!==r[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const d=r[1].dims[1]*i.group;if(r.length===3&&(r[2].dims.length!==1||r[2].dims[0]!==d))throw new Error("invalid bias");const g=r[0].dims.length-2;if(i.dilations.length!==g)throw new Error(`dilations should be ${g}D`);if(i.strides.length!==g)throw new Error(`strides should be ${g}D`);if(i.pads.length!==2*g)throw new Error(`pads should be ${2*g}D`);if(i.outputPadding.length!==g)throw new Error(`output_padding should be ${g}D`);if(i.kernelShape.length!==0&&i.kernelShape.length!==r[1].dims.length-2)throw new Error("invalid kernel shape");if(i.outputShape.length!==0&&i.outputShape.length!==r[0].dims.length-2)throw new Error("invalid output shape");if(r[0].type!=="float32"||r[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(r.length===3&&r[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConvAttributes=n.conv=n.calculateOutputShape=void 0;const c=s(246),l=s(2517),p=s(4770),a=s(1386),h=s(9828),f=s(2823),u=s(3248),o=s(5623);n.calculateOutputShape=(g,m,b,y,v)=>{const w=g[0],S=g.slice(2),A=S.length,O=m[0],x=m.slice(2).map(($,z)=>$+($-1)*(b[z]-1)),I=S.map(($,z)=>$+y[z]+y[z+A]).map(($,z)=>Math.floor(($-x[z]+v[z])/v[z]));return[w,O].concat(...I)},n.conv=(g,m,b)=>(d(m,b),t(g,m,b));const t=(g,m,b)=>{const y=i(b,m),v=g.session.pack,w=y.kernelShape[0]===1&&y.kernelShape[1]===1;return y.group>1?[g.run((0,p.createUnpackedGroupedConvProgramInfoLoader)(g,m,y),m)]:w&&v?[e(g,m,y)]:v&&m[0].dims.length===4&&m[0].dims[0]===1&&!w?[(0,a.conv2DPacked)(g,m,y)]:[r(g,m,y)]},e=(g,m,b)=>{const y=m[0].dims,v=m[1].dims,w=(0,n.calculateOutputShape)(y,v,b.dilations,b.pads,b.strides),S=g.reshapeUnpacked(m[0],[y[1],y[2]*y[3]]),A=g.reshapeUnpacked(m[1],[v[0],v[1]]),O=m.length>2?[A,S,m[2]]:[A,S],x=g.run((0,o.createMatmulProgramInfoLoader)(O,b),O);return g.reshapeUnpacked(x,w)},r=(g,m,b)=>{const y=m[0].dims,v=m[1].dims,w=(0,n.calculateOutputShape)(y,v,b.dilations,b.pads,b.strides),S=g.run((0,u.createIm2ColProgramInfoLoader)(g,m[0],m[1],w,b),[m[0]]),A=m.length===3?[S,m[1],m[2]]:[S,m[1]];return g.run((0,h.createDotProductProgramInfoLoader)(g,m,w,b),A)},i=(g,m)=>{const b=g.kernelShape.slice();if(g.kernelShape.length===0)for(let w=2;w{const m=g.attributes,b=(0,f.parseInternalActivationAttributes)(m),y=m.getString("auto_pad","NOTSET"),v=m.getInts("dilations",[1,1]),w=m.getInt("group",1),S=m.getInts("kernel_shape",[]),A=m.getInts("pads",[0,0,0,0]),O=m.getInts("strides",[1,1]);return(0,c.createAttributeWithCacheKey)(Object.assign({autoPad:y,dilations:v,group:w,kernelShape:S,pads:A,strides:O},b))};const d=(g,m)=>{if(!g||g.length!==2&&g.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(g[0].dims.length!==4||g[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(g[0].dims[1]!==g[1].dims[1]*m.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(g.length===3&&(g[2].dims.length!==1||g[1].dims[0]!==g[2].dims[0]))throw new Error("invalid bias");const b=g[0].dims.length-2;if(m.dilations.length!==b)throw new Error(`dilations should be ${b}D`);if(m.strides.length!==b)throw new Error(`strides should be ${b}D`);if(m.pads.length!==2*b)throw new Error(`pads should be ${2*b}D`);if(m.kernelShape.length!==0&&m.kernelShape.length!==g[1].dims.length-2)throw new Error("invalid kernel shape");if(g[0].type!=="float32"||g[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(g.length===3&&g[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseDepthToSpaceAttributes=n.depthToSpace=void 0;const c=s(3738);n.depthToSpace=(p,a,h)=>{l(a);const f=h.blocksize,u=f*f,o=h.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],t=h.mode==="DCR"?[a[0].dims[0],f,f,a[0].dims[1]/u,a[0].dims[2],a[0].dims[3]]:[a[0].dims[0],a[0].dims[1]/u,f,f,a[0].dims[2],a[0].dims[3]],e=p.reshapeUnpacked(a[0],t),r={perm:o,cacheKey:`${o}`},[i]=(0,c.transpose)(p,[e],r),d=[a[0].dims[0],a[0].dims[1]/u,a[0].dims[2]*f,a[0].dims[3]*f];return[p.reshapeUnpacked(i,d)]},n.parseDepthToSpaceAttributes=p=>{const a=p.attributes.getInt("blocksize");if(a<1)throw new Error(`blocksize must be >= 1, but got : ${a} for DepthToSpace`);const h=p.attributes.getString("mode","DCR");if(h!=="DCR"&&h!=="CRD")throw new Error(`unrecognized mode: ${h} for DepthToSpace`);return{mode:h,blocksize:a}};const l=p=>{if(p.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${p.length}`);if(p[0].type==="string"||p[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDotProductProgramInfoLoader=void 0;const c=s(2517),l=s(5060),p=s(2039),a=s(2823),h=s(3248);n.createDotProductProgramInfoLoader=(f,u,o,t)=>{const e=((r,i)=>({name:"ConvDotProduct",inputNames:r?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:r?[p.TextureType.unpacked,p.TextureType.packedLastDimension,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.packedLastDimension],cacheKey:i.activationCacheKey}))(u.length>2,t);return Object.assign(Object.assign({},e),{get:()=>((r,i,d,g,m)=>{const b=d[0].dims,y=d[1].dims,v=[y[0],Math.ceil(b[1]*y[2]*y[3]/4)],w=(0,h.calculateIm2ColDims)(b,y,g),[S,A]=r.calculateTextureWidthAndHeight(v,p.TextureType.packedLastDimension),O=c.ShapeUtil.computeStrides(w),[x,I]=r.calculateTextureWidthAndHeight(w,p.TextureType.packedLastDimension),$=g.length,z=d.length<3?"0.0":"_B(b)",L=Math.ceil(b[1]*y[2]*y[3]/4),{activationFunction:N,applyActivation:H}=(0,a.getActivationSnippet)(m),M=(0,l.getGlsl)(r.session.backend.glContext.version),j=` +${N} +float process(int indices[${$}]) { + int b[1]; + b[0] = indices[1]; + int im2col[4]; + im2col[0] = indices[0]; + im2col[1] = indices[2]; + im2col[2] = indices[3]; + int im2colOffset = im2col[0] * ${O[0]} + im2col[1] * ${O[1]} + im2col[2] * ${O[2]}; + int kernelOffset = indices[1] * ${v[1]}; + float value = ${z}; + for (int i = 0; i < ${L}; ++i) { + vec2 im2colCoords = offsetToCoords(im2colOffset, ${x}, ${I}); + vec2 kernelCoords = offsetToCoords(kernelOffset, ${S}, ${A}); + value += dot(${M.texture2D}(Im2Col, im2colCoords), ${M.texture2D}(K, kernelCoords)); + ++im2colOffset; + ++kernelOffset; + } + ${H} + return value; +}`;return Object.assign(Object.assign({},i),{output:{dims:g,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:j})})(f,e,u,o,t)})}},7992:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseFlattenAttributes=n.flatten=void 0;const c=s(2517);n.flatten=(p,a,h)=>{l(a,h);const f=c.ShapeUtil.flattenShape(a[0].dims,h);return[p.reshapeUnpacked(a[0],f)]},n.parseFlattenAttributes=p=>p.attributes.getInt("axis",1);const l=(p,a)=>{if(!p||p.length!==1)throw new Error("Flatten requires 1 input.");const h=p[0].dims.length;if(h===0)throw new Error("scalar tensor is not supported.");if(a<-h||a>h)throw new Error("Invalid axis");if(p[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseInternalActivationAttributes=n.getActivationSnippet=void 0;const c=s(2517),l=s(4909);n.getActivationSnippet=function(p){let a;switch(p.activation){case"Relu":a=(0,l.glslRelu)();break;case"Sigmoid":a=(0,l.glslSigmoid)();break;case"Clip":a=(0,l.glslClip)(p.clipMin,p.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const h=a.name;return{activationFunction:a.body,applyActivation:`value = ${h}_(value);`}},n.parseInternalActivationAttributes=p=>{const a=p.getString("activation","");if(a==="Clip"){const[h,f]=p.getFloats("activation_params",[c.MIN_CLIP,c.MAX_CLIP]);return{activation:a,clipMax:f,clipMin:h,activationCacheKey:`${a}:${h},${f}`}}return{activation:a,activationCacheKey:a}}},1253:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseGatherAttributes=n.gather=void 0;const c=s(246),l=s(782),p=s(2517),a=s(2039);n.gather=(o,t,e)=>(u(t,e.axis),[o.run(f(o,t,e),t)]),n.parseGatherAttributes=o=>(0,c.createAttributeWithCacheKey)({axis:o.attributes.getInt("axis",0)});const h={name:"Gather",inputNames:["A","B"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},f=(o,t,e)=>{const r=Object.assign(Object.assign({},h),{cacheHint:e.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((i,d,g,m)=>{const b=g[0].dims.slice(),y=g[1].dims.slice(),v=new Array(b.length+y.length-1);m=p.ShapeUtil.normalizeAxis(m,b.length);const w=[];for(let A=0;A{if(!o||o.length!==2)throw new Error("Gather requires 2 inputs.");const e=o[0].dims.length;if(e<1)throw new Error("Invalid input shape.");if(t<-e||t>e-1)throw new Error("Invalid axis.");if(l.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invaid input type.");if(o[1].type!=="int32"&&o[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseGemmAttributesV11=n.parseGemmAttributesV7=n.gemm=void 0;const c=s(246),l=s(2517),p=s(2039);n.gemm=(o,t,e)=>(u(t,e),[o.run(h(t,e),t)]);const a=(o,t)=>{const e=o.attributes.getInt("transA",0)!==0,r=o.attributes.getInt("transB",0)!==0,i=o.attributes.getFloat("alpha",1),d=o.attributes.getFloat("beta",1);return(0,c.createAttributeWithCacheKey)({transA:e,transB:r,alpha:i,beta:d,isOptionalC:t})};n.parseGemmAttributesV7=o=>a(o,!1),n.parseGemmAttributesV11=o=>a(o,!0);const h=(o,t)=>{const e={name:"Gemm",inputNames:o.length===3?["A","B","C"]:["A","B"],inputTypes:o.length===3?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],key:t.cacheKey};return Object.assign(Object.assign({},e),{get:()=>f(e,o,t)})},f=(o,t,e)=>{const r=t[0].dims.slice(),i=t[1].dims.slice(),[d,g]=l.GemmUtil.getShapeOfGemmResult(r,e.transA,i,e.transB,t.length===3?t[2].dims:void 0),m=[d,g];if(!m)throw new Error("Can't use gemm on the given tensors");let b=r[r.length-1],y="";e.transA&&(b=r[0]),e.transA&&e.transB?y="value += _A_T(a) * _B_T(b);":e.transA&&!e.transB?y="value += _A_T(a) * _B(b);":!e.transA&&e.transB?y="value += _A(a) * _B_T(b);":e.transA||e.transB||(y="value += _A(a) * _B(b);");const v=m.length,w=` + float process(int indices[${v}]) { + int a[${v}]; + int b[${v}]; + ${t.length===3?`int c[${t[2].dims.length}];`:""} + + copyVec(indices, a); + copyVec(indices, b); + ${t.length===3?"bcastIndices_C(indices, c);":""} + + float value = 0.0; + for (int k=0; k<${b}; ++k) { + a[${v-1}] = k; + b[${v-2}] = k; + ${y} + } + + value = value * alpha; + ${t.length===3?"value += beta * _C(c);":""} + return value; + }`;return Object.assign(Object.assign({},o),{output:{dims:m,type:t[0].type,textureType:p.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:e.alpha},{name:"beta",type:"float",data:e.beta}],shaderSource:w})},u=(o,t)=>{if(!o)throw new Error("Input is missing");if(t.isOptionalC&&(o.length<2||o.length>3))throw new Error("Invaid input shape.");if(!t.isOptionalC&&o.length!==3)throw new Error("Gemm requires 3 inputs");if(o.length===3&&o[2].dims.length!==1&&o[2].dims.length!==2)throw new Error("Invalid input shape of C");if(o[0].type!=="float32"&&o[0].type!=="float64"||o[1].type!=="float32"&&o[1].type!=="float64"||o.length===3&&o[2].type!=="float32"&&o[2].type!=="float64")throw new Error("Invalid input type.");if(o[0].type!==o[1].type||o.length===3&&o[0].type!==o[2].type)throw new Error("Input types are mismatched")}},8555:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedIm2ColProgramInfoLoader=void 0;const c=s(5060),l=s(2039),p=s(2827);n.createPackedIm2ColProgramInfoLoader=(a,h,f,u,o)=>{const t=(e=o.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[l.TextureType.packed],cacheHint:e});var e;return Object.assign(Object.assign({},t),{get:()=>((r,i,d,g,m,b)=>{const y=d.dims,v=g.dims,w=m.length,S=[v[1]*v[2]*v[3],m[2]*m[3]],A=v[2]*v[3],O=(0,p.unpackFromChannel)(),x=(0,c.getGlsl)(r.session.backend.glContext.version);let I="";for(let z=0;z<=1;z++)for(let L=0;L<=1;L++)I+=` + blockIndex = rc.x + ${L}; + pos = rc.y + ${z}; + + if(blockIndex < ${S[1]} && pos < ${S[0]}) { + offsetY = int(blockIndex / (${m[w-1]})) * ${b.strides[0]} - + ${b.pads[0]}; + d0 = offsetY + ${b.dilations[0]} * (imod(pos, ${A}) / ${v[2]}); + + if(d0 < ${y[2]} && d0 >= 0) { + offsetX = imod(blockIndex, ${m[w-1]}) * ${b.strides[1]} - + ${b.pads[1]}; + d1 = offsetX + ${b.dilations[1]} * imod(imod(pos, ${A}), ${v[2]}); + + if(d1 < ${y[3]} && d1 >= 0) { + + ch = int(float(pos)/ ${A}.); + innerDims = vec2(d0, d1); + result[${2*z+L}] = getChannel( + getA(0, ch, int(innerDims.x), + int(innerDims.y)), innerDims); + } + } + } + + `;const $=` + ${O} + + void main() { + ivec2 rc = getOutputCoords(); + vec4 result = vec4(0.0); + int blockIndex, pos, offsetY, d0, offsetX, d1, ch; + vec2 innerDims; + ${I} + ${x.output} = result; + } + `;return Object.assign(Object.assign({},i),{output:{dims:S,type:d.type,textureType:l.TextureType.packed},shaderSource:$,hasMain:!0})})(a,t,h,f,u,o)})}},3248:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.calculateIm2ColDims=n.createIm2ColProgramInfoLoader=void 0;const c=s(2039);n.createIm2ColProgramInfoLoader=(l,p,a,h,f)=>{const u=(o=f.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[c.TextureType.unpacked],cacheHint:o});var o;return Object.assign(Object.assign({},u),{get:()=>((t,e,r,i,d,g)=>{const m=r.dims,b=i.dims,y=d.length,v=(0,n.calculateIm2ColDims)(m,b,d,4),w=` + const int XC = ${m[1]}; + const int XH = ${m[2]}; + const int XW = ${m[3]}; + const int KH = ${g.kernelShape[0]}; + const int KW = ${g.kernelShape[1]}; + const int dilationH = ${g.dilations[0]}; + const int dilationW = ${g.dilations[1]}; + const int strideH = ${g.strides[0]}; + const int strideW = ${g.strides[1]}; + const int padH = ${g.pads[0]}; + const int padW = ${g.pads[1]}; + const int KHKW = KH*KW; + const int XCKHKW = XC * KHKW; + const int outputChannels = 4; + vec4 process(int indices[${y}]) { + int b = indices[0]; // batch size + int oh = indices[1] * strideH - padH; //output height + int ow = indices[2] * strideW - padW; //output width + int p = indices[3] * outputChannels; //patch + vec4 value = vec4(0.0); + for(int i=0; i < outputChannels; ++i) { + if(p < XCKHKW) { + int patchC = p / KHKW; + int patchH = (p - patchC*KHKW) / KW; + int patchW = (p - patchC*KHKW) - patchH * KW; + int xh2 = oh + patchH * dilationH; + int xw2 = ow + patchW * dilationW; + int x[${m.length}]; + x[0] = b; + x[1] = patchC; + x[2] = xh2; + x[3] = xw2; + if(xh2 >= 0 && + xh2 < XH && + xw2 >= 0 && + xw2 < XW) { + value[i] = _X(x); + } + } + ++p; + } + return value; + } + `;return Object.assign(Object.assign({},e),{output:{dims:v,type:r.type,textureType:c.TextureType.packedLastDimension},shaderSource:w})})(0,u,p,a,h,f)})},n.calculateIm2ColDims=(l,p,a,h=4)=>[a[0],a[2],a[3],Math.ceil(l[1]*p[2]*p[3]/h)]},6572:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseImageScalerAttributes=n.imageScaler=void 0;const c=s(246),l=s(2039);n.imageScaler=(u,o,t)=>(f(o),[u.run(a(u,o,t),o)]),n.parseImageScalerAttributes=u=>{const o=u.attributes.getFloat("scale"),t=u.attributes.getFloats("bias");return(0,c.createAttributeWithCacheKey)({scale:o,bias:t})};const p={name:"ImageScaler",inputNames:["X"],inputTypes:[l.TextureType.unpacked]},a=(u,o,t)=>{const e=Object.assign(Object.assign({},p),{cacheHint:t.cacheKey});return Object.assign(Object.assign({},e),{get:()=>((r,i,d,g)=>{const m=d[0].dims.slice(),b=m.length,y=` + ${h(g.bias.length)} + float process(int indices[${b}]) { + return _X(indices) * scale + getBias(bias, indices[1]); + }`;return Object.assign(Object.assign({},i),{output:{dims:m,type:d[0].type,textureType:l.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:g.bias.length,data:g.bias},{name:"scale",type:"float",data:g.scale}],shaderSource:y})})(0,e,o,t)})},h=u=>{const o=[`float getBias(float bias[${u}], int channel) {`];for(let t=0;t{if(!u||u.length!==1)throw new Error("ImageScaler requires 1 input.");if(u[0].dims.length!==4)throw new Error("Invalid input shape.");if(u[0].type!=="float32"&&u[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseInstanceNormalizationAttributes=n.instanceNormalization=void 0;const c=s(5060),l=s(2039);n.instanceNormalization=(o,t,e)=>{u(t);const r=o.run(a(t[0]),t);return[o.run(f(o,t[0],e,r.dims),[t[0],r,t[1],t[2]])]},n.parseInstanceNormalizationAttributes=o=>o.attributes.getFloat("epsilon",1e-5);const p={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[l.TextureType.unpacked]},a=o=>Object.assign(Object.assign({},p),{get:()=>((t,e)=>{const r=e.dims.slice(),i=r[1],d=r[2]*r[3],g=[r[0],i],m=` + vec4 process(int[2] indices) { + vec4 v = vec4(0.0); + int a[4]; + a[0] = indices[0]; + a[1] = indices[1]; + float temp = 0.0; + for(int a2=0; a2<${r[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${r[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += x; + } + } + float mean = temp / float(${d}); + temp = 0.0; + for(int a2=0; a2<${r[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${r[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += (x - mean) * (x - mean); + } + } + v.r = mean; + v.g = temp / float(${d}); + + return v; + }`;return Object.assign(Object.assign({},t),{output:{dims:g,type:e.type,textureType:l.TextureType.packedLastDimension},shaderSource:m})})(p,o)}),h={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[l.TextureType.unpacked,l.TextureType.packedLastDimension,l.TextureType.unpacked,l.TextureType.unpacked]},f=(o,t,e,r)=>{const i=Object.assign(Object.assign({},h),{cacheHint:`${e}`});return Object.assign(Object.assign({},i),{get:()=>((d,g,m,b,y)=>{const v=(0,c.getGlsl)(d.session.backend.glContext.version),[w,S]=d.calculateTextureWidthAndHeight(y,l.TextureType.packedLastDimension),[A,O]=[w/4,S],x=` + vec4 get_MeanAndVariance(int[2] mv) { + int offset = indicesToOffset_MeanAndVariance(mv); + vec2 coords = offsetToCoords(offset, ${A}, ${O}); + return ${v.texture2D}(MeanAndVariance, coords); + } + + float process(int[4] indices) { + int mv[2]; + mv[0] = indices[0]; + mv[1] = indices[1]; + vec4 mean_and_variance = get_MeanAndVariance(mv); + float mean = mean_and_variance.r; + float variance = mean_and_variance.g; + + int sb[1]; + sb[0] = indices[1]; + float scale = _Scale(sb); + float b = _B(sb); + + return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; + }`;return Object.assign(Object.assign({},g),{output:{dims:m.dims,type:m.type,textureType:l.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:b}],shaderSource:x})})(o,i,t,e,r)})},u=o=>{if(!o||o.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const t=o[0],e=o[1],r=o[2];if(t.dims.length<3||e.dims.length!==1||r.dims.length!==1)throw new Error("Invalid input shape.");if(e.dims[0]!==t.dims[1]||r.dims[0]!==t.dims[1])throw new Error("Input shapes are mismatched.");if(t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64"||r.type!=="float32"&&r.type!=="float64")throw new Error("Invalid input type.");if(o[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedMatmulProgramInfoLoader=void 0;const c=s(2517),l=s(5060),p=s(2039),a=s(9390),h=s(2823),f=s(5623);n.createPackedMatmulProgramInfoLoader=(u,o,t)=>{const e=(r=o.length>2,i=t.activationCacheKey,{name:"MatMul (packed)",inputNames:r?["A","B","Bias"]:["A","B"],inputTypes:r?[p.TextureType.packed,p.TextureType.packed,p.TextureType.packed]:[p.TextureType.packed,p.TextureType.packed],cacheHint:i});var r,i;return Object.assign(Object.assign({},e),{get:()=>((d,g,m,b)=>{const y=m.length>2,v=y?"value += getBiasForMatmul();":"",w=m[0].dims,S=m[1].dims,A=c.BroadcastUtil.calcShape(w,S,!0),O=!c.ShapeUtil.areEqual(m[0].dims,m[1].dims);if(!A)throw new Error("Can't use matmul on the given tensors");const x=w[w.length-1],I=Math.ceil(x/2),$=w.length,z=S.length,L=(0,l.getGlsl)(d.session.backend.glContext.version),N=(0,a.getCoordsDataType)(A.length),H=A.length,M=(0,a.getGlChannels)(),{activationFunction:j,applyActivation:Z}=(0,h.getActivationSnippet)(b),X=y?`${(0,f.getBiasForMatmul)(N,M,m[2].dims,A,!0)}`:"",Q=O?`${function(xe,oe,we,ye){let ke=[],Ne=[];const Te=we[0].dims,$e=we[1].dims,Ce=Te.length,Ee=$e.length,Oe=ye.length,ze=Oe-Ce,Ve=Oe-Ee;ke=Te.map((Ie,je)=>`coords.${oe[je+ze]}`),ke[Ce-1]="i*2",ke.join(", "),Ne=$e.map((Ie,je)=>`coords.${oe[je+Ve]}`),Ne[Ee-2]="i*2",Ne.join(", ");const Ge=c.BroadcastUtil.getBroadcastDims(Te,ye),Ye=c.BroadcastUtil.getBroadcastDims($e,ye),Je=Ge.map(Ie=>`coords.${oe[Ie+ze]} = 0;`).join(` +`),qe=Ye.map(Ie=>`coords.${oe[Ie+Ve]} = 0;`).join(` +`),Ue=`int lastDim = coords.${oe[Oe-1]}; + coords.${oe[Oe-1]} = coords.${oe[Oe-2]}; + coords.${oe[Oe-2]} = lastDim;`;return` +vec4 getAAtOutCoordsMatmul(int i) { + ${xe} coords = getOutputCoords(); + ${Ue} + ${Je} + vec4 outputValue = getA(${ke}); + return outputValue; +} + +vec4 getBAtOutCoordsMatmul(int i) { + ${xe} coords = getOutputCoords(); + ${Ue} + ${qe} + vec4 outputValue = getB(${Ne}); + return outputValue; +}`}(N,M,m,A)}`:"",ee=O?"getAAtOutCoordsMatmul(i)":`getA(${function(xe,oe){let we="";for(let ye=0;ye{Object.defineProperty(n,"__esModule",{value:!0}),n.getBiasForMatmul=n.createMatmulProgramInfoLoader=n.parseMatMulAttributes=n.matMul=void 0;const c=s(2517),l=s(2039),p=s(9390),a=s(2823),h=s(708);function f(t,e){const r=(i=t.length>2,d=e.activationCacheKey,{name:"MatMul",inputNames:i?["A","B","Bias"]:["A","B"],inputTypes:i?[l.TextureType.unpacked,l.TextureType.unpacked,l.TextureType.unpacked]:[l.TextureType.unpacked,l.TextureType.unpacked],cacheHint:d});var i,d;return Object.assign(Object.assign({},r),{get:()=>function(g,m,b){const y=m[0].dims,v=m[1].dims,w=c.BroadcastUtil.calcShape(y,v,!0);if(!w)throw new Error("Can't use matmul on the given tensors");const S=(0,p.getCoordsDataType)(w.length),A=(0,p.getGlChannels)(),{activationFunction:O,applyActivation:x}=(0,a.getActivationSnippet)(b),I=m.length>2,$=I?"value += getBiasForMatmul();":"",z=I?`${o(S,A,m[2].dims,w,!1)}`:"",L=w.length,N=y.length,H=v.length,M=` + ${O} + ${z} + float process(int indices[${L}]) { + int a[${N}]; + int b[${H}]; + bcastMatmulIndices_A(indices, a); + bcastMatmulIndices_B(indices, b); + + float value; + for (int k=0; k<${y[y.length-1]}; ++k) { + a[${N-1}] = k; + b[${H-2}] = k; + value += _A(a) * _B(b); + } + ${$} + ${x} + return value; + }`;return Object.assign(Object.assign({},g),{output:{dims:w,type:m[0].type,textureType:l.TextureType.unpacked},shaderSource:M})}(r,t,e)})}n.matMul=(t,e,r)=>(u(e),t.session.pack?[t.run((0,h.createPackedMatmulProgramInfoLoader)(t,e,r),e)]:[t.run(f(e,r),e)]),n.parseMatMulAttributes=t=>(0,a.parseInternalActivationAttributes)(t.attributes),n.createMatmulProgramInfoLoader=f;const u=t=>{if(!t||t.length!==2)throw new Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw new Error("shared dimension does not match.");if(t[0].type!=="float32"&&t[0].type!=="float64"||t[1].type!=="float32"&&t[1].type!=="float64")throw new Error("inputs should be float type");if(t[0].type!==t[1].type)throw new Error("inputs types should match")};function o(t,e,r,i,d){let g="";const m=r.length,b=i.length,y=b-m;g=b<2&&m>0?"coords":r.map((S,A)=>`coords.${e[A+y]}`).join(", ");const v=c.BroadcastUtil.getBroadcastDims(r,i).map(S=>`coords.${e[S+y]} = 0;`).join(` +`);let w="vec4(outputValue.xx, outputValue.yy)";return c.ShapeUtil.size(r)===1&&(w="vec4(outputValue.x)"),d?` +vec4 getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${v} + vec4 outputValue = getBias(${g}); + return ${w}; +}`:` +float getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${v} + return getBias(coords.x); +}`}n.getBiasForMatmul=o},2403:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackProgramInfoLoader=void 0;const c=s(5060),l=s(2039),p=s(9390),a=s(2827),h={name:"pack",inputNames:["A"],inputTypes:[l.TextureType.unpackedReversed]};n.createPackProgramInfoLoader=(f,u)=>Object.assign(Object.assign({},h),{get:()=>((o,t)=>{const e=(0,c.getGlsl)(o.session.backend.glContext.version),r=t.dims,i=r.length,d=t.dims.length,g=(0,p.getCoordsDataType)(d),m=(0,a.getChannels)("rc",d),b=(y=d,v=m,w=r[r.length-2],S=r[r.length-1],y===0||y===1?"":` + int r = ${v[y-2]}; + int c = ${v[y-1]}; + int rp1 = ${v[y-2]} + 1; + int cp1 = ${v[y-1]} + 1; + bool rEdge = rp1 >= ${S}; + bool cEdge = cp1 >= ${w}; + `);var y,v,w,S;let A;A=i===0?[1,1]:i===1?[r[0],1]:[r[d-1],r[d-2]];const O=function($,z,L){if($===0)return"false";if($===1)return`rc > ${z[0]}`;let N="";for(let H=$-2;H<$;H++)N+=`${L[H]} >= ${z[H-$+2]}`,H<$-1&&(N+="||");return N}(d,A,m),x=function($,z){const L=$.length;if(L===0)return"getA(), 0, 0, 0";if(L===1)return`getA(rc), + rc + 1 >= ${$[0]} ? 0. : getA(rc + 1), + 0, 0`;let N="";if(L>2)for(let H=0;H{Object.defineProperty(n,"__esModule",{value:!0}),n.unpackFromChannel=n.getChannels=n.getVecChannels=void 0;const c=s(9390);function l(p,a){return(0,c.getGlChannels)(a).map(h=>`${p}.${h}`)}n.getVecChannels=l,n.getChannels=function(p,a){return a===1?[p]:l(p,a)},n.unpackFromChannel=function(){return` + float getChannel(vec4 frag, int dim) { + int modCoord = imod(dim, 2); + return modCoord == 0 ? frag.r : frag.g; + } + + float getChannel(vec4 frag, vec2 innerDims) { + vec2 modCoord = mod(innerDims, 2.); + return modCoord.x == 0. ? + (modCoord.y == 0. ? frag.r : frag.g) : + (modCoord.y == 0. ? frag.b : frag.a); + } + `}},2870:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parsePadAttributesV11=n.padV11=n.parsePadAttributesV2=n.padV2=void 0;const c=s(246),l=s(2517),p=s(5060),a=s(2039),h={name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};n.padV2=(g,m,b)=>(o(m),[g.run(Object.assign(Object.assign({},h),{cacheHint:b.cacheKey,get:()=>u(g,m[0],b)}),m)]),n.parsePadAttributesV2=g=>{const m=g.attributes.getString("mode","constant"),b=g.attributes.getFloat("value",0),y=g.attributes.getInts("pads");return(0,c.createAttributeWithCacheKey)({mode:m,value:b,pads:y})},n.padV11=(g,m,b)=>{t(m);const y=f(g,m,b);return(0,n.padV2)(g,[m[0]],y)},n.parsePadAttributesV11=g=>g.attributes.getString("mode","constant");const f=(g,m,b)=>{if(!g.session.isInitializer(m[1].dataId)||m.length>=3&&!g.session.isInitializer(m[2].dataId))throw new Error("dynamic pad attributes are not allowed");const y=Array.from(m[1].integerData),v=m.length>=3?m[2].floatData[0]:0;return(0,c.createAttributeWithCacheKey)({mode:b,pads:y,value:v})},u=(g,m,b)=>{const y=l.ShapeUtil.padShape(m.dims.slice(),b.pads),v=y.length,w=` + ${e(g,m,b)} + float process(int[${v}] indices) { + return padA(indices); + }`;return{name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked],output:{dims:y,type:m.type,textureType:a.TextureType.unpacked},shaderSource:w}},o=g=>{if(!g||g.length!==1)throw new Error("Pad requires 1 input");if(g[0].type!=="float32"&&g[0].type!=="float64")throw new Error("Invalid input type.")},t=g=>{if(!g||g.length!==2&&g.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(g[1].type!=="int32")throw new Error("Invalid input type.");if(g.length>=3&&g[2].type==="string")throw new Error("Invalid input type.")},e=(g,m,b)=>{const y=(0,p.getGlsl)(g.session.backend.glContext.version),[v,w]=g.calculateTextureWidthAndHeight(m.dims,a.TextureType.unpacked),S=l.ShapeUtil.computeStrides(m.dims);switch(b.mode){case"constant":return r(y,m.dims,S,v,w,b.pads,b.value);case"reflect":return i(y,m.dims,S,v,w,b.pads);case"edge":return d(y,m.dims,S,v,w,b.pads);default:throw new Error("Invalid mode")}},r=(g,m,b,y,v,w,S)=>{const A=m.length;let O="";for(let x=A-1;x>=0;--x)O+=` + k = m[${x}] - ${w[x]}; + if (k < 0) return constant; + if (k >= ${m[x]}) return constant; + offset += k * ${b[x]}; + `;return` + float padA(int m[${A}]) { + const float constant = float(${S}); + int offset = 0; + int k = 0; + ${O} + vec2 coords = offsetToCoords(offset, ${y}, ${v}); + float value = getColorAsFloat(${g.texture2D}(A, coords)); + return value; + } + `},i=(g,m,b,y,v,w)=>{const S=m.length;let A="";for(let O=S-1;O>=0;--O)A+=` + k = m[${O}] - ${w[O]}; + if (k < 0) { k = -k; } + { + const int _2n_1 = ${2*(m[O]-1)}; + k = int( mod( float(k), float(_2n_1) ) ) ; + if(k >= ${m[O]}) { k = _2n_1 - k; } + } + offset += k * ${b[O]}; + `;return` + float padA(int m[${S}]) { + int offset = 0; + int k = 0; + ${A} + vec2 coords = offsetToCoords(offset, ${y}, ${v}); + float value = getColorAsFloat(${g.texture2D}(A, coords)); + return value; + } + `},d=(g,m,b,y,v,w)=>{const S=m.length;let A="";for(let O=S-1;O>=0;--O)A+=` + k = m[${O}] - ${w[O]}; + if (k < 0) k = 0; + if (k >= ${m[O]}) k = ${m[O]-1}; + offset += k * ${b[O]}; + `;return` + float padA(int m[${S}]) { + int offset = 0; + int k = 0; + ${A} + vec2 coords = offsetToCoords(offset, ${y}, ${v}); + float value = getColorAsFloat(${g.texture2D}(A, coords)); + return value; + } + `}},2143:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.globalMaxPool=n.parseMaxPoolAttributes=n.maxPool=n.parseGlobalAveragePoolAttributes=n.globalAveragePool=n.parseAveragePoolAttributes=n.averagePool=void 0;const c=s(246),l=s(2517),p=s(2039);n.averagePool=(d,g,m)=>{t(g);const b={name:"AveragePool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:m.cacheKey};return[d.run(Object.assign(Object.assign({},b),{get:()=>a(g,b,!1,m)}),g)]},n.parseAveragePoolAttributes=d=>{const g=d.attributes.getString("auto_pad","NOTSET"),m=d.attributes.getInt("ceil_mode",0),b=d.attributes.getInt("count_include_pad",0)!==0,y=d.attributes.getInts("kernel_shape"),v=d.attributes.getInts("strides",[]),w=d.attributes.getInts("pads",[]);if(m!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,c.createAttributeWithCacheKey)({autoPad:g,ceilMode:m,countIncludePad:b,kernelShape:y,strides:v,pads:w})};const a=(d,g,m,b)=>{const[y,v]=f(d,b,m),w=l.ShapeUtil.size(y.kernelShape);let S="";y.countIncludePad?S+=`value /= float(${w});`:S+=`value /= float(${w} - pad);`;const A=` + ${e(d[0].dims,y,"value += _X(x);",S,"0.0")} + `;return Object.assign(Object.assign({},g),{output:{dims:v,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:A})};n.globalAveragePool=(d,g,m)=>{t(g);const b={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:`${m.countIncludePad}`};return[d.run(Object.assign(Object.assign({},b),{get:()=>a(g,b,!0,m)}),g)]},n.parseGlobalAveragePoolAttributes=d=>{const g=d.attributes.getInt("count_include_pad",0)!==0;return(0,c.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:g,kernelShape:[],strides:[],pads:[]})},n.maxPool=(d,g,m)=>{t(g);const b={name:"MaxPool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:m.cacheKey};return[d.run(Object.assign(Object.assign({},b),{get:()=>h(g,b,!1,m)}),g)]},n.parseMaxPoolAttributes=d=>{const g=d.attributes.getString("auto_pad","NOTSET"),m=d.attributes.getInt("ceil_mode",0),b=d.attributes.getInts("kernel_shape"),y=d.attributes.getInts("strides",[]),v=d.attributes.getInts("pads",[]),w=d.attributes.getInt("storage_order",0),S=d.attributes.getInts("dilations",[]);if(w!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(m!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,c.createAttributeWithCacheKey)({autoPad:g,ceilMode:m,countIncludePad:!1,kernelShape:b,strides:y,pads:v,storageOrder:w,dilations:S})};const h=(d,g,m,b)=>{const[y,v]=f(d,b,m),w=` + ${e(d[0].dims,y,` + value = max(_X(x), value); + `,"","-1e5")} + `;return Object.assign(Object.assign({},g),{output:{dims:v,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:w})},f=(d,g,m)=>{const b=d[0].dims.slice(),y=Object.hasOwnProperty.call(g,"dilations"),v=g.kernelShape.slice(),w=g.strides.slice(),S=y?g.dilations.slice():[],A=g.pads.slice();l.PoolConvUtil.adjustPoolAttributes(m,b,v,w,S,A);const O=l.PoolConvUtil.computePoolOutputShape(m,b,w,S,v,A,g.autoPad),x=Object.assign({},g);return y?Object.assign(x,{kernelShape:v,strides:w,pads:A,dilations:S,cacheKey:g.cacheKey}):Object.assign(x,{kernelShape:v,strides:w,pads:A,cacheKey:g.cacheKey}),[x,O]},u={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},o={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[p.TextureType.unpacked]};n.globalMaxPool=(d,g)=>(t(g),[d.run(Object.assign(Object.assign({},o),{get:()=>h(g,o,!0,u)}),g)]);const t=d=>{if(!d||d.length!==1)throw new Error("Pool ops requires 1 input.");if(d[0].type!=="float32"&&d[0].type!=="float64")throw new Error("Invalid input type.")},e=(d,g,m,b,y)=>{const v=d.length;if(g.kernelShape.length<=2){const w=g.kernelShape[g.kernelShape.length-1],S=g.strides[g.strides.length-1],A=g.pads[g.pads.length/2-1],O=g.pads[g.pads.length-1],x=d[v-1];let I="",$="",z="";if(I=A+O!==0?` + for (int i = 0; i < ${w}; i++) { + x[${v} - 1] = indices[${v} - 1] * ${S} - ${A} + i; + if (x[${v} - 1] < 0 || x[${v} - 1] >= ${x}) { + pad++; + continue; + } + ${m} + }`:` + for (int i = 0; i < ${w}; i++) { + x[${v} - 1] = indices[${v} - 1] * ${S} - ${A} + i; + ${m} + }`,g.kernelShape.length===2){const L=g.kernelShape[g.kernelShape.length-2],N=g.strides[g.strides.length-2],H=g.pads[g.pads.length/2-2],M=g.pads[g.pads.length-2],j=d[v-2];$=H+M!==0?` + for (int j = 0; j < ${L}; j++) { + x[${v} - 2] = indices[${v} - 2] * ${N} - ${H} + j; + if (x[${v} - 2] < 0 || x[${v} - 2] >= ${j}) { + pad+= ${w}; + continue; + } + `:` + for (int j = 0; j < ${L}; j++) { + x[${v} - 2] = indices[${v} - 2] * ${N} - ${H} + j; + `,z=` + } + `}return` + float process(int indices[${v}]) { + int x[${v}]; + copyVec(indices, x); + + float value = ${y}; + int pad = 0; + ${$} + ${I} + ${z} + ${b} + return value; + } + `}{const w=l.ShapeUtil.size(g.kernelShape),S=l.ShapeUtil.computeStrides(g.kernelShape),A=S.length,O=g.pads.length,x=i(A),I=r(d,"inputDims"),$=r(g.pads,"pads"),z=r(S,"kernelStrides"),L=r(g.strides,"strides");let N="";return N=g.pads.reduce((H,M)=>H+M)?` + if (x[j] >= inputDims[j] || x[j] < 0) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + ${m} + }`:` + } + ${m} + `,` + ${x} + float process(int indices[${v}]) { + int x[${v}]; + copyVec(indices, x); + int offset[${A}]; + int pads[${O}]; + int inputDims[${v}]; + int kernelStrides[${A}]; + int strides[${A}]; + ${$} + ${I} + ${L} + ${z} + + float value = ${y}; + int pad = 0; + bool isPad = false; + for (int i = 0; i < ${w}; i++) { + offsetToIndices(i, kernelStrides, offset); + isPad = false; + for (int j = ${v} - ${A}; j < ${v}; j++) { + x[j] = indices[j] * strides[j - ${v} + ${A}] + + offset[j - ${v} + ${A}] - pads[j - 2]; + ${N} + } + ${b} + + return value; + } + `}},r=(d,g)=>{let m="";for(let b=0;b` + void offsetToIndices(int offset, int[${d}] strides, out int[${d}] indices) { + if (${d} == 0) { + return; + } + for (int i = 0; i < ${d} - 1; ++i) { + indices[i] = offset / strides[i]; + offset -= indices[i] * strides[i]; + } + indices[${d} - 1] = offset; + }`},4939:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.reduceLogSumSquare=n.reduceLogSum=n.reduceProd=n.reduceMin=n.reduceMax=n.reduceMean=n.reduceSum=n.parseReduceAttributes=void 0;const c=s(246),l=s(782),p=s(2517),a=s(2039),h=(o,t,e,r,i)=>{u(t);const d={name:r,inputNames:["A"],inputTypes:[a.TextureType.unpacked]};return[o.run(Object.assign(Object.assign({},d),{cacheHint:e.cacheKey,get:()=>f(o,t,e,r,i,d)}),t)]};n.parseReduceAttributes=o=>{const t=o.attributes.getInts("axes",[]),e=o.attributes.getInt("keepdims",1)===1;return(0,c.createAttributeWithCacheKey)({axes:t,keepDims:e})};const f=(o,t,e,r,i,d)=>{const g=[],m=t[0].dims.length||1,b=[],y=p.ShapeUtil.normalizeAxes(e.axes,t[0].dims.length),v=i(t,y);let w=v[1];for(let A=0;A=0||y.length===0?(e.keepDims&&g.push(1),w=` + for(int j${A} = 0; j${A} < ${t[0].dims[A]}; j${A}++) { + inputIdx[${A}] = j${A}; + ${w} + }`):(b.push(`inputIdx[${A}] = outputIdx[${g.length}];`),g.push(t[0].dims[A]));const S=` + float process(int outputIdx[${g.length||1}]) { + float value; // final result + int inputIdx[${m}]; // addressing input data + ${b.join(` +`)} + ${v[0]} // init ops for reduce max/min + ${w} + ${v[2]} // final computation for reduce mean + return value; + }`;return Object.assign(Object.assign({},d),{output:{dims:g,type:t[0].type,textureType:a.TextureType.unpacked},shaderSource:S})},u=o=>{if(!o||o.length!==1)throw new Error("Reduce op requires 1 input.");if(l.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invalid input type.")};n.reduceSum=(o,t,e)=>h(o,t,e,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),n.reduceMean=(o,t,e)=>h(o,t,e,"ReduceMean",(r,i)=>{let d=1;for(let g=0;g=0||i.length===0)&&(d*=r[0].dims[g]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${d}.;`]}),n.reduceMax=(o,t,e)=>h(o,t,e,"ReduceMax",(r,i)=>{const d=[];for(let g=0;g=0||i.length===0)&&d.push(`inputIdx[${g}] = 0;`);return[`${d.join(` +`)} +value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),n.reduceMin=(o,t,e)=>h(o,t,e,"ReduceMin",(r,i)=>{const d=[];for(let g=0;g=0||i.length===0)&&d.push(`inputIdx[${g}] = 0;`);return[`${d.join(` +`)} +value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),n.reduceProd=(o,t,e)=>h(o,t,e,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),n.reduceLogSum=(o,t,e)=>h(o,t,e,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),n.reduceLogSumSquare=(o,t,e)=>h(o,t,e,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isReshapeCheap=n.processDims3D=n.createPackedReshape3DProgramInfoLoader=void 0;const c=s(2517),l=s(5060),p=s(2039),a=s(2827);n.createPackedReshape3DProgramInfoLoader=(h,f,u)=>{const o=(t=>({name:"Reshape (packed)",inputTypes:[p.TextureType.packed],inputNames:["A"],cacheHint:`${t}`}))(u);return Object.assign(Object.assign({},o),{get:()=>((t,e,r,i)=>{const d=e.dims,g=i;let m="";for(let v=0;v<4;v++){let w="";switch(v){case 0:w="outputCoords = rc;";break;case 1:w="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:w="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:w="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}m+=` + ${w} + ${v>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} + int flattenedIndex = getFlattenedIndex(outputCoords); + + ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); + vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); + + result[${v}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); + + ${v>0?"}":""} + `}const b=(0,l.getGlsl)(t.session.backend.glContext.version),y=` + ${function(v){const w=c.ShapeUtil.computeStrides(v),S=["b","r","c"],A="index";return` + ivec3 inputCoordsFromReshapedOutCoords(int index) { + ${w.map((O,x)=>`int ${S[x]} = ${A} / ${O}; ${x===w.length-1?`int ${S[x+1]} = ${A} - ${S[x]} * ${O}`:`index -= ${S[x]} * ${O}`};`).join("")} + return ivec3(b, r, c); + } + `}(d)} + ${function(v){const w=c.ShapeUtil.computeStrides(v);return` + int getFlattenedIndex(ivec3 coords) { + // reverse y, z order + return coords.x * ${w[0]} + coords.z * ${w[1]} + coords.y; + } +`}(g)} + ${(0,a.unpackFromChannel)()} + + void main() { + ivec3 rc = getOutputCoords(); + + vec4 result = vec4(0.0); + + ivec3 outputCoords; + int rows = ${g[2]}; + int cols = ${g[1]}; + + ${m} + ${b.output} = result; + } + `;return Object.assign(Object.assign({},r),{output:{dims:g,type:e.type,textureType:p.TextureType.packed},shaderSource:y,hasMain:!0})})(h,f,o,u)})},n.processDims3D=function(h){if(h.length===0)return[1,1,1];let f=1;for(let u=0;u1?h[h.length-2]:1,h[h.length-1]]},n.isReshapeCheap=function(h,f){let u=!1;return u=h.length===0||f.length===0||(h.length<2||f.length<2?h[h.length-1]===f[f.length-1]:h[h.length-1]===f[f.length-1]&&h[h.length-2]===f[f.length-2]),u}},718:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.reshape=void 0;const c=s(2517);n.reshape=(l,p)=>{const a=c.ShapeUtil.calculateReshapedDims(p[0].dims,p[1].integerData);return l.session.pack?[l.reshapePacked(p[0],a)]:[l.reshapeUnpacked(p[0],a)]}},2268:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseResizeAttributesV11=n.parseResizeAttributesV10=n.resize=void 0;const c=s(5060),l=s(2039),p=s(9390),a=s(2827),h=s(9793),f={name:"Resize",inputNames:["A"],inputTypes:[l.TextureType.packed]};n.resize=(r,i,d)=>((0,h.validateInputs)(i,d),[r.run(Object.assign(Object.assign({},f),{cacheHint:d.cacheKey,get:()=>u(r,i,d)}),i)]),n.parseResizeAttributesV10=r=>(0,h.parseUpsampleAttributes)(r,10),n.parseResizeAttributesV11=r=>(0,h.parseUpsampleAttributes)(r,11);const u=(r,i,d)=>{const g=(0,c.getGlsl)(r.session.backend.glContext.version),[m,b]=o(i,d);if(m.every(N=>N===1)&&d.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},f),{output:{dims:b,type:i[0].type,textureType:l.TextureType.packed},hasMain:!0,shaderSource:`void main() { + vec4 v = ${g.texture2D}(X, TexCoords); + ${g.output} = v; + }`});const y=b.length;if(y<2)throw new Error(`output dimension should be at least 2, but got ${y}`);const v=b[y-2],w=b[y-1],S=i[0].dims;if(y!==S.length)throw new Error(`output dimension should match input ${S.length}, but got ${y}`);const A=S[y-2],O=S[y-1],x=m[y-2],I=m[y-1];let $="";if(d.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${d.mode}'`);switch(d.coordinateTransformMode){case"asymmetric":$=` + vec4 getSourceFracIndex(ivec4 coords) { + return vec4(coords) / scaleWHWH; + } + `;break;case"half_pixel":$=` + vec4 getSourceFracIndex(ivec4 coords) { + return (vec4(coords) + 0.5) / scaleWHWH - 0.5; + } + `;break;case"pytorch_half_pixel":$=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 fcoords = vec4(coords); + return vec4( + ${w}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, + ${v}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, + ${w}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, + ${v}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 + ); + } + `;break;case"align_corners":$=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 resized = vec4(${w}.0 - 1.0, ${v}.0 - 1.0, ${w}.0 - 1.0, + ${v}.0 - 1.0); + vec4 original = vec4(${O}.0 - 1.0, ${A}.0 - 1.0, ${O}.0 - 1.0, + ${A}.0 - 1.0); + vec4 new_scale = original / resized; + return vec4(coords) * new_scale; + } + `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${d.coordinateTransformMode}'`)}const z=(0,p.getCoordsDataType)(y),L=` + const vec2 inputWH = vec2(${A}.0, ${O}.0); + const vec4 scaleWHWH = vec4(float(${x}), float(${I}), float(${x}), float(${I})); + ${(0,a.unpackFromChannel)()} + ${$} + float getAValue(int x10, int r, int c, int d) { + return getChannel(getA(x10, r, c, d), vec2(c, d)); + } + void main() { + ${z} rc = getOutputCoords(); + + int batch = rc[0]; + int depth = rc[1]; + + // retrieve the 4 coordinates that is used in the 4 packed output values. + ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); + + // calculate the source index in fraction + vec4 sourceFrac = getSourceFracIndex(coords); + + // get the lower and upper bound of the 4 values that will be packed into one texel. + ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); + ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); + ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); + ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); + + bool hasNextRow = rc.w < ${v-1}; + bool hasNextCol = rc.z < ${w-1}; + + // pack x00, x01, x10, x11's top-left corner into one vec4 structure + vec4 topLeft = vec4( + getAValue(batch, depth, x00.x, x00.y), + hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); + + // pack x00, x01, x10, x11's top-right corner into one vec4 structure + vec4 topRight = vec4( + getAValue(batch, depth, x00.x, x00.w), + hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); + + // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure + vec4 bottomLeft = vec4( + getAValue(batch, depth, x00.z, x00.y), + hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); + + // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure + vec4 bottomRight = vec4( + getAValue(batch, depth, x00.z, x00.w), + hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); + + // calculate the interpolation fraction on u and v direction + vec4 frac = vec4(sourceFrac) - floor(sourceFrac); + vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); + + vec4 top = mix(topLeft, topRight, clampFrac.ywyw); + vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); + vec4 newValue = mix(top, bottom, clampFrac.xxzz); + + ${g.output} = vec4(newValue); + } + `;return Object.assign(Object.assign({},f),{output:{dims:b,type:i[0].type,textureType:l.TextureType.packed},hasMain:!0,shaderSource:L})},o=(r,i)=>{const d=r[0].dims;let g,m=i.scales;if(m.length===0){const y=r[i.scalesInputIdx];if(y&&y.size!==0){if(r[i.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");m=t(y,i.mode,i.isResize)}else{const v=r[i.sizesInputIdx];if(!v||v.size===0)throw new Error("Either scales or sizes MUST be provided as input.");g=Array.from(v.integerData),m=e(g,d,i.mode,i.isResize)}}else if(r[i.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const b=g||d.map((y,v)=>Math.floor(y*m[v]));return[m,b]},t=(r,i,d)=>{const g=Array.from(r.floatData);return(0,h.scalesValidation)(g,i,d),g},e=(r,i,d,g)=>{const m=i.length,b=new Array(m);for(let y=0,v=m;y{Object.defineProperty(n,"__esModule",{value:!0}),n.shape=void 0;const c=s(9162);n.shape=(p,a)=>(l(a),[new c.Tensor([a[0].dims.length],"int32",void 0,void 0,new Int32Array(a[0].dims))]);const l=p=>{if(!p||p.length!==1)throw new Error("Shape requires 1 input.")}},2278:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.sliceV10=n.parseSliceAttributes=n.slice=void 0;const c=s(246),l=s(782),p=s(2517),a=s(2039),h={name:"Slice",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};n.slice=(e,r,i)=>(u(r),[e.run(Object.assign(Object.assign({},h),{cacheHint:i.cacheKey,get:()=>f(e,r[0],i)}),r)]),n.parseSliceAttributes=e=>{const r=e.attributes.getInts("starts"),i=e.attributes.getInts("ends"),d=e.attributes.getInts("axes",[]);return(0,c.createAttributeWithCacheKey)({starts:r,ends:i,axes:d})};const f=(e,r,i)=>{const d=i.axes.length===0?r.dims.slice(0).map((S,A)=>A):i.axes,g=p.ShapeUtil.normalizeAxes(d,r.dims.length),m=i.starts.map((S,A)=>S>r.dims[g[A]]-1?r.dims[g[A]]:p.ShapeUtil.normalizeAxis(S,r.dims[g[A]])),b=i.ends.map((S,A)=>S>r.dims[g[A]]-1?r.dims[g[A]]:p.ShapeUtil.normalizeAxis(S,r.dims[g[A]])),y=r.dims.slice(),v=[];for(let S=0;S0&&v.push(`outputIdx[${g[S]}] += ${m[S]};`);const w=` + float process(int outputIdx[${y.length}]) { + ${v.join(` + `)} + return _A(outputIdx); + }`;return Object.assign(Object.assign({},h),{output:{dims:y,type:r.type,textureType:a.TextureType.unpacked},shaderSource:w})},u=e=>{if(!e||e.length!==1)throw new Error("Slice requires 1 input.");if(l.NUMBER_TYPES.indexOf(e[0].type)===-1)throw new Error("Invalid input type.")};n.sliceV10=(e,r)=>{t(r);const i=o(e,r);return[e.run(Object.assign(Object.assign({},h),{cacheHint:i.cacheKey,get:()=>f(e,r[0],i)}),[r[0]])]};const o=(e,r)=>{if(!e.session.isInitializer(r[1].dataId)||!e.session.isInitializer(r[2].dataId)||r.length>=4&&!e.session.isInitializer(r[3].dataId)||r.length>=5&&!e.session.isInitializer(r[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(r.length>=5&&r[4].integerData.some(m=>m!==1))throw new Error("currently non-1 steps is not supported for Slice");const i=Array.from(r[1].integerData),d=Array.from(r[2].integerData),g=r.length>=4?Array.from(r[3].integerData):[];return{starts:i,ends:d,axes:g,cacheKey:`${g};${i};${d}`}},t=e=>{if(!e||e.length<3||e.length>5)throw new Error("Invalid input number.");if(e[1].type!=="int32"||e[1].dims.length!==1)throw new Error("Invalid input type.");if(e[2].type!=="int32"||e[2].dims.length!==1)throw new Error("Invalid input type.");if(e.length>=4&&(e[3].type!=="int32"||e[3].dims.length!==1))throw new Error("Invalid input type.");if(e.length>=5&&(e[4].type!=="int32"||e[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.softmaxV13=n.parseSoftmaxAttributesV13=n.parseSoftmaxAttributes=n.softmax=void 0;const c=s(246),l=s(2517),p=s(5060),a=s(2039),h=s(3738),f={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[a.TextureType.unpacked]},u={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},o={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]};n.softmax=(g,m,b)=>{d(m);const y=m[0].dims.slice(),v=l.ShapeUtil.normalizeAxis(b.axis,y.length),w=l.ShapeUtil.sizeToDimension(y,v),S=l.ShapeUtil.sizeFromDimension(y,v);return t(g,m,b,w,S)},n.parseSoftmaxAttributes=g=>(0,c.createAttributeWithCacheKey)({axis:g.attributes.getInt("axis",1)}),n.parseSoftmaxAttributesV13=g=>(0,c.createAttributeWithCacheKey)({axis:g.attributes.getInt("axis",-1)}),n.softmaxV13=(g,m,b)=>{d(m);const y=m[0].dims.slice(),v=l.ShapeUtil.normalizeAxis(b.axis,y.length),w=y.length,S=v!==w-1,A=[];let O,x=[],I=[];S&&(x=Array.from({length:w}).map((N,H)=>H),x[v]=w-1,x[w-1]=v,x.map(N=>A.push(y[N])),O=(0,c.createAttributeWithCacheKey)({perm:x}),I=(0,h.transpose)(g,m,O));const $=S?l.ShapeUtil.sizeToDimension(A,w-1):l.ShapeUtil.sizeToDimension(y,w-1),z=S?l.ShapeUtil.sizeFromDimension(A,w-1):l.ShapeUtil.sizeFromDimension(y,w-1),L=t(g,S?I:m,b,$,z);return S?(0,h.transpose)(g,L,O):L};const t=(g,m,b,y,v)=>{const w=e(g,m[0],y,v,[y]),S=g.run(Object.assign(Object.assign({},f),{cacheHint:b.cacheKey,get:()=>w}),m),A=r(g,m[0],y,v,w.output.dims,[y]),O=g.run(Object.assign(Object.assign({},u),{cacheHint:b.cacheKey,get:()=>A}),[m[0],S]),x=i(g,m[0],y,v,w.output.dims,A.output.dims);return[g.run(Object.assign(Object.assign({},o),{cacheHint:b.cacheKey,get:()=>x}),[m[0],S,O])]},e=(g,m,b,y,v)=>{const[w,S]=g.calculateTextureWidthAndHeight(m.dims,a.TextureType.unpacked),A=v.length;if(b<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(v.length!==1)throw new Error("Dimensionality of the output should be 1");if(v[0]!==b)throw new Error("Shape of the output should be equal to logical row count");const O=(0,p.getGlsl)(g.session.backend.glContext.version),x=` + float process(int[${A}] indices) { + int logical_row_start_offset = indices[0] * ${y}; + + float max = getColorAsFloat(${O.texture2D}(A, offsetToCoords(logical_row_start_offset, ${w}, + ${S} ))); + for(int i=1; i<${y}; ++i) + { + float current = getColorAsFloat(${O.texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${w}, ${S}))); + if(current > max) + max = current; + } + + return max; + }`;return Object.assign(Object.assign({},f),{output:{dims:v,type:m.type,textureType:a.TextureType.unpacked},shaderSource:x})},r=(g,m,b,y,v,w)=>{const[S,A]=g.calculateTextureWidthAndHeight(m.dims,a.TextureType.unpacked),O=w.length;if(b<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(w.length!==1)throw new Error("Dimensionality of the output should be 1");if(w[0]!==b)throw new Error("Shape of the output should be equal to logical row count");if(v.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(v[0]!==b)throw new Error("Shape of the intermediate results should be equal to logical row count");const x=` + float process(int[${O}] indices) { + int logical_row_start_offset = indices[0] * ${y}; + + float norm_factor = 0.0; + float max = _Max(indices); + for(int i=0; i<${y}; ++i) + { + norm_factor += exp(getColorAsFloat(${(0,p.getGlsl)(g.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${S}, ${A}))) - max); + } + + return norm_factor; + }`;return Object.assign(Object.assign({},u),{output:{dims:w,type:m.type,textureType:a.TextureType.unpacked},shaderSource:x})},i=(g,m,b,y,v,w)=>{const[S,A]=g.calculateTextureWidthAndHeight(m.dims,a.TextureType.unpacked),O=m.dims.length;if(b<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(v.length!==1||w.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(v[0]!==b||w[0]!==b)throw new Error("Shape of the intermediate results should be equal to logical row count");const x=` + float process(int[${O}] indices) { + + // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) + int offset = coordsToOffset(TexCoords, ${S}, ${A}); + + //determine the logical row for this index + int logical_row_index[1]; + logical_row_index[0] = offset / ${y}; + + float norm_factor = _Norm(logical_row_index); + + // avoid possible division by 0 + // if norm_facor is 0, all elements are zero + // if so, return 0 + if(norm_factor == 0.0) + return 0.0; + + return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; + }`;return Object.assign(Object.assign({},o),{output:{dims:m.dims,type:m.type,textureType:a.TextureType.unpacked},shaderSource:x})},d=g=>{if(!g||g.length!==1)throw new Error("Softmax requires 1 input.");if(g[0].type!=="float32"&&g[0].type!=="float64")throw new Error("Invalid input type")}},5975:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseSplitAttributes=n.split=void 0;const c=s(246),l=s(2517),p=s(2039),a={name:"Split",inputNames:["A"],inputTypes:[p.TextureType.unpacked]};n.split=(o,t,e)=>{u(t);const r=l.ShapeUtil.normalizeAxis(e.axis,t[0].dims.length),i=h(o,t,r,e),d=[];for(let g=0;gf(o,t[0],e,r,g)}),t));return d},n.parseSplitAttributes=o=>{const t=o.attributes.getInt("axis",0),e=o.attributes.getInts("split",[]),r=o.outputs.length;return(0,c.createAttributeWithCacheKey)({axis:t,split:e,numOutputs:r})};const h=(o,t,e,r)=>{const[,i]=l.SplitUtil.splitShape(t[0].dims,e,r.split,r.numOutputs);return i.length},f=(o,t,e,r,i)=>{const[d,g]=l.SplitUtil.splitShape(t.dims,r,e.split,e.numOutputs),m=g[i],b=d[i],y=` + float process(int indices[${b.length}]) { + indices[${r}] += ${m}; + return _A(indices); + } + `;return Object.assign(Object.assign({},a),{cacheHint:`${e.cacheKey}:${i}`,output:{dims:b,type:t.type,textureType:p.TextureType.unpacked},shaderSource:y})},u=o=>{if(!o||o.length!==1)throw new Error("Split requires one input.");if(o[0].type!=="int8"&&o[0].type!=="uint8"&&o[0].type!=="int16"&&o[0].type!=="uint16"&&o[0].type!=="int32"&&o[0].type!=="uint32"&&o[0].type!=="float32"&&o[0].type!=="float64"&&o[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseSqueezeAttributes=n.squeezeV13=n.squeeze=void 0;const c=s(2517);n.squeeze=(a,h,f)=>{l(h);const u=c.ShapeUtil.squeezeShape(h[0].dims,f);return[a.reshapeUnpacked(h[0],u)]},n.squeezeV13=(a,h)=>(p(h),(0,n.squeeze)(a,[h[0]],Array.from(h[1].integerData))),n.parseSqueezeAttributes=a=>a.attributes.getInts("axes");const l=a=>{if(!a||a.length!==1)throw new Error("Squeeze requires 1 input.");if(a[0].type==="string")throw new Error("invalid input tensor types.")},p=a=>{if(!a||a.length!==2)throw new Error("Squeeze requires 2 inputs.");if(a[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.sum=void 0;const c=s(5060),l=s(2039);n.sum=(h,f)=>{a(f);const u={name:"Sum",inputNames:f.map((o,t)=>`X${t}`),inputTypes:new Array(f.length).fill(l.TextureType.unpacked)};return[h.run(Object.assign(Object.assign({},u),{get:()=>p(h,f,u)}),f)]};const p=(h,f,u)=>{const o=(0,c.getGlsl)(h.session.backend.glContext.version),t=f[0].dims.slice(),e=` + void main() { + vec4 result = ${f.map((r,i)=>`${o.texture2D}(X${i},TexCoords)`).join(" + ")}; + ${o.output} = result; + } + `;return Object.assign(Object.assign({},u),{output:{dims:t,type:f[0].type,textureType:l.TextureType.unpacked},hasMain:!0,shaderSource:e})},a=h=>{if(!h||h.length===0)throw new Error("Sum requires inputs.");const f=h[0].dims.length;for(let u=1;u{Object.defineProperty(n,"__esModule",{value:!0}),n.tile=void 0;const c=s(782),l=s(2039);n.tile=(h,f)=>{a(f);const u={name:"Tile",inputNames:["A"],inputTypes:[l.TextureType.unpacked]};return[h.run(Object.assign(Object.assign({},u),{get:()=>p(h,f,u)}),f)]};const p=(h,f,u)=>{const o=f[0].dims.slice(),t=new Array(o.length),e=[];for(let d=0;d{if(!h||h.length!==2)throw new Error("Tile requires 2 input.");if(h[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(h[1].dims[0]!==h[0].dims.length)throw new Error("Invalid input shape.");if(c.NUMBER_TYPES.indexOf(h[0].type)===-1)throw new Error("Invalid input type.");if(h[1].type!=="int32"&&h[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseTransposeAttributes=n.transpose=void 0;const c=s(246),l=s(2517),p=s(2039),a={name:"Transpose",inputNames:["A"],inputTypes:[p.TextureType.unpacked]};n.transpose=(e,r,i)=>(t(r),[e.run(Object.assign(Object.assign({},a),{cacheHint:i.cacheKey,get:()=>h(e,r[0],i.perm)}),r)]),n.parseTransposeAttributes=e=>(0,c.createAttributeWithCacheKey)({perm:e.attributes.getInts("perm",[])});const h=(e,r,i)=>{const d=r.dims;i=f(d,i);const g=u(d,i),m=d.length,b=` + ${o("perm",i,m)} + float process(int indices[${m}]) { + int a[${m}]; + perm(a, indices); + return _A(a); + }`;return Object.assign(Object.assign({},a),{output:{dims:g,type:r.type,textureType:p.TextureType.unpacked},shaderSource:b})},f=(e,r)=>(r&&r.length!==e.length&&(r=[...e.keys()].reverse()),r),u=(e,r)=>(r=f(e,r),l.ShapeUtil.sortBasedOnPerm(e,r)),o=(e,r,i)=>{const d=[];d.push(`void ${e}(out int a[${i}], int src[${i}]) {`);for(let g=0;g{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(e[0].type!=="float32"&&e[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.encodeAsUint8=void 0;const c=s(5060),l=s(2039);n.encodeAsUint8=(p,a)=>{const h=a.shape,f=(0,c.getGlsl)(p.session.backend.glContext.version),u=` + const float FLOAT_MAX = 1.70141184e38; + const float FLOAT_MIN = 1.17549435e-38; + + bool isNaN(float val) { + return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; + } + + highp vec4 encodeAsUint8(highp float v) { + if (isNaN(v)) { + return vec4(255, 255, 255, 255); + } + + highp float av = abs(v); + + if(av < FLOAT_MIN) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if(v > FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; + } else if(v < -FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; + } + + highp vec4 c = vec4(0,0,0,0); + + highp float e = floor(log2(av)); + highp float m = exp2(fract(log2(av))) - 1.0; + + c[2] = floor(128.0 * m); + m -= c[2] / 128.0; + c[1] = floor(32768.0 * m); + m -= c[1] / 32768.0; + c[0] = floor(8388608.0 * m); + + highp float ebias = e + 127.0; + c[3] = floor(ebias / 2.0); + ebias -= c[3] * 2.0; + c[2] += floor(ebias) * 128.0; + + c[3] += 128.0 * step(0.0, -v); + + return c / 255.0; + } + + void main() { + float value = ${f.texture2D}(X,TexCoords).r; + ${f.output} = encodeAsUint8(value); + }`,o={name:"Uint8Encode",inputTypes:[l.TextureType.unpacked],inputNames:["X"],output:{dims:h,type:a.tensor.type,textureType:l.TextureType.downloadUint8AsFloat},shaderSource:u,hasMain:!0};return p.executeProgram(o,[a.tensor])}},4909:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tanh=n.tan=n.sqrt=n.sin=n.sigmoid=n.relu=n.not=n.neg=n.log=n.parseLeakyReluAttributes=n.leakyRelu=n.identity=n.floor=n.exp=n.parseEluAttributes=n.elu=n.cos=n.ceil=n.clipV11=n.parseClipAttributes=n.clip=n.atan=n.asin=n.acos=n.abs=n.glslTanh=n.glslTan=n.glslSqrt=n.glslSigmoid=n.glslRelu=n.glslSin=n.glslNot=n.glslNeg=n.glslLog=n.glslLeakyRelu=n.glslIdentity=n.glslClip=n.glslFloor=n.glslExp=n.glslElu=n.glslCos=n.glslCeil=n.glslAtan=n.glslAsin=n.glslAcos=n.glslAbs=void 0;const c=s(246),l=s(2517),p=s(8520),a=s(5060),h=s(2039);function f(){return L("abs")}function u(){return L("acos")}function o(){return L("asin")}function t(){return L("atan")}function e(){return L("ceil")}function r(){return L("cos")}function i(M){const j="elu";return{body:` + const float alpha = float(${M}); + + float ${j}_(float a) { + return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; + } + vec4 ${j}_(vec4 v) { + return vec4(${j}_(v.x), ${j}_(v.y), ${j}_(v.z), ${j}_(v.w)); + } + `,name:j,type:p.FunctionType.ValueBased}}function d(){return L("exp")}function g(){return L("floor")}function m(M,j){const Z="clip";return{body:` + const float min = float(${M}); + const float max = float(${j}); + + float ${Z}_(float a) { + return clamp(a, min, max); + } + vec4 ${Z}_(vec4 v) { + return clamp(v, min, max); + } + `,name:Z,type:p.FunctionType.ValueBased}}function b(){const M="indentity";return{body:` + float ${M}_(float a) { + return a; + } + vec4 ${M}_(vec4 v) { + return v; + } + `,name:M,type:p.FunctionType.ValueBased}}function y(M){const j="leakyRelu";return{body:` + const float alpha = float(${M}); + + float ${j}_(float a) { + return a < 0.0 ? a * alpha : a; + } + vec4 ${j}_(vec4 v) { + return vec4(${j}_(v.x), ${j}_(v.y), ${j}_(v.z), ${j}_(v.w)); + } + `,name:j,type:p.FunctionType.ValueBased}}function v(){return L("log")}function w(){const M="neg";return{body:` + float ${M}_(float a) { + return -a; + } + vec4 ${M}_(vec4 v) { + return -v; + } + `,name:M,type:p.FunctionType.ValueBased}}function S(){const M="not";return{body:` + float ${M}_(float a) { + return float( ! bool(a) ); + } + bool ${M}_(bool a) { + return !a; + } + vec4 ${M}_(vec4 v) { + return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); + } + bvec4 ${M}_(bvec4 v) { + return bvec4(!v.x, !v.y, !v.z, !v.w); + } + `,name:M,type:p.FunctionType.ValueBased}}function A(){return L("sin")}function O(){const M="relu";return{body:` + float ${M}_(float a) { + return max( a, 0.0 ); + } + vec4 ${M}_(vec4 v) { + return max( v, 0.0 ); + } + `,name:M,type:p.FunctionType.ValueBased}}function x(){const M="sigmoid";return{body:` + float ${M}_(float a) { + return 1.0 / (1.0 + exp(-a)); + } + vec4 ${M}_(vec4 v) { + return 1.0 / (1.0 + exp(-v)); + } + `,name:M,type:p.FunctionType.ValueBased}}function I(){return L("sqrt")}function $(){return L("tan")}function z(){const M="tanh";return{body:` + float ${M}_(float a) { + a = clamp(a, -10., 10.); + a = exp(2.*a); + return (a - 1.) / (a + 1.); + } + vec4 ${M}_(vec4 v) { + v = clamp(v, -10., 10.); + v = exp(2.*v); + return (v - 1.) / (v + 1.); + } + `,name:M,type:p.FunctionType.ValueBased}}function L(M){return{body:` + float ${M}_(float a) { + return ${M}(a); + } + vec4 ${M}_(vec4 v) { + return ${M}(v); + } + `,name:M,type:p.FunctionType.ValueBased}}n.glslAbs=f,n.glslAcos=u,n.glslAsin=o,n.glslAtan=t,n.glslCeil=e,n.glslCos=r,n.glslElu=i,n.glslExp=d,n.glslFloor=g,n.glslClip=m,n.glslIdentity=b,n.glslLeakyRelu=y,n.glslLog=v,n.glslNeg=w,n.glslNot=S,n.glslSin=A,n.glslRelu=O,n.glslSigmoid=x,n.glslSqrt=I,n.glslTan=$,n.glslTanh=z;const N=(M,j,Z,X)=>{const Q=M.session.pack?h.TextureType.packed:h.TextureType.unpacked,ee={name:Z.name,inputTypes:[Q],inputNames:["A"],cacheHint:X};return Object.assign(Object.assign({},ee),{get:()=>((ue,Ae,xe,oe)=>{const we=ue.session.pack?h.TextureType.packed:h.TextureType.unpacked,ye=(0,a.getGlsl)(ue.session.backend.glContext.version);return Object.assign(Object.assign({},Ae),{output:{dims:xe.dims,type:xe.type,textureType:we},shaderSource:` + ${oe.body} + void main() { + vec4 v = ${ye.texture2D}(A, TexCoords); + v = ${oe.name}_(v); + ${ye.output} = v; + } + `,hasMain:!0})})(M,ee,j,Z)})};n.abs=(M,j)=>[M.run(N(M,j[0],f()),j)],n.acos=(M,j)=>[M.run(N(M,j[0],u()),j)],n.asin=(M,j)=>[M.run(N(M,j[0],o()),j)],n.atan=(M,j)=>[M.run(N(M,j[0],t()),j)],n.clip=(M,j,Z)=>[M.run(N(M,j[0],m(Z.min,Z.max),Z.cacheKey),j)],n.parseClipAttributes=M=>(0,c.createAttributeWithCacheKey)({min:M.attributes.getFloat("min",l.MIN_CLIP),max:M.attributes.getFloat("max",l.MAX_CLIP)}),n.clipV11=(M,j)=>{const Z=H(M,j);return(0,n.clip)(M,[j[0]],Z)};const H=(M,j)=>{if(j.length>=3&&(!M.session.isInitializer(j[1].dataId)||!M.session.isInitializer(j[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const Z=j.length>=3?j[1].numberData[0]:l.MIN_CLIP,X=j.length>=3?j[2].numberData[0]:l.MAX_CLIP;return(0,c.createAttributeWithCacheKey)({min:Z,max:X})};n.ceil=(M,j)=>[M.run(N(M,j[0],e()),j)],n.cos=(M,j)=>[M.run(N(M,j[0],r()),j)],n.elu=(M,j,Z)=>[M.run(N(M,j[0],i(Z.alpha),Z.cacheKey),j)],n.parseEluAttributes=M=>(0,c.createAttributeWithCacheKey)({alpha:M.attributes.getFloat("alpha",1)}),n.exp=(M,j)=>[M.run(N(M,j[0],d()),j)],n.floor=(M,j)=>[M.run(N(M,j[0],g()),j)],n.identity=(M,j)=>[M.run(N(M,j[0],b()),j)],n.leakyRelu=(M,j,Z)=>[M.run(N(M,j[0],y(Z.alpha),Z.cacheKey),j)],n.parseLeakyReluAttributes=M=>(0,c.createAttributeWithCacheKey)({alpha:M.attributes.getFloat("alpha",.01)}),n.log=(M,j)=>[M.run(N(M,j[0],v()),j)],n.neg=(M,j)=>[M.run(N(M,j[0],w()),j)],n.not=(M,j)=>[M.run(N(M,j[0],S()),j)],n.relu=(M,j)=>[M.run(N(M,j[0],O()),j)],n.sigmoid=(M,j)=>[M.run(N(M,j[0],x()),j)],n.sin=(M,j)=>[M.run(N(M,j[0],A()),j)],n.sqrt=(M,j)=>[M.run(N(M,j[0],I()),j)],n.tan=(M,j)=>[M.run(N(M,j[0],$()),j)],n.tanh=(M,j)=>[M.run(N(M,j[0],z()),j)]},5611:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createUnpackProgramInfoLoader=n.createUnpackProgramInfo=void 0;const c=s(5060),l=s(2039),p=s(9390),a=s(2827),h={name:"unpack",inputNames:["A"],inputTypes:[l.TextureType.packed]};n.createUnpackProgramInfo=(f,u)=>{const o=u.dims.length,t=(0,a.getChannels)("rc",o),e=t.slice(-2),r=(0,p.getCoordsDataType)(o),i=(0,a.unpackFromChannel)(),d=u.dims.length===0?"":function(b,y){if(b===1)return"rc";let v="";for(let w=0;wObject.assign(Object.assign({},h),{get:()=>(0,n.createUnpackProgramInfo)(f,u)})},8428:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseUnsqueezeAttributes=n.unsqueezeV13=n.unsqueeze=void 0;const c=s(2517);n.unsqueeze=(a,h,f)=>{l(h);const u=c.ShapeUtil.unsqueezeShape(h[0].dims,f);return[a.reshapeUnpacked(h[0],u)]},n.unsqueezeV13=(a,h)=>(p(h),(0,n.unsqueeze)(a,[h[0]],Array.from(h[1].integerData))),n.parseUnsqueezeAttributes=a=>a.attributes.getInts("axes");const l=a=>{if(!a||a.length!==1)throw new Error("Unsqueeze requires 1 input.");if(a[0].type==="string")throw new Error("invalid input tensor types.")},p=a=>{if(!a||a.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(a[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.scalesValidation=n.validateInputs=n.parseUpsampleAttributes=n.parseUpsampleAttributesV9=n.parseUpsampleAttributesV7=n.upsample=void 0;const c=s(246),l=s(5060),p=s(2039),a={name:"Upsample",inputNames:["X"],inputTypes:[p.TextureType.unpacked]};n.upsample=(f,u,o)=>((0,n.validateInputs)(u,o),[f.run(Object.assign(Object.assign({},a),{cacheHint:o.cacheKey,get:()=>h(f,u,o)}),u)]),n.parseUpsampleAttributesV7=f=>(0,n.parseUpsampleAttributes)(f,7),n.parseUpsampleAttributesV9=f=>(0,n.parseUpsampleAttributes)(f,9),n.parseUpsampleAttributes=(f,u)=>{const o=u>=10,t=f.attributes.getString("mode","nearest");if(t!=="nearest"&&t!=="linear"&&(u<11||t!=="cubic"))throw new Error(`unrecognized mode: ${t}`);let e=[];u<9&&(e=f.attributes.getFloats("scales"),(0,n.scalesValidation)(e,t,o));const r=f.attributes.getFloat("extrapolation_value",0),i=u>10?f.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(i)===-1)throw new Error(`coordinate_transform_mode '${i}' is not supported`);const d=i==="tf_crop_and_resize",g=d,m=t==="nearest"&&u>=11?f.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(m)===-1)throw new Error(`nearest_mode '${m}' is not supported`);const b=f.attributes.getFloat("cubic_coeff_a",-.75),y=f.attributes.getInt("exclude_outside",0)!==0;if(y&&t!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const v=u<11||t==="nearest"&&i==="asymmetric"&&m==="floor";let w=0,S=0,A=0;return u>10?f.inputs.length>2?(w=1,S=2,A=3):(S=1,A=2):u===9&&(S=1),(0,c.createAttributeWithCacheKey)({opset:u,isResize:o,mode:t,scales:e,extrapolationValue:r,coordinateTransformMode:i,useExtrapolation:g,needRoiInput:d,nearestMode:m,cubicCoefficientA:b,excludeOutside:y,useNearest2xOptimization:v,roiInputIdx:w,scalesInputIdx:S,sizesInputIdx:A})};const h=(f,u,o)=>{const t=(0,l.getGlsl)(f.session.backend.glContext.version),[e,r]=f.calculateTextureWidthAndHeight(u[0].dims,p.TextureType.unpacked),i=u[0].dims.map((A,O)=>Math.floor(A*o.scales[O])),[d,g]=f.calculateTextureWidthAndHeight(i,p.TextureType.unpacked),m=i.length,b=new Array(m),y=new Array(m);let v=` + int output_pitches[${m}]; + int input_pitches[${m}]; + `;for(let A=m-1;A>=0;A--)b[A]=A===m-1?1:b[A+1]*i[A+1],y[A]=A===m-1?1:y[A+1]*u[0].dims[A+1],v+=` + output_pitches[${A}] = ${b[A]}; + input_pitches[${A}] = ${y[A]}; + `;const w=` + float getInputFloat(int index) { + vec2 coords = offsetToCoords(index, ${e}, ${r}); + float value = getColorAsFloat(${t.texture2D}(X, coords)); + return value; + } + `,S=o.mode==="nearest"?` + ${w} + float process(int indices[${m}]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${d}, ${g}); + + ${v} + + int d, m; + for (int dim = 0; dim < ${m}; ++dim) { + d = output_index / output_pitches[dim]; + m = output_index - d * output_pitches[dim]; + output_index = m; + + if (scales[dim] != 1 && d > 0) { + int d2 = d / scales[dim]; + m = d - d2 * scales[dim]; + d = d2; + } + input_index += input_pitches[dim] * d; + } + + return getInputFloat(input_index); + }`:m===4?` + ${w} + float process(int indices[4]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${d}, ${g}); + + ${v} + + int m; + int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m / output_pitches[1]; + m = m - index_of_dim1 * output_pitches[1]; + index_of_dim2 = m / output_pitches[2]; + m = m - index_of_dim2 * output_pitches[2]; + index_of_dim3 = m; + + int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; + index_of_input_dim2 = index_of_dim2 / scales[2]; + y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; + index_of_input_dim3 = index_of_dim3 / scales[3]; + x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; + + input_index = index_of_dim0 * input_pitches[0] + + index_of_dim1 * input_pitches[1] + + index_of_input_dim2 * input_pitches[2] + + index_of_input_dim3; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim2 = false; + if (index_of_input_dim2 == (${u[0].dims[2]} - 1)) { + // It's the end in dimension 2 + x01 = x00; + end_of_dim2 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[2]); + } + + if (index_of_input_dim3 == (input_pitches[2] - 1)) { + // It's the end in dimension 3 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); + }`:` + ${w} + float process(int indices[2]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${d}, ${g}); + + ${v} + + int m; + int index_of_dim0, index_of_dim1; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m; + + int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; + index_of_input_dim0 = index_of_dim0 / scales[0]; + y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; + index_of_input_dim1 = index_of_dim1 / scales[1]; + x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; + + input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim0 = false; + if (index_of_input_dim0 == (${u[0].dims[0]} - 1)) { + // It's the end in dimension 0 + x01 = x00; + end_of_dim0 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[0]); + } + + if (index_of_input_dim1 == (input_pitches[0] - 1)) { + // It's the end in dimension 1 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); + }`;return Object.assign(Object.assign({},a),{output:{dims:i,type:u[0].type,textureType:p.TextureType.unpacked},shaderSource:S,variables:[{name:"scales",type:"int",arrayLength:o.scales.length,data:o.scales.map(A=>Math.ceil(A))}]})};n.validateInputs=(f,u)=>{if(!f||u.opset<9&&f.length!==1||u.opset>=9&&u.opset<11&&f.length!==2||u.opset>=11&&f.length<2)throw new Error("invalid inputs.");if(u.scales.length>0&&f[0].dims.length!==u.scales.length)throw new Error("Invalid input shape.");if(f[0].type==="string")throw new Error("Invalid input tensor types.")},n.scalesValidation=(f,u,o)=>{if(o){for(const t of f)if(t<=0)throw new Error("Scale value should be greater than 0.")}else for(const t of f)if(t<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(u!=="linear"&&u!=="cubic"||f.length===2||f.length===4&&f[0]===1&&f[1]===1))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${o?"Resize":"Upsample"} opeartor.`)}},1958:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ProgramManager=void 0;const c=s(1670),l=s(6231),p=s(8879),a=s(5060);n.ProgramManager=class{constructor(h,f,u){this.profiler=h,this.glContext=f,this.textureLayoutStrategy=u,this.repo=new Map,this.attributesBound=!1}getArtifact(h){return this.repo.get(h)}setArtifact(h,f){this.repo.set(h,f)}run(h,f,u){var o;this.profiler.event("op",`ProgramManager.run ${(o=h.programInfo.name)!==null&&o!==void 0?o:"unknown kernel"}`,()=>{var t;const e=this.glContext.gl,r=h.program;e.useProgram(r);try{this.bindOutput(u),this.attributesBound||this.bindAttributes(h.attribLocations),this.bindUniforms(h.uniformLocations,(t=h.programInfo.variables)!==null&&t!==void 0?t:[],f)}catch(i){throw l.Logger.error("ProgramManager",h.programInfo.shaderSource),i}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(h=>this.glContext.deleteProgram(h.program))}build(h,f,u){return this.profiler.event("backend","ProgramManager.build",()=>{const o=new p.GlslPreprocessor(this.glContext,h,f,u),t=o.preprocess(),e=this.compile(t);return{programInfo:h,program:e,uniformLocations:this.getUniformLocations(e,o.context.programInfo.inputNames,o.context.programInfo.variables),attribLocations:this.getAttribLocations(e)}})}compile(h){if(!this.vertexShader){l.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const o=(0,a.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(o,this.glContext.gl.VERTEX_SHADER)}c.env.debug&&l.Logger.verbose("ProrgramManager",`FragShader: +${h} +`);const f=this.glContext.compileShader(h,this.glContext.gl.FRAGMENT_SHADER),u=this.glContext.createProgram(this.vertexShader,f);return this.glContext.deleteShader(f),u}bindOutput(h){const f=h.width,u=h.height;l.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${f}/${u}, shape=${h.shape}, type=${h.tensor.type}`),this.glContext.attachFramebuffer(h.texture,f,u)}bindAttributes(h){const f=h.position,u=h.textureCoord;this.glContext.setVertexAttributes(f,u),this.attributesBound=!0}bindUniforms(h,f,u){var o;const t=this.glContext.gl;let e=0;for(const{name:r,type:i,location:d,arrayLength:g}of h){const m=(o=f.find(b=>b.name===r))===null||o===void 0?void 0:o.data;if(i!=="sampler2D"&&!m)throw new Error(`variable '${r}' does not have data defined in program info`);switch(i){case"sampler2D":this.bindTexture(u[e],d,e),e++;break;case"float":g?t.uniform1fv(d,m):t.uniform1f(d,m);break;case"int":g?t.uniform1iv(d,m):t.uniform1i(d,m);break;default:throw new Error(`Uniform not implemented: ${i}`)}}}bindTexture(h,f,u){this.glContext.bindTextureToUniform(h.texture,u,f)}getAttribLocations(h){return{position:this.getAttribLocation(h,"position"),textureCoord:this.getAttribLocation(h,"textureCoord")}}getUniformLocations(h,f,u){const o=[];if(f)for(const t of f)o.push({name:t,type:"sampler2D",location:this.getUniformLocation(h,t)});if(u)for(const t of u)o.push(Object.assign(Object.assign({},t),{location:this.getUniformLocation(h,t.name)}));return o}getUniformLocation(h,f){const u=this.glContext.gl.getUniformLocation(h,f);if(u===null)throw new Error(`Uniform ${f} not found.`);return u}getAttribLocation(h,f){return this.glContext.gl.getAttribLocation(h,f)}}},6416:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLSessionHandler=void 0;const c=s(6231),l=s(1047),p=s(8316),a=s(1640),h=s(1958),f=s(7859),u=s(5702);n.WebGLSessionHandler=class{constructor(o,t){this.backend=o,this.context=t,this.layoutStrategy=new f.PreferLogicalStrategy(o.glContext.maxTextureSize),this.programManager=new h.ProgramManager(this.context.profiler,o.glContext,this.layoutStrategy),this.textureManager=new u.TextureManager(o.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:o.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=o.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new p.WebGLInferenceHandler(this)}onGraphInitialized(o){const t=o.getValues().filter(e=>e.from===-1&&e.tensor).map(e=>e.tensor.dataId);this.initializers=new Set(t)}isInitializer(o){return!!this.initializers&&this.initializers.has(o)}addInitializer(o){this.initializers.add(o)}getTextureData(o,t){return t?this.packedTextureDataCache.get(o):this.unpackedTextureDataCache.get(o)}setTextureData(o,t,e=!1){c.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),e?this.packedTextureDataCache.set(o,t):this.unpackedTextureDataCache.set(o,t)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.unpackedTextureDataCache=new Map}resolve(o,t,e){const r=(0,l.resolveOperator)(o,t,a.WEBGL_OP_RESOLVE_RULES);return{impl:r.opImpl,context:r.opInit?r.opInit(o,e):o}}}},7769:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Uint8DataEncoder=n.RGBAFloatDataEncoder=n.RedFloat32DataEncoder=void 0;const c=s(6231);n.RedFloat32DataEncoder=class{constructor(l,p=1){if(p===1)this.internalFormat=l.R32F,this.format=l.RED,this.textureType=l.FLOAT,this.channelSize=p;else{if(p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=l.RGBA32F,this.format=l.RGBA,this.textureType=l.FLOAT,this.channelSize=p}}encode(l,p){let a,h;return l.constructor!==Float32Array&&(c.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),h=new Float32Array(l)),p*this.channelSize>l.length?(c.Logger.warning("Encoder","Source data too small. Allocating larger array"),h=l,a=this.allocate(p*this.channelSize),h.forEach((f,u)=>a[u]=f)):(h=l,a=h),a}allocate(l){return new Float32Array(4*l)}decode(l,p){return this.channelSize===1?l.filter((a,h)=>h%4==0).subarray(0,p):l.subarray(0,p)}},n.RGBAFloatDataEncoder=class{constructor(l,p=1,a){if(p!==1&&p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=l.RGBA,this.format=l.RGBA,this.channelSize=p,this.textureType=a||l.FLOAT}encode(l,p){let a=l;return this.channelSize===1&&(c.Logger.verbose("Encoder","Exploding into a larger array"),a=this.allocate(p),l.forEach((h,f)=>a[4*f]=h)),a}allocate(l){return new Float32Array(4*l)}decode(l,p){return this.channelSize===1?l.filter((a,h)=>h%4==0).subarray(0,p):l.subarray(0,p)}},n.Uint8DataEncoder=class{constructor(l,p=1){if(this.channelSize=4,p===1)this.internalFormat=l.ALPHA,this.format=l.ALPHA,this.textureType=l.UNSIGNED_BYTE,this.channelSize=p;else{if(p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=l.RGBA,this.format=l.RGBA,this.textureType=l.UNSIGNED_BYTE,this.channelSize=p}}encode(l,p){return new Uint8Array(l.buffer,l.byteOffset,l.byteLength)}allocate(l){return new Uint8Array(l*this.channelSize)}decode(l,p){if(l instanceof Uint8Array)return l.subarray(0,p);throw new Error(`Invalid array type: ${l.constructor}`)}}},7859:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getBatchDim=n.sizeToSquarishShape=n.getRowsCols=n.sizeFromShape=n.isInt=n.parseAxisParam=n.squeezeShape=n.PreferLogicalStrategy=n.AlwaysKeepOriginalSizeStrategy=void 0;const c=s(6231),l=s(2517);function p(o,t){const e=[],r=[],i=t!=null&&Array.isArray(t)&&t.length===0,d=t==null||i?null:a(t,o).sort();let g=0;for(let m=0;mm)&&o[m]===1&&(e.push(o[m]),r.push(m)),d[g]<=m&&g++}o[m]!==1&&(e.push(o[m]),r.push(m))}return{newShape:e,keptDims:r}}function a(o,t){const e=t.length;return o=o==null?t.map((r,i)=>i):[].concat(o),(0,l.assert)(o.every(r=>r>=-e&&r`All values in axis param must be in range [-${e}, ${e}) but got axis ${o}`),(0,l.assert)(o.every(h),()=>`All values in axis param must be integers but got axis ${o}`),o.map(r=>r<0?e+r:r)}function h(o){return o%1==0}function f(o){if(o.length===0)return 1;let t=o[0];for(let e=1;e=o.length?1:o.slice(t.breakAxis).reduce((m,b)=>m*b),g=t.breakAxis<=0?1:o.slice(0,t.breakAxis).reduce((m,b)=>m*b);if(!(d>e||g>e))return[d,g];c.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${t.breakAxis}`)}const r=o.reduce((d,g)=>d*g);let i=Math.floor(Math.sqrt(r));for(;i=e||r%i!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${o}`);return[i,r/i]}},n.PreferLogicalStrategy=class{constructor(o){this.maxTextureSize=o}computeTextureWH(o,t){const e=this.computeTexture(o,t);return t&&t.isPacked&&(e[0]/=2,e[1]/=2),t&&t.reverseWH?[e[1],e[0]]:e}computeTexture(o,t){const e=t&&t.isPacked;if(o.length===0)return e?[2,2]:[1,1];let r=this.maxTextureSize;if(t&&t.breakAxis!==void 0){const g=t.breakAxis>=o.length?1:o.slice(t.breakAxis).reduce((b,y)=>b*y),m=t.breakAxis<=0?1:o.slice(0,t.breakAxis).reduce((b,y)=>b*y);if(!(g>r||m>r))return[g,m];c.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${t.breakAxis}`)}let i=o.slice(0);e&&(r*=2,i=i.map((g,m)=>m>=i.length-2?i[m]%2==0?i[m]:i[m]+1:i[m]),i.length===1&&(i=[2,i[0]])),i.length!==2&&(i=p(i).newShape);const d=f(i);return i.length<=1&&d<=r?[1,d]:i.length===2&&i[0]<=r&&i[1]<=r?i:i.length===3&&i[0]*i[1]<=r&&i[2]<=r?[i[0]*i[1],i[2]]:i.length===3&&i[0]<=r&&i[1]*i[2]<=r?[i[0],i[1]*i[2]]:i.length===4&&i[0]*i[1]*i[2]<=r&&i[3]<=r?[i[0]*i[1]*i[2],i[3]]:i.length===4&&i[0]<=r&&i[1]*i[2]*i[3]<=r?[i[0],i[1]*i[2]*i[3]]:e?u(d/4).map(g=>2*g):u(d)}},n.squeezeShape=p,n.parseAxisParam=a,n.isInt=h,n.sizeFromShape=f,n.getRowsCols=function(o){if(o.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[o.length>1?o[o.length-2]:1,o[o.length-1]]},n.sizeToSquarishShape=u,n.getBatchDim=function(o,t=2){return f(o.slice(0,o.length-t))}},4057:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createTextureLayoutFromShape=n.calculateTextureWidthAndHeight=n.createTextureLayoutFromTextureType=void 0;const c=s(2517),l=s(2039);n.createTextureLayoutFromTextureType=(p,a,h)=>{const f=h===l.TextureType.unpacked||h===l.TextureType.unpackedReversed?1:4,u=h===l.TextureType.packed,o=h===l.TextureType.unpackedReversed||h===l.TextureType.packed,t=h===l.TextureType.packedLastDimension?a.length-1:void 0,e=h===l.TextureType.packedLastDimension?a.map((r,i)=>i===a.length-1?4*r:r):void 0;return(0,n.createTextureLayoutFromShape)(p,a,f,e,{isPacked:u,reverseWH:o,breakAxis:t})},n.calculateTextureWidthAndHeight=(p,a,h)=>{const f=(0,n.createTextureLayoutFromTextureType)(p,a,h);return[f.width,f.height]},n.createTextureLayoutFromShape=(p,a,h=1,f,u)=>{const o=!(!u||!u.isPacked),[t,e]=p.computeTextureWH(o&&f||a,u),r=a.length;let i=a.slice(0);if(r===0&&(i=[1]),h===1)f=a;else if(o){if(h!==4)throw new Error("a packed texture must be 4-channel");f=a,r>0&&(i[r-1]=Math.ceil(i[r-1]/2)),r>1&&(i[r-2]=Math.ceil(i[r-2]/2))}else if(!f)throw new Error("Unpacked shape is needed when using channels > 1");return{width:t,height:e,channels:h,isPacked:o,shape:i,strides:c.ShapeUtil.computeStrides(i),unpackedShape:f,reversedWH:u&&u.reverseWH}}},5702:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TextureManager=void 0;const c=s(6231);n.TextureManager=class{constructor(l,p,a,h){this.glContext=l,this.layoutStrategy=p,this.profiler=a,this.config=h,this.pendingRead=new Map,h.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(l,p,a,h){const f=this.toEncoderType(l),u=this.glContext.getEncoder(f,p.channels||1,h);if(p.isPacked&&h===1)throw new Error("not implemented");const o=p.width,t=p.height;let e,r;if(this.config.reuseTextures){e=`${o}x${t}_${u.format}_${u.internalFormat}_${u.textureType}`,r=this.inUseTextures.get(e),r||(r=[],this.inUseTextures.set(e,r));const d=this.idleTextures.get(e);if(d&&d.length>0){const g=d.pop();return r.push(g),h===1&&this.glContext.updateTexture(g,o,t,u,this.toTextureData(l,a)),g}}c.Logger.verbose("TextureManager",`Creating new texture of size ${p.width}x${p.height}`);const i=this.glContext.allocateTexture(o,t,u,this.toTextureData(l,a));return this.config.reuseTextures&&(r.push(i),this.textureLookup.set(i,e)),i}readTexture(l,p,a){return a||(a=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const h=l.shape.reduce((u,o)=>u*o)*a,f=this.glContext.readTexture(l.texture,l.width,l.height,h,this.toEncoderType(p),a);return this.toTensorData(p,f)})}async readTextureAsync(l,p,a){const h=l.tensor.dataId;if(a||(a=1),this.pendingRead.has(h)){const f=this.pendingRead.get(h);return new Promise(u=>f==null?void 0:f.push(u))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(h,[]);const f=l.shape.reduce((e,r)=>e*r)*a;await this.glContext.createAndWaitForFence();const u=this.glContext.readTexture(l.texture,l.width,l.height,f,this.toEncoderType(p),a),o=this.toTensorData(p,u),t=this.pendingRead.get(h);return this.pendingRead.delete(h),t==null||t.forEach(e=>e(o)),o})}readUint8TextureAsFloat(l){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const p=l.shape.reduce((h,f)=>h*f),a=this.glContext.readTexture(l.texture,l.width,l.height,4*p,"byte",4);return new Float32Array(a.buffer,a.byteOffset,p)})}releaseTexture(l,p){let a;if(this.config.reuseTextures&&(a=this.textureLookup.get(l.texture),a)){p&&this.textureLookup.delete(a);const h=this.inUseTextures.get(a);if(h){const f=h.indexOf(l.texture);if(f!==-1){h.splice(f,1);let u=this.idleTextures.get(a);u||(u=[],this.idleTextures.set(a,u)),u.push(l.texture)}}}a&&!p||(c.Logger.verbose("TextureManager",`Deleting texture of size ${l.width}x${l.height}`),this.glContext.deleteTexture(l.texture))}toTensorData(l,p){switch(l){case"int16":return p instanceof Int16Array?p:Int16Array.from(p);case"int32":return p instanceof Int32Array?p:Int32Array.from(p);case"int8":return p instanceof Int8Array?p:Int8Array.from(p);case"uint16":return p instanceof Uint16Array?p:Uint16Array.from(p);case"uint32":return p instanceof Uint32Array?p:Uint32Array.from(p);case"uint8":case"bool":return p instanceof Uint8Array?p:Uint8Array.from(p);case"float32":return p instanceof Float32Array?p:Float32Array.from(p);case"float64":return p instanceof Float64Array?p:Float64Array.from(p);default:throw new Error(`TensorData type ${l} is not supported`)}}toTextureData(l,p){if(p)return p instanceof Float32Array?p:new Float32Array(p)}toEncoderType(l){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(_,n)=>{var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TextureType=void 0,(s=n.TextureType||(n.TextureType={}))[s.unpacked=0]="unpacked",s[s.unpackedReversed=1]="unpackedReversed",s[s.packed=2]="packed",s[s.downloadUint8AsFloat=3]="downloadUint8AsFloat",s[s.packedLastDimension=4]="packedLastDimension"},9390:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getGlChannels=n.getCoordsDataType=n.getSqueezedParams=n.squeezeInputShape=n.generateShaderFuncNameFromInputSamplerNameAtOutCoords=n.generateShaderFuncNameFromInputSamplerName=n.repeatedTry=n.getPackedShape=void 0;const c=s(2517);n.getPackedShape=function(l){const p=l.length;return l.slice(0,p-1).concat(l[p-1]/4)},n.repeatedTry=async function(l,p=h=>0,a){return new Promise((h,f)=>{let u=0;const o=()=>{if(l())return void h();u++;const t=p(u);a!=null&&u>=a?f():setTimeout(o,t)};o()})},n.generateShaderFuncNameFromInputSamplerName=function(l){return(0,c.assert)(l!==void 0&&l.length!==0,()=>"empty string found for sampler name"),"get"+l.charAt(0).toUpperCase()+l.slice(1)},n.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(l){return(0,c.assert)(l!==void 0&&l.length!==0,()=>"empty string found for sampler name"),"get"+l.charAt(0).toUpperCase()+l.slice(1)+"AtOutCoords"},n.squeezeInputShape=function(l,p){let a=JSON.parse(JSON.stringify(l));return a=p,a},n.getSqueezedParams=function(l,p){return p.map(a=>l[a]).join(", ")},n.getCoordsDataType=function(l){if(l<=1)return"int";if(l===2)return"ivec2";if(l===3)return"ivec3";if(l===4)return"ivec4";if(l===5)return"ivec5";if(l===6)return"ivec6";throw Error(`GPU for rank ${l} is not yet supported`)},n.getGlChannels=function(l=6){return["x","y","z","w","u","v"].slice(0,l)}},7305:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createNewWebGLContext=n.createWebGLContext=void 0;const c=s(6231),l=s(1713),p={};function a(h){const f=function(){if(typeof document>"u"){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const t=document.createElement("canvas");return t.width=1,t.height=1,t}();let u;const o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!h||h==="webgl2")&&(u=f.getContext("webgl2",o),u))try{return new l.WebGLContext(u,2)}catch(t){c.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${t}`)}if((!h||h==="webgl")&&(u=f.getContext("webgl",o)||f.getContext("experimental-webgl",o),u))try{return new l.WebGLContext(u,1)}catch(t){c.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${t}`)}throw new Error("WebGL is not supported")}n.createWebGLContext=function h(f){let u;f&&f!=="webgl2"||!("webgl2"in p)?f&&f!=="webgl"||!("webgl"in p)||(u=p.webgl):u=p.webgl2,u=u||a(f),f=f||u.version===1?"webgl":"webgl2";const o=u.gl;return p[f]=u,o.isContextLost()?(delete p[f],h(f)):(o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),u)},n.createNewWebGLContext=a},1713:function(_,n,s){var c=this&&this.__createBinding||(Object.create?function(o,t,e,r){r===void 0&&(r=e);var i=Object.getOwnPropertyDescriptor(t,e);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(o,r,i)}:function(o,t,e,r){r===void 0&&(r=e),o[r]=t[e]}),l=this&&this.__setModuleDefault||(Object.create?function(o,t){Object.defineProperty(o,"default",{enumerable:!0,value:t})}:function(o,t){o.default=t}),p=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var t={};if(o!=null)for(var e in o)e!=="default"&&Object.prototype.hasOwnProperty.call(o,e)&&c(t,o,e);return l(t,o),t};Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLContext=n.linearSearchLastTrue=void 0;const a=s(1670),h=p(s(7769)),f=s(9390);function u(o){let t=0;for(;tthis.isTimerResultAvailable(o)),this.getTimerResult(o)}async createAndWaitForFence(){const o=this.createFence(this.gl);return this.pollFence(o)}createFence(o){let t;const e=o,r=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return o.flush(),t=r===null?()=>!0:()=>{const i=e.clientWaitSync(r,0,0);return i===e.ALREADY_SIGNALED||i===e.CONDITION_SATISFIED},{query:r,isFencePassed:t}}async pollFence(o){return new Promise(t=>{this.addItemToPoll(()=>o.isFencePassed(),()=>t())})}pollItems(){const o=u(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=o;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(o+1)}async addItemToPoll(o,t){this.itemsToPoll.push({isDoneFn:o,resolveFn:t}),this.itemsToPoll.length>1||await(0,f.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExecutionPlan=void 0;const c=s(6231);class l{constructor(a,h){this.op=a,this.node=h}}n.ExecutionPlan=class{constructor(p,a,h){this.graph=p,this.profiler=h,this.initialize(a)}initialize(p){this.profiler.event("session","ExecutionPlan.initialize",()=>{const a=this.graph.getNodes();if(a.length!==p.length)throw new Error("The size of nodes and OPs do not match.");this._ops=p.map((h,f)=>new l(h,a[f])),this.reset(),this._starter=[],this._ops.forEach((h,f)=>{let u=!0;for(const o of h.node.inputs)if(!this._values[o]&&this.graph.getInputIndices().indexOf(o)===-1){u=!1;break}u&&this._starter.push(f)})})}reset(){this._values=this.graph.getValues().map(p=>p.tensor)}async execute(p,a){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const h=p.createInferenceHandler(),f=this.graph.getInputIndices();if(a.length!==f.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${a.length} expected: ${f.length}`);a.forEach((i,d)=>{const g=f[d];this._values[g]=i});const u=this._starter.slice(0),o=this.graph.getValues(),t=this.graph.getNodes();let e=0;for(;ethis._values[v]);if(g.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${d.node}`);const m=g;c.Logger.verbose("ExecPlan",`Runing op:${d.node.name} (${m.map((v,w)=>`'${d.node.inputs[w]}': ${v.type}[${v.dims.join(",")}]`).join(", ")})`);const b=await this.profiler.event("node",d.node.name,async()=>d.op.impl(h,m,d.op.context));if(b.length!==d.node.outputs.length)throw new Error("the size of output does not match model definition.");b.forEach((v,w)=>{const S=d.node.outputs[w];if(this._values[S])throw new Error(`output [${S}] already has value: op:${d.node.name}`);this._values[S]=v});const y=new Set;b.forEach((v,w)=>{const S=d.node.outputs[w];for(const A of o[S].to){const O=t[A];let x=!0;for(const I of O.inputs)if(!this._values[I]){x=!1;break}x&&y.add(A)}}),u.push(...y)}const r=[];for(let i=0;i{Object.defineProperty(n,"__esModule",{value:!0}),n.Graph=void 0;const c=s(1446),l=s(7778),p=s(9395),a=s(9162),h=s(2517);var f=p.onnxruntime.experimental.fbs;n.Graph={from:(e,r)=>new t(e,r)};class u{constructor(r){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,r&&(this.type=h.ProtoUtil.tensorValueTypeFromProto(r.type.tensorType))}get from(){return this._from}get to(){return this._to}}class o{constructor(r,i){r instanceof c.onnx.NodeProto?(this.name=r.name,this.opType=r.opType,this.attributes=new l.Attribute(r.attribute)):r instanceof f.Node&&(this.name=i??r.name(),this.opType=r.opType(),this.attributes=new l.Attribute(h.ProtoUtil.tensorAttributesFromORTFormat(r))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class t{constructor(r,i){if(!r)throw new TypeError("graph is empty");this.buildGraph(r),this.transformGraph(i),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(r){if(r instanceof c.onnx.GraphProto)this.buildGraphFromOnnxFormat(r);else{if(!(r instanceof f.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(r)}}buildGraphFromOnnxFormat(r){const i=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const d=new Map;if(!r.input)throw new Error("missing information in graph: input");const g=[];for(const m of r.input){if(i.has(m.name))throw new Error(`duplicated input name: ${m.name}`);const b=this._allData.push(new u(m))-1;i.set(m.name,b),g.push(m.name)}if(!r.initializer)throw new Error("missing information in graph: initializer");for(const m of r.initializer){let b=i.get(m.name);if(b===void 0){const y=new u;y.type={shape:{dims:h.ProtoUtil.tensorDimsFromProto(m.dims)},tensorType:h.ProtoUtil.tensorDataTypeFromProto(m.dataType)},b=this._allData.push(y)-1,i.set(m.name,b)}this._allData[b]._from=-1,this._allData[b].tensor=a.Tensor.fromProto(m)}for(let m=0;m{this._allData[g]._to.forEach(m=>{r.add(m)})});const i=Array.from(r),d=new Array(this._nodes.length).fill("white");for(;i.length>0;){const g=i.pop();d[g]==="gray"?d[g]="black":(i.push(g),d[g]="gray",this._nodes[g].outputs.forEach(m=>{const b=this._allData[m];if(b.tensor!==void 0)throw new Error("node outputs should not be initialized");if(b._from!==g)throw new Error("from property of the Value object doesn't match index of Node being processed");b._to.forEach(y=>{if(d[y]==="gray")throw new Error("model graph is cyclic");d[y]==="white"&&i.push(y)})}))}}transformGraph(r){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),r&&r.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let r=0;for(let i=0;i0&&(this._nodes[i].inputs.forEach(d=>{const g=this._allData[d]._to.indexOf(i+r);g!==-1&&(this._allData[d]._to[g]=i)}),this._nodes[i].outputs.forEach(d=>{this._allData[d]._from&&this._allData[d]._from===i+r&&(this._allData[d]._from=i)})):(r++,this._nodes[i].outputs.forEach(d=>{this._allData[d]._from=-2}),this._nodes.splice(i,1),i--);r=0;for(let i=0;i0){let d=-1;this._allData[i].from!==void 0&&this._allData[i].from!==-1?(d=this._nodes[this._allData[i].from].outputs.indexOf(i+r),d!==-1&&(this._nodes[this._allData[i].from].outputs[d]=i)):(d=this._allInputIndices.indexOf(i+r),d!==-1&&(this._allInputIndices[d]=i)),this._allData[i].to.forEach(g=>{d=this._nodes[g].inputs.indexOf(i+r),d!==-1&&(this._nodes[g].inputs[d]=i)}),this._allData[i].to.length===0&&(d=this._allOutputIndices.indexOf(i+r),d!==-1&&(this._allOutputIndices[d]=i))}}else r++,this._allData.splice(i,1),i--}deleteNode(r){const i=this._nodes[r];if(i.outputs.length>1){for(let v=1;v0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}i.executeNode=!1;const d=i.inputs[0],g=i.outputs[0],m=this._allData[g].to,b=this._allData[d].to.indexOf(r);if(b===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[d].to.splice(b,1),this._allData[g]._to=[];const y=this._allOutputIndices.indexOf(g);if(y!==-1&&(this._allOutputIndices[y]=d),m&&m.length>0)for(const v of m){const w=this._nodes[v].inputs.indexOf(g);if(w===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[v].inputs[w]=d,this._allData[d].to.push(v)}}removeAllDropoutNodes(){let r=0;for(const i of this._nodes){if(i.opType==="Dropout"){if(i.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(i.outputs.length!==1&&i.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(i.outputs.length===2&&this._allData[i.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(r)}r++}}removeAllIdentityNodes(){let r=0;for(const i of this._nodes)i.opType==="Identity"&&this.deleteNode(r),r++}isActivation(r){switch(r.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const r of this._nodes)if(r.opType==="Conv"){const i=this._allData[r.outputs[0]]._to;if(i.length===1&&this.isActivation(this._nodes[i[0]])){const d=this._nodes[i[0]];if(d.opType==="Clip")if(d.inputs.length===1)try{r.attributes.set("activation_params","floats",[d.attributes.getFloat("min"),d.attributes.getFloat("max")])}catch{r.attributes.set("activation_params","floats",[h.MIN_CLIP,h.MAX_CLIP])}else{if(!(d.inputs.length>=3&&this._allData[d.inputs[1]].tensor!==void 0&&this._allData[d.inputs[2]].tensor!==void 0))continue;r.attributes.set("activation_params","floats",[this._allData[d.inputs[1]].tensor.floatData[0],this._allData[d.inputs[2]].tensor.floatData[0]])}r.attributes.set("activation","string",d.opType),this.deleteNode(i[0])}}}}},6231:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.now=n.Profiler=n.Logger=void 0;const s={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},c={none:new class{log(o,t,e){}},console:new class{log(o,t,e){console.log(`${this.color(o)} ${e?"\x1B[35m"+e+"\x1B[0m ":""}${t}`)}color(o){switch(o){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${o}`)}}}},l={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let p={"":l};function a(o,t,e,r){if(t===void 0)return i=o,{verbose:a.verbose.bind(null,i),info:a.info.bind(null,i),warning:a.warning.bind(null,i),error:a.error.bind(null,i),fatal:a.fatal.bind(null,i)};if(e===void 0)h(o,t);else if(typeof e=="number"&&r===void 0)h(o,t);else if(typeof e=="string"&&r===void 0)h(o,e,0,t);else{if(typeof e!="string"||typeof r!="number")throw new TypeError("input is valid");h(o,e,0,t)}var i}function h(o,t,e,r){const i=p[r||""]||p[""];s[o]{g.then(async y=>{i&&await i.end(),m(y)},async y=>{i&&await i.end(),b(y)})});if(!d&&i){const m=i.end();if(m&&typeof m.then=="function")return new Promise((b,y)=>{m.then(()=>{b(g)},v=>{y(v)})})}return g}begin(o,t,e){if(!this._started)throw new Error("profiler is not started yet");if(e===void 0){const r=(0,n.now)();return this.flush(r),new f(o,t,r,i=>this.endSync(i))}{const r=e.beginTimer();return new f(o,t,0,async i=>this.end(i),r,e)}}async end(o){const t=await o.checkTimer();this._timingEvents.length=this._flushBatchSize||o-this._flushTime>=this._flushIntervalInMilliseconds){for(const t=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Model=void 0;const c=s(5686),l=s(1446),p=s(7070),a=s(9395),h=s(2517);var f=a.onnxruntime.experimental.fbs;n.Model=class{constructor(){}load(u,o,t){if(!t)try{return void this.loadFromOnnxFormat(u,o)}catch(e){if(t!==void 0)throw e}this.loadFromOrtFormat(u,o)}loadFromOnnxFormat(u,o){const t=l.onnx.ModelProto.decode(u);if(h.LongUtil.longToNumber(t.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=t.opsetImport.map(e=>({domain:e.domain,version:h.LongUtil.longToNumber(e.version)})),this._graph=p.Graph.from(t.graph,o)}loadFromOrtFormat(u,o){const t=new c.flatbuffers.ByteBuffer(u),e=f.InferenceSession.getRootAsInferenceSession(t).model();if(h.LongUtil.longToNumber(e.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let r=0;r{Object.defineProperty(n,"__esModule",{value:!0}),n.FLOAT_TYPES=n.INT_TYPES=n.NUMBER_TYPES=void 0,n.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],n.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],n.FLOAT_TYPES=["float32","float64"]},1047:(_,n)=>{function s(c,l){if(l.endsWith("+")){const p=Number.parseInt(l.substring(0,l.length-1),10);return!isNaN(p)&&p<=c}if(l.split("-").length===2){const p=l.split("-"),a=Number.parseInt(p[0],10),h=Number.parseInt(p[1],10);return!isNaN(a)&&!isNaN(h)&&a<=c&&c<=h}return Number.parseInt(l,10)===c}Object.defineProperty(n,"__esModule",{value:!0}),n.resolveOperator=void 0,n.resolveOperator=function(c,l,p){for(const a of p){const h=a[0],f=a[1],u=a[2],o=a[3],t=a[4];if(c.opType===h){for(const e of l)if((e.domain===f||e.domain==="ai.onnx"&&f==="")&&s(e.version,u))return{opImpl:o,opInit:t}}}throw new TypeError(`cannot resolve operator '${c.opType}' with opsets: ${l.map(a=>`${a.domain||"ai.onnx"} v${a.version}`).join(", ")}`)}},9395:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.onnxruntime=void 0;const c=s(5686);var l,p;l=n.onnxruntime||(n.onnxruntime={}),function(a){(function(h){h[h.UNDEFINED=0]="UNDEFINED",h[h.FLOAT=1]="FLOAT",h[h.INT=2]="INT",h[h.STRING=3]="STRING",h[h.TENSOR=4]="TENSOR",h[h.GRAPH=5]="GRAPH",h[h.FLOATS=6]="FLOATS",h[h.INTS=7]="INTS",h[h.STRINGS=8]="STRINGS",h[h.TENSORS=9]="TENSORS",h[h.GRAPHS=10]="GRAPHS",h[h.SPARSE_TENSOR=11]="SPARSE_TENSOR",h[h.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(a.AttributeType||(a.AttributeType={}))}((p=l.experimental||(l.experimental={})).fbs||(p.fbs={})),function(a){(function(h){(function(f){(function(u){u[u.UNKNOWN=0]="UNKNOWN",u[u.VALUE=1]="VALUE",u[u.PARAM=2]="PARAM"})(f.DimensionValueType||(f.DimensionValueType={}))})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){(function(u){u[u.UNDEFINED=0]="UNDEFINED",u[u.FLOAT=1]="FLOAT",u[u.UINT8=2]="UINT8",u[u.INT8=3]="INT8",u[u.UINT16=4]="UINT16",u[u.INT16=5]="INT16",u[u.INT32=6]="INT32",u[u.INT64=7]="INT64",u[u.STRING=8]="STRING",u[u.BOOL=9]="BOOL",u[u.FLOAT16=10]="FLOAT16",u[u.DOUBLE=11]="DOUBLE",u[u.UINT32=12]="UINT32",u[u.UINT64=13]="UINT64",u[u.COMPLEX64=14]="COMPLEX64",u[u.COMPLEX128=15]="COMPLEX128",u[u.BFLOAT16=16]="BFLOAT16"})(f.TensorDataType||(f.TensorDataType={}))})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){(function(u){u[u.Primitive=0]="Primitive",u[u.Fused=1]="Fused"})(f.NodeType||(f.NodeType={}))})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){(function(u){u[u.NONE=0]="NONE",u[u.tensor_type=1]="tensor_type",u[u.sequence_type=2]="sequence_type",u[u.map_type=3]="map_type"})(f.TypeInfoValue||(f.TypeInfoValue={}))})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsShape(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsShape(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}dim(t,e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new a.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}dimLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}static startShape(t){t.startObject(1)}static addDim(t,e){t.addFieldOffset(0,e,0)}static createDimVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startDimVector(t,e){t.startVector(4,e,4)}static endShape(t){return t.endObject()}static createShape(t,e){return u.startShape(t),u.addDim(t,e),u.endShape(t)}}f.Shape=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimension(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimension(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}value(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new a.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}denotation(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimension(t){t.startObject(2)}static addValue(t,e){t.addFieldOffset(0,e,0)}static addDenotation(t,e){t.addFieldOffset(1,e,0)}static endDimension(t){return t.endObject()}static createDimension(t,e,r){return u.startDimension(t),u.addValue(t,e),u.addDenotation(t,r),u.endDimension(t)}}f.Dimension=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimensionValue(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimensionValue(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}dimType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):a.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}dimParam(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimensionValue(t){t.startObject(3)}static addDimType(t,e){t.addFieldInt8(0,e,a.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static addDimParam(t,e){t.addFieldOffset(2,e,0)}static endDimensionValue(t){return t.endObject()}static createDimensionValue(t,e,r,i){return u.startDimensionValue(t),u.addDimType(t,e),u.addDimValue(t,r),u.addDimParam(t,i),u.endDimensionValue(t)}}f.DimensionValue=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensorTypeAndShape(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensorTypeAndShape(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}elemType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):a.experimental.fbs.TensorDataType.UNDEFINED}shape(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new a.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startTensorTypeAndShape(t){t.startObject(2)}static addElemType(t,e){t.addFieldInt32(0,e,a.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(t,e){t.addFieldOffset(1,e,0)}static endTensorTypeAndShape(t){return t.endObject()}static createTensorTypeAndShape(t,e,r){return u.startTensorTypeAndShape(t),u.addElemType(t,e),u.addShape(t,r),u.endTensorTypeAndShape(t)}}f.TensorTypeAndShape=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMapType(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMapType(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}keyType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):a.experimental.fbs.TensorDataType.UNDEFINED}valueType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new a.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startMapType(t){t.startObject(2)}static addKeyType(t,e){t.addFieldInt32(0,e,a.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(t,e){t.addFieldOffset(1,e,0)}static endMapType(t){return t.endObject()}static createMapType(t,e,r){return u.startMapType(t),u.addKeyType(t,e),u.addValueType(t,r),u.endMapType(t)}}f.MapType=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSequenceType(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSequenceType(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}elemType(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new a.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startSequenceType(t){t.startObject(1)}static addElemType(t,e){t.addFieldOffset(0,e,0)}static endSequenceType(t){return t.endObject()}static createSequenceType(t,e){return u.startSequenceType(t),u.addElemType(t,e),u.endSequenceType(t)}}f.SequenceType=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(h.fbs||(h.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(f,u){return this.bb_pos=f,this.bb=u,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(f,u,o,t){return f.prep(4,12),f.writeInt32(t),f.writeInt32(o),f.writeInt32(u),f.offset()}}})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNodeEdge(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNodeEdge(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}nodeIndex(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}inputEdges(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new a.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}inputEdgesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}outputEdges(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new a.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}outputEdgesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNodeEdge(t){t.startObject(3)}static addNodeIndex(t,e){t.addFieldInt32(0,e,0)}static addInputEdges(t,e){t.addFieldOffset(1,e,0)}static startInputEdgesVector(t,e){t.startVector(12,e,4)}static addOutputEdges(t,e){t.addFieldOffset(2,e,0)}static startOutputEdgesVector(t,e){t.startVector(12,e,4)}static endNodeEdge(t){return t.endObject()}static createNodeEdge(t,e,r,i){return u.startNodeEdge(t),u.addNodeIndex(t,e),u.addInputEdges(t,r),u.addOutputEdges(t,i),u.endNodeEdge(t)}}f.NodeEdge=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNode(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNode(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}sinceVersion(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0}index(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}opType(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):a.experimental.fbs.NodeType.Primitive}executionProviderType(t){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null}inputs(t,e){let r=this.bb.__offset(this.bb_pos,20);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}attributes(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?(e||new a.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}attributesLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCounts(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}inputArgCountsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCountsArray(){let t=this.bb.__offset(this.bb_pos,26);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}implicitInputs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}implicitInputsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNode(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDomain(t,e){t.addFieldOffset(2,e,0)}static addSinceVersion(t,e){t.addFieldInt32(3,e,0)}static addIndex(t,e){t.addFieldInt32(4,e,0)}static addOpType(t,e){t.addFieldOffset(5,e,0)}static addType(t,e){t.addFieldInt32(6,e,a.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(t,e){t.addFieldOffset(7,e,0)}static addInputs(t,e){t.addFieldOffset(8,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(9,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addAttributes(t,e){t.addFieldOffset(10,e,0)}static createAttributesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startAttributesVector(t,e){t.startVector(4,e,4)}static addInputArgCounts(t,e){t.addFieldOffset(11,e,0)}static createInputArgCountsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startInputArgCountsVector(t,e){t.startVector(4,e,4)}static addImplicitInputs(t,e){t.addFieldOffset(12,e,0)}static createImplicitInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startImplicitInputsVector(t,e){t.startVector(4,e,4)}static endNode(t){return t.endObject()}static createNode(t,e,r,i,d,g,m,b,y,v,w,S,A,O){return u.startNode(t),u.addName(t,e),u.addDocString(t,r),u.addDomain(t,i),u.addSinceVersion(t,d),u.addIndex(t,g),u.addOpType(t,m),u.addType(t,b),u.addExecutionProviderType(t,y),u.addInputs(t,v),u.addOutputs(t,w),u.addAttributes(t,S),u.addInputArgCounts(t,A),u.addImplicitInputs(t,O),u.endNode(t)}}f.Node=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsValueInfo(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsValueInfo(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new a.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startValueInfo(t){t.startObject(3)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldOffset(2,e,0)}static endValueInfo(t){return t.endObject()}static createValueInfo(t,e,r,i){return u.startValueInfo(t),u.addName(t,e),u.addDocString(t,r),u.addType(t,i),u.endValueInfo(t)}}f.ValueInfo=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTypeInfo(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTypeInfo(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}denotation(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}valueType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):a.experimental.fbs.TypeInfoValue.NONE}value(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}static startTypeInfo(t){t.startObject(3)}static addDenotation(t,e){t.addFieldOffset(0,e,0)}static addValueType(t,e){t.addFieldInt8(1,e,a.experimental.fbs.TypeInfoValue.NONE)}static addValue(t,e){t.addFieldOffset(2,e,0)}static endTypeInfo(t){return t.endObject()}static createTypeInfo(t,e,r,i){return u.startTypeInfo(t),u.addDenotation(t,e),u.addValueType(t,r),u.addValue(t,i),u.endTypeInfo(t)}}f.TypeInfo=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsOperatorSetId(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsOperatorSetId(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}domain(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}version(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}static startOperatorSetId(t){t.startObject(2)}static addDomain(t,e){t.addFieldOffset(0,e,0)}static addVersion(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static endOperatorSetId(t){return t.endObject()}static createOperatorSetId(t,e,r){return u.startOperatorSetId(t),u.addDomain(t,e),u.addVersion(t,r),u.endOperatorSetId(t)}}f.OperatorSetId=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensor(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensor(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}dataType(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):a.experimental.fbs.TensorDataType.UNDEFINED}rawData(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}rawDataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}rawDataArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}stringData(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringDataLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}static startTensor(t){t.startObject(6)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static addDataType(t,e){t.addFieldInt32(3,e,a.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(t,e){t.addFieldOffset(4,e,0)}static createRawDataVector(t,e){t.startVector(1,e.length,1);for(let r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startRawDataVector(t,e){t.startVector(1,e,1)}static addStringData(t,e){t.addFieldOffset(5,e,0)}static createStringDataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringDataVector(t,e){t.startVector(4,e,4)}static endTensor(t){return t.endObject()}static createTensor(t,e,r,i,d,g,m){return u.startTensor(t),u.addName(t,e),u.addDocString(t,r),u.addDims(t,i),u.addDataType(t,d),u.addRawData(t,g),u.addStringData(t,m),u.endTensor(t)}}f.Tensor=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSparseTensor(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSparseTensor(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}values(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new a.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}indices(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new a.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSparseTensor(t){t.startObject(3)}static addValues(t,e){t.addFieldOffset(0,e,0)}static addIndices(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static endSparseTensor(t){return t.endObject()}static createSparseTensor(t,e,r,i){return u.startSparseTensor(t),u.addValues(t,e),u.addIndices(t,r),u.addDims(t,i),u.endSparseTensor(t)}}f.SparseTensor=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsAttribute(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsAttribute(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):a.experimental.fbs.AttributeType.UNDEFINED}f(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0}i(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}s(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}t(t){let e=this.bb.__offset(this.bb_pos,16);return e?(t||new a.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}g(t){let e=this.bb.__offset(this.bb_pos,18);return e?(t||new a.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}floats(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0}floatsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}floatsArray(){let t=this.bb.__offset(this.bb_pos,20);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ints(t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}intsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}strings(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringsLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}tensors(t,e){let r=this.bb.__offset(this.bb_pos,26);return r?(e||new a.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}tensorsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}graphs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?(e||new a.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}graphsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startAttribute(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldInt32(2,e,a.experimental.fbs.AttributeType.UNDEFINED)}static addF(t,e){t.addFieldFloat32(3,e,0)}static addI(t,e){t.addFieldInt64(4,e,t.createLong(0,0))}static addS(t,e){t.addFieldOffset(5,e,0)}static addT(t,e){t.addFieldOffset(6,e,0)}static addG(t,e){t.addFieldOffset(7,e,0)}static addFloats(t,e){t.addFieldOffset(8,e,0)}static createFloatsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()}static startFloatsVector(t,e){t.startVector(4,e,4)}static addInts(t,e){t.addFieldOffset(9,e,0)}static createIntsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startIntsVector(t,e){t.startVector(8,e,8)}static addStrings(t,e){t.addFieldOffset(10,e,0)}static createStringsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringsVector(t,e){t.startVector(4,e,4)}static addTensors(t,e){t.addFieldOffset(11,e,0)}static createTensorsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startTensorsVector(t,e){t.startVector(4,e,4)}static addGraphs(t,e){t.addFieldOffset(12,e,0)}static createGraphsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startGraphsVector(t,e){t.startVector(4,e,4)}static endAttribute(t){return t.endObject()}static createAttribute(t,e,r,i,d,g,m,b,y,v,w,S,A,O){return u.startAttribute(t),u.addName(t,e),u.addDocString(t,r),u.addType(t,i),u.addF(t,d),u.addI(t,g),u.addS(t,m),u.addT(t,b),u.addG(t,y),u.addFloats(t,v),u.addInts(t,w),u.addStrings(t,S),u.addTensors(t,A),u.addGraphs(t,O),u.endAttribute(t)}}f.Attribute=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGraph(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGraph(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}initializers(t,e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new a.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}initializersLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeArgs(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new a.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeArgsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}nodes(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new a.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}maxNodeIndex(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}nodeEdges(t,e){let r=this.bb.__offset(this.bb_pos,12);return r?(e||new a.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeEdgesLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}inputs(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,16);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}sparseInitializers(t,e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new a.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}sparseInitializersLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGraph(t){t.startObject(8)}static addInitializers(t,e){t.addFieldOffset(0,e,0)}static createInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInitializersVector(t,e){t.startVector(4,e,4)}static addNodeArgs(t,e){t.addFieldOffset(1,e,0)}static createNodeArgsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeArgsVector(t,e){t.startVector(4,e,4)}static addNodes(t,e){t.addFieldOffset(2,e,0)}static createNodesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodesVector(t,e){t.startVector(4,e,4)}static addMaxNodeIndex(t,e){t.addFieldInt32(3,e,0)}static addNodeEdges(t,e){t.addFieldOffset(4,e,0)}static createNodeEdgesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeEdgesVector(t,e){t.startVector(4,e,4)}static addInputs(t,e){t.addFieldOffset(5,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(6,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addSparseInitializers(t,e){t.addFieldOffset(7,e,0)}static createSparseInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSparseInitializersVector(t,e){t.startVector(4,e,4)}static endGraph(t){return t.endObject()}static createGraph(t,e,r,i,d,g,m,b,y){return u.startGraph(t),u.addInitializers(t,e),u.addNodeArgs(t,r),u.addNodes(t,i),u.addMaxNodeIndex(t,d),u.addNodeEdges(t,g),u.addInputs(t,m),u.addOutputs(t,b),u.addSparseInitializers(t,y),u.endGraph(t)}}f.Graph=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsModel(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsModel(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}irVersion(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}opsetImport(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new a.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}opsetImportLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}producerName(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}producerVersion(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}modelVersion(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}docString(t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb_pos+e,t):null}graph(t){let e=this.bb.__offset(this.bb_pos,18);return e?(t||new a.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}graphDocString(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb_pos+e,t):null}static startModel(t){t.startObject(9)}static addIrVersion(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addOpsetImport(t,e){t.addFieldOffset(1,e,0)}static createOpsetImportVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOpsetImportVector(t,e){t.startVector(4,e,4)}static addProducerName(t,e){t.addFieldOffset(2,e,0)}static addProducerVersion(t,e){t.addFieldOffset(3,e,0)}static addDomain(t,e){t.addFieldOffset(4,e,0)}static addModelVersion(t,e){t.addFieldInt64(5,e,t.createLong(0,0))}static addDocString(t,e){t.addFieldOffset(6,e,0)}static addGraph(t,e){t.addFieldOffset(7,e,0)}static addGraphDocString(t,e){t.addFieldOffset(8,e,0)}static endModel(t){return t.endObject()}static createModel(t,e,r,i,d,g,m,b,y,v){return u.startModel(t),u.addIrVersion(t,e),u.addOpsetImport(t,r),u.addProducerName(t,i),u.addProducerVersion(t,d),u.addDomain(t,g),u.addModelVersion(t,m),u.addDocString(t,b),u.addGraph(t,y),u.addGraphDocString(t,v),u.endModel(t)}}f.Model=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKernelCreateInfos(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKernelCreateInfos(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}nodeIndices(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}nodeIndicesLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeIndicesArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}kernelDefHashes(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}kernelDefHashesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startKernelCreateInfos(t){t.startObject(2)}static addNodeIndices(t,e){t.addFieldOffset(0,e,0)}static createNodeIndicesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startNodeIndicesVector(t,e){t.startVector(4,e,4)}static addKernelDefHashes(t,e){t.addFieldOffset(1,e,0)}static createKernelDefHashesVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startKernelDefHashesVector(t,e){t.startVector(8,e,8)}static endKernelCreateInfos(t){return t.endObject()}static createKernelCreateInfos(t,e,r){return u.startKernelCreateInfos(t),u.addNodeIndices(t,e),u.addKernelDefHashes(t,r),u.endKernelCreateInfos(t)}}f.KernelCreateInfos=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSubGraphSessionState(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSubGraphSessionState(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}graphId(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}sessionState(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new a.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startSubGraphSessionState(t){t.startObject(2)}static addGraphId(t,e){t.addFieldOffset(0,e,0)}static addSessionState(t,e){t.addFieldOffset(1,e,0)}static endSubGraphSessionState(t){let e=t.endObject();return t.requiredField(e,4),e}static createSubGraphSessionState(t,e,r){return u.startSubGraphSessionState(t),u.addGraphId(t,e),u.addSessionState(t,r),u.endSubGraphSessionState(t)}}f.SubGraphSessionState=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSessionState(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSessionState(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}kernels(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new a.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}subGraphSessionStates(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new a.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}subGraphSessionStatesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSessionState(t){t.startObject(2)}static addKernels(t,e){t.addFieldOffset(0,e,0)}static addSubGraphSessionStates(t,e){t.addFieldOffset(1,e,0)}static createSubGraphSessionStatesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSubGraphSessionStatesVector(t,e){t.startVector(4,e,4)}static endSessionState(t){return t.endObject()}static createSessionState(t,e,r){return u.startSessionState(t),u.addKernels(t,e),u.addSubGraphSessionStates(t,r),u.endSessionState(t)}}f.SessionState=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(a){(function(h){(function(f){class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInferenceSession(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInferenceSession(t,e){return t.setPosition(t.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier("ORTM")}ortVersion(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}model(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new a.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}sessionState(t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new a.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startInferenceSession(t){t.startObject(3)}static addOrtVersion(t,e){t.addFieldOffset(0,e,0)}static addModel(t,e){t.addFieldOffset(1,e,0)}static addSessionState(t,e){t.addFieldOffset(2,e,0)}static endInferenceSession(t){return t.endObject()}static finishInferenceSessionBuffer(t,e){t.finish(e,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(t,e){t.finish(e,"ORTM",!0)}static createInferenceSession(t,e,r,i){return u.startInferenceSession(t),u.addOrtVersion(t,e),u.addModel(t,r),u.addSessionState(t,i),u.endInferenceSession(t)}}f.InferenceSession=u})(h.fbs||(h.fbs={}))})(a.experimental||(a.experimental={}))}(n.onnxruntime||(n.onnxruntime={}))},7448:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OnnxjsSessionHandler=void 0;const c=s(1670),l=s(9162);n.OnnxjsSessionHandler=class{constructor(p){this.session=p,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(p,a,h){const f=new Map;for(const t in p)if(Object.hasOwnProperty.call(p,t)){const e=p[t];f.set(t,new l.Tensor(e.dims,e.type,void 0,void 0,e.data))}const u=await this.session.run(f),o={};return u.forEach((t,e)=>{o[e]=new c.Tensor(t.type,t.data,t.dims)}),o}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Session=void 0;const c=s(7067),l=s(1296),p=s(7091),a=s(1036),h=s(6231),f=s(2644);n.Session=class{constructor(u={}){this._initialized=!1,this.backendHint=u.backendHint,this.profiler=h.Profiler.create(u.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(u,o,t){await this.profiler.event("session","Session.loadModel",async()=>{const e=await(0,p.resolveBackend)(this.backendHint);if(this.sessionHandler=e.createSessionHandler(this.context),this._model=new f.Model,typeof u=="string"){const r=u.endsWith(".ort");if(typeof fetch>"u"){const i=await(0,l.promisify)(c.readFile)(u);this.initialize(i,r)}else{const i=await fetch(u),d=await i.arrayBuffer();this.initialize(new Uint8Array(d),r)}}else if(ArrayBuffer.isView(u))this.initialize(u);else{const r=new Uint8Array(u,o||0,t||u.byteLength);this.initialize(r)}})}initialize(u,o){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const t=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(u,t,o),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new a.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(u){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const o=this.normalizeAndValidateInputs(u),t=await this._executionPlan.execute(this.sessionHandler,o);return this.createOutput(t)})}normalizeAndValidateInputs(u){const o=this._model.graph.getInputNames();if(Array.isArray(u)){if(u.length!==o.length)throw new Error(`incorrect input array length: expected ${o.length} but got ${u.length}`)}else{if(u.size!==o.length)throw new Error(`incorrect input map size: expected ${o.length} but got ${u.size}`);const t=new Array(u.size);let e=0;for(let r=0;rtypeof O=="string")))throw new TypeError("cache should be a string array");A&&(this.cache=new Array(S))}else{if(v!==void 0){const O=e(m);if(!(v instanceof O))throw new TypeError(`cache should be type ${O.name}`)}if(A){const O=new ArrayBuffer(S*function(x){switch(x){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${x}`)}}(m));this.cache=function(x,I){return new(e(I))(x)}(O,m)}}}static fromProto(g){if(!g)throw new Error("cannot construct Value from an empty tensor");const m=f.ProtoUtil.tensorDataTypeFromProto(g.dataType),b=f.ProtoUtil.tensorDimsFromProto(g.dims),y=new o(b,m);if(m==="string")g.stringData.forEach((v,w)=>{y.data[w]=(0,f.decodeUtf8String)(v)});else if(g.rawData&&typeof g.rawData.byteLength=="number"&&g.rawData.byteLength>0){const v=y.data,w=new DataView(g.rawData.buffer,g.rawData.byteOffset,g.rawData.byteLength),S=t(g.dataType),A=g.rawData.byteLength/S;if(g.rawData.byteLength%S!=0)throw new Error("invalid buffer length");if(v.length!==A)throw new Error("buffer length mismatch");for(let O=0;O0){const v=y.data,w=new DataView(g.rawDataArray().buffer,g.rawDataArray().byteOffset,g.rawDataLength()),S=t(g.dataType()),A=g.rawDataLength()/S;if(g.rawDataLength()%S!=0)throw new Error("invalid buffer length");if(v.length!==A)throw new Error("buffer length mismatch");for(let O=0;O1&&I>1)return;A[S-O]=Math.max(x,I)}return A}static index(m,b){const y=new Array(b.length);return u.fillIndex(m,b,y),y}static fillIndex(m,b,y){const v=m.length-b.length;for(let w=0;w=0;Z--)x[Z]=z%S[Z],z=Math.floor(z/S[Z]);H||(u.fillIndex(x,m.dims,I),L=m.get(I)),M||(u.fillIndex(x,b.dims,$),N=b.get($)),O.set(x,y(L,N))}}return O}}static isValidBroadcast(m,b){const y=m.length,v=b.length;if(y>v)return!1;for(let w=1;w<=y;w++)if(m[y-w]!==1&&m[y-w]!==b[v-w])return!1;return!0}static getBroadcastDims(m,b){const y=m.length,v=[];for(let w=0;w1&&A===1&&v.unshift(S)}return v}}n.BroadcastUtil=u,n.arrayCopyHelper=function(g,m,b,y,v){if(y<0||y>=m.length)throw new Error("sourceIndex out of bounds");if(b<0||b>=g.length)throw new Error("targetIndex out of bounds");if(y+v>m.length)throw new Error("source indices to be copied are outside bounds");if(b+v>g.length)throw new Error("target array is too small to hold result");for(let w=0;wp.default.isLong(b)?b.toNumber():b)}static tensorValueTypeFromProto(m){return{tensorType:o.tensorDataTypeFromProto(m.elemType),shape:{dims:o.tensorDimsFromProto(m.shape.dim.map(b=>b.dimValue))}}}static tensorDimsFromORTFormat(m){const b=[];for(let y=0;ym.length)throw new Error(`invalid dimension of ${b} for sizeFromDimension as Tensor has ${m.length} dimensions.`);return e.getSizeFromDimensionRange(m,b,m.length)}static sizeToDimension(m,b){if(b<0||b>m.length)throw new Error(`invalid dimension of ${b} for sizeToDimension as Tensor has ${m.length} dimensions.`);return e.getSizeFromDimensionRange(m,0,b)}static getSizeFromDimensionRange(m,b,y){let v=1;for(let w=b;w=0;--v)y[v]=y[v+1]*m[v+1];return y}static transpose(m){return m.slice().reverse()}static indicesToOffset(m,b,y){y===void 0&&(y=m.length);let v=0;for(let w=0;w=b)throw new Error("unsupported axis for this operation.");return m<0?m+b:m}static normalizeAxes(m,b){return m.map(y=>this.normalizeAxis(y,b))}static incrementIndex(m,b,y){if(b.length===0||m.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(y===void 0)y=b.length;else if(y<=0||y>b.length)throw new Error("Incorrect axis to increment on");for(let v=y-1;v>=0&&(m[v]++,!(m[v]=m.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");v[O]=m[O]}else v[O]=b[O];S*=v[O]}}const A=e.size(m);if(w!==-1){if(A%S!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${m}] Output shape: [${b}]`);v[w]=A/S}else if(S!==A)throw new Error("reshapedDims and originalDims don't have matching sizes");return v}static sortBasedOnPerm(m,b){return b?b.map(y=>m[y]):m.slice().reverse()}static padShape(m,b){const y=m.length;return m.map((v,w)=>v+b[w]+b[w+y])}static areEqual(m,b){return m.length===b.length&&m.every((y,v)=>y===b[v])}static validateDimsAndCalcSize(m){if(m.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let b=1;for(const y of m){if(!Number.isInteger(y))throw new TypeError(`Invalid shape: ${y} is not an integer`);if(y<0||y>2147483647)throw new TypeError(`Invalid shape: length ${y} is not allowed`);b*=y}return b}static flattenShape(m,b){b<0&&(b+=m.length);const y=m.reduce((w,S)=>w*S,1),v=m.slice(b).reduce((w,S)=>w*S,1);return[y/v,v]}static squeezeShape(m,b){const y=new Array;b=e.normalizeAxes(b,m.length);for(let v=0;v=0;if(w&&m[v]!==1)throw new Error("squeeze an axis of size different than 1");(b.length===0&&m[v]>1||b.length>0&&!w)&&y.push(m[v])}return y}static unsqueezeShape(m,b){const y=new Array(m.length+b.length);y.fill(0);for(let w=0;w=y.length)throw new Error("'axes' has an out of range axis");if(y[S]!==0)throw new Error("'axes' has a duplicate axis");y[S]=1}let v=0;for(let w=0;w=m.length)throw new Error("sourceIndex out of bounds");if(b<0||b>=g.length)throw new Error("targetIndex out of bounds");if(y+v>m.length)throw new Error("source indices to be copied are outside bounds");if(b+v>g.length)throw new Error("target array is too small to hold result");for(let w=0;w=m.length)throw new Error("sourceIndex out of bounds");if(b<0||b>=g.length)throw new Error("targetIndex out of bounds");if(y+v>m.length)throw new Error("source indices to be copied are outside bounds");if(b+v>g.length)throw new Error("target array is too small to hold result");for(let S=0;S=m.length)throw new Error("sourceIndex out of bounds");if(b<0||b>=g.length)throw new Error("targetIndex out of bounds");if(y+v>m.length)throw new Error("source indices to be copied are outside bounds");if(b+v>g.length)throw new Error("target array is too small to hold result");for(let S=0;S=m.length)throw new Error("sourceIndex out of bounds");if(b<0||b>=g.length)throw new Error("targetIndex out of bounds");if(y+v>m.length)throw new Error("source indices to be copied are outside bounds");if(b+v>g.length)throw new Error("target array is too small to hold result");for(let w=0;wb.push(N));const A=i.calcReduceShape(S,b,!0),O=e.size(A),x=new h.Tensor(A,m.type),I=e.computeStrides(A),$=e.computeStrides(S),z=new Array(S.length);for(let L=0;L=b.length)return S(m[w]);const x=b[v],I=x>=y.length?1:e.size(y.slice(x+1));for(let $=0;$w!==0)}}n.ReduceUtil=i;class d{static adjustPoolAttributes(m,b,y,v,w,S){if(!m&&y.length!==b.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(m)for(let A=0;A=y.length?y.push(b[A+2]):y[A]=b[A+2];for(let A=0;A=y[A]||S[A+y.length]>=y[A])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(m,b,y,v,w,S){if(S){if(w.length!==2*(m.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(b.length!==m.length-2)throw new Error("length of strides should be the length of data dimensions");if(v.length!==m.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let A=0;A{Object.defineProperty(n,"__esModule",{value:!0}),n.iterateExtraOptions=void 0,n.iterateExtraOptions=(s,c,l,p)=>{if(typeof s=="object"&&s!==null){if(l.has(s))throw new Error("Circular reference in options");l.add(s)}Object.entries(s).forEach(([a,h])=>{const f=c?c+a:a;if(typeof h=="object")(0,n.iterateExtraOptions)(h,f+".",l,p);else if(typeof h=="string"||typeof h=="number")p(f,h.toString());else{if(typeof h!="boolean")throw new Error("Can't handle extra config type: "+typeof h);p(f,h?"1":"0")}})}},2157:function(_,n,s){var c,l=this&&this.__createBinding||(Object.create?function(I,$,z,L){L===void 0&&(L=z);var N=Object.getOwnPropertyDescriptor($,z);N&&!("get"in N?!$.__esModule:N.writable||N.configurable)||(N={enumerable:!0,get:function(){return $[z]}}),Object.defineProperty(I,L,N)}:function(I,$,z,L){L===void 0&&(L=z),I[L]=$[z]}),p=this&&this.__setModuleDefault||(Object.create?function(I,$){Object.defineProperty(I,"default",{enumerable:!0,value:$})}:function(I,$){I.default=$}),a=this&&this.__importStar||function(I){if(I&&I.__esModule)return I;var $={};if(I!=null)for(var z in I)z!=="default"&&Object.prototype.hasOwnProperty.call(I,z)&&l($,I,z);return p($,I),$};Object.defineProperty(n,"__esModule",{value:!0}),n.endProfiling=n.run=n.releaseSession=n.createSession=n.createSessionFinalize=n.createSessionAllocate=n.initOrt=n.initWasm=void 0;const h=s(1670),f=a(s(349)),u=s(6361),o=()=>!!h.env.wasm.proxy&&typeof document<"u";let t,e,r,i=!1,d=!1,g=!1;const m=[],b=[],y=[],v=[],w=[],S=[],A=()=>{if(i||!d||g||!t)throw new Error("worker not ready")},O=I=>{switch(I.data.type){case"init-wasm":i=!1,I.data.err?(g=!0,e[1](I.data.err)):(d=!0,e[0]());break;case"init-ort":I.data.err?r[1](I.data.err):r[0]();break;case"create_allocate":I.data.err?m.shift()[1](I.data.err):m.shift()[0](I.data.out);break;case"create_finalize":I.data.err?b.shift()[1](I.data.err):b.shift()[0](I.data.out);break;case"create":I.data.err?y.shift()[1](I.data.err):y.shift()[0](I.data.out);break;case"release":I.data.err?v.shift()[1](I.data.err):v.shift()[0]();break;case"run":I.data.err?w.shift()[1](I.data.err):w.shift()[0](I.data.out);break;case"end-profiling":I.data.err?S.shift()[1](I.data.err):S.shift()[0]()}},x=typeof document<"u"?(c=document==null?void 0:document.currentScript)===null||c===void 0?void 0:c.src:void 0;n.initWasm=async()=>{if(o()){if(d)return;if(i)throw new Error("multiple calls to 'initWasm()' detected.");if(g)throw new Error("previous call to 'initWasm()' failed.");return i=!0,h.env.wasm.wasmPaths===void 0&&x&&x.indexOf("blob:")!==0&&(h.env.wasm.wasmPaths=x.substr(0,+x.lastIndexOf("/")+1)),new Promise((I,$)=>{t==null||t.terminate(),t=s(9710).Z(),t.onmessage=O,e=[I,$];const z={type:"init-wasm",in:h.env.wasm};t.postMessage(z)})}return(0,u.initializeWebAssembly)(h.env.wasm)},n.initOrt=async(I,$)=>{if(o())return A(),new Promise((z,L)=>{r=[z,L];const N={type:"init-ort",in:{numThreads:I,loggingLevel:$}};t.postMessage(N)});f.initOrt(I,$)},n.createSessionAllocate=async I=>o()?(A(),new Promise(($,z)=>{m.push([$,z]);const L={type:"create_allocate",in:{model:I}};t.postMessage(L,[I.buffer])})):f.createSessionAllocate(I),n.createSessionFinalize=async(I,$)=>o()?(A(),new Promise((z,L)=>{b.push([z,L]);const N={type:"create_finalize",in:{modeldata:I,options:$}};t.postMessage(N)})):f.createSessionFinalize(I,$),n.createSession=async(I,$)=>o()?(A(),new Promise((z,L)=>{y.push([z,L]);const N={type:"create",in:{model:I,options:$}};t.postMessage(N,[I.buffer])})):f.createSession(I,$),n.releaseSession=async I=>{if(o())return A(),new Promise(($,z)=>{v.push([$,z]);const L={type:"release",in:I};t.postMessage(L)});f.releaseSession(I)},n.run=async(I,$,z,L,N)=>o()?(A(),new Promise((H,M)=>{w.push([H,M]);const j={type:"run",in:{sessionId:I,inputIndices:$,inputs:z,outputIndices:L,options:N}};t.postMessage(j,f.extractTransferableBuffers(z))})):f.run(I,$,z,L,N),n.endProfiling=async I=>{if(o())return A(),new Promise(($,z)=>{S.push([$,z]);const L={type:"end-profiling",in:I};t.postMessage(L)});f.endProfiling(I)}},586:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.setRunOptions=void 0;const c=s(7967),l=s(4983),p=s(6361);n.setRunOptions=a=>{const h=(0,p.getInstance)();let f=0;const u=[],o=a||{};try{if((a==null?void 0:a.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof a.logSeverityLevel!="number"||!Number.isInteger(a.logSeverityLevel)||a.logSeverityLevel<0||a.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${a.logSeverityLevel}`);if((a==null?void 0:a.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof a.logVerbosityLevel!="number"||!Number.isInteger(a.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${a.logVerbosityLevel}`);(a==null?void 0:a.terminate)===void 0&&(o.terminate=!1);let t=0;if((a==null?void 0:a.tag)!==void 0&&(t=(0,l.allocWasmString)(a.tag,u)),f=h._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,t),f===0)throw new Error("Can't create run options");return(a==null?void 0:a.extra)!==void 0&&(0,c.iterateExtraOptions)(a.extra,"",new WeakSet,(e,r)=>{const i=(0,l.allocWasmString)(e,u),d=(0,l.allocWasmString)(r,u);if(h._OrtAddRunConfigEntry(f,i,d)!==0)throw new Error(`Can't set a run config entry: ${e} - ${r}`)}),[f,u]}catch(t){throw f!==0&&h._OrtReleaseRunOptions(f),u.forEach(h._free),t}}},2306:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OnnxruntimeWebAssemblySessionHandler=void 0;const c=s(2806),l=s(1670),p=s(2850),a=s(2157);let h;n.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(f){const u=await fetch(f),o=await u.arrayBuffer();return(0,a.createSessionAllocate)(new Uint8Array(o))}async loadModel(f,u){if(h||(await(0,a.initOrt)(l.env.wasm.numThreads,(o=>{switch(o){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${o}`)}})(l.env.logLevel)),h=!0),typeof f=="string")if(typeof fetch>"u"){const o=await(0,p.promisify)(c.readFile)(f);[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSession)(o,u)}else{const o=await this.createSessionAllocate(f);[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSessionFinalize)(o,u)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSession)(f,u)}async dispose(){return(0,a.releaseSession)(this.sessionId)}async run(f,u,o){const t=[],e=[];Object.entries(f).forEach(g=>{const m=g[0],b=g[1],y=this.inputNames.indexOf(m);if(y===-1)throw new Error(`invalid input '${m}'`);t.push(b),e.push(y)});const r=[];Object.entries(u).forEach(g=>{const m=g[0],b=this.outputNames.indexOf(m);if(b===-1)throw new Error(`invalid output '${m}'`);r.push(b)});const i=await(0,a.run)(this.sessionId,e,t.map(g=>[g.type,g.dims,g.data]),r,o),d={};for(let g=0;g{Object.defineProperty(n,"__esModule",{value:!0}),n.setSessionOptions=void 0;const c=s(7967),l=s(4983),p=s(6361);n.setSessionOptions=a=>{const h=(0,p.getInstance)();let f=0;const u=[],o=a||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(o);try{(a==null?void 0:a.graphOptimizationLevel)===void 0&&(o.graphOptimizationLevel="all");const t=(i=>{switch(i){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${i}`)}})(o.graphOptimizationLevel);(a==null?void 0:a.enableCpuMemArena)===void 0&&(o.enableCpuMemArena=!0),(a==null?void 0:a.enableMemPattern)===void 0&&(o.enableMemPattern=!0),(a==null?void 0:a.executionMode)===void 0&&(o.executionMode="sequential");const e=(i=>{switch(i){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${i}`)}})(o.executionMode);let r=0;if((a==null?void 0:a.logId)!==void 0&&(r=(0,l.allocWasmString)(a.logId,u)),(a==null?void 0:a.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof a.logSeverityLevel!="number"||!Number.isInteger(a.logSeverityLevel)||a.logSeverityLevel<0||a.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${a.logSeverityLevel}`);if((a==null?void 0:a.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof a.logVerbosityLevel!="number"||!Number.isInteger(a.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${a.logVerbosityLevel}`);if((a==null?void 0:a.enableProfiling)===void 0&&(o.enableProfiling=!1),f=h._OrtCreateSessionOptions(t,!!o.enableCpuMemArena,!!o.enableMemPattern,e,!!o.enableProfiling,0,r,o.logSeverityLevel,o.logVerbosityLevel),f===0)throw new Error("Can't create session options");return a!=null&&a.executionProviders&&((i,d,g)=>{for(const m of d){let b=typeof m=="string"?m:m.name;switch(b){case"xnnpack":b="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${b}`)}const y=(0,l.allocWasmString)(b,g);if((0,p.getInstance)()._OrtAppendExecutionProvider(i,y)!==0)throw new Error(`Can't append execution provider: ${b}`)}})(f,a.executionProviders,u),(a==null?void 0:a.extra)!==void 0&&(0,c.iterateExtraOptions)(a.extra,"",new WeakSet,(i,d)=>{const g=(0,l.allocWasmString)(i,u),m=(0,l.allocWasmString)(d,u);if(h._OrtAddSessionConfigEntry(f,g,m)!==0)throw new Error(`Can't set a session config entry: ${i} - ${d}`)}),[f,u]}catch(t){throw f!==0&&h._OrtReleaseSessionOptions(f),u.forEach(h._free),t}}},4983:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.allocWasmString=void 0;const c=s(6361);n.allocWasmString=(l,p)=>{const a=(0,c.getInstance)(),h=a.lengthBytesUTF8(l)+1,f=a._malloc(h);return a.stringToUTF8(l,f,h),p.push(f),f}},349:(_,n,s)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.extractTransferableBuffers=n.endProfiling=n.run=n.releaseSession=n.createSession=n.createSessionFinalize=n.createSessionAllocate=n.initOrt=void 0;const c=s(586),l=s(4919),p=s(4983),a=s(6361);n.initOrt=(t,e)=>{const r=(0,a.getInstance)()._OrtInit(t,e);if(r!==0)throw new Error(`Can't initialize onnxruntime. error code = ${r}`)};const h=new Map;n.createSessionAllocate=t=>{const e=(0,a.getInstance)(),r=e._malloc(t.byteLength);return e.HEAPU8.set(t,r),[r,t.byteLength]},n.createSessionFinalize=(t,e)=>{const r=(0,a.getInstance)();let i=0,d=0,g=[];try{if([d,g]=(0,l.setSessionOptions)(e),i=r._OrtCreateSession(t[0],t[1],d),i===0)throw new Error("Can't create a session")}finally{r._free(t[0]),r._OrtReleaseSessionOptions(d),g.forEach(r._free)}const m=r._OrtGetInputCount(i),b=r._OrtGetOutputCount(i),y=[],v=[],w=[],S=[];for(let A=0;A{const r=(0,n.createSessionAllocate)(t);return(0,n.createSessionFinalize)(r,e)},n.releaseSession=t=>{const e=(0,a.getInstance)(),r=h.get(t);if(!r)throw new Error("invalid session id");const i=r[0],d=r[1],g=r[2];d.forEach(e._OrtFree),g.forEach(e._OrtFree),e._OrtReleaseSession(i),h.delete(t)};const f=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},u=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},o=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};n.run=(t,e,r,i,d)=>{const g=(0,a.getInstance)(),m=h.get(t);if(!m)throw new Error("invalid session id");const b=m[0],y=m[1],v=m[2],w=e.length,S=i.length;let A=0,O=[];const x=[],I=[];try{[A,O]=(0,c.setRunOptions)(d);for(let M=0;Mg.HEAP32[xe++]=we);const oe=g._OrtCreateTensor(f(j),Q,ee,Ae,Z.length);if(oe===0)throw new Error("Can't create a tensor");x.push(oe)}finally{g.stackRestore(ue)}}const $=g.stackSave(),z=g.stackAlloc(4*w),L=g.stackAlloc(4*w),N=g.stackAlloc(4*S),H=g.stackAlloc(4*S);try{let M=z/4,j=L/4,Z=N/4,X=H/4;for(let ue=0;ueOe*ze);if(we=u(Ne),we==="string"){const Oe=[];let ze=ye/4;for(let Ve=0;Ve{const e=(0,a.getInstance)(),r=h.get(t);if(!r)throw new Error("invalid session id");const i=r[0],d=e._OrtEndProfiling(i);if(d===0)throw new Error("Can't get an profile file name");e._OrtFree(d)},n.extractTransferableBuffers=t=>{const e=[];for(const r of t){const i=r[2];!Array.isArray(i)&&i.buffer&&e.push(i.buffer)}return e}},6361:function(_,n,s){var c=this&&this.__createBinding||(Object.create?function(d,g,m,b){b===void 0&&(b=m);var y=Object.getOwnPropertyDescriptor(g,m);y&&!("get"in y?!g.__esModule:y.writable||y.configurable)||(y={enumerable:!0,get:function(){return g[m]}}),Object.defineProperty(d,b,y)}:function(d,g,m,b){b===void 0&&(b=m),d[b]=g[m]}),l=this&&this.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),p=this&&this.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var m in d)m!=="default"&&Object.prototype.hasOwnProperty.call(d,m)&&c(g,d,m);return l(g,d),g},a=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0}),n.dispose=n.getInstance=n.initializeWebAssembly=void 0;const h=p(s(6449)),f=a(s(932)),u=s(3474);let o,t=!1,e=!1,r=!1;const i=(d,g)=>g?d?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":d?"ort-wasm-simd.wasm":"ort-wasm.wasm";n.initializeWebAssembly=async d=>{if(t)return Promise.resolve();if(e)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(r)throw new Error("previous call to 'initializeWebAssembly()' failed.");e=!0;const g=d.initTimeout,m=d.numThreads,b=d.simd,y=m>1&&(()=>{try{return typeof SharedArrayBuffer<"u"&&(typeof MessageChannel<"u"&&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}})(),v=b&&(()=>{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,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}})(),w=typeof d.wasmPaths=="string"?d.wasmPaths:void 0,S=i(!1,y),A=i(v,y),O=typeof d.wasmPaths=="object"?d.wasmPaths[A]:void 0;let x=!1;const I=[];if(g>0&&I.push(new Promise($=>{setTimeout(()=>{x=!0,$()},g)})),I.push(new Promise(($,z)=>{const L=y?u:f.default,N={locateFile:(H,M)=>y&&H.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([s(4154)],{type:"text/javascript"})):H===S?O??(w??M)+A:M+H};if(y)if(typeof Blob>"u")N.mainScriptUrlOrBlob=h.join("/","ort-wasm-threaded.js");else{const H=`var ortWasmThreaded=(function(){var _scriptDir;return ${L.toString()}})();`;N.mainScriptUrlOrBlob=new Blob([H],{type:"text/javascript"})}L(N).then(H=>{e=!1,t=!0,o=H,$()},H=>{e=!1,r=!0,z(H)})})),await Promise.race(I),x)throw new Error(`WebAssembly backend initializing failed due to timeout: ${g}ms`)},n.getInstance=()=>{if(t&&o)return o;throw new Error("WebAssembly is not initialized yet.")},n.dispose=()=>{var d;!t||e||r||(e=!0,(d=o.PThread)===null||d===void 0||d.terminateAllThreads(),o=void 0,e=!1,t=!1,r=!0)}},9710:(_,n,s)=>{s.d(n,{Z:()=>p});var c=s(477),l=s.n(c);function p(){return l()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("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 need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(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(t){return!1}})(),o=a&&(()=>{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,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:_=>{_.exports=function(n,s,c,l){var p=self||window;try{try{var a;try{a=new p.Blob([n])}catch{(a=new(p.BlobBuilder||p.WebKitBlobBuilder||p.MozBlobBuilder||p.MSBlobBuilder)).append(n),a=a.getBlob()}var h=p.URL||p.webkitURL,f=h.createObjectURL(a),u=new p[s](f,c);return h.revokeObjectURL(f),u}catch{return new p[s]("data:application/javascript,".concat(encodeURIComponent(n)),c)}}catch{if(!l)throw Error("Inline worker is not supported");return new p[s](l,c)}}},4154:_=>{_.exports=`"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}}; +`},1670:_=>{_.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(_,n,s)=>{s.r(n),s.d(n,{flatbuffers:()=>c});var c={};c.Offset,c.Table,c.SIZEOF_SHORT=2,c.SIZEOF_INT=4,c.FILE_IDENTIFIER_LENGTH=4,c.SIZE_PREFIX_LENGTH=4,c.Encoding={UTF8_BYTES:1,UTF16_STRING:2},c.int32=new Int32Array(2),c.float32=new Float32Array(c.int32.buffer),c.float64=new Float64Array(c.int32.buffer),c.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,c.Long=function(l,p){this.low=0|l,this.high=0|p},c.Long.create=function(l,p){return l==0&&p==0?c.Long.ZERO:new c.Long(l,p)},c.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},c.Long.prototype.equals=function(l){return this.low==l.low&&this.high==l.high},c.Long.ZERO=new c.Long(0,0),c.Builder=function(l){if(l)p=l;else var p=1024;this.bb=c.ByteBuffer.allocate(p),this.space=p,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},c.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},c.Builder.prototype.forceDefaults=function(l){this.force_defaults=l},c.Builder.prototype.dataBuffer=function(){return this.bb},c.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},c.Builder.prototype.prep=function(l,p){l>this.minalign&&(this.minalign=l);for(var a=1+~(this.bb.capacity()-this.space+p)&l-1;this.space=0&&this.vtable[p]==0;p--);for(var a=p+1;p>=0;p--)this.addInt16(this.vtable[p]!=0?l-this.vtable[p]:0);this.addInt16(l-this.object_start);var h=(a+2)*c.SIZEOF_SHORT;this.addInt16(h);var f=0,u=this.space;e:for(p=0;p=0;u--)this.writeInt8(f.charCodeAt(u))}this.prep(this.minalign,c.SIZEOF_INT+h),this.addOffset(l),h&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},c.Builder.prototype.finishSizePrefixed=function(l,p){this.finish(l,p,!0)},c.Builder.prototype.requiredField=function(l,p){var a=this.bb.capacity()-l,h=a-this.bb.readInt32(a);if(this.bb.readInt16(h+p)==0)throw new Error("FlatBuffers: field "+p+" must be set")},c.Builder.prototype.startVector=function(l,p,a){this.notNested(),this.vector_num_elems=p,this.prep(c.SIZEOF_INT,l*p),this.prep(a,l*p)},c.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},c.Builder.prototype.createString=function(l){if(l instanceof Uint8Array)var p=l;else{p=[];for(var a=0;a=56320?f:(f<<10)+l.charCodeAt(a++)+-56613888)<128?p.push(h):(h<2048?p.push(h>>6&31|192):(h<65536?p.push(h>>12&15|224):p.push(h>>18&7|240,h>>12&63|128),p.push(h>>6&63|128)),p.push(63&h|128))}}this.addInt8(0),this.startVector(1,p.length,1),this.bb.setPosition(this.space-=p.length),a=0;for(var u=this.space,o=this.bb.bytes();a>24},c.ByteBuffer.prototype.readUint8=function(l){return this.bytes_[l]},c.ByteBuffer.prototype.readInt16=function(l){return this.readUint16(l)<<16>>16},c.ByteBuffer.prototype.readUint16=function(l){return this.bytes_[l]|this.bytes_[l+1]<<8},c.ByteBuffer.prototype.readInt32=function(l){return this.bytes_[l]|this.bytes_[l+1]<<8|this.bytes_[l+2]<<16|this.bytes_[l+3]<<24},c.ByteBuffer.prototype.readUint32=function(l){return this.readInt32(l)>>>0},c.ByteBuffer.prototype.readInt64=function(l){return new c.Long(this.readInt32(l),this.readInt32(l+4))},c.ByteBuffer.prototype.readUint64=function(l){return new c.Long(this.readUint32(l),this.readUint32(l+4))},c.ByteBuffer.prototype.readFloat32=function(l){return c.int32[0]=this.readInt32(l),c.float32[0]},c.ByteBuffer.prototype.readFloat64=function(l){return c.int32[c.isLittleEndian?0:1]=this.readInt32(l),c.int32[c.isLittleEndian?1:0]=this.readInt32(l+4),c.float64[0]},c.ByteBuffer.prototype.writeInt8=function(l,p){this.bytes_[l]=p},c.ByteBuffer.prototype.writeUint8=function(l,p){this.bytes_[l]=p},c.ByteBuffer.prototype.writeInt16=function(l,p){this.bytes_[l]=p,this.bytes_[l+1]=p>>8},c.ByteBuffer.prototype.writeUint16=function(l,p){this.bytes_[l]=p,this.bytes_[l+1]=p>>8},c.ByteBuffer.prototype.writeInt32=function(l,p){this.bytes_[l]=p,this.bytes_[l+1]=p>>8,this.bytes_[l+2]=p>>16,this.bytes_[l+3]=p>>24},c.ByteBuffer.prototype.writeUint32=function(l,p){this.bytes_[l]=p,this.bytes_[l+1]=p>>8,this.bytes_[l+2]=p>>16,this.bytes_[l+3]=p>>24},c.ByteBuffer.prototype.writeInt64=function(l,p){this.writeInt32(l,p.low),this.writeInt32(l+4,p.high)},c.ByteBuffer.prototype.writeUint64=function(l,p){this.writeUint32(l,p.low),this.writeUint32(l+4,p.high)},c.ByteBuffer.prototype.writeFloat32=function(l,p){c.float32[0]=p,this.writeInt32(l,c.int32[0])},c.ByteBuffer.prototype.writeFloat64=function(l,p){c.float64[0]=p,this.writeInt32(l,c.int32[c.isLittleEndian?0:1]),this.writeInt32(l+4,c.int32[c.isLittleEndian?1:0])},c.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&u)))}return h},c.ByteBuffer.prototype.__indirect=function(l){return l+this.readInt32(l)},c.ByteBuffer.prototype.__vector=function(l){return l+this.readInt32(l)+c.SIZEOF_INT},c.ByteBuffer.prototype.__vector_len=function(l){return this.readInt32(l+this.readInt32(l))},c.ByteBuffer.prototype.__has_identifier=function(l){if(l.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var p=0;p{var n=_&&_.__esModule?()=>_.default:()=>_;return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=(_,n)=>{for(var s in n)__webpack_require__.o(n,s)&&!__webpack_require__.o(_,s)&&Object.defineProperty(_,s,{enumerable:!0,get:n[s]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(_,n)=>Object.prototype.hasOwnProperty.call(_,n),__webpack_require__.r=_=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min$1);var ortWeb_minExports=ortWeb_min$1.exports,ortWeb_min=getDefaultExportFromCjs(ortWeb_minExports),ONNX_WEB=_mergeNamespaces({__proto__:null,default:ortWeb_min},[ortWeb_minExports]);let ONNX;const executionProviders=["wasm"];typeof process<"u"&&((rt=process==null?void 0:process.release)==null?void 0:rt.name)==="node"?(ONNX=ONNX_NODE,executionProviders.unshift("cpu")):(ONNX=ONNX_WEB,typeof navigator<"u"&&/iP(hone|od|ad)/.test(navigator.userAgent)&&(ONNX.env.wasm.simd=!1)),ONNX=ONNX.default??ONNX;const{env:onnx_env}=ONNX,WEB_CACHE_AVAILABLE=typeof self<"u"&&"caches"in self,FS_AVAILABLE=!isEmpty(fs),PATH_AVAILABLE=!isEmpty(fs),RUNNING_LOCALLY=FS_AVAILABLE&&PATH_AVAILABLE,__dirname=RUNNING_LOCALLY?fs.dirname(fs.dirname(fs.fileURLToPath(self.location.href))):"./",DEFAULT_CACHE_DIR=RUNNING_LOCALLY?fs.join(__dirname,"/.cache/"):null,DEFAULT_LOCAL_MODEL_PATH="/models/",localModelPath=RUNNING_LOCALLY?fs.join(__dirname,DEFAULT_LOCAL_MODEL_PATH):DEFAULT_LOCAL_MODEL_PATH;onnx_env.wasm.wasmPaths=RUNNING_LOCALLY?fs.join(__dirname,"/dist/"):"https://cdn.jsdelivr.net/npm/@xenova/transformers/dist/";const env={backends:{onnx:onnx_env,tfjs:{}},__dirname,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath,useFS:FS_AVAILABLE,useBrowserCache:WEB_CACHE_AVAILABLE,useFSCache:FS_AVAILABLE,cacheDir:DEFAULT_CACHE_DIR};function isEmpty(_){return Object.keys(_).length===0}globalThis.ReadableStream||(globalThis.ReadableStream=fs.ReadableStream);class Headers extends Object{constructor(...n){super(),Object.assign(this,n)}get(n){return this[n]}clone(){return new Headers(this)}}class FileResponse{constructor(n){de(this,"_CONTENT_TYPE_MAP",{txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"});if(this.filePath=n,this.headers=new Headers,this.exists=fs.existsSync(n),this.exists){this.status=200,this.statusText="OK";let s=fs.statSync(n);this.headers["content-length"]=s.size,this.updateContentType();let c=this;this.body=new ReadableStream({start(l){c.arrayBuffer().then(p=>{l.enqueue(new Uint8Array(p)),l.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const n=this.filePath.toString().split(".").pop().toLowerCase();this.headers["content-type"]=this._CONTENT_TYPE_MAP[n]??"application/octet-stream"}clone(){let n=new FileResponse(this.filePath);return n.exists=this.exists,n.status=this.status,n.statusText=this.statusText,n.headers=this.headers.clone(),n}async arrayBuffer(){return(await fs.promises.readFile(this.filePath)).buffer}async blob(){const n=await fs.promises.readFile(this.filePath);return new Blob([n],{type:this.headers["content-type"]})}async text(){return await fs.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function isValidHttpUrl(_){let n;try{n=new URL(_)}catch{return!1}return n.protocol==="http:"||n.protocol==="https:"}async function getFile(_){return env.useFS&&!isValidHttpUrl(_)?new FileResponse(_):fetch(_)}function handleError(_,n,s){if(!s)return null;switch(_){case 400:throw Error(`Bad request error occurred while trying to load file: "${n}".`);case 401:throw Error(`Unauthorized access to file: "${n}".`);case 403:throw Error(`Forbidden access to file: "${n}".`);case 404:throw Error(`Could not locate file: "${n}".`);case 408:throw Error(`Request timeout error occurred while trying to load file: "${n}".`);case 500:throw Error(`Internal server error error occurred while trying to load file: "${n}".`);case 502:throw Error(`Bad gateway error occurred while trying to load file: "${n}".`);case 503:throw Error(`Service unavailable error occurred while trying to load file: "${n}".`);case 504:throw Error(`Gateway timeout error occurred while trying to load file: "${n}".`);default:throw Error(`Error (${_}) occurred while trying to load file: "${n}".`)}}class FileCache{constructor(n){this.path=n}async match(n){let s=fs.join(this.path,n),c=new FileResponse(s);if(c.exists)return c}async put(n,s){const c=Buffer.from(await s.arrayBuffer());let l=fs.join(this.path,n);try{await fs.promises.mkdir(fs.dirname(l),{recursive:!0}),await fs.promises.writeFile(l,c)}catch(p){console.warn("An error occurred while writing the file to cache:",p)}}}async function getModelFile(_,n,s=!0,c={}){dispatchCallback(c.progress_callback,{status:"initiate",name:_,file:n});let l;if(!l&&env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");l=await caches.open("transformers-cache")}!l&&env.useFSCache&&(l=new FileCache(c.cache_dir??env.cacheDir));const p=pathJoin(_,n);let a,h;if(l&&(h=await l.match(p)),h===void 0){let u=isValidHttpUrl(p),o=pathJoin(env.localModelPath,p);if(u){if(c.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${p}.`)}else try{h=await getFile(o)}catch(t){console.warn(`Unable to load from local path "${o}": "${t}"`)}if(h===void 0||h.status===404){if(c.local_files_only||!env.allowRemoteModels){if(s)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${o}".`);return null}let t=pathJoin(env.remoteHost,env.remotePathTemplate.replace("{model}",_).replace("{revision}",c.revision??"main"),n);if(h=await getFile(t),h.status!==200)return handleError(h.status,t,s)}l&&h instanceof Response&&h.status===200&&(a=h.clone())}dispatchCallback(c.progress_callback,{status:"download",name:_,file:n});const f=await readResponse(h,u=>{dispatchCallback(c.progress_callback,{status:"progress",...u,name:_,file:n})});return a&&await l.match(p)===void 0&&await l.put(p,a).catch(u=>{console.warn(`Unable to add ${p} to browser cache: ${u}.`)}),dispatchCallback(c.progress_callback,{status:"done",name:_,file:n}),f}async function getModelJSON(_,n,s=!0,c={}){let l=await getModelFile(_,n,s,c);if(l===null)return{};let a=new TextDecoder("utf-8").decode(l);return JSON.parse(a)}async function readResponse(_,n){const s=_.headers.get("Content-Length");s===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let c=parseInt(s??"0"),l=new Uint8Array(c),p=0;const a=_.body.getReader();async function h(){const{done:f,value:u}=await a.read();if(f)return;let o=p+u.length;if(o>c){c=o;let e=new Uint8Array(c);e.set(l),l=e}l.set(u,p),p=o;const t=p/c*100;return n({progress:t,loaded:p,total:c}),h()}return await h(),l}function pathJoin(..._){return _=_.map((n,s)=>(s&&(n=n.replace(new RegExp("^/"),"")),s!==_.length-1&&(n=n.replace(new RegExp("/$"),"")),n)),_.join("/")}function interpolate_data(_,[n,s,c],[l,p],a="bilinear",h=!1){const f=p/c,u=l/s,o=new _.constructor(l*p*n),t=s*c,e=l*p;for(let r=0;r=0;--h)l[h]=f,c[h]=n[s[h]],f*=c[h];const p=s.map((h,f)=>l[s.indexOf(f)]),a=new _.constructor(_.length);for(let h=0;h<_.length;++h){let f=0;for(let u=n.length-1,o=h;u>=0;--u)f+=o%n[u]*p[u],o=Math.floor(o/n[u]);a[f]=_[h]}return[a,c]}function softmax(_){const n=max(_)[0],s=_.map(p=>Math.exp(p-n)),c=s.reduce((p,a)=>p+a,0);return s.map(p=>p/c)}function log_softmax(_){return softmax(_).map(c=>Math.log(c))}function dot(_,n){return _.reduce((s,c,l)=>s+c*n[l],0)}function getTopItems(_,n=0){return _=Array.from(_).map((s,c)=>[c,s]).sort((s,c)=>c[1]-s[1]),n>0&&(_=_.slice(0,n)),_}function cos_sim(_,n){const s=dot(_,n),c=magnitude(_),l=magnitude(n);return s/(c*l)}function magnitude(_){return Math.sqrt(_.reduce((n,s)=>n+s*s,0))}function min(_){if(_.length===0)throw Error("Array must not be empty");let n=_[0],s=0;for(let c=1;c<_.length;++c)_[c]n&&(n=_[c],s=c);return[n,s]}function rfftfreq(_,n=1){if(!Number.isInteger(_))throw new TypeError(`n should be an integer, but ${_} given.`);const s=1/(_*n),c=Math.floor(_/2)+1,l=new Array(c);for(let p=0;pc;c<<=1)++s;this._width=s%2===0?s-1:s,this._bitrev=new Int32Array(1<>>l&3)<>>1);for(let l=0;l>>1]=n[l];return c}toComplexArray(n,s){const c=s||this.createComplexArray();for(let l=0;l>>1],c[l+1]=0;return c}completeSpectrum(n){const s=this._csize,c=s>>>1;for(let l=2;l>=2;a>=2;a>>=2){h=l/a<<1;let t=h>>>2;for(f=0;f>>1,a>>>1)}else for(f=0,u=0;f>>1,a>>>1,c)}for(a>>=2;a>=2;a>>=2){h=l/a<<1;const t=h>>>1,e=t>>>1,r=e>>>1;for(f=0;f{if(typeof c=="string"){let l=Number(c);if(Number.isInteger(l))return s._getitem(l)}return s[c]},set:(s,c,l)=>s[c]=l})}*[Symbol.iterator](){const[n,...s]=this.dims;if(s.length>0){const c=s.reduce((l,p)=>l*p);for(let l=0;l=s||n<-s)throw new Error(`Index ${n} is out of bounds for dimension 0 with size ${s}`);if(n<0&&(n+=s),c.length>0){const l=c.reduce((p,a)=>p*a);return this._subarray(n,l,c)}else return new Tensor(this.type,[this.data[n]],c)}indexOf(n){for(let s=0;s=this.dims[f])throw new Error(`IndexError: index ${u} is out of bounds for dimension ${f} with size ${this.dims[f]}`);u<0&&(u+=this.dims[f]),c.push([u,u+1])}else if(Array.isArray(u)&&u.length===2){if(u[0]>u[1])throw new Error(`Invalid slice: ${u}`);let o=[Math.max(u[0],0),Math.min(u[1],this.dims[f])];c.push(o),s.push(o[1]-o[0])}else throw new Error(`Invalid slice: ${u}`)}let l=c.map(([f,u])=>u-f),p=l.reduce((f,u)=>f*u),a=new this.data.constructor(p);const h=new Array(this.dims.length);for(let f=l.length-1,u=1;f>=0;--f)h[f]=u,u*=this.dims[f];for(let f=0;f=0;--o){const e=l[o];u+=(t%e+c[o][0])*h[o],t=Math.floor(t/e)}a[f]=this.data[u]}return new Tensor(this.type,a,s)}transpose(...n){return transpose(this,n)}}function reshape(_,n){const s=_.length,c=n.reduce((p,a)=>p*a);if(s!==c)throw Error(`cannot reshape array of size ${s} into shape (${n})`);let l=_;for(let p=n.length-1;p>=0;p--)l=l.reduce((a,h)=>{let f=a[a.length-1];return f.lengththis.tokens_to_ids.get(c)??this.unk_token_id);return this.fuse_unk&&(s=fuse(s,this.unk_token_id)),s}convert_ids_to_tokens(n){return n.map(s=>this.vocab[s]??this.unk_token)}}class WordPieceTokenizer extends TokenizerModel{constructor(n){super(n),this.tokens_to_ids=n.vocab,this.unk_token_id=this.tokens_to_ids.get(n.unk_token),this.unk_token=n.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[s,c]of this.tokens_to_ids)this.vocab[c]=s}encode(n){let s=[];for(let c of n){let l=[...c],p=!1,a=0,h=[];for(;a0&&(o=this.config.continuing_subword_prefix+o),this.tokens_to_ids.has(o)){u=o;break}--f}if(u===null){p=!0;break}h.push(u),a=f}p?s.push(this.unk_token):s.push(...h)}return s}}class Unigram extends TokenizerModel{constructor(n,s){super(n),this.vocab=new Array(n.vocab.size),this.scores=new Array(n.vocab.size);let c=0;n.vocab.forEach((l,p)=>{this.vocab[c]=p,this.scores[c]=l,++c}),this.unk_token_id=n.unk_id,this.unk_token=this.vocab[n.unk_id],this.tokens_to_ids=new Map(this.vocab.map((l,p)=>[l,p])),this.bosToken=" ",this.bosTokenId=this.tokens_to_ids.get(this.bosToken),this.eosToken=s.eos_token,this.eosTokenId=this.tokens_to_ids.get(this.eosToken),this.unkToken=this.vocab[this.unk_token_id],this.minScore=min(this.scores)[0],this.unkScore=this.minScore-10,this.scores[this.unk_token_id]=this.unkScore,this.trie=new CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(n){const s=n.sentence,c=s.length;let l=0;for(;l{const _=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},(l,p)=>p+"!".charCodeAt(0)),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},(l,p)=>p+"¡".charCodeAt(0)),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},(l,p)=>p+"®".charCodeAt(0))];let n=_.slice(),s=0;for(let l=0;l<256;++l)_.includes(l)||(_.push(l),n.push(256+s),s+=1);let c=n.map(l=>String.fromCharCode(l));return Object.fromEntries(_.map((l,p)=>[l,c[p]]))})(),UNICODE_TO_BYTES=reverseDictionary(BYTES_TO_UNICODE);class BPE extends TokenizerModel{constructor(n){super(n),this.tokens_to_ids=n.vocab,this.unk_token_id=this.tokens_to_ids.get(n.unk_token),this.unk_token=n.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[s,c]of this.tokens_to_ids)this.vocab[c]=s;this.bpe_ranks=Object.fromEntries(n.merges.map((s,c)=>[s,c])),this.merges=n.merges.map(s=>s.split(/\s+/)),this.end_of_word_suffix=n.end_of_word_suffix,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.cache=Object.create(null),this.fuse_unk??(this.fuse_unk=this.config.fuse_unk)}get_pairs(n){let s=new Set,c=n[0];for(let l=1;l{let r=this.bpe_ranks[t]??1/0,i=this.bpe_ranks[e]??1/0;return r<=i?t:e});if(!(p in this.bpe_ranks))break;let[a,h]=p.split(/\s+/g),f=[],u=0,o=-1;for(;u`<0x${a.toString(16).toUpperCase().padStart(2,"0")}>`)):s.push(this.unk_token)}return s}}class Normalizer extends Callable{constructor(n){super(),this.config=n}static fromConfig(n){if(n===null)return null;switch(n.type){case"BertNormalizer":return new BertNormalizer(n);case"Precompiled":return new Precompiled(n);case"Sequence":return new NormalizerSequence(n);case"Replace":return new Replace(n);case"NFC":return new NFC(n);case"NFKD":return new NFKD(n);case"StripAccents":return new StripAccents(n);case"Lowercase":return new Lowercase(n);case"Prepend":return new Prepend(n);default:throw new Error(`Unknown Normalizer type: ${n.type}`)}}normalize(n){throw Error("normalize should be implemented in subclass.")}_call(n){return this.normalize(n)}}class Replace extends Normalizer{normalize(n){let s=createPattern(this.config.pattern);return s===null||(n=n.replaceAll(s,this.config.content)),n}}class NFC extends Normalizer{normalize(n){return n=n.normalize("NFC"),n}}class NFKD extends Normalizer{normalize(n){return n=n.normalize("NFKD"),n}}class StripAccents extends Normalizer{normalize(n){return n=n.replace(/[\u0300-\u036f]/g,""),n}}class Lowercase extends Normalizer{normalize(n){return n=n.toLowerCase(),n}}class Prepend extends Normalizer{normalize(n){return n=this.config.prepend+n,n}}class NormalizerSequence extends Normalizer{constructor(n){super(n),this.normalizers=n.normalizers.map(s=>Normalizer.fromConfig(s))}normalize(n){return this.normalizers.reduce((s,c)=>c.normalize(s),n)}}class BertNormalizer extends Normalizer{_tokenize_chinese_chars(n){let s=[];for(let c=0;c=19968&&n<=40959||n>=13312&&n<=19903||n>=131072&&n<=173791||n>=173824&&n<=177983||n>=177984&&n<=178207||n>=178208&&n<=183983||n>=63744&&n<=64255||n>=194560&&n<=195103}stripAccents(n){return n.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}normalize(n){return this.config.handle_chinese_chars&&(n=this._tokenize_chinese_chars(n)),this.config.lowercase?(n=n.toLowerCase(),this.config.strip_accents!==!1&&(n=this.stripAccents(n))):this.config.strip_accents&&(n=this.stripAccents(n)),n}}class PreTokenizer extends Callable{static fromConfig(n){if(n===null)return null;switch(n.type){case"BertPreTokenizer":return new BertPreTokenizer(n);case"Sequence":return new PreTokenizerSequence(n);case"WhitespaceSplit":return new WhitespaceSplit(n);case"Metaspace":return new MetaspacePreTokenizer(n);case"ByteLevel":return new ByteLevelPreTokenizer(n);case"Split":return new SplitPreTokenizer(n);default:throw new Error(`Unknown PreTokenizer type: ${n.type}`)}}pre_tokenize_text(n){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(n){let s=[];return Array.isArray(n)?s=n.map(c=>this.pre_tokenize_text(c)):s=this.pre_tokenize_text(n),s.flat()}_call(n){return this.pre_tokenize(n)}}class BertPreTokenizer extends PreTokenizer{constructor(n){super();const s="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E";this.pattern=new RegExp(`[^\\s${s}]+|[${s}]`,"gu")}pre_tokenize_text(n){return n.trim().match(this.pattern)||[]}}class ByteLevelPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=BYTES_TO_UNICODE,this.text_encoder=new TextEncoder}pre_tokenize_text(n){return(this.use_regex?n.match(this.pattern)||[]:[n]).map(c=>(this.add_prefix_space&&!c.startsWith(" ")&&(c=" "+c),c=Array.from(this.text_encoder.encode(c),l=>this.byte_encoder[l]).join(""),c))}}class SplitPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n}pre_tokenize_text(n){let s=createPattern(this.config.pattern);if(s===null)return[];switch(this.config.behavior.toLowerCase()){case"isolated":case"removed":return n.match(s)||[];default:return console.warn(`Unknown split behavior: "${this.config.behavior}"`),[]}}}class PostProcessor extends Callable{constructor(n){super(),this.config=n}static fromConfig(n){switch(n.type){case"TemplateProcessing":return new TemplateProcessing(n);case"ByteLevel":return new ByteLevelPostProcessor(n);case"RobertaProcessing":return new RobertaProcessing(n);default:throw new Error(`Unknown PostProcessor type: ${n.type}`)}}post_process(n,...s){throw Error("post_process should be implemented in subclass.")}_call(n,...s){return this.post_process(n,...s)}}class RobertaProcessing extends PostProcessor{constructor(n){super(n),this.cls=n.cls[0],this.sep=n.sep[0]}post_process(n,s=null){return n=[this.cls,...n,this.sep],s!==null&&(n=[...n,this.sep,...s,this.sep]),n}}class TemplateProcessing extends PostProcessor{constructor(n){super(n),this.single=n.single,this.pair=n.pair}post_process(n,s=null){let c=s===null?this.single:this.pair,l=[];for(let p of c)"SpecialToken"in p?l.push(p.SpecialToken.id):"Sequence"in p&&(p.Sequence.id==="A"?l.push(...n):p.Sequence.id==="B"&&l.push(...s));return l}}class ByteLevelPostProcessor extends PostProcessor{post_process(n){return n}}class Decoder extends Callable{constructor(n){super(),this.config=n,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=n.trim_offsets}static fromConfig(n){switch(n.type){case"WordPiece":return new WordPieceDecoder(n);case"Metaspace":return new MetaspaceDecoder(n);case"ByteLevel":return new ByteLevelDecoder(n);case"Replace":return new ReplaceDecoder(n);case"ByteFallback":return new ByteFallback(n);case"Fuse":return new FuseDecoder(n);case"Strip":return new StripDecoder(n);case"Sequence":return new DecoderSequence(n);default:throw new Error(`Unknown Decoder type: ${n.type}`)}}_call(n){return this.decode(n)}decode(n){return this.decode_chain(n).join("")}decode_chain(n){throw Error("`decode_chain` should be implemented in subclass.")}}class ReplaceDecoder extends Decoder{constructor(n){super(n)}decode_chain(n){let s=createPattern(this.config.pattern);return s===null?n:n.map(c=>c.replaceAll(s,this.config.content))}}class ByteFallback extends Decoder{constructor(n){super(n),this.text_decoder=new TextDecoder}decode_chain(n){let s=[],c=[];for(let l of n){let p=null;if(l.length===6&&l.startsWith("<0x")&&l.endsWith(">")){let a=parseInt(l.slice(3,5),16);isNaN(a)||(p=a)}if(p!==null)c.push(p);else{if(c.length>0){let a=this.text_decoder.decode(Uint8Array.from(c));s.push(a),c=[]}s.push(l)}}if(c.length>0){let l=this.text_decoder.decode(Uint8Array.from(c));s.push(l),c=[]}return s}}class FuseDecoder extends Decoder{constructor(n){super(n)}decode_chain(n){return[n.join("")]}}class StripDecoder extends Decoder{constructor(n){super(n),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(n){return n.map(s=>{let c=0;for(let p=0;p(c!==0&&(s.startsWith(this.config.prefix)?s=s.replace(this.config.prefix,""):s=" "+s),this.cleanup&&(s=clean_up_tokenization(s)),s))}}class ByteLevelDecoder extends Decoder{constructor(n){super(n),this.byte_decoder=UNICODE_TO_BYTES,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(n){let s=n.join(""),c=new Uint8Array([...s].map(p=>this.byte_decoder[p]));return this.text_decoder.decode(c)}decode_chain(n){let s=[],c=[];for(let l of n)this.added_tokens.includes(l)?(c.length>0&&(s.push(this.convert_tokens_to_string(c)),c=[]),s.push(l)):c.push(l);return c.length>0&&s.push(this.convert_tokens_to_string(c)),s}}class DecoderSequence extends Decoder{constructor(n){super(n),this.decoders=n.decoders.map(s=>Decoder.fromConfig(s))}decode_chain(n){return this.decoders.reduce((s,c)=>c.decode_chain(s),n)}}class MetaspacePreTokenizer extends PreTokenizer{constructor(n){super(),this.addPrefixSpace=n.add_prefix_space,this.replacement=n.replacement,this.strRep=n.str_rep||this.replacement}pre_tokenize(n){typeof n=="string"&&(n=n.trimStart().split(/\s+/));const s=[];for(let c of n){let l=c.replaceAll(" ",this.strRep);this.addPrefixSpace&&!l.startsWith(this.replacement)&&(l=this.strRep+l),s.push(l)}return s}}class MetaspaceDecoder extends Decoder{constructor(n){super(n),this.addPrefixSpace=n.add_prefix_space,this.replacement=n.replacement}decode_chain(n){let s=[];for(let c=0;cPreTokenizer.fromConfig(s))}pre_tokenize_text(n){return typeof n=="string"&&(n=[n]),this.tokenizers.reduce((s,c)=>c.pre_tokenize(s),n)}}class WhitespaceSplit extends PreTokenizer{constructor(n){super()}pre_tokenize_text(n){return whitespace_split(n)}}class PreTrainedTokenizer extends Callable{constructor(n,s){super(),this.normalizer=Normalizer.fromConfig(n.normalizer),this.pre_tokenizer=PreTokenizer.fromConfig(n.pre_tokenizer),n.model.vocab&&(Array.isArray(n.model.vocab)||(n.model.vocab=Object.entries(n.model.vocab)),n.model.vocab=new Map(n.model.vocab)),this.model=TokenizerModel.fromConfig(n.model,s),this.post_processor=PostProcessor.fromConfig(n.post_processor),this.decoder=Decoder.fromConfig(n.decoder),this.decoder.end_of_word_suffix=this.model.end_of_word_suffix,this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(let c of n.added_tokens){let l=c.id,p=c.content;this.added_tokens.push(p),this.model.tokens_to_ids.set(p,l),this.model.vocab[l]=p,c.special&&(this.special_tokens.push(p),this.all_special_ids.push(l))}this.decoder.added_tokens=this.added_tokens,this.added_tokens_regex=new RegExp("("+this.added_tokens.map(escapeRegExp).join("|")+")"),this.mask_token=this.getToken(s,"mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken(s,"pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken(s,"sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.model_max_length=s.model_max_length,this.remove_space=s.remove_space,this.clean_up_tokenization_spaces=s.clean_up_tokenization_spaces??!0,this.padding_side="right"}getToken(n,...s){for(let c of s){let l=n[c];if(l)if(typeof l=="object"){if(l.__type==="AddedToken")return l.content;throw Error(`Unknown token: ${l}`)}else return l}return null}static async from_pretrained(n,{progress_callback:s=null,config:c=null,cache_dir:l=null,local_files_only:p=!1,revision:a="main"}={}){let h=await loadTokenizer(n,{progress_callback:s,config:c,cache_dir:l,local_files_only:p,revision:a});return new this(...h)}prepare_model_inputs(n){return n}_call(n,{text_pair:s=null,padding:c=!1,truncation:l=null,max_length:p=null,return_tensor:a=!0}={}){let h;if(Array.isArray(n)){if(n.length===0)throw Error("text array must be non-empty");if(s!==null){if(Array.isArray(s)){if(n.length!==s.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");h=n.map((t,e)=>this.encode(t,s[e]))}else h=n.map(t=>this.encode(t))}else{if(n===null)throw Error("text may not be null");if(Array.isArray(s))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");h=[this.encode(n,s)]}let f=Math.max(...h.map(t=>t.length));p===null&&(p=f),p=Math.min(p,this.model_max_length);let u=[];if(c||l)for(let t=0;tp)l&&(h[t]=h[t].slice(0,p)),u.push(new Array(h[t].length).fill(1));else if(c){let e=p-h[t].length;this.padding_side==="right"?(u.push(new Array(h[t].length).fill(1).concat(new Array(e).fill(0))),h[t].push(...new Array(e).fill(this.pad_token_id))):(u.push(new Array(e).fill(0).concat(new Array(h[t].length).fill(1))),h[t].unshift(...new Array(e).fill(this.pad_token_id)))}else u.push(new Array(h[t].length).fill(1));else u=h.map(t=>new Array(t.length).fill(1));if(a){if(!(c&&l)&&h.some(e=>e.length!==h[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");let t=[h.length,h[0].length];h=new Tensor("int64",BigInt64Array.from(h.flat().map(BigInt)),t),u=new Tensor("int64",BigInt64Array.from(u.flat().map(BigInt)),t)}else Array.isArray(n)||(h=h[0],u=u[0]);let o={input_ids:h,attention_mask:u};return o=this.prepare_model_inputs(o),o}_encode_text(n){return n===null?null:n.split(this.added_tokens_regex).filter(l=>l).map(l=>{if(this.added_tokens.includes(l))return l;{this.remove_space===!0&&(l=l.trim().split(/\s+/).join(" ")),this.normalizer!==null&&(l=this.normalizer(l));let p=this.pre_tokenizer!==null?this.pre_tokenizer(l):[l];return this.model(p)}}).flat()}encode(n,s=null){let c=this._encode_text(n),l=this._encode_text(s),p=this.post_processor(c,l);return this.model.convert_tokens_to_ids(p)}batch_decode(n,s={}){return n.map(c=>this.decode(c,s))}decode(n,s={}){if(!Array.isArray(n)||n.length===0||!isIntegralNumber(n[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(n,s)}decode_single(n,{skip_special_tokens:s=!1,clean_up_tokenization_spaces:c=null}){let l=this.model.convert_ids_to_tokens(n);s&&(l=l.filter(a=>!this.special_tokens.includes(a)));let p=this.decoder(l);return this.decoder.end_of_word_suffix&&(p=p.replaceAll(this.decoder.end_of_word_suffix," "),s&&(p=p.trim())),(c??this.clean_up_tokenization_spaces)&&(p=clean_up_tokenization(p)),p}}function add_token_types(_){if(_.input_ids instanceof Tensor)_.token_type_ids=new Tensor("int64",new BigInt64Array(_.input_ids.data.length),_.input_ids.dims);else if(Array.isArray(_.input_ids))Array.isArray(_.input_ids[0])?_.token_type_ids=_.input_ids.map(n=>new Array(n.length).fill(0)):_.token_type_ids=new Array(_.input_ids.length).fill(0);else throw new Error("Input ids must be a Tensor or an Array");return _}class BertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class AlbertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class MobileBertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class SqueezeBertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class DistilBertTokenizer extends PreTrainedTokenizer{}class T5Tokenizer extends PreTrainedTokenizer{}class GPT2Tokenizer extends PreTrainedTokenizer{}class BartTokenizer extends PreTrainedTokenizer{}class RobertaTokenizer extends PreTrainedTokenizer{}class BloomTokenizer extends PreTrainedTokenizer{}class LlamaTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class NllbTokenizer extends PreTrainedTokenizer{constructor(n,s){super(n,s),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(c=>this.languageRegex.test(c))}_build_translation_inputs(n,s,c){if(!this.language_codes.includes(c.tgt_lang))throw new Error(`Target language code "${c.tgt_lang}" is not valid. Must be one of: {${this.language_codes.join(", ")}}`);if(c.src_lang!==void 0){if(!this.language_codes.includes(c.src_lang))throw new Error(`Source language code "${c.src_lang}" is not valid. Must be one of: {${this.language_codes.join(", ")}}`);for(let l of this.post_processor.config.single)if("SpecialToken"in l&&this.languageRegex.test(l.SpecialToken.id)){l.SpecialToken.id=c.src_lang;break}}return c.forced_bos_token_id=this.model.convert_tokens_to_ids([c.tgt_lang])[0],this._call(n,s)}}const Xe=class extends PreTrainedTokenizer{_decode_asr(n,{return_timestamps:s=!1,return_language:c=!1,time_precision:l=null,force_full_sequences:p=!0}={}){if(l===null)throw Error("Must specify time_precision");let a=null;function h(){return{language:a,timestamp:[null,null],text:""}}const f=[];let u=h(),o=0;const t=this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1;let e=[],r=!1,i=null;const d=new Set(this.all_special_ids);for(let b of n){const y=b.tokens;let v=null,w=t;if("stride"in b){const[A,O,x]=b.stride;if(o-=O,i=A-x,O&&(w=O/l+t),x)for(let I=y.length-1;I>=0;--I){const $=y[I];if($>=t){if(v!==null&&($-t)*l=t){const O=(A-t)*l+o,x=Math.round(O*100)/100;if(v!==null&&A>=v)r=!0;else if(r||e.length>0&&A0?e.push(S):e.every(A=>A.length===0)&&(u=h(),e=[],S=[])}if(e.length>0){if(p&&s)throw new Error("There was an error while processing timestamps, we haven't found a timestamp as last token.");const b=this.findLongestCommonSequence(e),y=this.decode(b);u.text=y,f.push(u)}let g=Object.create(null);const m=f.map(b=>b.text).join("");if(s||c){for(let b=0;bI===A[$]).length,x=O/g+m;O>1&&x>h&&(h=x,f=[b,y,w,S])}const[o,t,e,r]=f,i=Math.floor((t+o)/2),d=Math.floor((r+e)/2);l.push(...s.slice(0,i)),s=a.slice(d),c=s.length}return l.push(...s),l}};let WhisperTokenizer=Xe;de(WhisperTokenizer,"LANGUAGES",{en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese"});class CodeGenTokenizer extends PreTrainedTokenizer{}class CLIPTokenizer extends PreTrainedTokenizer{}class MarianTokenizer extends PreTrainedTokenizer{constructor(n,s){super(n,s),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(c=>this.languageRegex.test(c)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(n){if(n===null)return null;let[s,...c]=n.trim().split(this.languageRegex);if(c.length===0)return super._encode_text(s);if(c.length===2){let[l,p]=c;return this.supported_language_codes.includes(l)||console.warn(`Unsupported language code "${l}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),[l,...super._encode_text(p)]}}}class CharTrie{constructor(){this.root=CharTrieNode.default()}extend(n){for(let s of n)this.push(s)}push(n){let s=this.root;for(let c of n){let l=s.children.get(c);l===void 0&&(l=CharTrieNode.default(),s.children.set(c,l)),s=l}s.isLeaf=!0}*commonPrefixSearch(n){let s=this.root,c="";for(let l=0;lf)&&(u=o.clone(),f=t)}if(u!==null)h.prev=u,h.backtraceScore=f;else return[]}++s}const c=[],p=this.beginNodes[n][0].prev;if(p===null)return[];let a=p.clone();for(;a.prev!==null;)c.push(a.clone()),a=a.clone().prev.clone();return c.reverse(),c}piece(n){return this.sentence.slice(n.pos,n.pos+n.length)}tokens(){return this.viterbi().map(s=>this.piece(s))}tokenIds(){return this.viterbi().map(s=>s.tokenId)}}class TokenLatticeNode{constructor(n,s,c,l,p){this.tokenId=n,this.nodeId=s,this.pos=c,this.length=l,this.score=p,this.prev=null,this.backtraceScore=0}clone(){const n=new TokenLatticeNode(this.tokenId,this.nodeId,this.pos,this.length,this.score);return n.prev=this.prev,n.backtraceScore=this.backtraceScore,n}}class AutoTokenizer{static async from_pretrained(n,{quantized:s=!0,progress_callback:c=null,config:l=null,cache_dir:p=null,local_files_only:a=!1,revision:h="main"}={}){let[f,u]=await loadTokenizer(n,{quantized:s,progress_callback:c,config:l,cache_dir:p,local_files_only:a,revision:h}),o=u.tokenizer_class.replace(/Fast$/,""),t=this.TOKENIZER_CLASS_MAPPING[o];return t||(console.warn(`Unknown tokenizer class "${o}", attempting to construct from base class.`),t=PreTrainedTokenizer),new t(f,u)}}de(AutoTokenizer,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer,DistilBertTokenizer,BertTokenizer,MobileBertTokenizer,SqueezeBertTokenizer,AlbertTokenizer,GPT2Tokenizer,BartTokenizer,RobertaTokenizer,WhisperTokenizer,CodeGenTokenizer,CLIPTokenizer,MarianTokenizer,BloomTokenizer,NllbTokenizer,LlamaTokenizer});class LogitsProcessorList extends Callable{constructor(){super(),this.processors=[]}push(n){this.processors.push(n)}extend(n){this.processors.push(...n)}_call(n,s){for(let c of s)this.processors.forEach(l=>l(n,c))}[Symbol.iterator](){return this.processors.values()}}class LogitsProcessor extends Callable{_call(n,s){throw Error("`_call` should be implemented in a subclass")}}class ForceTokensLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.force_token_map=Object.fromEntries(n??[])}_call(n,s){let c=this.force_token_map[n.length];return exists(c)&&(s.data.fill(-1/0),s.data[c]=0),s}}class ForcedBOSTokenLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.bos_token_id=n}_call(n,s){n.length===1&&(s.data.fill(-1/0),s.data[this.bos_token_id]=0)}}class ForcedEOSTokenLogitsProcessor extends LogitsProcessor{constructor(n,s){super(),this.max_length=n,this.forced_eos_token_id=s}_call(n,s){}}class WhisperTimeStampLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.eos_token_id=n.eos_token_id,this.no_timestamps_token_id=n.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(n.forced_decoder_ids||[]).length+2,n.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=n.max_initial_timestamp_index}_call(n,s){if(s.data[this.no_timestamps_token_id]=-1/0,n.length===this.begin_index-1)return s.data.fill(-1/0),s.data[this.timestamp_begin]=0,s;const c=n.slice(this.begin_index),l=c.length>=1&&c[c.length-1]>=this.timestamp_begin,p=c.length<2||c[c.length-2]>=this.timestamp_begin;if(l&&(p?s.data.subarray(this.timestamp_begin).fill(-1/0):s.data.subarray(0,this.eos_token_id).fill(-1/0)),n.length===this.begin_index&&this.max_initial_timestamp_index!==null){const u=this.timestamp_begin+this.max_initial_timestamp_index;s.data.subarray(u+1).fill(-1/0)}const a=log_softmax(s.data),h=Math.log(a.subarray(this.timestamp_begin).map(Math.exp).reduce((u,o)=>u+o)),f=Math.max(...a.subarray(0,this.timestamp_begin));return h>f&&s.data.subarray(0,this.timestamp_begin).fill(-1/0),s}}class NoRepeatNGramLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.no_repeat_ngram_size=n}getNgrams(n){const s=n.length,c=[];for(let p=0;p0&&(l=l.map(p=>p/this.temperature)),l}randomSelect(n){let s=n.reduce((l,p)=>l+p,0),c=Math.random()*s;for(let l=0;l1)return new BeamSearchSampler(n.temperature,n.num_beams,n.do_sample,n.top_k);if(n.do_sample)return new TopKSampler(n.temperature,n.top_k);if(n.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${n.num_return_sequences}.`);return new GreedySampler(n.temperature)}}class GreedySampler extends Sampler{sample(n,s=-1){let c=this.getLogits(n,s);return[[max(c)[1],0]]}}class TopKSampler extends Sampler{constructor(n,s){super(n),this.k=s}sample(n,s=-1){let[c,l,p]=n.dims,a=p;this.k>0&&(a=Math.min(this.k,a));let h=this.getLogits(n,s),f=getTopItems(h,a),u=softmax(f.map(r=>r[1])),o=this.randomSelect(u),t=f[o][0],e=Math.log(u[o]);return[[t,e]]}}class BeamSearchSampler extends Sampler{constructor(n,s,c,l){super(n),this.num_beams=s,this.do_sample=c,this.top_k=l}sample(n,s=-1){let c=this.getLogits(n,s);if(this.do_sample||this.top_k>0){const[l,p,a]=n.dims;let h=a;this.top_k>0&&(h=Math.min(this.top_k,h));const f=getTopItems(c,h),u=softmax(f.map(o=>o[1]));return Array.from({length:this.num_beams},()=>{const o=this.randomSelect(u);return[f[o][0],Math.log(u[o])]})}else{const l=log_softmax(c);return getTopItems(l,this.num_beams)}}}const{InferenceSession,Tensor:ONNXTensor}=ONNX;async function constructSession(_,n,s){let c=`onnx/${n}${s.quantized?"_quantized":""}.onnx`,l=await getModelFile(_,c,!0,s);try{return await InferenceSession.create(l,{executionProviders})}catch(p){if(executionProviders.length===1&&executionProviders[0]==="wasm")throw p;return console.warn(p),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await InferenceSession.create(l,{executionProviders:["wasm"]})}}async function sessionRun(_,n){const s={},c=[];for(let a of _.inputNames)n[a]===void 0?c.push(a):s[a]=n[a];if(c.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${c.join(", ")}.`);const l=Object.keys(n).length,p=_.inputNames.length;if(l>p){let a=Object.keys(n).filter(h=>!_.inputNames.includes(h));console.warn(`WARNING: Too many inputs were provided (${l} > ${p}). The following inputs will be ignored: "${a.join(", ")}".`)}try{let a=await _.run(s);return a=replaceTensors(a),a}catch(a){throw console.error(`An error occurred during model execution: "${a}".`),console.error("Inputs given to model:",s),a}}function replaceTensors(_){for(let n in _)_[n]instanceof ONNXTensor&&(_[n]=new Tensor(_[n]));return _}function toI64Tensor(_){if(_ instanceof Tensor)return _;if(_.length===0)throw Error("items must be non-empty");if(Array.isArray(_[0])){if(_.some(n=>n.length!==_[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new Tensor("int64",BigInt64Array.from(_.flat().map(n=>BigInt(n))),[_.length,_[0].length])}else return new Tensor("int64",BigInt64Array.from(_.map(n=>BigInt(n))),[1,_.length])}function _prepare_attention_mask(_,n){let s=_.config.pad_token_id??null,c=_.config.eos_token_id??null;isIntegralNumber(c)&&(c=[c]);let l=n.indexOf(s)!==-1,p=c===null||!c.includes(s);if(l&&p){let a=BigInt64Array.from(n.data.map(h=>h!=s));return new Tensor("int64",a,n.dims)}else return new Tensor("int64",new BigInt64Array(n.data.length).fill(1n),n.dims)}function boolTensor(_){return new Tensor("bool",[_],[1])}async function loadAutoModel(_,n){let s=n.config??await getModelJSON(_,"config.json",!0,n),c=s.is_encoder_decoder?"encoder_model":"model",l=await constructSession(_,c,n);return[s,l]}async function loadModel(_,n){return await Promise.all([n.config??getModelJSON(_,"config.json",!0,n),constructSession(_,"model",n)])}async function seq2seqLoadModel(_,n){return await Promise.all([n.config??getModelJSON(_,"config.json",!0,n),constructSession(_,"encoder_model",n),constructSession(_,"decoder_model_merged",n),getModelJSON(_,"generation_config.json",!1,n)])}async function encoderDecoderLoadModel(_,n){return await Promise.all([n.config??getModelJSON(_,"config.json",!0,n),constructSession(_,"encoder_model",n),constructSession(_,"decoder_model_merged",n)])}async function decoderLoadModel(_,n){return await Promise.all([n.config??getModelJSON(_,"config.json",!0,n),constructSession(_,"decoder_model_merged",n)])}async function seq2seq_forward(_,n,{encoder_input_name:s="input_ids",add_decoder_pkv:c=!0}={}){let l=n.encoder_outputs,p=n.past_key_values;if(l===null){const u={[s]:n[s]};_.session.inputNames.includes("attention_mask")&&(u.attention_mask=n.attention_mask),l=(await sessionRun(_.session,u)).last_hidden_state}let a={input_ids:n.decoder_input_ids,encoder_hidden_states:l,use_cache_branch:boolTensor(p!==null)};_.decoder_merged_session.inputNames.includes("encoder_attention_mask")&&(a.encoder_attention_mask=n.attention_mask),_.addPastKeyValues(a,p,c);const h=await sessionRun(_.decoder_merged_session,a);let f=h.logits;return p=_.getPastKeyValues(h,p),new Seq2SeqLMOutput(f,p,l)}function seq2seqStartBeams(_,n,s,c=!0){let l=[],p=0;for(let a of n){a.dims=[1,...a.dims];let h={inputs:a,encoder_outputs:null,past_key_values:null,output_token_ids:[_.config.decoder_start_token_id],done:!1,score:0,id:p++};c&&(h.attention_mask=_prepare_attention_mask(_,a)),l.push(h)}return l}async function seq2seqRunBeam(_,n,{input_name:s="input_ids"}={}){let c={[s]:n.inputs,decoder_input_ids:toI64Tensor(n.output_token_ids.slice(-1)),encoder_outputs:n.encoder_outputs,past_key_values:n.past_key_values};n.attention_mask&&(c.attention_mask=n.attention_mask);let l=await _.forward(c);return n.past_key_values=l.past_key_values,n.encoder_outputs=l.encoder_outputs,l}async function textgen_forward(_,n){let s=n.past_key_values,c={input_ids:n.input_ids,attention_mask:n.attention_mask,use_cache_branch:boolTensor(s!==null)};_.addPastKeyValues(c,s);let l=await sessionRun(_.session,c),p=l.logits;return s=_.getPastKeyValues(l,s),{logits:p,past_key_values:s}}function textgenStartBeams(_,n,s,c){let l=[],p=0;for(let a of n){a.dims=[1,...a.dims];let h;c?(h=c[p],h.dims=[1,...h.dims]):h=_prepare_attention_mask(_,a);let f={input:a,model_input_ids:a,attention_mask:h,past_key_values:null,output_token_ids:[],num_output_tokens:s,done:!1,score:0,id:p++};l.push(f)}return l}async function textgenRunBeam(_,n){let s=new BigInt64Array(n.input.data.length+n.output_token_ids.length).fill(1n),c={input_ids:n.model_input_ids,attention_mask:new Tensor("int64",s,[1,s.length]),past_key_values:n.past_key_values},l=await _.forward(c);return n.past_key_values=l.past_key_values,l}function textgenUpdatebeam(_,n){_.output_token_ids=[..._.output_token_ids,n],_.model_input_ids=new Tensor("int64",[BigInt(n)],[1,1])}class PreTrainedModel extends Callable{constructor(n,s){super(),this.config=n,this.session=s}async dispose(){let n=[];for(let s of Object.keys(this)){let c=this[s];c instanceof InferenceSession&&n.push(c.handler.dispose())}return await Promise.all(n)}static async from_pretrained(n,{quantized:s=!0,progress_callback:c=null,config:l=null,cache_dir:p=null,local_files_only:a=!1,revision:h="main"}={}){let f=await loadAutoModel(n,{quantized:s,progress_callback:c,config:l,cache_dir:p,local_files_only:a,revision:h});return new this(...f)}async _call(n){return await sessionRun(this.session,n)}async forward(n){throw Error("forward should be implemented in subclasses.")}_get_logits_processor(n,s,c=null){const l=new LogitsProcessorList;return n.repetition_penalty!==null&&n.repetition_penalty!==1&&l.push(new RepetitionPenaltyLogitsProcessor(n.repetition_penalty)),n.no_repeat_ngram_size!==null&&n.no_repeat_ngram_size>0&&l.push(new NoRepeatNGramLogitsProcessor(n.no_repeat_ngram_size)),n.forced_bos_token_id!==null&&l.push(new ForcedBOSTokenLogitsProcessor(n.forced_bos_token_id)),n.forced_eos_token_id!==null&&l.push(new ForcedEOSTokenLogitsProcessor(n.max_length,n.forced_eos_token_id)),n.forced_decoder_ids!==null&&l.push(new ForceTokensLogitsProcessor(n.forced_decoder_ids)),c!==null&&l.extend(c),l}_get_generation_config(n){let s=new GenerationConfig;return"generation_config"in this&&Object.assign(s,this.generation_config),n!==null&&Object.assign(s,n),s}async generate(n,s=null,c=null,{inputs_attention_mask:l=null}={}){if(!(n instanceof Tensor)&&!isTypedArray(n)&&!Array.isArray(n))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${n.constructor.name}".`);if(n.length===0)throw Error("Must supply a non-empty array of input token ids.");s=this._get_generation_config(s),c=c??new LogitsProcessorList,c=this._get_logits_processor(s,n.length,c);let p=1;const a=p+(s.max_new_tokens??1/0);let h=Sampler.getSampler(s),f=this.getStartBeams(n,p,l);for(;f.some(u=>!u.done)&&po.sort((t,e)=>e.score-t.score).slice(0,s.num_beams)),f=u.flat(),s.callback_function&&s.callback_function(f)}return this.groupBeams(f).map(u=>s.num_return_sequences>1?u.slice(0,s.num_return_sequences).map(o=>o.output_token_ids):[u[0].output_token_ids])}groupBeams(n){const s=Object.create(null);for(const c of n)s[c.id]===void 0?s[c.id]=[c]:s[c.id].push(c);return Object.values(s)}getPastKeyValues(n,s){const c=Object.create(null);for(const l in n)if(l.startsWith("present")){let p=l.replace("present","past_key_values");s!==null&&l.includes("encoder")?c[p]=s[p]:c[p]=n[l]}return c}addPastKeyValues(n,s,c=!1){if(s===null)if(c){let l=[1,this.num_encoder_heads,0,this.encoder_dim_kv];for(let a=0;a{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(_,n)},loadImageFunction=self.createImageBitmap,ImageDataClass=self.ImageData;else if(fs)loadImageFunction=async _=>{let{data:n,info:s}=await _.raw().toBuffer({resolveWithObject:!0});return new RawImage(new Uint8ClampedArray(n),s.width,s.height,s.channels)};else throw new Error("Unable to load image processing library.");const RESAMPLING_MAPPING={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"};class RawImage{constructor(n,s,c,l){this._update(n,s,c,l)}static async read(n){if(n instanceof RawImage)return n;if(isString(n)||n instanceof URL)return await this.fromURL(n);throw new Error(`Unsupported input type: ${typeof n}`)}static async fromURL(n){let c=await(await getFile(n)).blob();return this.fromBlob(c)}static async fromBlob(n){if(BROWSER_ENV){let s=await loadImageFunction(n);const c=createCanvasFunction(s.width,s.height).getContext("2d");return c.drawImage(s,0,0),new this(c.getImageData(0,0,s.width,s.height).data,s.width,s.height,4)}else{let s=fs(await n.arrayBuffer());return await loadImageFunction(s)}}grayscale(){if(this.channels===1)return this;let n=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 3:case 4:for(let s=0,c=0;s=0?f=c:o=-c,l>=0?u=l:t=-l,h.drawImage(a,f,u,n,s,o,t,n,s),new RawImage(h.getImageData(0,0,n,s).data,n,s,4).convert(p)}else{let p=fs(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}});if(c>=0&&l>=0)p=p.extract({left:Math.floor(c),top:Math.floor(l),width:n,height:s});else if(c<=0&&l<=0){let a=Math.floor(-l),h=Math.floor(-c);p=p.extend({top:a,left:h,right:n-this.width-h,bottom:s-this.height-a})}else{let a=[0,0],h=0;l<0?(a[0]=Math.floor(-l),a[1]=s-this.height-a[0]):h=Math.floor(l);let f=[0,0],u=0;c<0?(f[0]=Math.floor(-c),f[1]=n-this.width-f[0]):u=Math.floor(c),p=p.extend({top:a[0],bottom:a[1],left:f[0],right:f[1]}).extract({left:u,top:h,width:n,height:s})}return await loadImageFunction(p)}}toCanvas(){let n=this.clone().rgba(),s=createCanvasFunction(n.width,n.height),c=new ImageDataClass(n.data,n.width,n.height);return s.getContext("2d").putImageData(c,0,0),s}_update(n,s,c,l=null){return this.data=n,this.width=s,this.height=c,l!==null&&(this.channels=l),this}clone(){return new RawImage(this.data.slice(),this.width,this.height,this.channels)}convert(n){if(this.channels===n)return this;switch(n){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}save(n,s="image/png"){if(!env.useFS)throw new Error("Unable to save the image because filesystem is disabled in this environment.");const l=this.toCanvas().toBuffer(s);fs.writeFileSync(n,l)}}async function read_audio(_,n){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. As a result, audio data must be passed directly to the processor. If you are running in node.js, you can use an external library (e.g., https://github.com/audiojs/web-audio-api) to do this.");const s=await(await getFile(_)).arrayBuffer(),l=await new AudioContext({sampleRate:n}).decodeAudioData(s);let p;if(l.numberOfChannels===2){const a=Math.sqrt(2);let h=l.getChannelData(0),f=l.getChannelData(1);p=new Float32Array(h.length);for(let u=0;u=i?e[b]=r*Math.exp(d*(y-i)):e[b]=o+t*y,g[b]=p.map(v=>e[b]-v)}const m=e.slice(1).map((b,y)=>1/(b-e[y]));for(let b=0;bthis.preprocess(l)));return s.forEach(l=>l.pixel_values.dims=[1,...l.pixel_values.dims]),{pixel_values:cat(s.map(l=>l.pixel_values)),original_sizes:s.map(l=>l.original_size),reshaped_input_sizes:s.map(l=>l.reshaped_input_size)}}}class ViTFeatureExtractor extends ImageFeatureExtractor{}class DetrFeatureExtractor extends ImageFeatureExtractor{async _call(n){let s=await super._call(n),c=[s.pixel_values.dims[0],64,64];return s.pixel_mask=new Tensor("int64",new BigInt64Array(c.reduce((l,p)=>l*p)).fill(1n),c),s}center_to_corners_format([n,s,c,l]){return[n-c/2,s-l/2,n+c/2,s+l/2]}post_process_object_detection(n,s=.5,c=null){const l=n.logits,p=n.pred_boxes,[a,h,f]=l.dims;if(c!==null&&c.length!==a)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let u=[];for(let o=0;os){let v=i[d].data;v=this.center_to_corners_format(v),t!==null&&(v=v.map((w,S)=>w*t[(S+1)%2])),e.boxes.push(v),e.classes.push(m),e.scores.push(y)}}u.push(e)}return u}remove_low_and_no_objects(n,s,c,l){let p=[],a=[],h=[];for(let f=0;fc&&(p.push(o),a.push(r),h.push(t))}return[p,a,h]}check_segment_validity(n,s,c,l=.5,p=.8){let a=[],h=0,f=0;for(let o=0;o=l&&++f;let u=h>0&&f>0;return u&&(u=h/f>p),[u,a]}compute_segments(n,s,c,l,p,a=null,h=null){let[f,u]=h??n[0].dims,o=new Tensor("int32",new Int32Array(f*u),[f,u]),t=[];if(h!==null)for(let d=0;dr[m]&&(e[m]=d,r[m]=n[d].data[m])}let i=0;for(let d=0;dBigInt(Math.round(f)))),a);return{pixel_values:c,original_sizes:l,reshaped_input_sizes:p,input_points:h}}post_process_masks(n,s,c,{mask_threshold:l=0,binarize:p=!0,pad_size:a=null}={}){let h=[];a=a??this.pad_size;let f=[a.height,a.width];for(let u=0;ub>l),m.dims)),m.dims=[1,...m.dims],r.push(m)}let i=cat(r);h.push(i)}return h}}class WhisperFeatureExtractor extends FeatureExtractor{constructor(n){var s;super(n),(s=this.config).mel_filters??(s.mel_filters=getMelFilters(this.config.sampling_rate,this.config.n_fft,this.config.feature_size))}calcOffset(n,s){return Math.abs((n+s)%(2*s)-s)}padReflect(n,s,c){const l=new Float32Array(n.length+s+c),p=n.length-1;for(let a=0;a>1;++w){const S=(w+1-c)**2/2,A=Math.sqrt(m**2+b**2)**S,O=S*Math.atan2(b,m);let x=2*w;u[x]=A*Math.cos(O),u[x+1]=A*Math.sin(O),o[x]=u[x],o[x+1]=-u[x+1]}const y=u.subarray(l,p),v=new FFT(a>>1);v.transform(r,o);for(let w=0;w>1,$=S[I]*s[I];t[O]=$*y[O],t[x]=$*y[x]}v.transform(i,t);for(let O=0;Ol?a-l:0,u=a>1,u=new Float32Array(h*f);for(let m=0;mthis.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`.");let s=n.slice(0,this.config.n_samples),c=this._extract_fbank_features(s);return{input_features:new Tensor("float32",c.data,[1,...c.dims])}}}class Processor extends Callable{constructor(n){super(),this.feature_extractor=n}async _call(n){return await this.feature_extractor(n)}}class SamProcessor extends Processor{async _call(n,s){return await this.feature_extractor(n,s)}post_process_masks(...n){return this.feature_extractor.post_process_masks(...n)}}class WhisperProcessor extends Processor{async _call(n){return await this.feature_extractor(n)}}class AutoProcessor{static async from_pretrained(n,{progress_callback:s=null,config:c=null,cache_dir:l=null,local_files_only:p=!1,revision:a="main"}={}){let h=c??await getModelJSON(n,"preprocessor_config.json",!0,{progress_callback:s,config:c,cache_dir:l,local_files_only:p,revision:a}),f=h.feature_extractor_type??h.image_processor_type,u=this.FEATURE_EXTRACTOR_CLASS_MAPPING[f];if(!u)if(h.size!==void 0)console.warn("Feature extractor type not specified, assuming ImageFeatureExtractor due to size parameter in config."),u=ImageFeatureExtractor;else throw new Error(`Unknown Feature Extractor type: ${h.feature_extractor_type}`);let o=this.PROCESSOR_CLASS_MAPPING[h.processor_class]??Processor,t=new u(h);return new o(t)}}de(AutoProcessor,"FEATURE_EXTRACTOR_CLASS_MAPPING",{WhisperFeatureExtractor,ViTFeatureExtractor,DetrFeatureExtractor,SamImageProcessor}),de(AutoProcessor,"PROCESSOR_CLASS_MAPPING",{WhisperProcessor,SamProcessor});async function prepareImages(_){return Array.isArray(_)||(_=[_]),_=await Promise.all(_.map(n=>RawImage.read(n))),_}class Pipeline extends Callable{constructor(n,s,c){super(),this.task=n,this.tokenizer=s,this.model=c}async dispose(){await this.model.dispose()}async _call(n){let s=this.tokenizer(n,{padding:!0,truncation:!0}),c=await this.model(s);return[s,c]}}class TextClassificationPipeline extends Pipeline{async _call(n,{topk:s=1}={}){let[c,l]=await super._call(n),p=this.model.config.id2label,a=[];for(let h of l.logits){let u=getTopItems(softmax(h.data),s).map(function(o){return{label:p[o[0]],score:o[1]}});s===1?a.push(...u):a.push(u)}return Array.isArray(n)||s===1?a:a[0]}}class TokenClassificationPipeline extends Pipeline{async _call(n,{ignore_labels:s=["O"]}={}){let c=Array.isArray(n);c||(n=[n]);let l=this.tokenizer,[p,a]=await super._call(n),h=a.logits,f=this.model.config.id2label,u=[];for(let o=0;o[r,i]).filter(r=>r[1]>u),t=Array.from(softmax(p.end_logits[h].data)).map((r,i)=>[r,i]).filter(r=>r[1]>u),e=product(o,t).filter(r=>r[0][1]<=r[1][1]).map(r=>[r[0][1],r[1][1],r[0][0]*r[1][0]]).sort((r,i)=>i[2]-r[2]);for(let r=0;r{let i=[...f];return i[u]=r[0],{score:r[1],token:r[0],token_str:p.model.vocab[r[0]],sequence:p.decode(i,{skip_special_tokens:!0})}}))}return Array.isArray(n)?a:a[0]}}class Text2TextGenerationPipeline extends Pipeline{constructor(){super(...arguments);de(this,"_key",null)}async _call(s,c={}){Array.isArray(s)||(s=[s]),this.model.config.prefix&&(s=s.map(u=>this.model.config.prefix+u));let l=this.model.config.task_specific_params;l&&l[this.task]&&l[this.task].prefix&&(s=s.map(u=>l[this.task].prefix+u));let p={padding:!0,truncation:!0},a;this instanceof TranslationPipeline&&"_build_translation_inputs"in this.tokenizer?a=this.tokenizer._build_translation_inputs(s,p,c).input_ids:a=this.tokenizer(s,p).input_ids;let h=(await this.model.generate(a,c)).flat(),f=this.tokenizer.batch_decode(h,{skip_special_tokens:!0});return this._key!==null&&(f=f.map(u=>this._key===null?u:{[this._key]:u})),f}}class SummarizationPipeline extends Text2TextGenerationPipeline{constructor(){super(...arguments);de(this,"_key","summary_text")}}class TranslationPipeline extends Text2TextGenerationPipeline{constructor(){super(...arguments);de(this,"_key","translation_text")}}class TextGenerationPipeline extends Pipeline{async _call(n,s={}){let c=typeof n=="string"||n instanceof String;c&&(n=[n]),this.tokenizer.padding_side="left";let l=this.tokenizer(n,{padding:!0,truncation:!0}),p=l.input_ids,a=l.attention_mask,f=(await this.model.generate(p,s,null,{inputs_attention_mask:a})).map((u,o)=>{let t=n[o].trim();return this.tokenizer.batch_decode(u,{skip_special_tokens:!0}).map(r=>({generated_text:t+r}))});return c&&f.length===1?f[0]:f}}class ZeroShotClassificationPipeline extends Pipeline{constructor(n,s,c){super(n,s,c),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map(([l,p])=>[l.toLowerCase(),p])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(n,s,{hypothesis_template:c="This example is {}.",multi_label:l=!1}={}){let p=Array.isArray(n);p||(n=[n]),Array.isArray(s)||(s=[s]);let a=s.map(u=>c.replace("{}",u)),h=l||s.length===1,f=[];for(let u of n){let o=[];for(let r of a){let i=this.tokenizer(u,{text_pair:r}),d=await this.model(i);h?o.push([d.logits.data[this.contradiction_id],d.logits.data[this.entailment_id]]):o.push(d.logits.data[this.entailment_id])}let t;h?t=o.map(r=>softmax(r)[1]):t=softmax(o);let e=t.map((r,i)=>[r,i]).sort((r,i)=>i[0]-r[0]);f.push({sequence:u,labels:e.map(r=>s[r[1]]),scores:e.map(r=>r[0])})}return p?f:f[0]}}class FeatureExtractionPipeline extends Pipeline{_mean_pooling(n,s){let c=[n.dims[0],n.dims[2]],l=new n.data.constructor(c[0]*c[1]),[p,a,h]=n.dims,f=0;for(let u=0;ul+p*p,0));for(let l=0;l0){if(p===null)p=l/6;else if(l<=p)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const g=u*l,m=u*p,b=g-2*m;let y=0;for(;y=e.length;r.push({stride:[v.length,S?0:m,A?0:m],input_features:w.input_features,is_last:A}),y+=b}}else r=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let g of r){let m=await this.model.generate(g.input_features,s);g.tokens=m[0].flat(),g.stride=g.stride.map(b=>b/u),a!==null&&a(g)}let[i,d]=this.tokenizer._decode_asr(r,{time_precision:o,return_timestamps:c,force_full_sequences:h});t.push({text:i,...d})}return f?t[0]:t}}class ImageToTextPipeline extends Pipeline{constructor(n,s,c,l){super(n,s,c),this.processor=l}async _call(n,s={}){let c=Array.isArray(n);n=await prepareImages(n);let{pixel_values:l}=await this.processor(n),p=[];for(let a of l){a.dims=[1,...a.dims];let h=(await this.model.generate(a,s)).flat(),f=this.tokenizer.batch_decode(h,{skip_special_tokens:!0}).map(u=>({generated_text:u.trim()}));p.push(f)}return c?p:p[0]}}class ImageClassificationPipeline extends Pipeline{constructor(n,s,c){super(n,null,s),this.processor=c}async _call(n,{topk:s=1}={}){let c=Array.isArray(n);n=await prepareImages(n);let{pixel_values:l}=await this.processor(n),p=await this.model({pixel_values:l}),a=this.model.config.id2label,h=[];for(let f of p.logits){let o=getTopItems(softmax(f.data),s).map(function(t){return{label:a[t[0]],score:t[1]}});s===1?h.push(...o):h.push(o)}return c||s===1?h:h[0]}}class ImageSegmentationPipeline extends Pipeline{constructor(n,s,c){super(n,null,s),this.processor=c,this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(n,{threshold:s=.5,mask_threshold:c=.5,overlap_mask_area_threshold:l=.8,label_ids_to_fuse:p=null,target_sizes:a=null,subtask:h=null}={}){if(Array.isArray(n)&&n.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");n=await prepareImages(n);let u=n.map(d=>[d.height,d.width]),{pixel_values:o,pixel_mask:t}=await this.processor(n),e=await this.model({pixel_values:o,pixel_mask:t}),r=null;if(h!==null)r=this.subtasks_mapping[h];else for(let[d,g]of Object.entries(this.subtasks_mapping))if(g in this.processor.feature_extractor){r=this.processor.feature_extractor[g].bind(this.processor.feature_extractor),h=d;break}let i=[];if(h==="panoptic"||h==="instance"){let d=r(e,s,c,l,p,a??u)[0],g=d.segmentation,m=this.model.config.id2label;for(let b of d.segments_info){let y=new Uint8ClampedArray(g.data.length);for(let w=0;wc.replace("{}",o)),a=this.tokenizer(p,{padding:!0,truncation:!0}),{pixel_values:h}=await this.processor(n),f=await this.model({...a,pixel_values:h}),u=[];for(let o of f.logits_per_image){let t=softmax(o.data);u.push([...t].map((e,r)=>({score:e,label:s[r]})))}return l?u:u[0]}}class ObjectDetectionPipeline extends Pipeline{constructor(n,s,c){super(n,null,s),this.processor=c}async _call(n,{threshold:s=.9,percentage:c=!1}={}){let l=Array.isArray(n);if(l&&n.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");n=await prepareImages(n);let p=c?null:n.map(t=>[t.height,t.width]),{pixel_values:a,pixel_mask:h}=await this.processor(n),f=await this.model({pixel_values:a,pixel_mask:h}),u=this.processor.feature_extractor.post_process_object_detection(f,s,p),o=this.model.config.id2label;return u.forEach(t=>t.labels=t.classes.map(e=>o[e])),l?u:u[0]}}const SUPPORTED_TASKS={"text-classification":{tokenizer:AutoTokenizer,pipeline:TextClassificationPipeline,model:AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:AutoTokenizer,pipeline:TokenClassificationPipeline,model:AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:AutoTokenizer,pipeline:QuestionAnsweringPipeline,model:AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:AutoTokenizer,pipeline:FillMaskPipeline,model:AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:AutoTokenizer,pipeline:SummarizationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:AutoTokenizer,pipeline:TranslationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:AutoTokenizer,pipeline:Text2TextGenerationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:AutoTokenizer,pipeline:TextGenerationPipeline,model:AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:AutoTokenizer,pipeline:ZeroShotClassificationPipeline,model:AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"automatic-speech-recognition":{tokenizer:AutoTokenizer,pipeline:AutomaticSpeechRecognitionPipeline,model:AutoModelForSeq2SeqLM,processor:AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"image-to-text":{tokenizer:AutoTokenizer,pipeline:ImageToTextPipeline,model:AutoModelForVision2Seq,processor:AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:ImageClassificationPipeline,model:AutoModelForImageClassification,processor:AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:ImageSegmentationPipeline,model:AutoModelForImageSegmentation,processor:AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:AutoTokenizer,pipeline:ZeroShotImageClassificationPipeline,model:AutoModel,processor:AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:ObjectDetectionPipeline,model:AutoModelForObjectDetection,processor:AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"feature-extraction":{tokenizer:AutoTokenizer,pipeline:FeatureExtractionPipeline,model:AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"}},TASK_ALIASES={"sentiment-analysis":"text-classification",ner:"token-classification",vqa:"visual-question-answering",embeddings:"feature-extraction"};async function pipeline(_,n=null,{quantized:s=!0,progress_callback:c=null,config:l=null,cache_dir:p=null,local_files_only:a=!1,revision:h="main"}={}){_=TASK_ALIASES[_]??_;let f=SUPPORTED_TASKS[_.split("_",1)[0]];if(!f)throw Error(`Unsupported pipeline: ${_}. Must be one of [${Object.keys(SUPPORTED_TASKS)}]`);n||(n=f.default.model,console.log(`No model specified. Using default model: "${n}".`));let u=f.tokenizer,o=f.model,t=f.pipeline,e=f.processor,r=[],i={quantized:s,progress_callback:c,config:l,cache_dir:p,local_files_only:a,revision:h};u&&r.push(u.from_pretrained(n,i)),o&&r.push(o.from_pretrained(n,i)),e&&r.push(e.from_pretrained(n,i));let d=await Promise.all(r);return dispatchCallback(c,{status:"ready",task:_,model:n}),new t(_,...d)}function product(..._){return _.reduce((n,s)=>n.flatMap(c=>s.map(l=>[c,l])))}class PipelineFactory{constructor(n,s){this.tokenizer=n,this.model=s}static async getInstance(n=null){if(this.task===null||this.model===null)throw Error("Must set task and model");return this.instance===null&&(this.instance=pipeline(this.task,this.model,{progress_callback:n})),this.instance}}de(PipelineFactory,"task",null),de(PipelineFactory,"model",null),de(PipelineFactory,"instance",null),self.addEventListener("message",async _=>{const n=_.data;let s=await transcribe(n.audio,n.model,n.subtask,n.language);self.postMessage({status:"complete",task:"automatic-speech-recognition",data:s})});class AutomaticSpeechRecognitionPipelineFactory extends PipelineFactory{}de(AutomaticSpeechRecognitionPipelineFactory,"task","automatic-speech-recognition"),de(AutomaticSpeechRecognitionPipelineFactory,"model",null);const transcribe=async(_,n,s,c)=>{const l=`Xenova/${n}`,p=AutomaticSpeechRecognitionPipelineFactory;p.model!==l&&(p.model=l,p.instance!==null&&((await p.getInstance()).dispose(),p.instance=null));let a=await p.getInstance(e=>{self.postMessage(e)});const h=a.processor.feature_extractor.config.chunk_length/a.model.config.max_source_positions;let f=[{tokens:[],finalised:!1}];function u(e){let r=f[f.length-1];Object.assign(r,e),r.finalised=!0,e.is_last||f.push({tokens:[],finalised:!1})}function o(e){let r=f[f.length-1];r.tokens=[...e[0].output_token_ids];let i=a.tokenizer._decode_asr(f,{time_precision:h,return_timestamps:!0,force_full_sequences:!1});self.postMessage({status:"update",task:"automatic-speech-recognition",data:i})}return await a(_,{max_new_tokens:1/0,top_k:0,do_sample:!1,chunk_length_s:30,stride_length_s:5,return_timestamps:!0,force_full_sequences:!1,callback_function:o,chunk_callback:u})}})(); diff --git a/index.html b/index.html index 58275de3b1c343a98420342baa076b9baaafa157..34edabd3ad09d7a1a250349922bc8a94cbde369d 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,15 @@ - - - - - My static Space - - - -
-

Welcome to your static Space!

-

You can modify this app directly by editing index.html in the Files and versions tab.

-

- Also don't forget to check the - Spaces documentation. -

-
- + + + + + + Whisper Web + + + + +
+ + diff --git a/vite.svg b/vite.svg new file mode 100644 index 0000000000000000000000000000000000000000..e7b8dfb1b2a60bd50538bec9f876511b9cac21e3 --- /dev/null +++ b/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file