',q=window.open();q.document.write(K),q.document.title=M}},c.getDefaultOption=function(_){var T={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:_.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:_.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return T},c}(ToolboxFeature);const SaveAsImage$1=SaveAsImage;var INNER_STACK_KEYWORD="__ec_magicType_stack__",radioTypes=[["line","bar"],["stack"]],MagicType=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.getIcons=function(){var _=this.model,T=_.get("icon"),C={};return each$f(_.get("type"),function(M){T[M]&&(C[M]=T[M])}),C},c.getDefaultOption=function(_){var T={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:_.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return T},c.prototype.onclick=function(_,T,C){var M=this.model,E=M.get(["seriesIndex",C]);if(seriesOptGenreator[C]){var P={series:[]},R=function(O){var L=O.subType,F=O.id,V=seriesOptGenreator[C](L,F,O,M);V&&(defaults(V,O.option),P.series.push(V));var W=O.coordinateSystem;if(W&&W.type==="cartesian2d"&&(C==="line"||C==="bar")){var z=W.getAxesByScale("ordinal")[0];if(z){var Z=z.dim,H=Z+"Axis",Y=O.getReferringComponents(H,SINGLE_REFERRING).models[0],U=Y.componentIndex;P[H]=P[H]||[];for(var j=0;j<=U;j++)P[H][U]=P[H][U]||{};P[H][U].boundaryGap=C==="bar"}}};each$f(radioTypes,function(O){indexOf(O,C)>=0&&each$f(O,function(L){M.setIconStatus(L,"normal")})}),M.setIconStatus(C,"emphasis"),_.eachComponent({mainType:"series",query:E==null?null:{seriesIndex:E}},R);var $,G=C;C==="stack"&&($=merge({stack:M.option.title.tiled,tiled:M.option.title.stack},M.option.title),M.get(["iconStatus",C])!=="emphasis"&&(G="tiled")),T.dispatchAction({type:"changeMagicType",currentType:G,newOption:P,newTitle:$,featureName:"magicType"})}},c}(ToolboxFeature),seriesOptGenreator={line:function(x,c,_,T){if(x==="bar")return merge({id:c,type:"line",data:_.get("data"),stack:_.get("stack"),markPoint:_.get("markPoint"),markLine:_.get("markLine")},T.get(["option","line"])||{},!0)},bar:function(x,c,_,T){if(x==="line")return merge({id:c,type:"bar",data:_.get("data"),stack:_.get("stack"),markPoint:_.get("markPoint"),markLine:_.get("markLine")},T.get(["option","bar"])||{},!0)},stack:function(x,c,_,T){var C=_.get("stack")===INNER_STACK_KEYWORD;if(x==="line"||x==="bar")return T.setIconStatus("stack",C?"normal":"emphasis"),merge({id:c,stack:C?"":INNER_STACK_KEYWORD},T.get(["option","stack"])||{},!0)}};registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(x,c){c.mergeOption(x.newOption)});const MagicType$1=MagicType;var BLOCK_SPLITER=new Array(60).join("-"),ITEM_SPLITER=" ";function groupSeries(x){var c={},_=[],T=[];return x.eachRawSeries(function(C){var M=C.coordinateSystem;if(M&&(M.type==="cartesian2d"||M.type==="polar")){var E=M.getBaseAxis();if(E.type==="category"){var P=E.dim+"_"+E.index;c[P]||(c[P]={categoryAxis:E,valueAxis:M.getOtherAxis(E),series:[]},T.push({axisDim:E.dim,axisIndex:E.index})),c[P].series.push(C)}else _.push(C)}else _.push(C)}),{seriesGroupByCategoryAxis:c,other:_,meta:T}}function assembleSeriesWithCategoryAxis(x){var c=[];return each$f(x,function(_,T){var C=_.categoryAxis,M=_.valueAxis,E=M.dim,P=[" "].concat(map$1(_.series,function(F){return F.name})),R=[C.model.getCategories()];each$f(_.series,function(F){var V=F.getRawData();R.push(F.getRawData().mapArray(V.mapDimension(E),function(W){return W}))});for(var $=[P.join(ITEM_SPLITER)],G=0;G=0)return!0}var itemSplitRegex=new RegExp("["+ITEM_SPLITER+"]+","g");function parseTSVContents(x){for(var c=x.split(/\n+/g),_=trim(c.shift()).split(itemSplitRegex),T=[],C=map$1(_,function(R){return{name:R,data:[]}}),M=0;M=0;M--){var E=_[M];if(E[C])break}if(M<0){var P=x.queryComponents({mainType:"dataZoom",subType:"select",id:C})[0];if(P){var R=P.getPercentRange();_[0][C]={dataZoomId:C,start:R[0],end:R[1]}}}}),_.push(c)}function pop$1(x){var c=getStoreSnapshots(x),_=c[c.length-1];c.length>1&&c.pop();var T={};return each$6(_,function(C,M){for(var E=c.length-1;E>=0;E--)if(C=c[E][M],C){T[M]=C;break}}),T}function clear(x){inner$6(x).snapshots=null}function count$1(x){return getStoreSnapshots(x).length}function getStoreSnapshots(x){var c=inner$6(x);return c.snapshots||(c.snapshots=[{}]),c.snapshots}var RestoreOption=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.onclick=function(_,T){clear(_),T.dispatchAction({type:"restore",from:this.uid})},c.getDefaultOption=function(_){var T={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:_.getLocaleModel().get(["toolbox","restore","title"])};return T},c}(ToolboxFeature);registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(x,c){c.resetOption("recreate")});const Restore=RestoreOption;var INCLUDE_FINDER_MAIN_TYPES=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],BrushTargetManager=function(){function x(c,_,T){var C=this;this._targetInfoList=[];var M=parseFinder(_,c);each$f(targetInfoBuilders,function(E,P){(!T||!T.include||indexOf(T.include,P)>=0)&&E(M,C._targetInfoList)})}return x.prototype.setOutputRanges=function(c,_){return this.matchOutputRanges(c,_,function(T,C,M){if((T.coordRanges||(T.coordRanges=[])).push(C),!T.coordRange){T.coordRange=C;var E=coordConvert[T.brushType](0,M,C);T.__rangeOffset={offset:diffProcessor[T.brushType](E.values,T.range,[1,1]),xyMinMax:E.xyMinMax}}}),c},x.prototype.matchOutputRanges=function(c,_,T){each$f(c,function(C){var M=this.findTargetInfo(C,_);M&&M!==!0&&each$f(M.coordSyses,function(E){var P=coordConvert[C.brushType](1,E,C.range,!0);T(C,P.values,E,_)})},this)},x.prototype.setInputRanges=function(c,_){each$f(c,function(T){var C=this.findTargetInfo(T,_);if(T.range=T.range||[],C&&C!==!0){T.panelId=C.panelId;var M=coordConvert[T.brushType](0,C.coordSys,T.coordRange),E=T.__rangeOffset;T.range=E?diffProcessor[T.brushType](M.values,E.offset,getScales(M.xyMinMax,E.xyMinMax)):M.values}},this)},x.prototype.makePanelOpts=function(c,_){return map$1(this._targetInfoList,function(T){var C=T.getPanelRect();return{panelId:T.panelId,defaultBrushType:_?_(T):null,clipPath:makeRectPanelClipPath(C),isTargetByCursor:makeRectIsTargetByCursor(C,c,T.coordSysModel),getLinearBrushOtherExtent:makeLinearBrushOtherExtent(C)}})},x.prototype.controlSeries=function(c,_,T){var C=this.findTargetInfo(c,T);return C===!0||C&&indexOf(C.coordSyses,_.coordinateSystem)>=0},x.prototype.findTargetInfo=function(c,_){for(var T=this._targetInfoList,C=parseFinder(_,c),M=0;Mx[1]&&x.reverse(),x}function parseFinder(x,c){return parseFinder$1(x,c,{includeMainTypes:INCLUDE_FINDER_MAIN_TYPES})}var targetInfoBuilders={grid:function(x,c){var _=x.xAxisModels,T=x.yAxisModels,C=x.gridModels,M=createHashMap(),E={},P={};!_&&!T&&!C||(each$f(_,function(R){var $=R.axis.grid.model;M.set($.id,$),E[$.id]=!0}),each$f(T,function(R){var $=R.axis.grid.model;M.set($.id,$),P[$.id]=!0}),each$f(C,function(R){M.set(R.id,R),E[R.id]=!0,P[R.id]=!0}),M.each(function(R){var $=R.coordinateSystem,G=[];each$f($.getCartesians(),function(O,L){(indexOf(_,O.getAxis("x").model)>=0||indexOf(T,O.getAxis("y").model)>=0)&&G.push(O)}),c.push({panelId:"grid--"+R.id,gridModel:R,coordSysModel:R,coordSys:G[0],coordSyses:G,getPanelRect:panelRectBuilders.grid,xAxisDeclared:E[R.id],yAxisDeclared:P[R.id]})}))},geo:function(x,c){each$f(x.geoModels,function(_){var T=_.coordinateSystem;c.push({panelId:"geo--"+_.id,geoModel:_,coordSysModel:_,coordSys:T,coordSyses:[T],getPanelRect:panelRectBuilders.geo})})}},targetInfoMatchers=[function(x,c){var _=x.xAxisModel,T=x.yAxisModel,C=x.gridModel;return!C&&_&&(C=_.axis.grid.model),!C&&T&&(C=T.axis.grid.model),C&&C===c.gridModel},function(x,c){var _=x.geoModel;return _&&_===c.geoModel}],panelRectBuilders={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var x=this.coordSys,c=x.getBoundingRect().clone();return c.applyTransform(getTransform$1(x)),c}},coordConvert={lineX:curry$1(axisConvert,0),lineY:curry$1(axisConvert,1),rect:function(x,c,_,T){var C=x?c.pointToData([_[0][0],_[1][0]],T):c.dataToPoint([_[0][0],_[1][0]],T),M=x?c.pointToData([_[0][1],_[1][1]],T):c.dataToPoint([_[0][1],_[1][1]],T),E=[formatMinMax([C[0],M[0]]),formatMinMax([C[1],M[1]])];return{values:E,xyMinMax:E}},polygon:function(x,c,_,T){var C=[[1/0,-1/0],[1/0,-1/0]],M=map$1(_,function(E){var P=x?c.pointToData(E,T):c.dataToPoint(E,T);return C[0][0]=Math.min(C[0][0],P[0]),C[1][0]=Math.min(C[1][0],P[1]),C[0][1]=Math.max(C[0][1],P[0]),C[1][1]=Math.max(C[1][1],P[1]),P});return{values:M,xyMinMax:C}}};function axisConvert(x,c,_,T){var C=_.getAxis(["x","y"][x]),M=formatMinMax(map$1([0,1],function(P){return c?C.coordToData(C.toLocalCoord(T[P]),!0):C.toGlobalCoord(C.dataToCoord(T[P]))})),E=[];return E[x]=M,E[1-x]=[NaN,NaN],{values:M,xyMinMax:E}}var diffProcessor={lineX:curry$1(axisDiffProcessor,0),lineY:curry$1(axisDiffProcessor,1),rect:function(x,c,_){return[[x[0][0]-_[0]*c[0][0],x[0][1]-_[0]*c[0][1]],[x[1][0]-_[1]*c[1][0],x[1][1]-_[1]*c[1][1]]]},polygon:function(x,c,_){return map$1(x,function(T,C){return[T[0]-_[0]*c[C][0],T[1]-_[1]*c[C][1]]})}};function axisDiffProcessor(x,c,_,T){return[c[0]-T[x]*_[0],c[1]-T[x]*_[1]]}function getScales(x,c){var _=getSize(x),T=getSize(c),C=[_[0]/T[0],_[1]/T[1]];return isNaN(C[0])&&(C[0]=1),isNaN(C[1])&&(C[1]=1),C}function getSize(x){return x?[x[0][1]-x[0][0],x[1][1]-x[1][0]]:[NaN,NaN]}const BrushTargetManager$1=BrushTargetManager;var each$5=each$f,DATA_ZOOM_ID_BASE=makeInternalComponentId("toolbox-dataZoom_"),DataZoomFeature=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.render=function(_,T,C,M){this._brushController||(this._brushController=new BrushController$1(C.getZr()),this._brushController.on("brush",bind$1(this._onBrush,this)).mount()),updateZoomBtnStatus(_,T,this,M,C),updateBackBtnStatus(_,T)},c.prototype.onclick=function(_,T,C){handlers[C].call(this)},c.prototype.remove=function(_,T){this._brushController&&this._brushController.unmount()},c.prototype.dispose=function(_,T){this._brushController&&this._brushController.dispose()},c.prototype._onBrush=function(_){var T=_.areas;if(!_.isEnd||!T.length)return;var C={},M=this.ecModel;this._brushController.updateCovers([]);var E=new BrushTargetManager$1(makeAxisFinder(this.model),M,{include:["grid"]});E.matchOutputRanges(T,M,function($,G,O){if(O.type==="cartesian2d"){var L=$.brushType;L==="rect"?(P("x",O,G[0]),P("y",O,G[1])):P({lineX:"x",lineY:"y"}[L],O,G)}}),push(M,C),this._dispatchZoomAction(C);function P($,G,O){var L=G.getAxis($),F=L.model,V=R($,F,M),W=V.findRepresentativeAxisProxy(F).getMinMaxSpan();(W.minValueSpan!=null||W.maxValueSpan!=null)&&(O=sliderMove(0,O.slice(),L.scale.getExtent(),0,W.minValueSpan,W.maxValueSpan)),V&&(C[V.id]={dataZoomId:V.id,startValue:O[0],endValue:O[1]})}function R($,G,O){var L;return O.eachComponent({mainType:"dataZoom",subType:"select"},function(F){var V=F.getAxisModel($,G.componentIndex);V&&(L=F)}),L}},c.prototype._dispatchZoomAction=function(_){var T=[];each$5(_,function(C,M){T.push(clone$4(C))}),T.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:T})},c.getDefaultOption=function(_){var T={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:_.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}};return T},c}(ToolboxFeature),handlers={zoom:function(){var x=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:x})},back:function(){this._dispatchZoomAction(pop$1(this.ecModel))}};function makeAxisFinder(x){var c={xAxisIndex:x.get("xAxisIndex",!0),yAxisIndex:x.get("yAxisIndex",!0),xAxisId:x.get("xAxisId",!0),yAxisId:x.get("yAxisId",!0)};return c.xAxisIndex==null&&c.xAxisId==null&&(c.xAxisIndex="all"),c.yAxisIndex==null&&c.yAxisId==null&&(c.yAxisIndex="all"),c}function updateBackBtnStatus(x,c){x.setIconStatus("back",count$1(c)>1?"emphasis":"normal")}function updateZoomBtnStatus(x,c,_,T,C){var M=_._isZoomActive;T&&T.type==="takeGlobalCursor"&&(M=T.key==="dataZoomSelect"?T.dataZoomSelectActive:!1),_._isZoomActive=M,x.setIconStatus("zoom",M?"emphasis":"normal");var E=new BrushTargetManager$1(makeAxisFinder(x),c,{include:["grid"]}),P=E.makePanelOpts(C,function(R){return R.xAxisDeclared&&!R.yAxisDeclared?"lineX":!R.xAxisDeclared&&R.yAxisDeclared?"lineY":"rect"});_._brushController.setPanels(P).enableBrush(M&&P.length?{brushType:"auto",brushStyle:x.getModel("brushStyle").getItemStyle()}:!1)}registerInternalOptionCreator("dataZoom",function(x){var c=x.getComponent("toolbox",0),_=["feature","dataZoom"];if(!c||c.get(_)==null)return;var T=c.getModel(_),C=[],M=makeAxisFinder(T),E=parseFinder$1(x,M);each$5(E.xAxisModels,function(R){return P(R,"xAxis","xAxisIndex")}),each$5(E.yAxisModels,function(R){return P(R,"yAxis","yAxisIndex")});function P(R,$,G){var O=R.componentIndex,L={type:"select",$fromToolbox:!0,filterMode:T.get("filterMode",!0)||"filter",id:DATA_ZOOM_ID_BASE+$+O};L[G]=O,C.push(L)}return C});const DataZoom=DataZoomFeature;function install$j(x){x.registerComponentModel(ToolboxModel$1),x.registerComponentView(ToolboxView$1),registerFeature("saveAsImage",SaveAsImage$1),registerFeature("magicType",MagicType$1),registerFeature("dataView",DataView$2),registerFeature("dataZoom",DataZoom),registerFeature("restore",Restore),use(install$k)}var TooltipModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="tooltip",c.dependencies=["axisPointer"],c.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},c}(ComponentModel$1);const TooltipModel$1=TooltipModel;function shouldTooltipConfine(x){var c=x.get("confine");return c!=null?!!c:x.get("renderMode")==="richText"}function testStyle(x){if(env$4.domSupported){for(var c=document.documentElement.style,_=0,T=x.length;_-1?(P+="top:50%",R+="translateY(-50%) rotate("+($=M==="left"?-225:-45)+"deg)"):(P+="left:50%",R+="translateX(-50%) rotate("+($=M==="top"?225:45)+"deg)");var G=$*Math.PI/180,O=E+C,L=O*Math.abs(Math.cos(G))+O*Math.abs(Math.sin(G)),F=Math.round(((L-Math.SQRT2*C)/2+Math.SQRT2*C-(L-O)/2)*100)/100;P+=";"+M+":-"+F+"px";var V=c+" solid "+C+"px;",W=["position:absolute;width:"+E+"px;height:"+E+"px;z-index:-1;",P+";"+R+";","border-bottom:"+V,"border-right:"+V,"background-color:"+T+";"];return''}function assembleTransition(x,c){var _="cubic-bezier(0.23,1,0.32,1)",T=" "+x/2+"s "+_,C="opacity"+T+",visibility"+T;return c||(T=" "+x+"s "+_,C+=env$4.transformSupported?","+CSS_TRANSFORM_VENDOR+T:",left"+T+",top"+T),CSS_TRANSITION_VENDOR+":"+C}function assembleTransform(x,c,_){var T=x.toFixed(0)+"px",C=c.toFixed(0)+"px";if(!env$4.transformSupported)return _?"top:"+C+";left:"+T+";":[["top",C],["left",T]];var M=env$4.transform3dSupported,E="translate"+(M?"3d":"")+"("+T+","+C+(M?",0":"")+")";return _?"top:0;left:0;"+CSS_TRANSFORM_VENDOR+":"+E+";":[["top",0],["left",0],[TRANSFORM_VENDOR,E]]}function assembleFont(x){var c=[],_=x.get("fontSize"),T=x.getTextColor();T&&c.push("color:"+T),c.push("font:"+x.getFont()),_&&c.push("line-height:"+Math.round(_*3/2)+"px");var C=x.get("textShadowColor"),M=x.get("textShadowBlur")||0,E=x.get("textShadowOffsetX")||0,P=x.get("textShadowOffsetY")||0;return C&&M&&c.push("text-shadow:"+E+"px "+P+"px "+M+"px "+C),each$f(["decoration","align"],function(R){var $=x.get(R);$&&c.push("text-"+R+":"+$)}),c.join(";")}function assembleCssText(x,c,_){var T=[],C=x.get("transitionDuration"),M=x.get("backgroundColor"),E=x.get("shadowBlur"),P=x.get("shadowColor"),R=x.get("shadowOffsetX"),$=x.get("shadowOffsetY"),G=x.getModel("textStyle"),O=getPaddingFromTooltipModel(x,"html"),L=R+"px "+$+"px "+E+"px "+P;return T.push("box-shadow:"+L),c&&C&&T.push(assembleTransition(C,_)),M&&T.push("background-color:"+M),each$f(["width","color","radius"],function(F){var V="border-"+F,W=toCamelCase(V),z=x.get(W);z!=null&&T.push(V+":"+z+(F==="color"?"":"px"))}),T.push(assembleFont(G)),O!=null&&T.push("padding:"+normalizeCssArray(O).join("px ")+"px"),T.join(";")+";"}function makeStyleCoord$1(x,c,_,T,C){var M=c&&c.painter;if(_){var E=M&&M.getViewportRoot();E&&transformLocalCoord(x,E,document.body,T,C)}else{x[0]=T,x[1]=C;var P=M&&M.getViewportRootOffset();P&&(x[0]+=P.offsetLeft,x[1]+=P.offsetTop)}x[2]=x[0]/c.getWidth(),x[3]=x[1]/c.getHeight()}var TooltipHTMLContent=function(){function x(c,_,T){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,env$4.wxa)return null;var C=document.createElement("div");C.domBelongToZr=!0,this.el=C;var M=this._zr=_.getZr(),E=this._appendToBody=T&&T.appendToBody;makeStyleCoord$1(this._styleCoord,M,E,_.getWidth()/2,_.getHeight()/2),E?document.body.appendChild(C):c.appendChild(C),this._container=c;var P=this;C.onmouseenter=function(){P._enterable&&(clearTimeout(P._hideTimeout),P._show=!0),P._inContent=!0},C.onmousemove=function(R){if(R=R||window.event,!P._enterable){var $=M.handler,G=M.painter.getViewportRoot();normalizeEvent(G,R,!0),$.dispatch("mousemove",R)}},C.onmouseleave=function(){P._inContent=!1,P._enterable&&P._show&&P.hideLater(P._hideDelay)}}return x.prototype.update=function(c){var _=this._container,T=getComputedStyle$1(_,"position"),C=_.style;C.position!=="absolute"&&T!=="absolute"&&(C.position="relative");var M=c.get("alwaysShowContent");M&&this._moveIfResized(),this._alwaysShowContent=M,this.el.className=c.get("className")||""},x.prototype.show=function(c,_){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var T=this.el,C=T.style,M=this._styleCoord;T.innerHTML?C.cssText=gCssText+assembleCssText(c,!this._firstShow,this._longHide)+assembleTransform(M[0],M[1],!0)+("border-color:"+convertToColorString(_)+";")+(c.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):C.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},x.prototype.setContent=function(c,_,T,C,M){var E=this.el;if(c==null){E.innerHTML="";return}var P="";if(isString(M)&&T.get("trigger")==="item"&&!shouldTooltipConfine(T)&&(P=assembleArrow(T,C,M)),isString(c))E.innerHTML=c+P;else if(c){E.innerHTML="",isArray$1(c)||(c=[c]);for(var R=0;R=0?this._tryShow(M,E):C==="leave"&&this._hide(E))},this))},c.prototype._keepShow=function(){var _=this._tooltipModel,T=this._ecModel,C=this._api,M=_.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&M!=="none"&&M!=="click"){var E=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!C.isDisposed()&&E.manuallyShowTip(_,T,C,{x:E._lastX,y:E._lastY,dataByCoordSys:E._lastDataByCoordSys})})}},c.prototype.manuallyShowTip=function(_,T,C,M){if(!(M.from===this.uid||env$4.node||!C.getDom())){var E=makeDispatchAction(M,C);this._ticket="";var P=M.dataByCoordSys,R=findComponentReference(M,T,C);if(R){var $=R.el.getBoundingRect().clone();$.applyTransform(R.el.transform),this._tryShow({offsetX:$.x+$.width/2,offsetY:$.y+$.height/2,target:R.el,position:M.position,positionDefault:"bottom"},E)}else if(M.tooltip&&M.x!=null&&M.y!=null){var G=proxyRect;G.x=M.x,G.y=M.y,G.update(),getECData(G).tooltipConfig={name:null,option:M.tooltip},this._tryShow({offsetX:M.x,offsetY:M.y,target:G},E)}else if(P)this._tryShow({offsetX:M.x,offsetY:M.y,position:M.position,dataByCoordSys:P,tooltipOption:M.tooltipOption},E);else if(M.seriesIndex!=null){if(this._manuallyAxisShowTip(_,T,C,M))return;var O=findPointFromSeries(M,T),L=O.point[0],F=O.point[1];L!=null&&F!=null&&this._tryShow({offsetX:L,offsetY:F,target:O.el,position:M.position,positionDefault:"bottom"},E)}else M.x!=null&&M.y!=null&&(C.dispatchAction({type:"updateAxisPointer",x:M.x,y:M.y}),this._tryShow({offsetX:M.x,offsetY:M.y,position:M.position,target:C.getZr().findHover(M.x,M.y).target},E))}},c.prototype.manuallyHideTip=function(_,T,C,M){var E=this._tooltipContent;this._tooltipModel&&E.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,M.from!==this.uid&&this._hide(makeDispatchAction(M,C))},c.prototype._manuallyAxisShowTip=function(_,T,C,M){var E=M.seriesIndex,P=M.dataIndex,R=T.getComponent("axisPointer").coordSysAxesInfo;if(!(E==null||P==null||R==null)){var $=T.getSeriesByIndex(E);if($){var G=$.getData(),O=buildTooltipModel([G.getItemModel(P),$,($.coordinateSystem||{}).model],this._tooltipModel);if(O.get("trigger")==="axis")return C.dispatchAction({type:"updateAxisPointer",seriesIndex:E,dataIndex:P,position:M.position}),!0}}},c.prototype._tryShow=function(_,T){var C=_.target,M=this._tooltipModel;if(M){this._lastX=_.offsetX,this._lastY=_.offsetY;var E=_.dataByCoordSys;if(E&&E.length)this._showAxisTooltip(E,_);else if(C){this._lastDataByCoordSys=null;var P,R;findEventDispatcher(C,function($){if(getECData($).dataIndex!=null)return P=$,!0;if(getECData($).tooltipConfig!=null)return R=$,!0},!0),P?this._showSeriesItemTooltip(_,P,T):R?this._showComponentItemTooltip(_,R,T):this._hide(T)}else this._lastDataByCoordSys=null,this._hide(T)}},c.prototype._showOrMove=function(_,T){var C=_.get("showDelay");T=bind$1(T,this),clearTimeout(this._showTimout),C>0?this._showTimout=setTimeout(T,C):T()},c.prototype._showAxisTooltip=function(_,T){var C=this._ecModel,M=this._tooltipModel,E=[T.offsetX,T.offsetY],P=buildTooltipModel([T.tooltipOption],M),R=this._renderMode,$=[],G=createTooltipMarkup("section",{blocks:[],noHeader:!0}),O=[],L=new TooltipMarkupStyleCreator;each$f(_,function(H){each$f(H.dataByAxis,function(Y){var U=C.getComponent(Y.axisDim+"Axis",Y.axisIndex),j=Y.value;if(!(!U||j==null)){var X=getValueLabel(j,U.axis,C,Y.seriesDataIndices,Y.valueLabelOpt),K=createTooltipMarkup("section",{header:X,noHeader:!trim$1(X),sortBlocks:!0,blocks:[]});G.blocks.push(K),each$f(Y.seriesDataIndices,function(q){var J=C.getSeriesByIndex(q.seriesIndex),Q=q.dataIndexInside,ee=J.getDataParams(Q);if(!(ee.dataIndex<0)){ee.axisDim=Y.axisDim,ee.axisIndex=Y.axisIndex,ee.axisType=Y.axisType,ee.axisId=Y.axisId,ee.axisValue=getAxisRawValue(U.axis,{value:j}),ee.axisValueLabel=X,ee.marker=L.makeTooltipMarker("item",convertToColorString(ee.color),R);var re=normalizeTooltipFormatResult(J.formatTooltip(Q,!0,null)),ie=re.frag;if(ie){var ae=buildTooltipModel([J],M).get("valueFormatter");K.blocks.push(ae?extend({valueFormatter:ae},ie):ie)}re.text&&O.push(re.text),$.push(ee)}})}})}),G.blocks.reverse(),O.reverse();var F=T.position,V=P.get("order"),W=buildTooltipMarkup(G,L,R,V,C.get("useUTC"),P.get("textStyle"));W&&O.unshift(W);var z=R==="richText"?`
`:"
",Z=O.join(z);this._showOrMove(P,function(){this._updateContentNotChangedOnAxis(_,$)?this._updatePosition(P,F,E[0],E[1],this._tooltipContent,$):this._showTooltipContent(P,Z,$,Math.random()+"",E[0],E[1],F,null,L)})},c.prototype._showSeriesItemTooltip=function(_,T,C){var M=this._ecModel,E=getECData(T),P=E.seriesIndex,R=M.getSeriesByIndex(P),$=E.dataModel||R,G=E.dataIndex,O=E.dataType,L=$.getData(O),F=this._renderMode,V=_.positionDefault,W=buildTooltipModel([L.getItemModel(G),$,R&&(R.coordinateSystem||{}).model],this._tooltipModel,V?{position:V}:null),z=W.get("trigger");if(!(z!=null&&z!=="item")){var Z=$.getDataParams(G,O),H=new TooltipMarkupStyleCreator;Z.marker=H.makeTooltipMarker("item",convertToColorString(Z.color),F);var Y=normalizeTooltipFormatResult($.formatTooltip(G,!1,O)),U=W.get("order"),j=W.get("valueFormatter"),X=Y.frag,K=X?buildTooltipMarkup(j?extend({valueFormatter:j},X):X,H,F,U,M.get("useUTC"),W.get("textStyle")):Y.text,q="item_"+$.name+"_"+G;this._showOrMove(W,function(){this._showTooltipContent(W,K,Z,q,_.offsetX,_.offsetY,_.position,_.target,H)}),C({type:"showTip",dataIndexInside:G,dataIndex:L.getRawIndex(G),seriesIndex:P,from:this.uid})}},c.prototype._showComponentItemTooltip=function(_,T,C){var M=getECData(T),E=M.tooltipConfig,P=E.option||{};if(isString(P)){var R=P;P={content:R,formatter:R}}var $=[P],G=this._ecModel.getComponent(M.componentMainType,M.componentIndex);G&&$.push(G),$.push({formatter:P.content});var O=_.positionDefault,L=buildTooltipModel($,this._tooltipModel,O?{position:O}:null),F=L.get("content"),V=Math.random()+"",W=new TooltipMarkupStyleCreator;this._showOrMove(L,function(){var z=clone$4(L.get("formatterParams")||{});this._showTooltipContent(L,F,z,V,_.offsetX,_.offsetY,_.position,T,W)}),C({type:"showTip",from:this.uid})},c.prototype._showTooltipContent=function(_,T,C,M,E,P,R,$,G){if(this._ticket="",!(!_.get("showContent")||!_.get("show"))){var O=this._tooltipContent;O.setEnterable(_.get("enterable"));var L=_.get("formatter");R=R||_.get("position");var F=T,V=this._getNearestPoint([E,P],C,_.get("trigger"),_.get("borderColor")),W=V.color;if(L)if(isString(L)){var z=_.ecModel.get("useUTC"),Z=isArray$1(C)?C[0]:C,H=Z&&Z.axisType&&Z.axisType.indexOf("time")>=0;F=L,H&&(F=format$1(Z.axisValue,F,z)),F=formatTpl(F,C,!0)}else if(isFunction(L)){var Y=bind$1(function(U,j){U===this._ticket&&(O.setContent(j,G,_,W,R),this._updatePosition(_,R,E,P,O,C,$))},this);this._ticket=M,F=L(C,M,Y)}else F=L;O.setContent(F,G,_,W,R),O.show(_,W),this._updatePosition(_,R,E,P,O,C,$)}},c.prototype._getNearestPoint=function(_,T,C,M){if(C==="axis"||isArray$1(T))return{color:M||(this._renderMode==="html"?"#fff":"none")};if(!isArray$1(T))return{color:M||T.color||T.borderColor}},c.prototype._updatePosition=function(_,T,C,M,E,P,R){var $=this._api.getWidth(),G=this._api.getHeight();T=T||_.get("position");var O=E.getSize(),L=_.get("align"),F=_.get("verticalAlign"),V=R&&R.getBoundingRect().clone();if(R&&V.applyTransform(R.transform),isFunction(T)&&(T=T([C,M],P,E.el,V,{viewSize:[$,G],contentSize:O.slice()})),isArray$1(T))C=parsePercent(T[0],$),M=parsePercent(T[1],G);else if(isObject$3(T)){var W=T;W.width=O[0],W.height=O[1];var z=getLayoutRect(W,{width:$,height:G});C=z.x,M=z.y,L=null,F=null}else if(isString(T)&&R){var Z=calcTooltipPosition(T,V,O,_.get("borderWidth"));C=Z[0],M=Z[1]}else{var Z=refixTooltipPosition(C,M,E,$,G,L?null:20,F?null:20);C=Z[0],M=Z[1]}if(L&&(C-=isCenterAlign(L)?O[0]/2:L==="right"?O[0]:0),F&&(M-=isCenterAlign(F)?O[1]/2:F==="bottom"?O[1]:0),shouldTooltipConfine(_)){var Z=confineTooltipPosition(C,M,E,$,G);C=Z[0],M=Z[1]}E.moveTo(C,M)},c.prototype._updateContentNotChangedOnAxis=function(_,T){var C=this._lastDataByCoordSys,M=this._cbParamsList,E=!!C&&C.length===_.length;return E&&each$f(C,function(P,R){var $=P.dataByAxis||[],G=_[R]||{},O=G.dataByAxis||[];E=E&&$.length===O.length,E&&each$f($,function(L,F){var V=O[F]||{},W=L.seriesDataIndices||[],z=V.seriesDataIndices||[];E=E&&L.value===V.value&&L.axisType===V.axisType&&L.axisId===V.axisId&&W.length===z.length,E&&each$f(W,function(Z,H){var Y=z[H];E=E&&Z.seriesIndex===Y.seriesIndex&&Z.dataIndex===Y.dataIndex}),M&&each$f(L.seriesDataIndices,function(Z){var H=Z.seriesIndex,Y=T[H],U=M[H];Y&&U&&U.data!==Y.data&&(E=!1)})})}),this._lastDataByCoordSys=_,this._cbParamsList=T,!!E},c.prototype._hide=function(_){this._lastDataByCoordSys=null,_({type:"hideTip",from:this.uid})},c.prototype.dispose=function(_,T){env$4.node||!T.getDom()||(clear$1(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",T))},c.type="tooltip",c}(ComponentView$1);function buildTooltipModel(x,c,_){var T=c.ecModel,C;_?(C=new Model$1(_,T,T),C=new Model$1(c.option,C,T)):C=c;for(var M=x.length-1;M>=0;M--){var E=x[M];E&&(E instanceof Model$1&&(E=E.get("tooltip",!0)),isString(E)&&(E={formatter:E}),E&&(C=new Model$1(E,C,T)))}return C}function makeDispatchAction(x,c){return x.dispatchAction||bind$1(c.dispatchAction,c)}function refixTooltipPosition(x,c,_,T,C,M,E){var P=_.getSize(),R=P[0],$=P[1];return M!=null&&(x+R+M+2>T?x-=R+M:x+=M),E!=null&&(c+$+E>C?c-=$+E:c+=E),[x,c]}function confineTooltipPosition(x,c,_,T,C){var M=_.getSize(),E=M[0],P=M[1];return x=Math.min(x+E,T)-E,c=Math.min(c+P,C)-P,x=Math.max(x,0),c=Math.max(c,0),[x,c]}function calcTooltipPosition(x,c,_,T){var C=_[0],M=_[1],E=Math.ceil(Math.SQRT2*T)+8,P=0,R=0,$=c.width,G=c.height;switch(x){case"inside":P=c.x+$/2-C/2,R=c.y+G/2-M/2;break;case"top":P=c.x+$/2-C/2,R=c.y-M-E;break;case"bottom":P=c.x+$/2-C/2,R=c.y+G+E;break;case"left":P=c.x-C-E,R=c.y+G/2-M/2;break;case"right":P=c.x+$+E,R=c.y+G/2-M/2}return[P,R]}function isCenterAlign(x){return x==="center"||x==="middle"}function findComponentReference(x,c,_){var T=preParseFinder(x).queryOptionMap,C=T.keys()[0];if(!(!C||C==="series")){var M=queryReferringComponents(c,C,T.get(C),{useDefault:!1,enableAll:!1,enableNone:!1}),E=M.models[0];if(E){var P=_.getViewOfComponentModel(E),R;if(P.group.traverse(function($){var G=getECData($).tooltipConfig;if(G&&G.name===x.name)return R=$,!0}),R)return{componentMainType:C,componentIndex:E.componentIndex,el:R}}}}const TooltipView$1=TooltipView;function install$i(x){use(install$q),x.registerComponentModel(TooltipModel$1),x.registerComponentView(TooltipView$1),x.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop),x.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop)}var DEFAULT_TOOLBOX_BTNS=["rect","polygon","keep","clear"];function brushPreprocessor(x,c){var _=normalizeToArray(x?x.brush:[]);if(_.length){var T=[];each$f(_,function(R){var $=R.hasOwnProperty("toolbox")?R.toolbox:[];$ instanceof Array&&(T=T.concat($))});var C=x&&x.toolbox;isArray$1(C)&&(C=C[0]),C||(C={feature:{}},x.toolbox=[C]);var M=C.feature||(C.feature={}),E=M.brush||(M.brush={}),P=E.type||(E.type=[]);P.push.apply(P,T),removeDuplicate(P),c&&!P.length&&P.push.apply(P,DEFAULT_TOOLBOX_BTNS)}}function removeDuplicate(x){var c={};each$f(x,function(_){c[_]=1}),x.length=0,each$f(c,function(_,T){x.push(T)})}var each$4=each$f;function hasKeys(x){if(x){for(var c in x)if(x.hasOwnProperty(c))return!0}}function createVisualMappings(x,c,_){var T={};return each$4(c,function(M){var E=T[M]=C();each$4(x[M],function(P,R){if(VisualMapping$1.isValidType(R)){var $={type:R,visual:P};_&&_($,M),E[R]=new VisualMapping$1($),R==="opacity"&&($=clone$4($),$.type="colorAlpha",E.__hidden.__alphaForOpacity=new VisualMapping$1($))}})}),T;function C(){var M=function(){};M.prototype.__hidden=M.prototype;var E=new M;return E}}function replaceVisualOption(x,c,_){var T;each$f(_,function(C){c.hasOwnProperty(C)&&hasKeys(c[C])&&(T=!0)}),T&&each$f(_,function(C){c.hasOwnProperty(C)&&hasKeys(c[C])?x[C]=clone$4(c[C]):delete x[C]})}function applyVisual(x,c,_,T,C,M){var E={};each$f(x,function(O){var L=VisualMapping$1.prepareVisualTypes(c[O]);E[O]=L});var P;function R(O){return getItemVisualFromData(_,P,O)}function $(O,L){setItemVisualFromData(_,P,O,L)}M==null?_.each(G):_.each([M],G);function G(O,L){P=M==null?O:L;var F=_.getRawDataItem(P);if(!(F&&F.visualMap===!1))for(var V=T.call(C,O),W=c[V],z=E[V],Z=0,H=z.length;Zc[0][1]&&(c[0][1]=M[0]),M[1]c[1][1]&&(c[1][1]=M[1])}return c&&getBoundingRectFromMinMax(c)}};function getBoundingRectFromMinMax(x){return new BoundingRect$1(x[0][0],x[1][0],x[0][1]-x[0][0],x[1][1]-x[1][0])}var BrushView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(_,T){this.ecModel=_,this.api=T,this.model,(this._brushController=new BrushController$1(T.getZr())).on("brush",bind$1(this._onBrush,this)).mount()},c.prototype.render=function(_,T,C,M){this.model=_,this._updateController(_,T,C,M)},c.prototype.updateTransform=function(_,T,C,M){layoutCovers(T),this._updateController(_,T,C,M)},c.prototype.updateVisual=function(_,T,C,M){this.updateTransform(_,T,C,M)},c.prototype.updateView=function(_,T,C,M){this._updateController(_,T,C,M)},c.prototype._updateController=function(_,T,C,M){(!M||M.$from!==_.id)&&this._brushController.setPanels(_.brushTargetManager.makePanelOpts(C)).enableBrush(_.brushOption).updateCovers(_.areas.slice())},c.prototype.dispose=function(){this._brushController.dispose()},c.prototype._onBrush=function(_){var T=this.model.id,C=this.model.brushTargetManager.setOutputRanges(_.areas,this.ecModel);(!_.isEnd||_.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:T,areas:clone$4(C),$from:T}),_.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:T,areas:clone$4(C),$from:T})},c.type="brush",c}(ComponentView$1);const BrushView$1=BrushView;var DEFAULT_OUT_OF_BRUSH_COLOR="#ddd",BrushModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.areas=[],_.brushOption={},_}return c.prototype.optionUpdated=function(_,T){var C=this.option;!T&&replaceVisualOption(C,_,["inBrush","outOfBrush"]);var M=C.inBrush=C.inBrush||{};C.outOfBrush=C.outOfBrush||{color:DEFAULT_OUT_OF_BRUSH_COLOR},M.hasOwnProperty("liftZ")||(M.liftZ=5)},c.prototype.setAreas=function(_){_&&(this.areas=map$1(_,function(T){return generateBrushOption(this.option,T)},this))},c.prototype.setBrushOption=function(_){this.brushOption=generateBrushOption(this.option,_),this.brushType=this.brushOption.brushType},c.type="brush",c.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],c.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},c}(ComponentModel$1);function generateBrushOption(x,c){return merge({brushType:x.brushType,brushMode:x.brushMode,transformable:x.transformable,brushStyle:new Model$1(x.brushStyle).getItemStyle(),removeOnClick:x.removeOnClick,z:x.z},c,!0)}const BrushModel$1=BrushModel;var ICON_TYPES=["rect","polygon","lineX","lineY","keep","clear"],BrushFeature=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.render=function(_,T,C){var M,E,P;T.eachComponent({mainType:"brush"},function(R){M=R.brushType,E=R.brushOption.brushMode||"single",P=P||!!R.areas.length}),this._brushType=M,this._brushMode=E,each$f(_.get("type",!0),function(R){_.setIconStatus(R,(R==="keep"?E==="multiple":R==="clear"?P:R===M)?"emphasis":"normal")})},c.prototype.updateView=function(_,T,C){this.render(_,T,C)},c.prototype.getIcons=function(){var _=this.model,T=_.get("icon",!0),C={};return each$f(_.get("type",!0),function(M){T[M]&&(C[M]=T[M])}),C},c.prototype.onclick=function(_,T,C){var M=this._brushType,E=this._brushMode;C==="clear"?(T.dispatchAction({type:"axisAreaSelect",intervals:[]}),T.dispatchAction({type:"brush",command:"clear",areas:[]})):T.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:C==="keep"?M:M===C?!1:C,brushMode:C==="keep"?E==="multiple"?"single":"multiple":E}})},c.getDefaultOption=function(_){var T={show:!0,type:ICON_TYPES.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:_.getLocaleModel().get(["toolbox","brush","title"])};return T},c}(ToolboxFeature);const BrushFeature$1=BrushFeature;function install$h(x){x.registerComponentView(BrushView$1),x.registerComponentModel(BrushModel$1),x.registerPreprocessor(brushPreprocessor),x.registerVisual(x.PRIORITY.VISUAL.BRUSH,brushVisual),x.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(c,_){_.eachComponent({mainType:"brush",query:c},function(T){T.setAreas(c.areas)})}),x.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},noop),x.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},noop),registerFeature("brush",BrushFeature$1)}var TitleModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.layoutMode={type:"box",ignoreSize:!0},_}return c.type="title",c.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},c}(ComponentModel$1),TitleView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.render=function(_,T,C){if(this.group.removeAll(),!!_.get("show")){var M=this.group,E=_.getModel("textStyle"),P=_.getModel("subtextStyle"),R=_.get("textAlign"),$=retrieve2(_.get("textBaseline"),_.get("textVerticalAlign")),G=new ZRText$1({style:createTextStyle(E,{text:_.get("text"),fill:E.getTextColor()},{disableBox:!0}),z2:10}),O=G.getBoundingRect(),L=_.get("subtext"),F=new ZRText$1({style:createTextStyle(P,{text:L,fill:P.getTextColor(),y:O.height+_.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),V=_.get("link"),W=_.get("sublink"),z=_.get("triggerEvent",!0);G.silent=!V&&!z,F.silent=!W&&!z,V&&G.on("click",function(){windowOpen(V,"_"+_.get("target"))}),W&&F.on("click",function(){windowOpen(W,"_"+_.get("subtarget"))}),getECData(G).eventData=getECData(F).eventData=z?{componentType:"title",componentIndex:_.componentIndex}:null,M.add(G),L&&M.add(F);var Z=M.getBoundingRect(),H=_.getBoxLayoutParams();H.width=Z.width,H.height=Z.height;var Y=getLayoutRect(H,{width:C.getWidth(),height:C.getHeight()},_.get("padding"));R||(R=_.get("left")||_.get("right"),R==="middle"&&(R="center"),R==="right"?Y.x+=Y.width:R==="center"&&(Y.x+=Y.width/2)),$||($=_.get("top")||_.get("bottom"),$==="center"&&($="middle"),$==="bottom"?Y.y+=Y.height:$==="middle"&&(Y.y+=Y.height/2),$=$||"top"),M.x=Y.x,M.y=Y.y,M.markRedraw();var U={align:R,verticalAlign:$};G.setStyle(U),F.setStyle(U),Z=M.getBoundingRect();var j=Y.margin,X=_.getItemStyle(["color","opacity"]);X.fill=_.get("backgroundColor");var K=new Rect$3({shape:{x:Z.x-j[3],y:Z.y-j[0],width:Z.width+j[1]+j[3],height:Z.height+j[0]+j[2],r:_.get("borderRadius")},style:X,subPixelOptimize:!0,silent:!0});M.add(K)}},c.type="title",c}(ComponentView$1);function install$g(x){x.registerComponentModel(TitleModel),x.registerComponentView(TitleView)}var TimelineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.layoutMode="box",_}return c.prototype.init=function(_,T,C){this.mergeDefaultAndTheme(_,C),this._initData()},c.prototype.mergeOption=function(_){x.prototype.mergeOption.apply(this,arguments),this._initData()},c.prototype.setCurrentIndex=function(_){_==null&&(_=this.option.currentIndex);var T=this._data.count();this.option.loop?_=(_%T+T)%T:(_>=T&&(_=T-1),_<0&&(_=0)),this.option.currentIndex=_},c.prototype.getCurrentIndex=function(){return this.option.currentIndex},c.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},c.prototype.setPlayState=function(_){this.option.autoPlay=!!_},c.prototype.getPlayState=function(){return!!this.option.autoPlay},c.prototype._initData=function(){var _=this.option,T=_.data||[],C=_.axisType,M=this._names=[],E;C==="category"?(E=[],each$f(T,function($,G){var O=convertOptionIdName(getDataItemValue($),""),L;isObject$3($)?(L=clone$4($),L.value=G):L=G,E.push(L),M.push(O)})):E=T;var P={category:"ordinal",time:"time",value:"number"}[C]||"number",R=this._data=new SeriesData$1([{name:"value",type:P}],this);R.initData(E,M)},c.prototype.getData=function(){return this._data},c.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},c.type="timeline",c.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},c}(ComponentModel$1);const TimelineModel$1=TimelineModel;var SliderTimelineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="timeline.slider",c.defaultOption=inheritDefaultOption(TimelineModel$1.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),c}(TimelineModel$1);mixin(SliderTimelineModel,DataFormatMixin.prototype);const SliderTimelineModel$1=SliderTimelineModel;var TimelineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="timeline",c}(ComponentView$1);const TimelineView$1=TimelineView;var TimelineAxis=function(x){__extends(c,x);function c(_,T,C,M){var E=x.call(this,_,T,C)||this;return E.type=M||"value",E}return c.prototype.getLabelModel=function(){return this.model.getModel("label")},c.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},c}(Axis$1);const TimelineAxis$1=TimelineAxis;var PI=Math.PI,labelDataIndexStore=makeInner(),SliderTimelineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(_,T){this.api=T},c.prototype.render=function(_,T,C){if(this.model=_,this.api=C,this.ecModel=T,this.group.removeAll(),_.get("show",!0)){var M=this._layout(_,C),E=this._createGroup("_mainGroup"),P=this._createGroup("_labelGroup"),R=this._axis=this._createAxis(M,_);_.formatTooltip=function($){var G=R.scale.getLabel({value:$});return createTooltipMarkup("nameValue",{noName:!0,value:G})},each$f(["AxisLine","AxisTick","Control","CurrentPointer"],function($){this["_render"+$](M,E,R,_)},this),this._renderAxisLabel(M,P,R,_),this._position(M,_)}this._doPlayStop(),this._updateTicksStatus()},c.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},c.prototype.dispose=function(){this._clearTimer()},c.prototype._layout=function(_,T){var C=_.get(["label","position"]),M=_.get("orient"),E=getViewRect(_,T),P;C==null||C==="auto"?P=M==="horizontal"?E.y+E.height/2=0||P==="+"?"left":"right"},$={horizontal:P>=0||P==="+"?"top":"bottom",vertical:"middle"},G={horizontal:0,vertical:PI/2},O=M==="vertical"?E.height:E.width,L=_.getModel("controlStyle"),F=L.get("show",!0),V=F?L.get("itemSize"):0,W=F?L.get("itemGap"):0,z=V+W,Z=_.get(["label","rotate"])||0;Z=Z*PI/180;var H,Y,U,j=L.get("position",!0),X=F&&L.get("showPlayBtn",!0),K=F&&L.get("showPrevBtn",!0),q=F&&L.get("showNextBtn",!0),J=0,Q=O;j==="left"||j==="bottom"?(X&&(H=[0,0],J+=z),K&&(Y=[J,0],J+=z),q&&(U=[Q-V,0],Q-=z)):(X&&(H=[Q-V,0],Q-=z),K&&(Y=[0,0],J+=z),q&&(U=[Q-V,0],Q-=z));var ee=[J,Q];return _.get("inverse")&&ee.reverse(),{viewRect:E,mainLength:O,orient:M,rotation:G[M],labelRotation:Z,labelPosOpt:P,labelAlign:_.get(["label","align"])||R[M],labelBaseline:_.get(["label","verticalAlign"])||_.get(["label","baseline"])||$[M],playPosition:H,prevBtnPosition:Y,nextBtnPosition:U,axisExtent:ee,controlSize:V,controlGap:W}},c.prototype._position=function(_,T){var C=this._mainGroup,M=this._labelGroup,E=_.viewRect;if(_.orient==="vertical"){var P=create$1(),R=E.x,$=E.y+E.height;translate(P,P,[-R,-$]),rotate(P,P,-PI/2),translate(P,P,[R,$]),E=E.clone(),E.applyTransform(P)}var G=H(E),O=H(C.getBoundingRect()),L=H(M.getBoundingRect()),F=[C.x,C.y],V=[M.x,M.y];V[0]=F[0]=G[0][0];var W=_.labelPosOpt;if(W==null||isString(W)){var z=W==="+"?0:1;Y(F,O,G,1,z),Y(V,L,G,1,1-z)}else{var z=W>=0?0:1;Y(F,O,G,1,z),V[1]=F[1]+W}C.setPosition(F),M.setPosition(V),C.rotation=M.rotation=_.rotation,Z(C),Z(M);function Z(U){U.originX=G[0][0]-U.x,U.originY=G[1][0]-U.y}function H(U){return[[U.x,U.x+U.width],[U.y,U.y+U.height]]}function Y(U,j,X,K,q){U[K]+=X[K][q]-j[K][q]}},c.prototype._createAxis=function(_,T){var C=T.getData(),M=T.get("axisType"),E=createScaleByModel(T,M);E.getTicks=function(){return C.mapArray(["value"],function($){return{value:$}})};var P=C.getDataExtent("value");E.setExtent(P[0],P[1]),E.calcNiceTicks();var R=new TimelineAxis$1("value",E,_.axisExtent,M);return R.model=T,R},c.prototype._createGroup=function(_){var T=this[_]=new Group$4;return this.group.add(T),T},c.prototype._renderAxisLine=function(_,T,C,M){var E=C.getExtent();if(M.get(["lineStyle","show"])){var P=new Line$3({shape:{x1:E[0],y1:0,x2:E[1],y2:0},style:extend({lineCap:"round"},M.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});T.add(P);var R=this._progressLine=new Line$3({shape:{x1:E[0],x2:this._currentPointer?this._currentPointer.x:E[0],y1:0,y2:0},style:defaults({lineCap:"round",lineWidth:P.style.lineWidth},M.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});T.add(R)}},c.prototype._renderAxisTick=function(_,T,C,M){var E=this,P=M.getData(),R=C.scale.getTicks();this._tickSymbols=[],each$f(R,function($){var G=C.dataToCoord($.value),O=P.getItemModel($.value),L=O.getModel("itemStyle"),F=O.getModel(["emphasis","itemStyle"]),V=O.getModel(["progress","itemStyle"]),W={x:G,y:0,onclick:bind$1(E._changeTimeline,E,$.value)},z=giveSymbol(O,L,T,W);z.ensureState("emphasis").style=F.getItemStyle(),z.ensureState("progress").style=V.getItemStyle(),enableHoverEmphasis(z);var Z=getECData(z);O.get("tooltip")?(Z.dataIndex=$.value,Z.dataModel=M):Z.dataIndex=Z.dataModel=null,E._tickSymbols.push(z)})},c.prototype._renderAxisLabel=function(_,T,C,M){var E=this,P=C.getLabelModel();if(P.get("show")){var R=M.getData(),$=C.getViewLabels();this._tickLabels=[],each$f($,function(G){var O=G.tickValue,L=R.getItemModel(O),F=L.getModel("label"),V=L.getModel(["emphasis","label"]),W=L.getModel(["progress","label"]),z=C.dataToCoord(G.tickValue),Z=new ZRText$1({x:z,y:0,rotation:_.labelRotation-_.rotation,onclick:bind$1(E._changeTimeline,E,O),silent:!1,style:createTextStyle(F,{text:G.formattedLabel,align:_.labelAlign,verticalAlign:_.labelBaseline})});Z.ensureState("emphasis").style=createTextStyle(V),Z.ensureState("progress").style=createTextStyle(W),T.add(Z),enableHoverEmphasis(Z),labelDataIndexStore(Z).dataIndex=O,E._tickLabels.push(Z)})}},c.prototype._renderControl=function(_,T,C,M){var E=_.controlSize,P=_.rotation,R=M.getModel("controlStyle").getItemStyle(),$=M.getModel(["emphasis","controlStyle"]).getItemStyle(),G=M.getPlayState(),O=M.get("inverse",!0);L(_.nextBtnPosition,"next",bind$1(this._changeTimeline,this,O?"-":"+")),L(_.prevBtnPosition,"prev",bind$1(this._changeTimeline,this,O?"+":"-")),L(_.playPosition,G?"stop":"play",bind$1(this._handlePlayClick,this,!G),!0);function L(F,V,W,z){if(F){var Z=parsePercent$1(retrieve2(M.get(["controlStyle",V+"BtnSize"]),E),E),H=[0,-Z/2,Z,Z],Y=makeControlIcon(M,V+"Icon",H,{x:F[0],y:F[1],originX:E/2,originY:0,rotation:z?-P:0,rectHover:!0,style:R,onclick:W});Y.ensureState("emphasis").style=$,T.add(Y),enableHoverEmphasis(Y)}}},c.prototype._renderCurrentPointer=function(_,T,C,M){var E=M.getData(),P=M.getCurrentIndex(),R=E.getItemModel(P).getModel("checkpointStyle"),$=this,G={onCreate:function(O){O.draggable=!0,O.drift=bind$1($._handlePointerDrag,$),O.ondragend=bind$1($._handlePointerDragend,$),pointerMoveTo(O,$._progressLine,P,C,M,!0)},onUpdate:function(O){pointerMoveTo(O,$._progressLine,P,C,M)}};this._currentPointer=giveSymbol(R,R,this._mainGroup,{},this._currentPointer,G)},c.prototype._handlePlayClick=function(_){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:_,from:this.uid})},c.prototype._handlePointerDrag=function(_,T,C){this._clearTimer(),this._pointerChangeTimeline([C.offsetX,C.offsetY])},c.prototype._handlePointerDragend=function(_){this._pointerChangeTimeline([_.offsetX,_.offsetY],!0)},c.prototype._pointerChangeTimeline=function(_,T){var C=this._toAxisCoord(_)[0],M=this._axis,E=asc$2(M.getExtent().slice());C>E[1]&&(C=E[1]),C=0&&(E[M]=+E[M].toFixed(L)),[E,O]}var markerTypeCalculator={min:curry$1(markerTypeCalculatorWithExtent,"min"),max:curry$1(markerTypeCalculatorWithExtent,"max"),average:curry$1(markerTypeCalculatorWithExtent,"average"),median:curry$1(markerTypeCalculatorWithExtent,"median")};function dataTransform(x,c){if(c){var _=x.getData(),T=x.coordinateSystem,C=T&&T.dimensions;if(!hasXAndY(c)&&!isArray$1(c.coord)&&isArray$1(C)){var M=getAxisInfo(c,_,T,x);if(c=clone$4(c),c.type&&markerTypeCalculator[c.type]&&M.baseAxis&&M.valueAxis){var E=indexOf(C,M.baseAxis.dim),P=indexOf(C,M.valueAxis.dim),R=markerTypeCalculator[c.type](_,M.baseDataDim,M.valueDataDim,E,P);c.coord=R[0],c.value=R[1]}else c.coord=[c.xAxis!=null?c.xAxis:c.radiusAxis,c.yAxis!=null?c.yAxis:c.angleAxis]}if(c.coord==null||!isArray$1(C))c.coord=[];else for(var $=c.coord,G=0;G<2;G++)markerTypeCalculator[$[G]]&&($[G]=numCalculate(_,_.mapDimension(C[G]),$[G]));return c}}function getAxisInfo(x,c,_,T){var C={};return x.valueIndex!=null||x.valueDim!=null?(C.valueDataDim=x.valueIndex!=null?c.getDimension(x.valueIndex):x.valueDim,C.valueAxis=_.getAxis(dataDimToCoordDim(T,C.valueDataDim)),C.baseAxis=_.getOtherAxis(C.valueAxis),C.baseDataDim=c.mapDimension(C.baseAxis.dim)):(C.baseAxis=T.getBaseAxis(),C.valueAxis=_.getOtherAxis(C.baseAxis),C.baseDataDim=c.mapDimension(C.baseAxis.dim),C.valueDataDim=c.mapDimension(C.valueAxis.dim)),C}function dataDimToCoordDim(x,c){var _=x.getData().getDimensionInfo(c);return _&&_.coordDim}function dataFilter(x,c){return x&&x.containData&&c.coord&&!hasXOrY(c)?x.containData(c.coord):!0}function zoneFilter(x,c,_){return x&&x.containZone&&c.coord&&_.coord&&!hasXOrY(c)&&!hasXOrY(_)?x.containZone(c.coord,_.coord):!0}function createMarkerDimValueGetter(x,c){return x?function(_,T,C,M){var E=M<2?_.coord&&_.coord[M]:_.value;return parseDataValue(E,c[M])}:function(_,T,C,M){return parseDataValue(_.value,c[M])}}function numCalculate(x,c,_){if(_==="average"){var T=0,C=0;return x.each(c,function(M,E){isNaN(M)||(T+=M,C++)}),T/C}else return _==="median"?x.getMedian(c):x.getDataExtent(c)[_==="max"?1:0]}var inner$4=makeInner(),MarkerView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(){this.markerGroupMap=createHashMap()},c.prototype.render=function(_,T,C){var M=this,E=this.markerGroupMap;E.each(function(P){inner$4(P).keep=!1}),T.eachSeries(function(P){var R=MarkerModel$1.getMarkerModelFromSeries(P,M.type);R&&M.renderSeries(P,R,T,C)}),E.each(function(P){!inner$4(P).keep&&M.group.remove(P.group)})},c.prototype.markKeep=function(_){inner$4(_).keep=!0},c.prototype.toggleBlurSeries=function(_,T){var C=this;each$f(_,function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,C.type);if(E){var P=E.getData();P.eachItemGraphicEl(function(R){R&&(T?enterBlur(R):leaveBlur(R))})}})},c.type="marker",c}(ComponentView$1);const MarkerView$1=MarkerView;function updateMarkerLayout(x,c,_){var T=c.coordinateSystem;x.each(function(C){var M=x.getItemModel(C),E,P=parsePercent(M.get("x"),_.getWidth()),R=parsePercent(M.get("y"),_.getHeight());if(!isNaN(P)&&!isNaN(R))E=[P,R];else if(c.getMarkerPosition)E=c.getMarkerPosition(x.getValues(x.dimensions,C));else if(T){var $=x.get(T.dimensions[0],C),G=x.get(T.dimensions[1],C);E=T.dataToPoint([$,G])}isNaN(P)||(E[0]=P),isNaN(R)||(E[1]=R),x.setItemLayout(C,E)})}var MarkPointView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markPoint");E&&(updateMarkerLayout(E.getData(),M,C),this.markerGroupMap.get(M.id).updateLayout())},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,new SymbolDraw$1),O=createData(E,_,T);T.setData(O),updateMarkerLayout(T.getData(),_,M),O.each(function(L){var F=O.getItemModel(L),V=F.getShallow("symbol"),W=F.getShallow("symbolSize"),z=F.getShallow("symbolRotate"),Z=F.getShallow("symbolOffset"),H=F.getShallow("symbolKeepAspect");if(isFunction(V)||isFunction(W)||isFunction(z)||isFunction(Z)){var Y=T.getRawValue(L),U=T.getDataParams(L);isFunction(V)&&(V=V(Y,U)),isFunction(W)&&(W=W(Y,U)),isFunction(z)&&(z=z(Y,U)),isFunction(Z)&&(Z=Z(Y,U))}var j=F.getModel("itemStyle").getItemStyle(),X=getVisualFromData(R,"color");j.fill||(j.fill=X),O.setItemVisual(L,{symbol:V,symbolSize:W,symbolRotate:z,symbolOffset:Z,symbolKeepAspect:H,style:j})}),G.updateData(O),this.group.add(G.group),O.eachItemGraphicEl(function(L){L.traverse(function(F){getECData(F).dataModel=T})}),this.markKeep(G),G.group.silent=T.get("silent")||_.get("silent")},c.type="markPoint",c}(MarkerView$1);function createData(x,c,_){var T;x?T=map$1(x&&x.dimensions,function(P){var R=c.getData().getDimensionInfo(c.getData().mapDimension(P))||{};return extend(extend({},R),{name:P,ordinalMeta:null})}):T=[{name:"value",type:"float"}];var C=new SeriesData$1(T,_),M=map$1(_.get("data"),curry$1(dataTransform,c));x&&(M=filter(M,curry$1(dataFilter,x)));var E=createMarkerDimValueGetter(!!x,T);return C.initData(M,null,E),C}const MarkPointView$1=MarkPointView;function install$e(x){x.registerComponentModel(MarkPointModel$1),x.registerComponentView(MarkPointView$1),x.registerPreprocessor(function(c){checkMarkerInSeries(c.series,"markPoint")&&(c.markPoint=c.markPoint||{})})}var MarkLineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.createMarkerModelFromSeries=function(_,T,C){return new c(_,T,C)},c.type="markLine",c.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},c}(MarkerModel$1);const MarkLineModel$1=MarkLineModel;var inner$3=makeInner(),markLineTransform=function(x,c,_,T){var C=x.getData(),M;if(isArray$1(T))M=T;else{var E=T.type;if(E==="min"||E==="max"||E==="average"||E==="median"||T.xAxis!=null||T.yAxis!=null){var P=void 0,R=void 0;if(T.yAxis!=null||T.xAxis!=null)P=c.getAxis(T.yAxis!=null?"y":"x"),R=retrieve(T.yAxis,T.xAxis);else{var $=getAxisInfo(T,C,c,x);P=$.valueAxis;var G=getStackedDimension(C,$.valueDataDim);R=numCalculate(C,G,E)}var O=P.dim==="x"?0:1,L=1-O,F=clone$4(T),V={coord:[]};F.type=null,F.coord=[],F.coord[L]=-1/0,V.coord[L]=1/0;var W=_.get("precision");W>=0&&isNumber(R)&&(R=+R.toFixed(Math.min(W,20))),F.coord[O]=V.coord[O]=R,M=[F,V,{type:E,valueIndex:T.valueIndex,value:R}]}else M=[]}var z=[dataTransform(x,M[0]),dataTransform(x,M[1]),extend({},M[2])];return z[2].type=z[2].type||null,merge(z[2],z[0]),merge(z[2],z[1]),z};function isInfinity$1(x){return!isNaN(x)&&!isFinite(x)}function ifMarkLineHasOnlyDim(x,c,_,T){var C=1-x,M=T.dimensions[x];return isInfinity$1(c[C])&&isInfinity$1(_[C])&&c[x]===_[x]&&T.getAxis(M).containData(c[x])}function markLineFilter(x,c){if(x.type==="cartesian2d"){var _=c[0].coord,T=c[1].coord;if(_&&T&&(ifMarkLineHasOnlyDim(1,_,T,x)||ifMarkLineHasOnlyDim(0,_,T,x)))return!0}return dataFilter(x,c[0])&&dataFilter(x,c[1])}function updateSingleMarkerEndLayout(x,c,_,T,C){var M=T.coordinateSystem,E=x.getItemModel(c),P,R=parsePercent(E.get("x"),C.getWidth()),$=parsePercent(E.get("y"),C.getHeight());if(!isNaN(R)&&!isNaN($))P=[R,$];else{if(T.getMarkerPosition)P=T.getMarkerPosition(x.getValues(x.dimensions,c));else{var G=M.dimensions,O=x.get(G[0],c),L=x.get(G[1],c);P=M.dataToPoint([O,L])}if(isCoordinateSystemType(M,"cartesian2d")){var F=M.getAxis("x"),V=M.getAxis("y"),G=M.dimensions;isInfinity$1(x.get(G[0],c))?P[0]=F.toGlobalCoord(F.getExtent()[_?0:1]):isInfinity$1(x.get(G[1],c))&&(P[1]=V.toGlobalCoord(V.getExtent()[_?0:1]))}isNaN(R)||(P[0]=R),isNaN($)||(P[1]=$)}x.setItemLayout(c,P)}var MarkLineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markLine");if(E){var P=E.getData(),R=inner$3(E).from,$=inner$3(E).to;R.each(function(G){updateSingleMarkerEndLayout(R,G,!0,M,C),updateSingleMarkerEndLayout($,G,!1,M,C)}),P.each(function(G){P.setItemLayout(G,[R.getItemLayout(G),$.getItemLayout(G)])}),this.markerGroupMap.get(M.id).updateLayout()}},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,new LineDraw$1);this.group.add(G.group);var O=createList$1(E,_,T),L=O.from,F=O.to,V=O.line;inner$3(T).from=L,inner$3(T).to=F,T.setData(V);var W=T.get("symbol"),z=T.get("symbolSize"),Z=T.get("symbolRotate"),H=T.get("symbolOffset");isArray$1(W)||(W=[W,W]),isArray$1(z)||(z=[z,z]),isArray$1(Z)||(Z=[Z,Z]),isArray$1(H)||(H=[H,H]),O.from.each(function(U){Y(L,U,!0),Y(F,U,!1)}),V.each(function(U){var j=V.getItemModel(U).getModel("lineStyle").getLineStyle();V.setItemLayout(U,[L.getItemLayout(U),F.getItemLayout(U)]),j.stroke==null&&(j.stroke=L.getItemVisual(U,"style").fill),V.setItemVisual(U,{fromSymbolKeepAspect:L.getItemVisual(U,"symbolKeepAspect"),fromSymbolOffset:L.getItemVisual(U,"symbolOffset"),fromSymbolRotate:L.getItemVisual(U,"symbolRotate"),fromSymbolSize:L.getItemVisual(U,"symbolSize"),fromSymbol:L.getItemVisual(U,"symbol"),toSymbolKeepAspect:F.getItemVisual(U,"symbolKeepAspect"),toSymbolOffset:F.getItemVisual(U,"symbolOffset"),toSymbolRotate:F.getItemVisual(U,"symbolRotate"),toSymbolSize:F.getItemVisual(U,"symbolSize"),toSymbol:F.getItemVisual(U,"symbol"),style:j})}),G.updateData(V),O.line.eachItemGraphicEl(function(U){getECData(U).dataModel=T,U.traverse(function(j){getECData(j).dataModel=T})});function Y(U,j,X){var K=U.getItemModel(j);updateSingleMarkerEndLayout(U,j,X,_,M);var q=K.getModel("itemStyle").getItemStyle();q.fill==null&&(q.fill=getVisualFromData(R,"color")),U.setItemVisual(j,{symbolKeepAspect:K.get("symbolKeepAspect"),symbolOffset:retrieve2(K.get("symbolOffset",!0),H[X?0:1]),symbolRotate:retrieve2(K.get("symbolRotate",!0),Z[X?0:1]),symbolSize:retrieve2(K.get("symbolSize"),z[X?0:1]),symbol:retrieve2(K.get("symbol",!0),W[X?0:1]),style:q})}this.markKeep(G),G.group.silent=T.get("silent")||_.get("silent")},c.type="markLine",c}(MarkerView$1);function createList$1(x,c,_){var T;x?T=map$1(x&&x.dimensions,function($){var G=c.getData().getDimensionInfo(c.getData().mapDimension($))||{};return extend(extend({},G),{name:$,ordinalMeta:null})}):T=[{name:"value",type:"float"}];var C=new SeriesData$1(T,_),M=new SeriesData$1(T,_),E=new SeriesData$1([],_),P=map$1(_.get("data"),curry$1(markLineTransform,c,x,_));x&&(P=filter(P,curry$1(markLineFilter,x)));var R=createMarkerDimValueGetter(!!x,T);return C.initData(map$1(P,function($){return $[0]}),null,R),M.initData(map$1(P,function($){return $[1]}),null,R),E.initData(map$1(P,function($){return $[2]})),E.hasItemOption=!0,{from:C,to:M,line:E}}const MarkLineView$1=MarkLineView;function install$d(x){x.registerComponentModel(MarkLineModel$1),x.registerComponentView(MarkLineView$1),x.registerPreprocessor(function(c){checkMarkerInSeries(c.series,"markLine")&&(c.markLine=c.markLine||{})})}var MarkAreaModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.createMarkerModelFromSeries=function(_,T,C){return new c(_,T,C)},c.type="markArea",c.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},c}(MarkerModel$1);const MarkAreaModel$1=MarkAreaModel;var inner$2=makeInner(),markAreaTransform=function(x,c,_,T){var C=T[0],M=T[1];if(!(!C||!M)){var E=dataTransform(x,C),P=dataTransform(x,M),R=E.coord,$=P.coord;R[0]=retrieve(R[0],-1/0),R[1]=retrieve(R[1],-1/0),$[0]=retrieve($[0],1/0),$[1]=retrieve($[1],1/0);var G=mergeAll([{},E,P]);return G.coord=[E.coord,P.coord],G.x0=E.x,G.y0=E.y,G.x1=P.x,G.y1=P.y,G}};function isInfinity(x){return!isNaN(x)&&!isFinite(x)}function ifMarkAreaHasOnlyDim(x,c,_,T){var C=1-x;return isInfinity(c[C])&&isInfinity(_[C])}function markAreaFilter(x,c){var _=c.coord[0],T=c.coord[1],C={coord:_,x:c.x0,y:c.y0},M={coord:T,x:c.x1,y:c.y1};return isCoordinateSystemType(x,"cartesian2d")?_&&T&&(ifMarkAreaHasOnlyDim(1,_,T)||ifMarkAreaHasOnlyDim(0,_,T))?!0:zoneFilter(x,C,M):dataFilter(x,C)||dataFilter(x,M)}function getSingleMarkerEndPoint(x,c,_,T,C){var M=T.coordinateSystem,E=x.getItemModel(c),P,R=parsePercent(E.get(_[0]),C.getWidth()),$=parsePercent(E.get(_[1]),C.getHeight());if(!isNaN(R)&&!isNaN($))P=[R,$];else{if(T.getMarkerPosition){var G=x.getValues(["x0","y0"],c),O=x.getValues(["x1","y1"],c),L=M.clampData(G),F=M.clampData(O),V=[];_[0]==="x0"?V[0]=L[0]>F[0]?O[0]:G[0]:V[0]=L[0]>F[0]?G[0]:O[0],_[1]==="y0"?V[1]=L[1]>F[1]?O[1]:G[1]:V[1]=L[1]>F[1]?G[1]:O[1],P=T.getMarkerPosition(V,_,!0)}else{var W=x.get(_[0],c),z=x.get(_[1],c),Z=[W,z];M.clampData&&M.clampData(Z,Z),P=M.dataToPoint(Z,!0)}if(isCoordinateSystemType(M,"cartesian2d")){var H=M.getAxis("x"),Y=M.getAxis("y"),W=x.get(_[0],c),z=x.get(_[1],c);isInfinity(W)?P[0]=H.toGlobalCoord(H.getExtent()[_[0]==="x0"?0:1]):isInfinity(z)&&(P[1]=Y.toGlobalCoord(Y.getExtent()[_[1]==="y0"?0:1]))}isNaN(R)||(P[0]=R),isNaN($)||(P[1]=$)}return P}var dimPermutations=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],MarkAreaView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markArea");if(E){var P=E.getData();P.each(function(R){var $=map$1(dimPermutations,function(O){return getSingleMarkerEndPoint(P,R,O,M,C)});P.setItemLayout(R,$);var G=P.getItemGraphicEl(R);G.setShape("points",$)})}},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,{group:new Group$4});this.group.add(G.group),this.markKeep(G);var O=createList(E,_,T);T.setData(O),O.each(function(L){var F=map$1(dimPermutations,function(q){return getSingleMarkerEndPoint(O,L,q,_,M)}),V=E.getAxis("x").scale,W=E.getAxis("y").scale,z=V.getExtent(),Z=W.getExtent(),H=[V.parse(O.get("x0",L)),V.parse(O.get("x1",L))],Y=[W.parse(O.get("y0",L)),W.parse(O.get("y1",L))];asc$2(H),asc$2(Y);var U=!(z[0]>H[1]||z[1]Y[1]||Z[1]=0},c.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},c.type="legend.plain",c.dependencies=["series"],c.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},c}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each$3=each$f,Group$1=Group$4,LegendView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.newlineDisabled=!1,_}return c.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},c.prototype.getContentGroup=function(){return this._contentGroup},c.prototype.getSelectorGroup=function(){return this._selectorGroup},c.prototype.render=function(_,T,C){var M=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!_.get("show",!0)){var E=_.get("align"),P=_.get("orient");(!E||E==="auto")&&(E=_.get("left")==="right"&&P==="vertical"?"right":"left");var R=_.get("selector",!0),$=_.get("selectorPosition",!0);R&&(!$||$==="auto")&&($=P==="horizontal"?"end":"start"),this.renderInner(E,_,T,C,R,P,$);var G=_.getBoxLayoutParams(),O={width:C.getWidth(),height:C.getHeight()},L=_.get("padding"),F=getLayoutRect(G,O,L),V=this.layoutInner(_,E,F,M,R,$),W=getLayoutRect(defaults({width:V.width,height:V.height},G),O,L);this.group.x=W.x-V.x,this.group.y=W.y-V.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(V,_))}},c.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},c.prototype.renderInner=function(_,T,C,M,E,P,R){var $=this.getContentGroup(),G=createHashMap(),O=T.get("selectedMode"),L=[];C.eachRawSeries(function(F){!F.get("legendHoverLink")&&L.push(F.id)}),each$3(T.getData(),function(F,V){var W=F.get("name");if(!this.newlineDisabled&&(W===""||W===`
`)){var z=new Group$1;z.newline=!0,$.add(z);return}var Z=C.getSeriesByName(W)[0];if(!G.get(W))if(Z){var H=Z.getData(),Y=H.getVisual("legendLineStyle")||{},U=H.getVisual("legendIcon"),j=H.getVisual("style"),X=this._createItem(Z,W,V,F,T,_,Y,j,U,O,M);X.on("click",curry(dispatchSelectAction,W,null,M,L)).on("mouseover",curry(dispatchHighlightAction,Z.name,null,M,L)).on("mouseout",curry(dispatchDownplayAction,Z.name,null,M,L)),G.set(W,!0)}else C.eachRawSeries(function(K){if(!G.get(W)&&K.legendVisualProvider){var q=K.legendVisualProvider;if(!q.containName(W))return;var J=q.indexOfName(W),Q=q.getItemVisual(J,"style"),ee=q.getItemVisual(J,"legendIcon"),re=parse$1(Q.fill);re&&re[3]===0&&(re[3]=.2,Q=extend(extend({},Q),{fill:stringify(re,"rgba")}));var ie=this._createItem(K,W,V,F,T,_,{},Q,ee,O,M);ie.on("click",curry(dispatchSelectAction,null,W,M,L)).on("mouseover",curry(dispatchHighlightAction,null,W,M,L)).on("mouseout",curry(dispatchDownplayAction,null,W,M,L)),G.set(W,!0)}},this)},this),E&&this._createSelector(E,T,M,P,R)},c.prototype._createSelector=function(_,T,C,M,E){var P=this.getSelectorGroup();each$3(_,function($){var G=$.type,O=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){C.dispatchAction({type:G==="all"?"legendAllSelect":"legendInverseSelect"})}});P.add(O);var L=T.getModel("selectorLabel"),F=T.getModel(["emphasis","selectorLabel"]);setLabelStyle(O,{normal:L,emphasis:F},{defaultText:$.title}),enableHoverEmphasis(O)})},c.prototype._createItem=function(_,T,C,M,E,P,R,$,G,O,L){var F=_.visualDrawType,V=E.get("itemWidth"),W=E.get("itemHeight"),z=E.isSelected(T),Z=M.get("symbolRotate"),H=M.get("symbolKeepAspect"),Y=M.get("icon");G=Y||G||"roundRect";var U=getLegendStyle(G,M,R,$,F,z,L),j=new Group$1,X=M.getModel("textStyle");if(isFunction(_.getLegendIcon)&&(!Y||Y==="inherit"))j.add(_.getLegendIcon({itemWidth:V,itemHeight:W,icon:G,iconRotate:Z,itemStyle:U.itemStyle,lineStyle:U.lineStyle,symbolKeepAspect:H}));else{var K=Y==="inherit"&&_.getData().getVisual("symbol")?Z==="inherit"?_.getData().getVisual("symbolRotate"):Z:0;j.add(getDefaultLegendIcon({itemWidth:V,itemHeight:W,icon:G,iconRotate:K,itemStyle:U.itemStyle,lineStyle:U.lineStyle,symbolKeepAspect:H}))}var q=P==="left"?V+5:-5,J=P,Q=E.get("formatter"),ee=T;isString(Q)&&Q?ee=Q.replace("{name}",T??""):isFunction(Q)&&(ee=Q(T));var re=z?X.getTextColor():M.get("inactiveColor");j.add(new ZRText$1({style:createTextStyle(X,{text:ee,x:q,y:W/2,fill:re,align:J,verticalAlign:"middle"},{inheritColor:re})}));var ie=new Rect$3({shape:j.getBoundingRect(),invisible:!0}),ae=M.getModel("tooltip");return ae.get("show")&&setTooltipConfig({el:ie,componentModel:E,itemName:T,itemTooltipOption:ae.option}),j.add(ie),j.eachChild(function(ne){ne.silent=!0}),ie.silent=!O,this.getContentGroup().add(j),enableHoverEmphasis(j),j.__legendDataIndex=C,j},c.prototype.layoutInner=function(_,T,C,M,E,P){var R=this.getContentGroup(),$=this.getSelectorGroup();box(_.get("orient"),R,_.get("itemGap"),C.width,C.height);var G=R.getBoundingRect(),O=[-G.x,-G.y];if($.markRedraw(),R.markRedraw(),E){box("horizontal",$,_.get("selectorItemGap",!0));var L=$.getBoundingRect(),F=[-L.x,-L.y],V=_.get("selectorButtonGap",!0),W=_.getOrient().index,z=W===0?"width":"height",Z=W===0?"height":"width",H=W===0?"y":"x";P==="end"?F[W]+=G[z]+V:O[W]+=L[z]+V,F[1-W]+=G[Z]/2-L[Z]/2,$.x=F[0],$.y=F[1],R.x=O[0],R.y=O[1];var Y={x:0,y:0};return Y[z]=G[z]+V+L[z],Y[Z]=Math.max(G[Z],L[Z]),Y[H]=Math.min(0,L[H]+F[1-W]),Y}else return R.x=O[0],R.y=O[1],this.group.getBoundingRect()},c.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},c.type="legend.plain",c}(ComponentView$1);function getLegendStyle(x,c,_,T,C,M,E){function P(z,Z){z.lineWidth==="auto"&&(z.lineWidth=Z.lineWidth>0?2:0),each$3(z,function(H,Y){z[Y]==="inherit"&&(z[Y]=Z[Y])})}var R=c.getModel("itemStyle"),$=R.getItemStyle(),G=x.lastIndexOf("empty",0)===0?"fill":"stroke",O=R.getShallow("decal");$.decal=!O||O==="inherit"?T.decal:createOrUpdatePatternFromDecal(O,E),$.fill==="inherit"&&($.fill=T[C]),$.stroke==="inherit"&&($.stroke=T[G]),$.opacity==="inherit"&&($.opacity=(C==="fill"?T:_).opacity),P($,T);var L=c.getModel("lineStyle"),F=L.getLineStyle();if(P(F,_),$.fill==="auto"&&($.fill=T.fill),$.stroke==="auto"&&($.stroke=T.fill),F.stroke==="auto"&&(F.stroke=T.fill),!M){var V=c.get("inactiveBorderWidth"),W=$[G];$.lineWidth=V==="auto"?T.lineWidth>0&&W?2:0:$.lineWidth,$.fill=c.get("inactiveColor"),$.stroke=c.get("inactiveBorderColor"),F.stroke=L.get("inactiveColor"),F.lineWidth=L.get("inactiveWidth")}return{itemStyle:$,lineStyle:F}}function getDefaultLegendIcon(x){var c=x.icon||"roundRect",_=createSymbol$1(c,0,0,x.itemWidth,x.itemHeight,x.itemStyle.fill,x.symbolKeepAspect);return _.setStyle(x.itemStyle),_.rotation=(x.iconRotate||0)*Math.PI/180,_.setOrigin([x.itemWidth/2,x.itemHeight/2]),c.indexOf("empty")>-1&&(_.style.stroke=_.style.fill,_.style.fill="#fff",_.style.lineWidth=2),_}function dispatchSelectAction(x,c,_,T){dispatchDownplayAction(x,c,_,T),_.dispatchAction({type:"legendToggleSelect",name:x??c}),dispatchHighlightAction(x,c,_,T)}function isUseHoverLayer(x){for(var c=x.getZr().storage.getDisplayList(),_,T=0,C=c.length;TC[E],z=[-F.x,-F.y];T||(z[M]=G[$]);var Z=[0,0],H=[-V.x,-V.y],Y=retrieve2(_.get("pageButtonGap",!0),_.get("itemGap",!0));if(W){var U=_.get("pageButtonPosition",!0);U==="end"?H[M]+=C[E]-V[E]:Z[M]+=V[E]+Y}H[1-M]+=F[P]/2-V[P]/2,G.setPosition(z),O.setPosition(Z),L.setPosition(H);var j={x:0,y:0};if(j[E]=W?C[E]:F[E],j[P]=Math.max(F[P],V[P]),j[R]=Math.min(0,V[R]+H[1-M]),O.__rectSize=C[E],W){var X={x:0,y:0};X[E]=Math.max(C[E]-V[E]-Y,0),X[P]=j[P],O.setClipPath(new Rect$3({shape:X})),O.__rectSize=X[E]}else L.eachChild(function(q){q.attr({invisible:!0,silent:!0})});var K=this._getPageInfo(_);return K.pageIndex!=null&&updateProps$1(G,{x:K.contentPosition[0],y:K.contentPosition[1]},W?_:null),this._updatePageInfoView(_,K),j},c.prototype._pageGo=function(_,T,C){var M=this._getPageInfo(T)[_];M!=null&&C.dispatchAction({type:"legendScroll",scrollDataIndex:M,legendId:T.id})},c.prototype._updatePageInfoView=function(_,T){var C=this._controllerGroup;each$f(["pagePrev","pageNext"],function(G){var O=G+"DataIndex",L=T[O]!=null,F=C.childOfName(G);F&&(F.setStyle("fill",L?_.get("pageIconColor",!0):_.get("pageIconInactiveColor",!0)),F.cursor=L?"pointer":"default")});var M=C.childOfName("pageText"),E=_.get("pageFormatter"),P=T.pageIndex,R=P!=null?P+1:0,$=T.pageCount;M&&E&&M.setStyle("text",isString(E)?E.replace("{current}",R==null?"":R+"").replace("{total}",$==null?"":$+""):E({current:R,total:$}))},c.prototype._getPageInfo=function(_){var T=_.get("scrollDataIndex",!0),C=this.getContentGroup(),M=this._containerGroup.__rectSize,E=_.getOrient().index,P=WH[E],R=XY[E],$=this._findTargetItemIndex(T),G=C.children(),O=G[$],L=G.length,F=L?1:0,V={contentPosition:[C.x,C.y],pageCount:F,pageIndex:F-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!O)return V;var W=U(O);V.contentPosition[E]=-W.s;for(var z=$+1,Z=W,H=W,Y=null;z<=L;++z)Y=U(G[z]),(!Y&&H.e>Z.s+M||Y&&!j(Y,Z.s))&&(H.i>Z.i?Z=H:Z=Y,Z&&(V.pageNextDataIndex==null&&(V.pageNextDataIndex=Z.i),++V.pageCount)),H=Y;for(var z=$-1,Z=W,H=W,Y=null;z>=-1;--z)Y=U(G[z]),(!Y||!j(H,Y.s))&&Z.i=K&&X.s<=K+M}},c.prototype._findTargetItemIndex=function(_){if(!this._showController)return 0;var T,C=this.getContentGroup(),M;return C.eachChild(function(E,P){var R=E.__legendDataIndex;M==null&&R!=null&&(M=P),R===_&&(T=P)}),T??M},c.type="legend.scroll",c}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(x){x.registerAction("legendScroll","legendscroll",function(c,_){var T=c.scrollDataIndex;T!=null&&_.eachComponent({mainType:"legend",subType:"scroll",query:c},function(C){C.setScrollDataIndex(T)})})}function install$a(x){use(install$b),x.registerComponentModel(ScrollableLegendModel$1),x.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(x)}function install$9(x){use(install$b),use(install$a)}var InsideZoomModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="dataZoom.inside",c.defaultOption=inheritDefaultOption(DataZoomModel$1.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),c}(DataZoomModel$1);const InsideZoomModel$1=InsideZoomModel;var inner$1=makeInner();function setViewInfoToCoordSysRecord(x,c,_){inner$1(x).coordSysRecordMap.each(function(T){var C=T.dataZoomInfoMap.get(c.uid);C&&(C.getRange=_)})}function disposeCoordSysRecordIfNeeded(x,c){for(var _=inner$1(x).coordSysRecordMap,T=_.keys(),C=0;CT[_+c]&&(c=P),C=C&&E.get("preventDefaultMouseMove",!0)}),{controlType:c,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!C}}}function installDataZoomRoamProcessor(x){x.registerProcessor(x.PRIORITY.PROCESSOR.FILTER,function(c,_){var T=inner$1(_),C=T.coordSysRecordMap||(T.coordSysRecordMap=createHashMap());C.each(function(M){M.dataZoomInfoMap=null}),c.eachComponent({mainType:"dataZoom",subType:"inside"},function(M){var E=collectReferCoordSysModelInfo(M);each$f(E.infoList,function(P){var R=P.model.uid,$=C.get(R)||C.set(R,createCoordSysRecord(_,P.model)),G=$.dataZoomInfoMap||($.dataZoomInfoMap=createHashMap());G.set(M.uid,{dzReferCoordSysInfo:P,model:M,getRange:null})})}),C.each(function(M){var E=M.controller,P,R=M.dataZoomInfoMap;if(R){var $=R.keys()[0];$!=null&&(P=R.get($))}if(!P){disposeCoordSysRecord(C,M);return}var G=mergeControllerParams(R);E.enable(G.controlType,G.opt),E.setPointerChecker(M.containsPoint),createOrUpdate(M,"dispatchAction",P.model.get("throttle",!0),"fixRate")})})}var InsideZoomView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type="dataZoom.inside",_}return c.prototype.render=function(_,T,C){if(x.prototype.render.apply(this,arguments),_.noTarget()){this._clear();return}this.range=_.getPercentRange(),setViewInfoToCoordSysRecord(C,_,{pan:bind$1(getRangeHandlers.pan,this),zoom:bind$1(getRangeHandlers.zoom,this),scrollMove:bind$1(getRangeHandlers.scrollMove,this)})},c.prototype.dispose=function(){this._clear(),x.prototype.dispose.apply(this,arguments)},c.prototype._clear=function(){disposeCoordSysRecordIfNeeded(this.api,this.dataZoomModel),this.range=null},c.type="dataZoom.inside",c}(DataZoomView$1),getRangeHandlers={zoom:function(x,c,_,T){var C=this.range,M=C.slice(),E=x.axisModels[0];if(E){var P=getDirectionInfo[c](null,[T.originX,T.originY],E,_,x),R=(P.signal>0?P.pixelStart+P.pixelLength-P.pixel:P.pixel-P.pixelStart)/P.pixelLength*(M[1]-M[0])+M[0],$=Math.max(1/T.scale,0);M[0]=(M[0]-R)*$+R,M[1]=(M[1]-R)*$+R;var G=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(sliderMove(0,M,[0,100],0,G.minSpan,G.maxSpan),this.range=M,C[0]!==M[0]||C[1]!==M[1])return M}},pan:makeMover(function(x,c,_,T,C,M){var E=getDirectionInfo[T]([M.oldX,M.oldY],[M.newX,M.newY],c,C,_);return E.signal*(x[1]-x[0])*E.pixel/E.pixelLength}),scrollMove:makeMover(function(x,c,_,T,C,M){var E=getDirectionInfo[T]([0,0],[M.scrollDelta,M.scrollDelta],c,C,_);return E.signal*(x[1]-x[0])*M.scrollDelta})};function makeMover(x){return function(c,_,T,C){var M=this.range,E=M.slice(),P=c.axisModels[0];if(P){var R=x(E,P,c,_,T,C);if(sliderMove(R,E,[0,100],"all"),this.range=E,M[0]!==E[0]||M[1]!==E[1])return E}}}var getDirectionInfo={grid:function(x,c,_,T,C){var M=_.axis,E={},P=C.model.coordinateSystem.getRect();return x=x||[0,0],M.dim==="x"?(E.pixel=c[0]-x[0],E.pixelLength=P.width,E.pixelStart=P.x,E.signal=M.inverse?1:-1):(E.pixel=c[1]-x[1],E.pixelLength=P.height,E.pixelStart=P.y,E.signal=M.inverse?-1:1),E},polar:function(x,c,_,T,C){var M=_.axis,E={},P=C.model.coordinateSystem,R=P.getRadiusAxis().getExtent(),$=P.getAngleAxis().getExtent();return x=x?P.pointToCoord(x):[0,0],c=P.pointToCoord(c),_.mainType==="radiusAxis"?(E.pixel=c[0]-x[0],E.pixelLength=R[1]-R[0],E.pixelStart=R[0],E.signal=M.inverse?1:-1):(E.pixel=c[1]-x[1],E.pixelLength=$[1]-$[0],E.pixelStart=$[0],E.signal=M.inverse?-1:1),E},singleAxis:function(x,c,_,T,C){var M=_.axis,E=C.model.coordinateSystem.getRect(),P={};return x=x||[0,0],M.orient==="horizontal"?(P.pixel=c[0]-x[0],P.pixelLength=E.width,P.pixelStart=E.x,P.signal=M.inverse?1:-1):(P.pixel=c[1]-x[1],P.pixelLength=E.height,P.pixelStart=E.y,P.signal=M.inverse?-1:1),P}};const InsideZoomView$1=InsideZoomView;function install$8(x){installCommon$1(x),x.registerComponentModel(InsideZoomModel$1),x.registerComponentView(InsideZoomView$1),installDataZoomRoamProcessor(x)}var SliderZoomModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="dataZoom.slider",c.layoutMode="box",c.defaultOption=inheritDefaultOption(DataZoomModel$1.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),c}(DataZoomModel$1);const SliderZoomModel$1=SliderZoomModel;var Rect=Rect$3,DEFAULT_LOCATION_EDGE_GAP=7,DEFAULT_FRAME_BORDER_WIDTH=1,DEFAULT_FILLER_SIZE=30,DEFAULT_MOVE_HANDLE_SIZE=7,HORIZONTAL="horizontal",VERTICAL="vertical",LABEL_GAP=5,SHOW_DATA_SHADOW_SERIES_TYPE=["line","bar","candlestick","scatter"],REALTIME_ANIMATION_CONFIG={easing:"cubicOut",duration:100,delay:0},SliderZoomView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_._displayables={},_}return c.prototype.init=function(_,T){this.api=T,this._onBrush=bind$1(this._onBrush,this),this._onBrushEnd=bind$1(this._onBrushEnd,this)},c.prototype.render=function(_,T,C,M){if(x.prototype.render.apply(this,arguments),createOrUpdate(this,"_dispatchZoomAction",_.get("throttle"),"fixRate"),this._orient=_.getOrient(),_.get("show")===!1){this.group.removeAll();return}if(_.noTarget()){this._clear(),this.group.removeAll();return}(!M||M.type!=="dataZoom"||M.from!==this.uid)&&this._buildView(),this._updateView()},c.prototype.dispose=function(){this._clear(),x.prototype.dispose.apply(this,arguments)},c.prototype._clear=function(){clear$1(this,"_dispatchZoomAction");var _=this.api.getZr();_.off("mousemove",this._onBrush),_.off("mouseup",this._onBrushEnd)},c.prototype._buildView=function(){var _=this.group;_.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var T=this._displayables.sliderGroup=new Group$4;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),_.add(T),this._positionGroup()},c.prototype._resetLocation=function(){var _=this.dataZoomModel,T=this.api,C=_.get("brushSelect"),M=C?DEFAULT_MOVE_HANDLE_SIZE:0,E=this._findCoordRect(),P={width:T.getWidth(),height:T.getHeight()},R=this._orient===HORIZONTAL?{right:P.width-E.x-E.width,top:P.height-DEFAULT_FILLER_SIZE-DEFAULT_LOCATION_EDGE_GAP-M,width:E.width,height:DEFAULT_FILLER_SIZE}:{right:DEFAULT_LOCATION_EDGE_GAP,top:E.y,width:DEFAULT_FILLER_SIZE,height:E.height},$=getLayoutParams(_.option);each$f(["right","top","width","height"],function(O){$[O]==="ph"&&($[O]=R[O])});var G=getLayoutRect($,P);this._location={x:G.x,y:G.y},this._size=[G.width,G.height],this._orient===VERTICAL&&this._size.reverse()},c.prototype._positionGroup=function(){var _=this.group,T=this._location,C=this._orient,M=this.dataZoomModel.getFirstTargetAxisModel(),E=M&&M.get("inverse"),P=this._displayables.sliderGroup,R=(this._dataShadowInfo||{}).otherAxisInverse;P.attr(C===HORIZONTAL&&!E?{scaleY:R?1:-1,scaleX:1}:C===HORIZONTAL&&E?{scaleY:R?1:-1,scaleX:-1}:C===VERTICAL&&!E?{scaleY:R?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:R?-1:1,scaleX:-1,rotation:Math.PI/2});var $=_.getBoundingRect([P]);_.x=T.x-$.x,_.y=T.y-$.y,_.markRedraw()},c.prototype._getViewExtent=function(){return[0,this._size[0]]},c.prototype._renderBackground=function(){var _=this.dataZoomModel,T=this._size,C=this._displayables.sliderGroup,M=_.get("brushSelect");C.add(new Rect({silent:!0,shape:{x:0,y:0,width:T[0],height:T[1]},style:{fill:_.get("backgroundColor")},z2:-40}));var E=new Rect({shape:{x:0,y:0,width:T[0],height:T[1]},style:{fill:"transparent"},z2:0,onclick:bind$1(this._onClickPanel,this)}),P=this.api.getZr();M?(E.on("mousedown",this._onBrushStart,this),E.cursor="crosshair",P.on("mousemove",this._onBrush),P.on("mouseup",this._onBrushEnd)):(P.off("mousemove",this._onBrush),P.off("mouseup",this._onBrushEnd)),C.add(E)},c.prototype._renderDataShadow=function(){var _=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!_)return;var T=this._size,C=this._shadowSize||[],M=_.series,E=M.getRawData(),P=M.getShadowDim&&M.getShadowDim(),R=P&&E.getDimensionInfo(P)?M.getShadowDim():_.otherDim;if(R==null)return;var $=this._shadowPolygonPts,G=this._shadowPolylinePts;if(E!==this._shadowData||R!==this._shadowDim||T[0]!==C[0]||T[1]!==C[1]){var O=E.getDataExtent(R),L=(O[1]-O[0])*.3;O=[O[0]-L,O[1]+L];var F=[0,T[1]],V=[0,T[0]],W=[[T[0],0],[0,0]],z=[],Z=V[1]/(E.count()-1),H=0,Y=Math.round(E.count()/T[0]),U;E.each([R],function(J,Q){if(Y>0&&Q%Y){H+=Z;return}var ee=J==null||isNaN(J)||J==="",re=ee?0:linearMap$2(J,O,F,!0);ee&&!U&&Q?(W.push([W[W.length-1][0],0]),z.push([z[z.length-1][0],0])):!ee&&U&&(W.push([H,0]),z.push([H,0])),W.push([H,re]),z.push([H,re]),H+=Z,U=ee}),$=this._shadowPolygonPts=W,G=this._shadowPolylinePts=z}this._shadowData=E,this._shadowDim=R,this._shadowSize=[T[0],T[1]];var j=this.dataZoomModel;function X(J){var Q=j.getModel(J?"selectedDataBackground":"dataBackground"),ee=new Group$4,re=new Polygon$1({shape:{points:$},segmentIgnoreThreshold:1,style:Q.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),ie=new Polyline$3({shape:{points:G},segmentIgnoreThreshold:1,style:Q.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return ee.add(re),ee.add(ie),ee}for(var K=0;K<3;K++){var q=X(K===1);this._displayables.sliderGroup.add(q),this._displayables.dataShadowSegs.push(q)}},c.prototype._prepareDataShadowInfo=function(){var _=this.dataZoomModel,T=_.get("showDataShadow");if(T!==!1){var C,M=this.ecModel;return _.eachTargetAxis(function(E,P){var R=_.getAxisProxy(E,P).getTargetSeriesModels();each$f(R,function($){if(!C&&!(T!==!0&&indexOf(SHOW_DATA_SHADOW_SERIES_TYPE,$.get("type"))<0)){var G=M.getComponent(getAxisMainType(E),P).axis,O=getOtherDim(E),L,F=$.coordinateSystem;O!=null&&F.getOtherAxis&&(L=F.getOtherAxis(G).inverse),O=$.getData().mapDimension(O),C={thisAxis:G,series:$,thisDim:E,otherDim:O,otherAxisInverse:L}}},this)},this),C}},c.prototype._renderHandle=function(){var _=this.group,T=this._displayables,C=T.handles=[null,null],M=T.handleLabels=[null,null],E=this._displayables.sliderGroup,P=this._size,R=this.dataZoomModel,$=this.api,G=R.get("borderRadius")||0,O=R.get("brushSelect"),L=T.filler=new Rect({silent:O,style:{fill:R.get("fillerColor")},textConfig:{position:"inside"}});E.add(L),E.add(new Rect({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:P[0],height:P[1],r:G},style:{stroke:R.get("dataBackgroundColor")||R.get("borderColor"),lineWidth:DEFAULT_FRAME_BORDER_WIDTH,fill:"rgba(0,0,0,0)"}})),each$f([0,1],function(Y){var U=R.get("handleIcon");!symbolBuildProxies[U]&&U.indexOf("path://")<0&&U.indexOf("image://")<0&&(U="path://"+U);var j=createSymbol$1(U,-1,0,2,2,null,!0);j.attr({cursor:getCursor$1(this._orient),draggable:!0,drift:bind$1(this._onDragMove,this,Y),ondragend:bind$1(this._onDragEnd,this),onmouseover:bind$1(this._showDataInfo,this,!0),onmouseout:bind$1(this._showDataInfo,this,!1),z2:5});var X=j.getBoundingRect(),K=R.get("handleSize");this._handleHeight=parsePercent(K,this._size[1]),this._handleWidth=X.width/X.height*this._handleHeight,j.setStyle(R.getModel("handleStyle").getItemStyle()),j.style.strokeNoScale=!0,j.rectHover=!0,j.ensureState("emphasis").style=R.getModel(["emphasis","handleStyle"]).getItemStyle(),enableHoverEmphasis(j);var q=R.get("handleColor");q!=null&&(j.style.fill=q),E.add(C[Y]=j);var J=R.getModel("textStyle");_.add(M[Y]=new ZRText$1({silent:!0,invisible:!0,style:createTextStyle(J,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:J.getTextColor(),font:J.getFont()}),z2:10}))},this);var F=L;if(O){var V=parsePercent(R.get("moveHandleSize"),P[1]),W=T.moveHandle=new Rect$3({style:R.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:P[1]-.5,height:V}}),z=V*.8,Z=T.moveHandleIcon=createSymbol$1(R.get("moveHandleIcon"),-z/2,-z/2,z,z,"#fff",!0);Z.silent=!0,Z.y=P[1]+V/2-.5,W.ensureState("emphasis").style=R.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var H=Math.min(P[1]/2,Math.max(V,10));F=T.moveZone=new Rect$3({invisible:!0,shape:{y:P[1]-H,height:V+H}}),F.on("mouseover",function(){$.enterEmphasis(W)}).on("mouseout",function(){$.leaveEmphasis(W)}),E.add(W),E.add(Z),E.add(F)}F.attr({draggable:!0,cursor:getCursor$1(this._orient),drift:bind$1(this._onDragMove,this,"all"),ondragstart:bind$1(this._showDataInfo,this,!0),ondragend:bind$1(this._onDragEnd,this),onmouseover:bind$1(this._showDataInfo,this,!0),onmouseout:bind$1(this._showDataInfo,this,!1)})},c.prototype._resetInterval=function(){var _=this._range=this.dataZoomModel.getPercentRange(),T=this._getViewExtent();this._handleEnds=[linearMap$2(_[0],[0,100],T,!0),linearMap$2(_[1],[0,100],T,!0)]},c.prototype._updateInterval=function(_,T){var C=this.dataZoomModel,M=this._handleEnds,E=this._getViewExtent(),P=C.findRepresentativeAxisProxy().getMinMaxSpan(),R=[0,100];sliderMove(T,M,E,C.get("zoomLock")?"all":_,P.minSpan!=null?linearMap$2(P.minSpan,R,E,!0):null,P.maxSpan!=null?linearMap$2(P.maxSpan,R,E,!0):null);var $=this._range,G=this._range=asc$2([linearMap$2(M[0],E,R,!0),linearMap$2(M[1],E,R,!0)]);return!$||$[0]!==G[0]||$[1]!==G[1]},c.prototype._updateView=function(_){var T=this._displayables,C=this._handleEnds,M=asc$2(C.slice()),E=this._size;each$f([0,1],function(F){var V=T.handles[F],W=this._handleHeight;V.attr({scaleX:W/2,scaleY:W/2,x:C[F]+(F?-1:1),y:E[1]/2-W/2})},this),T.filler.setShape({x:M[0],y:0,width:M[1]-M[0],height:E[1]});var P={x:M[0],width:M[1]-M[0]};T.moveHandle&&(T.moveHandle.setShape(P),T.moveZone.setShape(P),T.moveZone.getBoundingRect(),T.moveHandleIcon&&T.moveHandleIcon.attr("x",P.x+P.width/2));for(var R=T.dataShadowSegs,$=[0,M[0],M[1],E[0]],G=0;GT[0]||C[1]<0||C[1]>T[1])){var M=this._handleEnds,E=(M[0]+M[1])/2,P=this._updateInterval("all",C[0]-E);this._updateView(),P&&this._dispatchZoomAction(!1)}},c.prototype._onBrushStart=function(_){var T=_.offsetX,C=_.offsetY;this._brushStart=new Point$1(T,C),this._brushing=!0,this._brushStartTime=+new Date},c.prototype._onBrushEnd=function(_){if(this._brushing){var T=this._displayables.brushRect;if(this._brushing=!1,!!T){T.attr("ignore",!0);var C=T.shape,M=+new Date;if(!(M-this._brushStartTime<200&&Math.abs(C.width)<5)){var E=this._getViewExtent(),P=[0,100];this._range=asc$2([linearMap$2(C.x,E,P,!0),linearMap$2(C.x+C.width,E,P,!0)]),this._handleEnds=[C.x,C.x+C.width],this._updateView(),this._dispatchZoomAction(!1)}}}},c.prototype._onBrush=function(_){this._brushing&&(stop(_.event),this._updateBrushRect(_.offsetX,_.offsetY))},c.prototype._updateBrushRect=function(_,T){var C=this._displayables,M=this.dataZoomModel,E=C.brushRect;E||(E=C.brushRect=new Rect({silent:!0,style:M.getModel("brushStyle").getItemStyle()}),C.sliderGroup.add(E)),E.attr("ignore",!1);var P=this._brushStart,R=this._displayables.sliderGroup,$=R.transformCoordToLocal(_,T),G=R.transformCoordToLocal(P.x,P.y),O=this._size;$[0]=Math.max(Math.min(O[0],$[0]),0),E.setShape({x:G[0],y:0,width:$[0]-G[0],height:O[1]})},c.prototype._dispatchZoomAction=function(_){var T=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:_?REALTIME_ANIMATION_CONFIG:null,start:T[0],end:T[1]})},c.prototype._findCoordRect=function(){var _,T=collectReferCoordSysModelInfo(this.dataZoomModel).infoList;if(!_&&T.length){var C=T[0].model.coordinateSystem;_=C.getRect&&C.getRect()}if(!_){var M=this.api.getWidth(),E=this.api.getHeight();_={x:M*.2,y:E*.2,width:M*.6,height:E*.6}}return _},c.type="dataZoom.slider",c}(DataZoomView$1);function getOtherDim(x){var c={x:"y",y:"x",radius:"angle",angle:"radius"};return c[x]}function getCursor$1(x){return x==="vertical"?"ns-resize":"ew-resize"}const SliderZoomView$1=SliderZoomView;function install$7(x){x.registerComponentModel(SliderZoomModel$1),x.registerComponentView(SliderZoomView$1),installCommon$1(x)}function install$6(x){use(install$8),use(install$7)}var visualDefault={get:function(x,c,_){var T=clone$4((defaultOption[x]||{})[c]);return _&&isArray$1(T)?T[T.length-1]:T}},defaultOption={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}};const visualDefault$1=visualDefault;var mapVisual=VisualMapping$1.mapVisual,eachVisual=VisualMapping$1.eachVisual,isArray=isArray$1,each$2=each$f,asc=asc$2,linearMap$1=linearMap$2,VisualMapModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.stateList=["inRange","outOfRange"],_.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],_.layoutMode={type:"box",ignoreSize:!0},_.dataBound=[-1/0,1/0],_.targetVisuals={},_.controllerVisuals={},_}return c.prototype.init=function(_,T,C){this.mergeDefaultAndTheme(_,C)},c.prototype.optionUpdated=function(_,T){var C=this.option;!T&&replaceVisualOption(C,_,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},c.prototype.resetVisual=function(_){var T=this.stateList;_=bind$1(_,this),this.controllerVisuals=createVisualMappings(this.option.controller,T,_),this.targetVisuals=createVisualMappings(this.option.target,T,_)},c.prototype.getItemSymbol=function(){return null},c.prototype.getTargetSeriesIndices=function(){var _=this.option.seriesIndex,T=[];return _==null||_==="all"?this.ecModel.eachSeries(function(C,M){T.push(M)}):T=normalizeToArray(_),T},c.prototype.eachTargetSeries=function(_,T){each$f(this.getTargetSeriesIndices(),function(C){var M=this.ecModel.getSeriesByIndex(C);M&&_.call(T,M)},this)},c.prototype.isTargetSeries=function(_){var T=!1;return this.eachTargetSeries(function(C){C===_&&(T=!0)}),T},c.prototype.formatValueText=function(_,T,C){var M=this.option,E=M.precision,P=this.dataBound,R=M.formatter,$;C=C||["<",">"],isArray$1(_)&&(_=_.slice(),$=!0);var G=T?_:$?[O(_[0]),O(_[1])]:O(_);if(isString(R))return R.replace("{value}",$?G[0]:G).replace("{value2}",$?G[1]:G);if(isFunction(R))return $?R(_[0],_[1]):R(_);if($)return _[0]===P[0]?C[0]+" "+G[1]:_[1]===P[1]?C[1]+" "+G[0]:G[0]+" - "+G[1];return G;function O(L){return L===P[0]?"min":L===P[1]?"max":(+L).toFixed(Math.min(E,20))}},c.prototype.resetExtent=function(){var _=this.option,T=asc([_.min,_.max]);this._dataExtent=T},c.prototype.getDataDimensionIndex=function(_){var T=this.option.dimension;if(T!=null)return _.getDimensionIndex(T);for(var C=_.dimensions,M=C.length-1;M>=0;M--){var E=C[M],P=_.getDimensionInfo(E);if(!P.isCalculationCoord)return P.storeDimIndex}},c.prototype.getExtent=function(){return this._dataExtent.slice()},c.prototype.completeVisualOption=function(){var _=this.ecModel,T=this.option,C={inRange:T.inRange,outOfRange:T.outOfRange},M=T.target||(T.target={}),E=T.controller||(T.controller={});merge(M,C),merge(E,C);var P=this.isCategory();R.call(this,M),R.call(this,E),$.call(this,M,"inRange","outOfRange"),G.call(this,E);function R(O){isArray(T.color)&&!O.inRange&&(O.inRange={color:T.color.slice().reverse()}),O.inRange=O.inRange||{color:_.get("gradientColor")}}function $(O,L,F){var V=O[L],W=O[F];V&&!W&&(W=O[F]={},each$2(V,function(z,Z){if(VisualMapping$1.isValidType(Z)){var H=visualDefault$1.get(Z,"inactive",P);H!=null&&(W[Z]=H,Z==="color"&&!W.hasOwnProperty("opacity")&&!W.hasOwnProperty("colorAlpha")&&(W.opacity=[0,0]))}}))}function G(O){var L=(O.inRange||{}).symbol||(O.outOfRange||{}).symbol,F=(O.inRange||{}).symbolSize||(O.outOfRange||{}).symbolSize,V=this.get("inactiveColor"),W=this.getItemSymbol(),z=W||"roundRect";each$2(this.stateList,function(Z){var H=this.itemSize,Y=O[Z];Y||(Y=O[Z]={color:P?V:[V]}),Y.symbol==null&&(Y.symbol=L&&clone$4(L)||(P?z:[z])),Y.symbolSize==null&&(Y.symbolSize=F&&clone$4(F)||(P?H[0]:[H[0],H[0]])),Y.symbol=mapVisual(Y.symbol,function(X){return X==="none"?z:X});var U=Y.symbolSize;if(U!=null){var j=-1/0;eachVisual(U,function(X){X>j&&(j=X)}),Y.symbolSize=mapVisual(U,function(X){return linearMap$1(X,[0,j],[0,H[0]],!0)})}},this)}},c.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},c.prototype.isCategory=function(){return!!this.option.categories},c.prototype.setSelected=function(_){},c.prototype.getSelected=function(){return null},c.prototype.getValueState=function(_){return null},c.prototype.getVisualMeta=function(_){return null},c.type="visualMap",c.dependencies=["series"],c.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},c}(ComponentModel$1);const VisualMapModel$1=VisualMapModel;var DEFAULT_BAR_BOUND=[20,140],ContinuousModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.optionUpdated=function(_,T){x.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(C){C.mappingMethod="linear",C.dataExtent=this.getExtent()}),this._resetRange()},c.prototype.resetItemSize=function(){x.prototype.resetItemSize.apply(this,arguments);var _=this.itemSize;(_[0]==null||isNaN(_[0]))&&(_[0]=DEFAULT_BAR_BOUND[0]),(_[1]==null||isNaN(_[1]))&&(_[1]=DEFAULT_BAR_BOUND[1])},c.prototype._resetRange=function(){var _=this.getExtent(),T=this.option.range;!T||T.auto?(_.auto=1,this.option.range=_):isArray$1(T)&&(T[0]>T[1]&&T.reverse(),T[0]=Math.max(T[0],_[0]),T[1]=Math.min(T[1],_[1]))},c.prototype.completeVisualOption=function(){x.prototype.completeVisualOption.apply(this,arguments),each$f(this.stateList,function(_){var T=this.option.controller[_].symbolSize;T&&T[0]!==T[1]&&(T[0]=T[1]/3)},this)},c.prototype.setSelected=function(_){this.option.range=_.slice(),this._resetRange()},c.prototype.getSelected=function(){var _=this.getExtent(),T=asc$2((this.get("range")||[]).slice());return T[0]>_[1]&&(T[0]=_[1]),T[1]>_[1]&&(T[1]=_[1]),T[0]<_[0]&&(T[0]=_[0]),T[1]<_[0]&&(T[1]=_[0]),T},c.prototype.getValueState=function(_){var T=this.option.range,C=this.getExtent();return(T[0]<=C[0]||T[0]<=_)&&(T[1]>=C[1]||_<=T[1])?"inRange":"outOfRange"},c.prototype.findTargetDataIndices=function(_){var T=[];return this.eachTargetSeries(function(C){var M=[],E=C.getData();E.each(this.getDataDimensionIndex(E),function(P,R){_[0]<=P&&P<=_[1]&&M.push(R)},this),T.push({seriesId:C.id,dataIndex:M})},this),T},c.prototype.getVisualMeta=function(_){var T=getColorStopValues(this,"outOfRange",this.getExtent()),C=getColorStopValues(this,"inRange",this.option.range.slice()),M=[];function E(F,V){M.push({value:F,color:_(F,V)})}for(var P=0,R=0,$=C.length,G=T.length;R_[1])break;M.push({color:this.getControllerVisual(R,"color",T),offset:P/C})}return M.push({color:this.getControllerVisual(_[1],"color",T),offset:1}),M},c.prototype._createBarPoints=function(_,T){var C=this.visualMapModel.itemSize;return[[C[0]-T[0],_[0]],[C[0],_[0]],[C[0],_[1]],[C[0]-T[1],_[1]]]},c.prototype._createBarGroup=function(_){var T=this._orient,C=this.visualMapModel.get("inverse");return new Group$4(T==="horizontal"&&!C?{scaleX:_==="bottom"?1:-1,rotation:Math.PI/2}:T==="horizontal"&&C?{scaleX:_==="bottom"?-1:1,rotation:-Math.PI/2}:T==="vertical"&&!C?{scaleX:_==="left"?1:-1,scaleY:-1}:{scaleX:_==="left"?1:-1})},c.prototype._updateHandle=function(_,T){if(this._useHandle){var C=this._shapes,M=this.visualMapModel,E=C.handleThumbs,P=C.handleLabels,R=M.itemSize,$=M.getExtent();each$1([0,1],function(G){var O=E[G];O.setStyle("fill",T.handlesColor[G]),O.y=_[G];var L=linearMap(_[G],[0,R[1]],$,!0),F=this.getControllerVisual(L,"symbolSize");O.scaleX=O.scaleY=F/R[0],O.x=R[0]-F/2;var V=applyTransform(C.handleLabelPoints[G],getTransform$1(O,this.group));P[G].setStyle({x:V[0],y:V[1],text:M.formatValueText(this._dataInterval[G]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",C.mainGroup):"center"})},this)}},c.prototype._showIndicator=function(_,T,C,M){var E=this.visualMapModel,P=E.getExtent(),R=E.itemSize,$=[0,R[1]],G=this._shapes,O=G.indicator;if(O){O.attr("invisible",!1);var L={convertOpacityToAlpha:!0},F=this.getControllerVisual(_,"color",L),V=this.getControllerVisual(_,"symbolSize"),W=linearMap(_,P,$,!0),z=R[0]-V/2,Z={x:O.x,y:O.y};O.y=W,O.x=z;var H=applyTransform(G.indicatorLabelPoint,getTransform$1(O,this.group)),Y=G.indicatorLabel;Y.attr("invisible",!1);var U=this._applyTransform("left",G.mainGroup),j=this._orient,X=j==="horizontal";Y.setStyle({text:(C||"")+E.formatValueText(T),verticalAlign:X?U:"middle",align:X?"center":U});var K={x:z,y:W,style:{fill:F}},q={style:{x:H[0],y:H[1]}};if(E.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var J={duration:100,easing:"cubicInOut",additive:!0};O.x=Z.x,O.y=Z.y,O.animateTo(K,J),Y.animateTo(q,J)}else O.attr(K),Y.attr(q);this._firstShowIndicator=!1;var Q=this._shapes.handleLabels;if(Q)for(var ee=0;eeE[1]&&(O[1]=1/0),T&&(O[0]===-1/0?this._showIndicator(G,O[1],"< ",R):O[1]===1/0?this._showIndicator(G,O[0],"> ",R):this._showIndicator(G,G,"≈ ",R));var L=this._hoverLinkDataIndices,F=[];(T||useHoverLinkOnHandle(C))&&(F=this._hoverLinkDataIndices=C.findTargetDataIndices(O));var V=compressBatches(L,F);this._dispatchHighDown("downplay",makeHighDownBatch(V[0],C)),this._dispatchHighDown("highlight",makeHighDownBatch(V[1],C))}},c.prototype._hoverLinkFromSeriesMouseOver=function(_){var T;if(findEventDispatcher(_.target,function(R){var $=getECData(R);if($.dataIndex!=null)return T=$,!0},!0),!!T){var C=this.ecModel.getSeriesByIndex(T.seriesIndex),M=this.visualMapModel;if(M.isTargetSeries(C)){var E=C.getData(T.dataType),P=E.getStore().get(M.getDataDimensionIndex(E),T.dataIndex);isNaN(P)||this._showIndicator(P,P)}}},c.prototype._hideIndicator=function(){var _=this._shapes;_.indicator&&_.indicator.attr("invisible",!0),_.indicatorLabel&&_.indicatorLabel.attr("invisible",!0);var T=this._shapes.handleLabels;if(T)for(var C=0;C=0&&(M.dimension=E,T.push(M))}}),x.getData().setVisual("visualMeta",T)}}];function getColorVisual(x,c,_,T){for(var C=c.targetVisuals[T],M=VisualMapping$1.prepareVisualTypes(C),E={color:getVisualFromData(x.getData(),"color")},P=0,R=M.length;P0:c.splitNumber>0)||c.calculable)?"continuous":"piecewise"}),x.registerAction(visualMapActionInfo,visualMapActionHander),each$f(visualMapEncodingHandlers,function(c){x.registerVisual(x.PRIORITY.VISUAL.COMPONENT,c)}),x.registerPreprocessor(visualMapPreprocessor))}function install$5(x){x.registerComponentModel(ContinuousModel$1),x.registerComponentView(ContinuousView$1),installCommon(x)}var PiecewiseModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_._pieceList=[],_}return c.prototype.optionUpdated=function(_,T){x.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var C=this._mode=this._determineMode();this._pieceList=[],resetMethods[this._mode].call(this,this._pieceList),this._resetSelected(_,T);var M=this.option.categories;this.resetVisual(function(E,P){C==="categories"?(E.mappingMethod="category",E.categories=clone$4(M)):(E.dataExtent=this.getExtent(),E.mappingMethod="piecewise",E.pieceList=map$1(this._pieceList,function(R){return R=clone$4(R),P!=="inRange"&&(R.visual=null),R}))})},c.prototype.completeVisualOption=function(){var _=this.option,T={},C=VisualMapping$1.listVisualTypes(),M=this.isCategory();each$f(_.pieces,function(P){each$f(C,function(R){P.hasOwnProperty(R)&&(T[R]=1)})}),each$f(T,function(P,R){var $=!1;each$f(this.stateList,function(G){$=$||E(_,G,R)||E(_.target,G,R)},this),!$&&each$f(this.stateList,function(G){(_[G]||(_[G]={}))[R]=visualDefault$1.get(R,G==="inRange"?"active":"inactive",M)})},this);function E(P,R,$){return P&&P[R]&&P[R].hasOwnProperty($)}x.prototype.completeVisualOption.apply(this,arguments)},c.prototype._resetSelected=function(_,T){var C=this.option,M=this._pieceList,E=(T?C:_).selected||{};if(C.selected=E,each$f(M,function(R,$){var G=this.getSelectedMapKey(R);E.hasOwnProperty(G)||(E[G]=!0)},this),C.selectedMode==="single"){var P=!1;each$f(M,function(R,$){var G=this.getSelectedMapKey(R);E[G]&&(P?E[G]=!1:P=!0)},this)}},c.prototype.getItemSymbol=function(){return this.get("itemSymbol")},c.prototype.getSelectedMapKey=function(_){return this._mode==="categories"?_.value+"":_.index+""},c.prototype.getPieceList=function(){return this._pieceList},c.prototype._determineMode=function(){var _=this.option;return _.pieces&&_.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},c.prototype.setSelected=function(_){this.option.selected=clone$4(_)},c.prototype.getValueState=function(_){var T=VisualMapping$1.findPieceIndex(_,this._pieceList);return T!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[T])]?"inRange":"outOfRange"},c.prototype.findTargetDataIndices=function(_){var T=[],C=this._pieceList;return this.eachTargetSeries(function(M){var E=[],P=M.getData();P.each(this.getDataDimensionIndex(P),function(R,$){var G=VisualMapping$1.findPieceIndex(R,C);G===_&&E.push($)},this),T.push({seriesId:M.id,dataIndex:E})},this),T},c.prototype.getRepresentValue=function(_){var T;if(this.isCategory())T=_.value;else if(_.value!=null)T=_.value;else{var C=_.interval||[];T=C[0]===-1/0&&C[1]===1/0?0:(C[0]+C[1])/2}return T},c.prototype.getVisualMeta=function(_){if(this.isCategory())return;var T=[],C=["",""],M=this;function E(G,O){var L=M.getRepresentValue({interval:G});O||(O=M.getValueState(L));var F=_(L,O);G[0]===-1/0?C[0]=F:G[1]===1/0?C[1]=F:T.push({value:G[0],color:F},{value:G[1],color:F})}var P=this._pieceList.slice();if(!P.length)P.push({interval:[-1/0,1/0]});else{var R=P[0].interval[0];R!==-1/0&&P.unshift({interval:[-1/0,R]}),R=P[P.length-1].interval[1],R!==1/0&&P.push({interval:[R,1/0]})}var $=-1/0;return each$f(P,function(G){var O=G.interval;O&&(O[0]>$&&E([$,O[0]],"outOfRange"),E(O.slice()),$=O[1])},this),{stops:T,outerColors:C}},c.type="visualMap.piecewise",c.defaultOption=inheritDefaultOption(VisualMapModel$1.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),c}(VisualMapModel$1),resetMethods={splitNumber:function(x){var c=this.option,_=Math.min(c.precision,20),T=this.getExtent(),C=c.splitNumber;C=Math.max(parseInt(C,10),1),c.splitNumber=C;for(var M=(T[1]-T[0])/C;+M.toFixed(_)!==M&&_<5;)_++;c.precision=_,M=+M.toFixed(_),c.minOpen&&x.push({interval:[-1/0,T[0]],close:[0,0]});for(var E=0,P=T[0];E","≥"][T[0]]];_.text=_.text||this.formatValueText(_.value!=null?_.value:_.interval,!1,C)},this)}};function normalizeReverse(x,c){var _=x.inverse;(x.orient==="vertical"?!_:_)&&c.reverse()}const PiecewiseModel$1=PiecewiseModel;var PiecewiseVisualMapView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.doRender=function(){var _=this.group;_.removeAll();var T=this.visualMapModel,C=T.get("textGap"),M=T.textStyleModel,E=M.getFont(),P=M.getTextColor(),R=this._getItemAlign(),$=T.itemSize,G=this._getViewData(),O=G.endsText,L=retrieve(T.get("showLabel",!0),!O);O&&this._renderEndsText(_,O[0],$,L,R),each$f(G.viewPieceList,function(F){var V=F.piece,W=new Group$4;W.onclick=bind$1(this._onItemClick,this,V),this._enableHoverLink(W,F.indexInModelPieceList);var z=T.getRepresentValue(V);if(this._createItemSymbol(W,z,[0,0,$[0],$[1]]),L){var Z=this.visualMapModel.getValueState(z);W.add(new ZRText$1({style:{x:R==="right"?-C:$[0]+C,y:$[1]/2,text:V.text,verticalAlign:"middle",align:R,font:E,fill:P,opacity:Z==="outOfRange"?.5:1}}))}_.add(W)},this),O&&this._renderEndsText(_,O[1],$,L,R),box(T.get("orient"),_,T.get("itemGap")),this.renderBackground(_),this.positionGroup(_)},c.prototype._enableHoverLink=function(_,T){var C=this;_.on("mouseover",function(){return M("highlight")}).on("mouseout",function(){return M("downplay")});var M=function(E){var P=C.visualMapModel;P.option.hoverLink&&C.api.dispatchAction({type:E,batch:makeHighDownBatch(P.findTargetDataIndices(T),P)})}},c.prototype._getItemAlign=function(){var _=this.visualMapModel,T=_.option;if(T.orient==="vertical")return getItemAlign(_,this.api,_.itemSize);var C=T.align;return(!C||C==="auto")&&(C="left"),C},c.prototype._renderEndsText=function(_,T,C,M,E){if(T){var P=new Group$4,R=this.visualMapModel.textStyleModel;P.add(new ZRText$1({style:createTextStyle(R,{x:M?E==="right"?C[0]:0:C[0]/2,y:C[1]/2,verticalAlign:"middle",align:M?E:"center",text:T})})),_.add(P)}},c.prototype._getViewData=function(){var _=this.visualMapModel,T=map$1(_.getPieceList(),function(P,R){return{piece:P,indexInModelPieceList:R}}),C=_.get("text"),M=_.get("orient"),E=_.get("inverse");return(M==="horizontal"?E:!E)?T.reverse():C&&(C=C.slice().reverse()),{viewPieceList:T,endsText:C}},c.prototype._createItemSymbol=function(_,T,C){_.add(createSymbol$1(this.getControllerVisual(T,"symbol"),C[0],C[1],C[2],C[3],this.getControllerVisual(T,"color")))},c.prototype._onItemClick=function(_){var T=this.visualMapModel,C=T.option,M=C.selectedMode;if(M){var E=clone$4(C.selected),P=T.getSelectedMapKey(_);M==="single"||M===!0?(E[P]=!0,each$f(E,function(R,$){E[$]=$===P})):E[P]=!E[P],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:E})}},c.type="visualMap.piecewise",c}(VisualMapView$1);const PiecewiseView=PiecewiseVisualMapView;function install$4(x){x.registerComponentModel(PiecewiseModel$1),x.registerComponentView(PiecewiseView),installCommon(x)}function install$3(x){use(install$5),use(install$4)}var DEFAULT_OPTION={label:{enabled:!0},decal:{show:!1}},inner=makeInner(),decalPaletteScope={};function ariaVisual(x,c){var _=x.getModel("aria");if(!_.get("enabled"))return;var T=clone$4(DEFAULT_OPTION);merge(T.label,x.getLocaleModel().get("aria"),!1),merge(_.option,T,!1),C(),M();function C(){var $=_.getModel("decal"),G=$.get("show");if(G){var O=createHashMap();x.eachSeries(function(L){if(!L.isColorBySeries()){var F=O.get(L.type);F||(F={},O.set(L.type,F)),inner(L).scope=F}}),x.eachRawSeries(function(L){if(x.isSeriesFiltered(L))return;if(isFunction(L.enableAriaDecal)){L.enableAriaDecal();return}var F=L.getData();if(L.isColorBySeries()){var H=getDecalFromPalette(L.ecModel,L.name,decalPaletteScope,x.getSeriesCount()),Y=F.getVisual("decal");F.setVisual("decal",U(Y,H))}else{var V=L.getRawData(),W={},z=inner(L).scope;F.each(function(j){var X=F.getRawIndex(j);W[X]=j});var Z=V.count();V.each(function(j){var X=W[j],K=V.getName(j)||j+"",q=getDecalFromPalette(L.ecModel,K,z,Z),J=F.getItemVisual(X,"decal");F.setItemVisual(X,"decal",U(J,q))})}function U(j,X){var K=j?extend(extend({},X),j):X;return K.dirty=!0,K}})}}function M(){var $=x.getLocaleModel().get("aria"),G=_.getModel("label");if(G.option=defaults(G.option,$),!!G.get("enabled")){var O=c.getZr().dom;if(G.get("description")){O.setAttribute("aria-label",G.get("description"));return}var L=x.getSeriesCount(),F=G.get(["data","maxCount"])||10,V=G.get(["series","maxCount"])||10,W=Math.min(L,V),z;if(!(L<1)){var Z=P();if(Z){var H=G.get(["general","withTitle"]);z=E(H,{title:Z})}else z=G.get(["general","withoutTitle"]);var Y=[],U=L>1?G.get(["series","multiple","prefix"]):G.get(["series","single","prefix"]);z+=E(U,{seriesCount:L}),x.eachSeries(function(q,J){if(J1?G.get(["series","multiple",re]):G.get(["series","single",re]),Q=E(Q,{seriesId:q.seriesIndex,seriesName:q.get("name"),seriesType:R(q.subType)});var ie=q.getData();if(ie.count()>F){var ae=G.get(["data","partialData"]);Q+=E(ae,{displayCnt:F})}else Q+=G.get(["data","allData"]);for(var ne=G.get(["data","separator","middle"]),te=G.get(["data","separator","end"]),oe=[],ue=0;ue":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},RegExpEvaluator=function(){function x(c){var _=this._condVal=isString(c)?new RegExp(c):isRegExp(c)?c:null;if(_==null){var T="";throwError(T)}}return x.prototype.evaluate=function(c){var _=typeof c;return isString(_)?this._condVal.test(c):isNumber(_)?this._condVal.test(c+""):!1},x}(),ConstConditionInternal=function(){function x(){}return x.prototype.evaluate=function(){return this.value},x}(),AndConditionInternal=function(){function x(){}return x.prototype.evaluate=function(){for(var c=this.children,_=0;_2&&T.push(C),C=[ie,ae]}function G(ie,ae,ne,te){aroundEqual(ie,ne)&&aroundEqual(ae,te)||C.push(ie,ae,ne,te,ne,te)}function O(ie,ae,ne,te,oe,ue){var de=Math.abs(ae-ie),pe=Math.tan(de/4)*4/3,he=aeq:ee2&&T.push(C),T}function adpativeBezier(x,c,_,T,C,M,E,P,R,$){if(aroundEqual(x,_)&&aroundEqual(c,T)&&aroundEqual(C,E)&&aroundEqual(M,P)){R.push(E,P);return}var G=2/$,O=G*G,L=E-x,F=P-c,V=Math.sqrt(L*L+F*F);L/=V,F/=V;var W=_-x,z=T-c,Z=C-E,H=M-P,Y=W*W+z*z,U=Z*Z+H*H;if(Y=0&&q=0){R.push(E,P);return}var J=[],Q=[];cubicSubdivide(x,_,C,E,.5,J),cubicSubdivide(c,T,M,P,.5,Q),adpativeBezier(J[0],Q[0],J[1],Q[1],J[2],Q[2],J[3],Q[3],R,$),adpativeBezier(J[4],Q[4],J[5],Q[5],J[6],Q[6],J[7],Q[7],R,$)}function pathToPolygons(x,c){var _=pathToBezierCurves(x),T=[];c=c||1;for(var C=0;C<_.length;C++){var M=_[C],E=[],P=M[0],R=M[1];E.push(P,R);for(var $=2;$0)for(var $=0;$Math.abs($),O=getDividingGrids([R,$],G?0:1,c),L=(G?P:$)/O.length,F=0;FC,E=getDividingGrids([T,C],M?0:1,c),P=M?"width":"height",R=M?"height":"width",$=M?"x":"y",G=M?"y":"x",O=x[P]/E.length,L=0;L1?null:new Point$1(W*R+x,W*$+c)}function projPtOnLine(x,c,_){var T=new Point$1;Point$1.sub(T,_,c),T.normalize();var C=new Point$1;Point$1.sub(C,x,c);var M=C.dot(T);return M}function addToPoly(x,c){var _=x[x.length-1];_&&_[0]===c[0]&&_[1]===c[1]||x.push(c)}function splitPolygonByLine(x,c,_){for(var T=x.length,C=[],M=0;ME?($.x=G.x=P+M/2,$.y=R,G.y=R+E):($.y=G.y=R+E/2,$.x=P,G.x=P+M),splitPolygonByLine(c,$,G)}function binaryDivideRecursive(x,c,_,T){if(_===1)T.push(c);else{var C=Math.floor(_/2),M=x(c);binaryDivideRecursive(x,M[0],C,T),binaryDivideRecursive(x,M[1],_-C,T)}return T}function clone(x,c){for(var _=[],T=0;T0)for(var j=T/_,X=-T/2;X<=T/2;X+=j){for(var K=Math.sin(X),q=Math.cos(X),J=0,Y=0;Y0;$/=2){var G=0,O=0;(x&$)>0&&(G=1),(c&$)>0&&(O=1),P+=$*$*(3*G^O),O===0&&(G===1&&(x=$-1-x,c=$-1-c),R=x,x=c,c=R)}return P}function sortPaths(x){var c=1/0,_=1/0,T=-1/0,C=-1/0,M=map$1(x,function(P){var R=P.getBoundingRect(),$=P.getComputedTransform(),G=R.x+R.width/2+($?$[4]:0),O=R.y+R.height/2+($?$[5]:0);return c=Math.min(G,c),_=Math.min(O,_),T=Math.max(G,T),C=Math.max(O,C),[G,O]}),E=map$1(M,function(P,R){return{cp:P,z:hilbert(P[0],P[1],c,_,T,C),path:x[R]}});return E.sort(function(P,R){return P.z-R.z}).map(function(P){return P.path})}function defaultDividePath(x){return split(x.path,x.count)}function createEmptyReturn(){return{fromIndividuals:[],toIndividuals:[],count:0}}function combineMorph(x,c,_){var T=[];function C(j){for(var X=0;X=0;C--)if(!_[C].many.length){var R=_[P].many;if(R.length<=1)if(P)P=0;else return _;var M=R.length,$=Math.ceil(M/2);_[C].many=R.slice($,M),_[P].many=R.slice(0,$),P++}return _}var pathDividers={clone:function(x){for(var c=[],_=1-Math.pow(1-x.path.style.opacity,1/x.count),T=0;T0))return;var P=T.getModel("universalTransition").get("delay"),R=Object.assign({setToFinal:!0},E),$,G;isMultiple(x)&&($=x,G=c),isMultiple(c)&&($=c,G=x);function O(Z,H,Y,U,j){var X=Z.many,K=Z.one;if(X.length===1&&!j){var q=H?X[0]:K,J=H?K:X[0];if(isCombineMorphing(q))O({many:[q],one:J},!0,Y,U,!0);else{var Q=P?defaults({delay:P(Y,U)},R):R;morphPath(q,J,Q),M(q,J,q,J,Q)}}else for(var ee=defaults({dividePath:pathDividers[_],individualDelay:P&&function(oe,ue,de,pe){return P(oe+Y,U)}},R),re=H?combineMorph(X,K,ee):separateMorph(K,X,ee),ie=re.fromIndividuals,ae=re.toIndividuals,ne=ie.length,te=0;tec.length,F=$?prepareMorphBatches(G,$):prepareMorphBatches(L?c:x,[L?x:c]),V=0,W=0;WDATA_COUNT_THRESHOLD))for(var C=T.getIndices(),M=getGroupIdDimension(T),E=0;E0&&U.group.traverse(function(X){X instanceof Path$1&&!X.animators.length&&X.animateFrom({style:{opacity:0}},j)})})}function getSeriesTransitionKey(x){var c=x.getModel("universalTransition").get("seriesKey");return c||x.id}function convertArraySeriesKeyToString(x){return isArray$1(x)?x.sort().join(","):x}function getDivideShapeFromData(x){if(x.hostModel)return x.hostModel.getModel("universalTransition").get("divideShape")}function findTransitionSeriesBatches(x,c){var _=createHashMap(),T=createHashMap(),C=createHashMap();return each$f(x.oldSeries,function(M,E){var P=x.oldDataGroupIds[E],R=x.oldData[E],$=getSeriesTransitionKey(M),G=convertArraySeriesKeyToString($);T.set(G,{dataGroupId:P,data:R}),isArray$1($)&&each$f($,function(O){C.set(O,{key:G,dataGroupId:P,data:R})})}),each$f(c.updatedSeries,function(M){if(M.isUniversalTransitionEnabled()&&M.isAnimationEnabled()){var E=M.get("dataGroupId"),P=M.getData(),R=getSeriesTransitionKey(M),$=convertArraySeriesKeyToString(R),G=T.get($);if(G)_.set($,{oldSeries:[{dataGroupId:G.dataGroupId,divide:getDivideShapeFromData(G.data),data:G.data}],newSeries:[{dataGroupId:E,divide:getDivideShapeFromData(P),data:P}]});else if(isArray$1(R)){var O=[];each$f(R,function(V){var W=T.get(V);W.data&&O.push({dataGroupId:W.dataGroupId,divide:getDivideShapeFromData(W.data),data:W.data})}),O.length&&_.set($,{oldSeries:O,newSeries:[{dataGroupId:E,data:P,divide:getDivideShapeFromData(P)}]})}else{var L=C.get(R);if(L){var F=_.get(L.key);F||(F={oldSeries:[{dataGroupId:L.dataGroupId,data:L.data,divide:getDivideShapeFromData(L.data)}],newSeries:[]},_.set(L.key,F)),F.newSeries.push({dataGroupId:E,data:P,divide:getDivideShapeFromData(P)})}}}}),_}function querySeries(x,c){for(var _=0;_=0&&C.push({dataGroupId:c.oldDataGroupIds[P],data:c.oldData[P],divide:getDivideShapeFromData(c.oldData[P]),dim:E.dimension})}),each$f(normalizeToArray(x.to),function(E){var P=querySeries(_.updatedSeries,E);if(P>=0){var R=_.updatedSeries[P].getData();M.push({dataGroupId:c.oldDataGroupIds[P],data:R,divide:getDivideShapeFromData(R),dim:E.dimension})}}),C.length>0&&M.length>0&&transitionBetween(C,M,T)}function installUniversalTransition(x){x.registerUpdateLifecycle("series:beforeupdate",function(c,_,T){each$f(normalizeToArray(T.seriesTransition),function(C){each$f(normalizeToArray(C.to),function(M){for(var E=T.updatedSeries,P=0;P(C(),C=subscribe(E,F=>_(5,T=F)),E);x.$$.on_destroy.push(()=>C());let{data:E}=c;M();let{height:P=400}=c,{color1:R="rgba(255, 145, 124, 0.1)"}=c,{color2:$="rgba(255, 145, 124, 0.9)"}=c,G;function O(){setTimeout(()=>{if(T&&G){const F=init$1(G),V={xAxis:{min:-1,max:1},yAxis:{min:-1,max:1},series:[{data:T,type:"line"}]};V&&F.setOption(V)}else console.log("Need both chat and data",G,T)},100)}function L(F){binding_callbacks[F?"unshift":"push"](()=>{G=F,_(2,G)})}return x.$$set=F=>{"data"in F&&M(_(0,E=F.data)),"height"in F&&_(1,P=F.height),"color1"in F&&_(3,R=F.color1),"color2"in F&&_(4,$=F.color2)},x.$$.update=()=>{x.$$.dirty&32&&O()},[E,P,G,R,$,T,L]}class Cartesian extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$7,create_fragment$b,safe_not_equal,{data:0,height:1,color1:3,color2:4})}}const TwoDimensions_svelte_svelte_type_style_lang="";function create_if_block$4(x){let c,_,T,C,M,E,P=float$2(x[0])+"",R,$,G,O,L,F,V,W,z,Z,H,Y,U;return c=new Cartesian({props:{height:300,data:x[1]}}),{c(){create_component(c.$$.fragment),_=space(),T=element("div"),C=element("div"),M=element("div"),E=text(`Cosine Distance:
`),R=text(P),$=space(),G=element("div"),O=element("div"),O.textContent=`${format(x[2])}`,L=space(),F=element("div"),F.textContent=`${format(x[3])}`,V=space(),W=element("div"),W.textContent=`${format(x[4])}`,z=space(),Z=element("div"),Z.textContent=`${format(x[5])}`,attr(C,"class","distance svelte-18d9ono"),attr(O,"class","btnn taller svelte-18d9ono"),attr(F,"class","btnn taller svelte-18d9ono"),attr(W,"class","btnn taller svelte-18d9ono"),attr(Z,"class","btnn taller svelte-18d9ono"),attr(G,"class","groups svelte-18d9ono"),attr(T,"class","btnns svelte-18d9ono")},m(j,X){mount_component(c,j,X),insert(j,_,X),insert(j,T,X),append(T,C),append(C,M),append(M,E),append(M,R),append(T,$),append(T,G),append(G,O),append(G,L),append(G,F),append(G,V),append(G,W),append(G,z),append(G,Z),H=!0,Y||(U=[listen(O,"click",x[6]),listen(F,"click",x[7]),listen(W,"click",x[8]),listen(Z,"click",x[9])],Y=!0)},p(j,X){(!H||X&1)&&P!==(P=float$2(j[0])+"")&&set_data(R,P)},i(j){H||(transition_in(c.$$.fragment,j),H=!0)},o(j){transition_out(c.$$.fragment,j),H=!1},d(j){destroy_component(c,j),j&&detach(_),j&&detach(T),Y=!1,run_all(U)}}}function create_fragment$a(x){let c,_,T=x[1]&&create_if_block$4(x);return{c(){T&&T.c(),c=empty()},m(C,M){T&&T.m(C,M),insert(C,c,M),_=!0},p(C,[M]){C[1]&&T.p(C,M)},i(C){_||(transition_in(T),_=!0)},o(C){transition_out(T),_=!1},d(C){T&&T.d(C),C&&detach(c)}}}function float$2(x){return parseFloat(x).toPrecision(2)}function format(x){return"["+x.map(c=>c.join(", ")).join("] and [")+"]"}function cosineSimilarity(x,c){for(var _=0,T=0,C=0,M=0;M_(10,T=W));let M=0;const E=[[-.22,.81],[.23,.44]],P=[[.34,-.12],[-.12,.67]],R=[[-1,0],[-.9,.2]],$=[[-1,-1],[1,1]];function G(){_(0,M=cosineSimilarity(T[0],T[2]))}function O(){set_store_value(C,T=[E[0],[0,0],E[1]],T),G()}function L(){set_store_value(C,T=[P[0],[0,0],P[1]],T),G()}function F(){set_store_value(C,T=[R[0],[0,0],R[1]],T),G()}function V(){set_store_value(C,T=[$[0],[0,0],$[1]],T),G()}return onMount(()=>{setTimeout(()=>{O()},100)}),[M,C,E,P,R,$,O,L,F,V]}class TwoDimensions extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$6,create_fragment$a,safe_not_equal,{})}}const Mult_svelte_svelte_type_style_lang="";function create_else_block$3(x){let c,_,T,C;return{c(){c=element("span"),_=text(x[0]),T=text(" x "),C=text(x[1]),attr(c,"class","multiplier item svelte-vdsfa9")},m(M,E){insert(M,c,E),append(c,_),append(c,T),append(c,C)},p(M,E){E&1&&set_data(_,M[0]),E&2&&set_data(C,M[1])},i:noop$1,o:noop$1,d(M){M&&detach(c)}}}function create_if_block$3(x){let c,_,T=float$1(x[2])+"",C,M,E,P;return{c(){c=element("span"),_=element("span"),C=text(T),attr(c,"class","item calc-result svelte-vdsfa9")},m(R,$){insert(R,c,$),append(c,_),append(_,C),P=!0},p(R,$){(!P||$&4)&&T!==(T=float$1(R[2])+"")&&set_data(C,T)},i(R){P||(add_render_callback(()=>{M||(M=create_bidirectional_transition(_,fly,{},!0)),M.run(1)}),add_render_callback(()=>{E||(E=create_bidirectional_transition(c,fly,{},!0)),E.run(1)}),P=!0)},o(R){M||(M=create_bidirectional_transition(_,fly,{},!1)),M.run(0),E||(E=create_bidirectional_transition(c,fly,{},!1)),E.run(0),P=!1},d(R){R&&detach(c),R&&M&&M.end(),R&&E&&E.end()}}}function create_fragment$9(x){let c,_,T,C;const M=[create_if_block$3,create_else_block$3],E=[];function P(R,$){return R[2]?0:1}return _=P(x),T=E[_]=M[_](x),{c(){c=element("span"),T.c(),attr(c,"class","w-full")},m(R,$){insert(R,c,$),E[_].m(c,null),C=!0},p(R,[$]){let G=_;_=P(R),_===G?E[_].p(R,$):(group_outros(),transition_out(E[G],1,1,()=>{E[G]=null}),check_outros(),T=E[_],T?T.p(R,$):(T=E[_]=M[_](R),T.c()),transition_in(T,1),T.m(c,null))},i(R){C||(transition_in(T),C=!0)},o(R){transition_out(T),C=!1},d(R){R&&detach(c),E[_].d()}}}function float$1(x){return parseFloat(x).toPrecision(2)}function instance$5(x,c,_){let{a:T}=c,{b:C}=c,{time:M}=c,E=0;function P(){_(2,E=0),setTimeout(()=>{_(2,E=T*C)},Math.max(10,M/2))}return x.$$set=R=>{"a"in R&&_(0,T=R.a),"b"in R&&_(1,C=R.b),"time"in R&&_(3,M=R.time)},x.$$.update=()=>{x.$$.dirty&11&&P()},[T,C,E,M]}class Mult extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$5,create_fragment$9,safe_not_equal,{a:0,b:1,time:3})}}const CosineCalculator_svelte_svelte_type_style_lang="";function create_else_block_1$2(x){let c;return{c(){c=element("div"),c.textContent='Please generate two embeddings by clicking the "Generate Embedding" buttons.',attr(c,"class","explanation svelte-rs6pxl")},m(_,T){insert(_,c,T)},p:noop$1,i:noop$1,o:noop$1,d(_){_&&detach(c)}}}function create_if_block$2(x){let c,_,T,C,M,E,P,R,$=!x[3]&&create_if_block_3$2(x),G=x[5]<384&&create_if_block_2$2(x);const O=[create_if_block_1$2,create_else_block$2],L=[];function F(V,W){return V[5]<384?0:1}return E=F(x),P=L[E]=O[E](x),{c(){c=element("div"),c.textContent="Cosine Calculator",_=space(),$&&$.c(),T=space(),G&&G.c(),C=space(),M=element("div"),P.c(),attr(c,"class","calc svelte-rs6pxl"),attr(M,"class","display svelte-rs6pxl")},m(V,W){insert(V,c,W),insert(V,_,W),$&&$.m(V,W),insert(V,T,W),G&&G.m(V,W),insert(V,C,W),insert(V,M,W),L[E].m(M,null),R=!0},p(V,W){V[3]?$&&($.d(1),$=null):$?$.p(V,W):($=create_if_block_3$2(V),$.c(),$.m(T.parentNode,T)),V[5]<384?G?(G.p(V,W),W&32&&transition_in(G,1)):(G=create_if_block_2$2(V),G.c(),transition_in(G,1),G.m(C.parentNode,C)):G&&(group_outros(),transition_out(G,1,1,()=>{G=null}),check_outros());let z=E;E=F(V),E===z?L[E].p(V,W):(group_outros(),transition_out(L[z],1,1,()=>{L[z]=null}),check_outros(),P=L[E],P?P.p(V,W):(P=L[E]=O[E](V),P.c()),transition_in(P,1),P.m(M,null))},i(V){R||(transition_in(G),transition_in(P),R=!0)},o(V){transition_out(G),transition_out(P),R=!1},d(V){V&&detach(c),V&&detach(_),$&&$.d(V),V&&detach(T),G&&G.d(V),V&&detach(C),V&&detach(M),L[E].d()}}}function create_if_block_3$2(x){let c,_,T,C,M;return{c(){c=element("div"),_=element("div"),_.textContent="Start",T=text(`
Click start, animation takes 35 seconds.`),attr(_,"class","btnn"),attr(c,"class","spread svelte-rs6pxl")},m(E,P){insert(E,c,P),append(c,_),append(c,T),C||(M=listen(_,"click",x[12]),C=!0)},p:noop$1,d(E){E&&detach(c),C=!1,M()}}}function create_if_block_2$2(x){let c,_,T,C,M,E;return _=new Embedding({props:{hidden:x[5],result:x[0]}}),M=new Embedding({props:{hidden:x[5],result:x[1]}}),{c(){c=element("div"),create_component(_.$$.fragment),T=space(),C=element("div"),create_component(M.$$.fragment),attr(c,"class","embedding"),attr(C,"class","embedding")},m(P,R){insert(P,c,R),mount_component(_,c,null),insert(P,T,R),insert(P,C,R),mount_component(M,C,null),E=!0},p(P,R){const $={};R&32&&($.hidden=P[5]),R&1&&($.result=P[0]),_.$set($);const G={};R&32&&(G.hidden=P[5]),R&2&&(G.result=P[1]),M.$set(G)},i(P){E||(transition_in(_.$$.fragment,P),transition_in(M.$$.fragment,P),E=!0)},o(P){transition_out(_.$$.fragment,P),transition_out(M.$$.fragment,P),E=!1},d(P){P&&detach(c),destroy_component(_),P&&detach(T),P&&detach(C),destroy_component(M)}}}function create_else_block$2(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V,W,z,Z,H,Y,U,j,X,K,q,J,Q=x[6]/(x[7]*x[8])+"",ee,re;return{c(){c=element("div"),_=element("div"),T=element("div"),T.textContent="dotproduct =",C=space(),M=element("div"),E=text(x[6]),P=space(),R=element("div"),$=element("div"),$.textContent="mA =",G=space(),O=element("div"),L=text(x[7]),F=space(),V=element("div"),W=element("div"),W.textContent="mB =",z=space(),Z=element("div"),H=text(x[8]),Y=space(),U=element("div"),U.innerHTML=`( dotproduct / mA * mB ) is
similarity score
`,j=space(),X=element("div"),K=element("div"),K.textContent="similarity score =",q=space(),J=element("div"),ee=text(Q),attr(M,"class","calc-result"),attr(_,"class","calcs svelte-rs6pxl"),attr(O,"class","calc-result"),attr(R,"class","calcs svelte-rs6pxl"),attr(Z,"class","calc-result"),attr(V,"class","calcs svelte-rs6pxl"),attr(U,"class","calcs svelte-rs6pxl"),attr(J,"class","calc-result"),attr(X,"class","calcs svelte-rs6pxl")},m(ie,ae){insert(ie,c,ae),append(c,_),append(_,T),append(_,C),append(_,M),append(M,E),append(c,P),append(c,R),append(R,$),append(R,G),append(R,O),append(O,L),append(c,F),append(c,V),append(V,W),append(V,z),append(V,Z),append(Z,H),append(c,Y),append(c,U),append(c,j),append(c,X),append(X,K),append(X,q),append(X,J),append(J,ee)},p(ie,ae){ae&64&&set_data(E,ie[6]),ae&128&&set_data(L,ie[7]),ae&256&&set_data(H,ie[8]),ae&448&&Q!==(Q=ie[6]/(ie[7]*ie[8])+"")&&set_data(ee,Q)},i(ie){re||add_render_callback(()=>{re=create_in_transition(c,fly,{}),re.start()})},o:noop$1,d(ie){ie&&detach(c)}}}function create_if_block_1$2(x){let c,_,T,C,M,E,P,R,$,G,O=float(x[10][x[5]])+"",L,F,V,W,z,Z,H,Y,U,j=float(x[9][x[5]])+"",X,K,q,J,Q,ee,re,ie,ae,ne,te,oe,ue,de,pe,he,we,ye,Me,Pe,Re,De,Le,$e,Oe,Ee,Be,He,We,Ke,Je,tt,mt,pt,bt,gt=float(x[6])+"",ct,yt,At,qe,Bt,xt,Mt=float(x[7])+"",Dt,Ot,_t,ft,Gt,Ye,Pt=float(x[8])+"",Wt,St;return oe=new Mult({props:{time:x[4],a:float(x[10][x[5]]),b:float(x[9][x[5]])}}),Re=new Mult({props:{time:x[4],a:float(x[10][x[5]]),b:float(x[10][x[5]])}}),Ke=new Mult({props:{time:x[4],a:float(x[9][x[5]]),b:float(x[9][x[5]])}}),{c(){c=text("Index: "),_=text(x[5]),T=space(),C=element("div"),M=element("div"),E=text("A["),P=text(x[5]),R=text("] ="),$=space(),G=element("div"),L=text(O),F=space(),V=element("div"),W=element("div"),z=text("B["),Z=text(x[5]),H=text("] ="),Y=space(),U=element("div"),X=text(j),K=space(),q=element("div"),J=element("div"),Q=text("A["),ee=text(x[5]),re=text("] * B["),ie=text(x[5]),ae=text("] ="),ne=space(),te=element("div"),create_component(oe.$$.fragment),ue=space(),de=element("div"),pe=element("div"),he=text("A["),we=text(x[5]),ye=text("]^2 ="),Me=space(),Pe=element("div"),create_component(Re.$$.fragment),De=space(),Le=element("div"),$e=element("div"),Oe=text("B["),Ee=text(x[5]),Be=text("]^2 ="),He=space(),We=element("div"),create_component(Ke.$$.fragment),Je=space(),tt=element("div"),mt=element("div"),mt.textContent="dotproduct (sum) =",pt=space(),bt=element("div"),ct=text(gt),yt=space(),At=element("div"),qe=element("div"),qe.textContent="mA (sum) =",Bt=space(),xt=element("div"),Dt=text(Mt),Ot=space(),_t=element("div"),ft=element("div"),ft.textContent="mB (sum) =",Gt=space(),Ye=element("div"),Wt=text(Pt),attr(G,"class","calc-result"),attr(C,"class","calcs svelte-rs6pxl"),attr(U,"class","calc-result"),attr(V,"class","calcs svelte-rs6pxl"),attr(q,"class","calcs svelte-rs6pxl"),attr(de,"class","calcs svelte-rs6pxl"),attr(Le,"class","calcs svelte-rs6pxl"),attr(bt,"class","calc-result"),attr(tt,"class","calcs svelte-rs6pxl"),attr(xt,"class","calc-result"),attr(At,"class","calcs svelte-rs6pxl"),attr(Ye,"class","calc-result"),attr(_t,"class","calcs svelte-rs6pxl")},m(Ge,ze){insert(Ge,c,ze),insert(Ge,_,ze),insert(Ge,T,ze),insert(Ge,C,ze),append(C,M),append(M,E),append(M,P),append(M,R),append(C,$),append(C,G),append(G,L),insert(Ge,F,ze),insert(Ge,V,ze),append(V,W),append(W,z),append(W,Z),append(W,H),append(V,Y),append(V,U),append(U,X),insert(Ge,K,ze),insert(Ge,q,ze),append(q,J),append(J,Q),append(J,ee),append(J,re),append(J,ie),append(J,ae),append(q,ne),append(q,te),mount_component(oe,te,null),insert(Ge,ue,ze),insert(Ge,de,ze),append(de,pe),append(pe,he),append(pe,we),append(pe,ye),append(de,Me),append(de,Pe),mount_component(Re,Pe,null),insert(Ge,De,ze),insert(Ge,Le,ze),append(Le,$e),append($e,Oe),append($e,Ee),append($e,Be),append(Le,He),append(Le,We),mount_component(Ke,We,null),insert(Ge,Je,ze),insert(Ge,tt,ze),append(tt,mt),append(tt,pt),append(tt,bt),append(bt,ct),insert(Ge,yt,ze),insert(Ge,At,ze),append(At,qe),append(At,Bt),append(At,xt),append(xt,Dt),insert(Ge,Ot,ze),insert(Ge,_t,ze),append(_t,ft),append(_t,Gt),append(_t,Ye),append(Ye,Wt),St=!0},p(Ge,ze){(!St||ze&32)&&set_data(_,Ge[5]),(!St||ze&32)&&set_data(P,Ge[5]),(!St||ze&1056)&&O!==(O=float(Ge[10][Ge[5]])+"")&&set_data(L,O),(!St||ze&32)&&set_data(Z,Ge[5]),(!St||ze&544)&&j!==(j=float(Ge[9][Ge[5]])+"")&&set_data(X,j),(!St||ze&32)&&set_data(ee,Ge[5]),(!St||ze&32)&&set_data(ie,Ge[5]);const kt={};ze&16&&(kt.time=Ge[4]),ze&1056&&(kt.a=float(Ge[10][Ge[5]])),ze&544&&(kt.b=float(Ge[9][Ge[5]])),oe.$set(kt),(!St||ze&32)&&set_data(we,Ge[5]);const Nt={};ze&16&&(Nt.time=Ge[4]),ze&1056&&(Nt.a=float(Ge[10][Ge[5]])),ze&1056&&(Nt.b=float(Ge[10][Ge[5]])),Re.$set(Nt),(!St||ze&32)&&set_data(Ee,Ge[5]);const $t={};ze&16&&($t.time=Ge[4]),ze&544&&($t.a=float(Ge[9][Ge[5]])),ze&544&&($t.b=float(Ge[9][Ge[5]])),Ke.$set($t),(!St||ze&64)&>!==(gt=float(Ge[6])+"")&&set_data(ct,gt),(!St||ze&128)&&Mt!==(Mt=float(Ge[7])+"")&&set_data(Dt,Mt),(!St||ze&256)&&Pt!==(Pt=float(Ge[8])+"")&&set_data(Wt,Pt)},i(Ge){St||(transition_in(oe.$$.fragment,Ge),transition_in(Re.$$.fragment,Ge),transition_in(Ke.$$.fragment,Ge),St=!0)},o(Ge){transition_out(oe.$$.fragment,Ge),transition_out(Re.$$.fragment,Ge),transition_out(Ke.$$.fragment,Ge),St=!1},d(Ge){Ge&&detach(c),Ge&&detach(_),Ge&&detach(T),Ge&&detach(C),Ge&&detach(F),Ge&&detach(V),Ge&&detach(K),Ge&&detach(q),destroy_component(oe),Ge&&detach(ue),Ge&&detach(de),destroy_component(Re),Ge&&detach(De),Ge&&detach(Le),destroy_component(Ke),Ge&&detach(Je),Ge&&detach(tt),Ge&&detach(yt),Ge&&detach(At),Ge&&detach(Ot),Ge&&detach(_t)}}}function create_fragment$8(x){let c,_,T,C;const M=[create_if_block$2,create_else_block_1$2],E=[];function P(R,$){return R[10].length&&R[9].length?0:1}return _=P(x),T=E[_]=M[_](x),{c(){c=element("div"),T.c(),attr(c,"class","wrapper svelte-rs6pxl")},m(R,$){insert(R,c,$),E[_].m(c,null),C=!0},p(R,[$]){let G=_;_=P(R),_===G?E[_].p(R,$):(group_outros(),transition_out(E[G],1,1,()=>{E[G]=null}),check_outros(),T=E[_],T?T.p(R,$):(T=E[_]=M[_](R),T.c()),transition_in(T,1),T.m(c,null))},i(R){C||(transition_in(T),C=!0)},o(R){transition_out(T),C=!1},d(R){R&&detach(c),E[_].d()}}}function float(x){return parseFloat(x).toPrecision(2)}function instance$4(x,c,_){let T,C=noop$1,M=()=>(C(),C=subscribe(F,Q=>_(9,T=Q)),F),E,P=noop$1,R=()=>(P(),P=subscribe(L,Q=>_(10,E=Q)),L),$,G=noop$1,O=()=>(G(),G=subscribe(V,Q=>_(11,$=Q)),V);x.$$.on_destroy.push(()=>C()),x.$$.on_destroy.push(()=>P()),x.$$.on_destroy.push(()=>G());let{a:L}=c;R();let{b:F}=c;M();let{start:V}=c;O();let W=!1,z,Z;onMount(()=>{if(console.log("a, b",L,F),V&&V.subscribe){console.log("Start",V);let Q=!1;V.subscribe(ee=>{Q?(console.log("Subscribed",ee),ee?(console.log("Running",ee),q()):console.log("Skipping it")):Q=!0})}});let H=2e3,Y=0,U=0,j=0,X=0;function K(){E&&T&&E.length&&T.length?(_(4,H=Math.max(10,H-Y*Y)),Y<383&&(z=E[Y],Z=T[Y],_(6,U+=z*Z),_(7,j+=z*z),_(8,X+=Z*Z),setTimeout(K,H)),_(5,Y+=1)):console.log("Not ready",E,T)}function q(){console.log("Inside run",W),W||(console.log("Not started, starting",W),_(3,W=!0),console.log("Not started, starting",W),K(),console.log("Calculated"))}const J=()=>set_store_value(V,$=!0,$);return x.$$set=Q=>{"a"in Q&&R(_(0,L=Q.a)),"b"in Q&&M(_(1,F=Q.b)),"start"in Q&&O(_(2,V=Q.start))},[L,F,V,W,H,Y,U,j,X,T,E,$,J]}class CosineCalculator extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$4,create_fragment$8,safe_not_equal,{a:0,b:1,start:2})}}const Credits_svelte_svelte_type_style_lang="";function get_each_context$2(x,c,_){const T=x.slice();return T[1]=c[_],T}function create_each_block$2(x){let c,_,T,C,M,E,P,R=x[1].name+"",$,G,O,L=x[1].bio+"",F,V;return{c(){c=element("div"),_=element("div"),T=element("img"),M=space(),E=element("div"),P=element("a"),$=text(R),G=space(),O=element("div"),F=text(L),V=space(),attr(T,"class","headshot svelte-exos6p"),src_url_equal(T.src,C=x[1].headshot)||attr(T,"src",C),attr(_,"class","wrapper svelte-exos6p"),attr(P,"href",x[1].link),attr(E,"class","name svelte-exos6p"),attr(O,"class","bio svelte-exos6p"),attr(c,"class","person svelte-exos6p")},m(W,z){insert(W,c,z),append(c,_),append(_,T),append(c,M),append(c,E),append(E,P),append(P,$),append(c,G),append(c,O),append(O,F),append(c,V)},p:noop$1,d(W){W&&detach(c)}}}function create_fragment$7(x){let c,_,T,C,M=x[0],E=[];for(let P=0;P[_,c]))}function escapeRegExp(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Callable=class{constructor(){let x=function(...c){return x._call(...c)};return Object.setPrototypeOf(x,new.target.prototype)}_call(...x){throw Error("Must implement _call method in subclass")}};function isTypedArray(x){var c,_,T;return((T=(_=(c=x==null?void 0:x.prototype)==null?void 0:c.__proto__)==null?void 0:_.constructor)==null?void 0:T.name)==="TypedArray"}function isIntegralNumber(x){return Number.isInteger(x)||typeof x=="bigint"}function exists(x){return x!=null}function calculateDimensions(x){const c=[];let _=x;for(;Array.isArray(_);)c.push(_.length),_=_[0];return c}function pop(x,c,_=void 0){const T=x[c];if(T!==void 0)return delete x[c],T;if(_===void 0)throw Error(`Key ${c} does not exist in object.`);return _}function mergeArrays(...x){return Array.prototype.concat.apply([],x)}function product(...x){return x.reduce((c,_)=>c.flatMap(T=>_.map(C=>[T,C])))}function calculateReflectOffset(x,c){return Math.abs((x+c)%(2*c)-c)}var ortWeb_minExports={},ortWeb_min$1={get exports(){return ortWeb_minExports},set exports(x){ortWeb_minExports=x}};const backends={},backendsSortedByPriority=[],registerBackend=(x,c,_)=>{if(c&&typeof c.init=="function"&&typeof c.createSessionHandler=="function"){const T=backends[x];if(T===void 0)backends[x]={backend:c,priority:_};else{if(T.priority>_)return;if(T.priority===_&&T.backend!==c)throw new Error(`cannot register backend "${x}" using priority ${_}`)}if(_>=0){const C=backendsSortedByPriority.indexOf(x);C!==-1&&backendsSortedByPriority.splice(C,1);for(let M=0;M{const c=x.length===0?backendsSortedByPriority:x,_=[];for(const T of c){const C=backends[T];if(C){if(C.initialized)return C.backend;if(C.aborted)continue;const M=!!C.initPromise;try{return M||(C.initPromise=C.backend.init()),await C.initPromise,C.initialized=!0,C.backend}catch(E){M||_.push({name:T,err:E}),C.aborted=!0}finally{delete C.initPromise}}}throw new Error(`no available backend found. ERR: ${_.map(T=>`[${T.name}] ${T.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(c){if(c!==void 0){if(typeof c!="string"||["verbose","info","warning","error","fatal"].indexOf(c)===-1)throw new Error(`Unsupported logging level: ${c}`);this.logLevelInternal=c}}get logLevel(){return this.logLevelInternal}}const env$2=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=x=>{let c=1;for(let _=0;_{const O=document.createElement("canvas"),L=O.getContext("2d");if(!c||!L)return G();const F=new Image;F.crossOrigin="Anonymous",F.src=c,F.onload=()=>{O.width=F.width,O.height=F.height,L.drawImage(F,0,0,O.width,O.height);const V=L.getImageData(0,0,O.width,O.height);if(_!==void 0){if(_.height!==void 0&&_.height!==O.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(R.height=O.height,_.width!==void 0&&_.width!==O.width)throw new Error("Image input config width doesn't match ImageBitmap width");R.width=O.width}else R.height=O.height,R.width=O.width;$(tr.bufferToTensor(V.data,R))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(P!==void 0)return tr.bufferToTensor(P,R);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(c){var _,T;const C=document.createElement("canvas").getContext("2d");let M;if(C!=null){const E=this.dims[3],P=this.dims[2],R=this.dims[1],$=c!==void 0&&c.format!==void 0?c.format:"RGB",G=c!==void 0&&((_=c.norm)===null||_===void 0?void 0:_.mean)!==void 0?c.norm.mean:255,O=c!==void 0&&((T=c.norm)===null||T===void 0?void 0:T.bias)!==void 0?c.norm.bias:0,L=P*E;if(c!==void 0){if(c.height!==void 0&&c.height!==P)throw new Error("Image output config height doesn't match tensor height");if(c.width!==void 0&&c.width!==E)throw new Error("Image output config width doesn't match tensor width");if(c.format!==void 0&&R===4&&c.format!=="RGBA"||R===3&&c.format!=="RGB"&&c.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const F=4;let V=0,W=1,z=2,Z=3,H=0,Y=L,U=L*2,j=-1;$==="RGBA"?(H=0,Y=L,U=L*2,j=L*3):$==="RGB"?(H=0,Y=L,U=L*2):$==="RBG"&&(H=0,U=L,Y=L*2),M=C.createImageData(E,P);for(let X=0;X"u")throw new Error(`input '${$}' is missing in 'feeds'.`);if(E)for(const $ of this.outputNames)C[$]=null;const P=await this.handler.run(c,C,M),R={};for(const $ in P)Object.hasOwnProperty.call(P,$)&&(R[$]=new Tensor$1(P[$].type,P[$].data,P[$].dims));return R}static async create(c,_,T,C){let M,E={};if(typeof c=="string"){if(M=c,typeof _=="object"&&_!==null)E=_;else if(typeof _<"u")throw new TypeError("'options' must be an object.")}else if(c instanceof Uint8Array){if(M=c,typeof _=="object"&&_!==null)E=_;else if(typeof _<"u")throw new TypeError("'options' must be an object.")}else if(c instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&c instanceof SharedArrayBuffer){const O=c;let L=0,F=c.byteLength;if(typeof _=="object"&&_!==null)E=_;else if(typeof _=="number"){if(L=_,!Number.isSafeInteger(L))throw new RangeError("'byteOffset' must be an integer.");if(L<0||L>=O.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${O.byteLength}).`);if(F=c.byteLength-L,typeof T=="number"){if(F=T,!Number.isSafeInteger(F))throw new RangeError("'byteLength' must be an integer.");if(F<=0||L+F>O.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${O.byteLength-L}].`);if(typeof C=="object"&&C!==null)E=C;else if(typeof C<"u")throw new TypeError("'options' must be an object.")}else if(typeof T<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof _<"u")throw new TypeError("'options' must be an object.");M=new Uint8Array(O,L,F)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const R=(E.executionProviders||[]).map(O=>typeof O=="string"?O:O.name),G=await(await resolveBackend(R)).createSessionHandler(M,E);return new Nr(G)}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,lib=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession:InferenceSession$1,Tensor:Tensor$1,env:env$2,registerBackend},Symbol.toStringTag,{value:"Module"})),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(x,c){module.exports=c(require$$0)})(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(x,c,_)=>{var T,C=(T=(T=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(M){function E(){return de.buffer!=he&&He(de.buffer),we}function P(){return de.buffer!=he&&He(de.buffer),ye}function R(){return de.buffer!=he&&He(de.buffer),Me}function $(){return de.buffer!=he&&He(de.buffer),Pe}function G(){return de.buffer!=he&&He(de.buffer),Re}var O,L,F;M=M||{},O||(O=M!==void 0?M:{}),O.ready=new Promise(function(se,le){L=se,F=le});var V,W,z,Z,H,Y,U=Object.assign({},O),j="./this.program",X=(se,le)=>{throw le},K=typeof window=="object",q=typeof importScripts=="function",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Q=O.ENVIRONMENT_IS_PTHREAD||!1,ee="";function re(se){return O.locateFile?O.locateFile(se,ee):ee+se}if(J){let se;ee=q?_(908).dirname(ee)+"/":"//",Y=()=>{H||(Z=_(1384),H=_(908))},V=function(le,fe){return Y(),le=H.normalize(le),Z.readFileSync(le,fe?void 0:"utf8")},z=le=>((le=V(le,!0)).buffer||(le=new Uint8Array(le)),le),W=(le,fe,ve)=>{Y(),le=H.normalize(le),Z.readFile(le,function(Se,Te){Se?ve(Se):fe(Te.buffer)})},1{if(bt())throw process.exitCode=le,fe;fe instanceof Dt||oe("exiting due to exception: "+fe),process.exit(le)},O.inspect=function(){return"[Emscripten Module object]"};try{se=_(9925)}catch(le){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),le}_.g.Worker=se.Worker}else(K||q)&&(q?ee=self.location.href:typeof document<"u"&&document.currentScript&&(ee=document.currentScript.src),T&&(ee=T),ee=ee.indexOf("blob:")!==0?ee.substr(0,ee.replace(/[?#].*/,"").lastIndexOf("/")+1):"",J||(V=se=>{var le=new XMLHttpRequest;return le.open("GET",se,!1),le.send(null),le.responseText},q&&(z=se=>{var le=new XMLHttpRequest;return le.open("GET",se,!1),le.responseType="arraybuffer",le.send(null),new Uint8Array(le.response)}),W=(se,le,fe)=>{var ve=new XMLHttpRequest;ve.open("GET",se,!0),ve.responseType="arraybuffer",ve.onload=()=>{ve.status==200||ve.status==0&&ve.response?le(ve.response):fe()},ve.onerror=fe,ve.send(null)}));J&&typeof performance>"u"&&(_.g.performance=_(6953).performance);var ie=console.log.bind(console),ae=console.warn.bind(console);J&&(Y(),ie=se=>Z.writeSync(1,se+`
`),ae=se=>Z.writeSync(2,se+`
`));var ne,te=O.print||ie,oe=O.printErr||ae;Object.assign(O,U),U=null,O.thisProgram&&(j=O.thisProgram),O.quit&&(X=O.quit),O.wasmBinary&&(ne=O.wasmBinary);var ue=O.noExitRuntime||!1;typeof WebAssembly!="object"&&qe("no native wasm support detected");var de,pe,he,we,ye,Me,Pe,Re,De=!1,Le=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function $e(se,le,fe){var ve=(le>>>=0)+fe;for(fe=le;se[fe]&&!(fe>=ve);)++fe;if(16(Se=(240&Se)==224?(15&Se)<<12|Te<<6|Fe:(7&Se)<<18|Te<<12|Fe<<6|63&se[le++])?ve+=String.fromCharCode(Se):(Se-=65536,ve+=String.fromCharCode(55296|Se>>10,56320|1023&Se))}}else ve+=String.fromCharCode(Se)}return ve}function Oe(se,le){return(se>>>=0)?$e(P(),se,le):""}function Ee(se,le,fe,ve){if(!(0>>=0;ve=fe+ve-1;for(var Te=0;Te=Fe&&(Fe=65536+((1023&Fe)<<10)|1023&se.charCodeAt(++Te)),127>=Fe){if(fe>=ve)break;le[fe++>>>0]=Fe}else{if(2047>=Fe){if(fe+1>=ve)break;le[fe++>>>0]=192|Fe>>6}else{if(65535>=Fe){if(fe+2>=ve)break;le[fe++>>>0]=224|Fe>>12}else{if(fe+3>=ve)break;le[fe++>>>0]=240|Fe>>18,le[fe++>>>0]=128|Fe>>12&63}le[fe++>>>0]=128|Fe>>6&63}le[fe++>>>0]=128|63&Fe}}return le[fe>>>0]=0,fe-Se}function Be(se){for(var le=0,fe=0;fe=ve?le++:2047>=ve?le+=2:55296<=ve&&57343>=ve?(le+=4,++fe):le+=3}return le}function He(se){he=se,O.HEAP8=we=new Int8Array(se),O.HEAP16=new Int16Array(se),O.HEAP32=Me=new Int32Array(se),O.HEAPU8=ye=new Uint8Array(se),O.HEAPU16=new Uint16Array(se),O.HEAPU32=Pe=new Uint32Array(se),O.HEAPF32=new Float32Array(se),O.HEAPF64=Re=new Float64Array(se)}Q&&(he=O.buffer);var We=O.INITIAL_MEMORY||16777216;if(Q)de=O.wasmMemory,he=O.buffer;else if(O.wasmMemory)de=O.wasmMemory;else if(!((de=new WebAssembly.Memory({initial:We/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw oe("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"),J&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");de&&(he=de.buffer),We=he.byteLength,He(he);var Ke,Je=[],tt=[],mt=[],pt=[];function bt(){return ue||!1}function gt(){var se=O.preRun.shift();Je.unshift(se)}var ct,yt=0,At=null;function qe(se){throw Q?postMessage({cmd:"onAbort",arg:se}):O.onAbort&&O.onAbort(se),oe(se="Aborted("+se+")"),De=!0,se=new WebAssembly.RuntimeError(se+". Build with -sASSERTIONS for more info."),F(se),se}function Bt(){return ct.startsWith("data:application/octet-stream;base64,")}function xt(){var se=ct;try{if(se==ct&&ne)return new Uint8Array(ne);if(z)return z(se);throw"both async and sync fetching of the wasm failed"}catch(le){qe(le)}}ct="ort-wasm-threaded.wasm",Bt()||(ct=re(ct));var Mt={};function Dt(se){this.name="ExitStatus",this.message="Program terminated with exit("+se+")",this.status=se}function Ot(se){(se=Ye.Vb[se])||qe(),Ye.mc(se)}function _t(se){var le=Ye.Cc();if(!le)return 6;Ye.ac.push(le),Ye.Vb[se.Ub]=le,le.Ub=se.Ub;var fe={cmd:"run",start_routine:se.Ic,arg:se.zc,pthread_ptr:se.Ub};return le.$b=()=>{fe.time=performance.now(),le.postMessage(fe,se.Nc)},le.loaded&&(le.$b(),delete le.$b),0}function ft(se){if(Q)return Ze(1,1,se);bt()||(Ye.oc(),O.onExit&&O.onExit(se),De=!0),X(se,new Dt(se))}function Gt(se,le){if(!le&&Q)throw St(se),"unwind";bt()||Q||(br(),Pt(mt),_r(0),ur[1].length&&cr(1,10),ur[2].length&&cr(2,10),Ye.oc()),ft(se)}var Ye={Yb:[],ac:[],qc:[],Vb:{},fc:function(){Q&&Ye.Ec()},Pc:function(){},Ec:function(){Ye.receiveObjectTransfer=Ye.Gc,Ye.threadInitTLS=Ye.pc,Ye.setExitStatus=Ye.nc,ue=!1},nc:function(){},oc:function(){for(var se of Object.values(Ye.Vb))Ye.mc(se);for(se of Ye.Yb)se.terminate();Ye.Yb=[]},mc:function(se){var le=se.Ub;delete Ye.Vb[le],Ye.Yb.push(se),Ye.ac.splice(Ye.ac.indexOf(se),1),se.Ub=0,hr(le)},Gc:function(){},pc:function(){Ye.qc.forEach(se=>se())},Fc:function(se,le){se.onmessage=fe=>{var ve=(fe=fe.data).cmd;if(se.Ub&&(Ye.Bc=se.Ub),fe.targetThread&&fe.targetThread!=or()){var Se=Ye.Vb[fe.Qc];Se?Se.postMessage(fe,fe.transferList):oe('Internal error! Worker sent a message "'+ve+'" to target pthread '+fe.targetThread+", but that thread no longer exists!")}else ve==="processProxyingQueue"?me(fe.queue):ve==="spawnThread"?_t(fe):ve==="cleanupThread"?Ot(fe.thread):ve==="killThread"?(fe=fe.thread,ve=Ye.Vb[fe],delete Ye.Vb[fe],ve.terminate(),hr(fe),Ye.ac.splice(Ye.ac.indexOf(ve),1),ve.Ub=0):ve==="cancelThread"?Ye.Vb[fe.thread].postMessage({cmd:"cancel"}):ve==="loaded"?(se.loaded=!0,le&&le(se),se.$b&&(se.$b(),delete se.$b)):ve==="print"?te("Thread "+fe.threadId+": "+fe.text):ve==="printErr"?oe("Thread "+fe.threadId+": "+fe.text):ve==="alert"?alert("Thread "+fe.threadId+": "+fe.text):fe.target==="setimmediate"?se.postMessage(fe):ve==="onAbort"?O.onAbort&&O.onAbort(fe.arg):ve&&oe("worker sent an unknown command "+ve);Ye.Bc=void 0},se.onerror=fe=>{throw oe("worker sent an error! "+fe.filename+":"+fe.lineno+": "+fe.message),fe},J&&(se.on("message",function(fe){se.onmessage({data:fe})}),se.on("error",function(fe){se.onerror(fe)}),se.on("detachedExit",function(){})),se.postMessage({cmd:"load",urlOrBlob:O.mainScriptUrlOrBlob||T,wasmMemory:de,wasmModule:pe})},yc:function(){var se=re("ort-wasm-threaded.worker.js");Ye.Yb.push(new Worker(se))},Cc:function(){return Ye.Yb.length==0&&(Ye.yc(),Ye.Fc(Ye.Yb[0])),Ye.Yb.pop()}};function Pt(se){for(;0>2>>>0];se=R()[se+48>>2>>>0],Ir(le,le-se),at(le)};var Ge=[];function ze(se){var le=Ge[se];return le||(se>=Ge.length&&(Ge.length=se+1),Ge[se]=le=Ke.get(se)),le}O.invokeEntryPoint=function(se,le){se=ze(se)(le),bt()?Ye.nc(se):Tr(se)};var kt,Nt,$t=[],et=0,Xe=0;function Qe(se){this.Zb=se,this.Sb=se-24,this.xc=function(le){$()[this.Sb+4>>2>>>0]=le},this.bc=function(){return $()[this.Sb+4>>2>>>0]},this.wc=function(le){$()[this.Sb+8>>2>>>0]=le},this.Dc=function(){return $()[this.Sb+8>>2>>>0]},this.rc=function(){R()[this.Sb>>2>>>0]=0},this.hc=function(le){le=le?1:0,E()[this.Sb+12>>0>>>0]=le},this.uc=function(){return E()[this.Sb+12>>0>>>0]!=0},this.ic=function(le){le=le?1:0,E()[this.Sb+13>>0>>>0]=le},this.kc=function(){return E()[this.Sb+13>>0>>>0]!=0},this.fc=function(le,fe){this.cc(0),this.xc(le),this.wc(fe),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(R(),this.Sb>>2,1)},this.Hc=function(){return Atomics.sub(R(),this.Sb>>2,1)===1},this.cc=function(le){$()[this.Sb+16>>2>>>0]=le},this.tc=function(){return $()[this.Sb+16>>2>>>0]},this.vc=function(){if(Ar(this.bc()))return $()[this.Zb>>2>>>0];var le=this.tc();return le!==0?le:this.Zb}}function Jt(se){return yr(new Qe(se).Sb)}function Rt(se,le,fe,ve){return Q?Ze(3,1,se,le,fe,ve):qt(se,le,fe,ve)}function qt(se,le,fe,ve){if(typeof SharedArrayBuffer>"u")return oe("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Se=[];return Q&&Se.length===0?Rt(se,le,fe,ve):(se={Ic:fe,Ub:se,zc:ve,Nc:Se},Q?(se.Oc="spawnThread",postMessage(se,Se),0):_t(se))}function Qt(se,le,fe){return Q?Ze(4,1,se,le,fe):0}function Ft(se,le){if(Q)return Ze(5,1,se,le)}function er(se,le){if(Q)return Ze(6,1,se,le)}function Tt(se,le,fe){if(Q)return Ze(7,1,se,le,fe)}function be(se,le,fe){return Q?Ze(8,1,se,le,fe):0}function Ve(se,le){if(Q)return Ze(9,1,se,le)}function Yt(se,le,fe){if(Q)return Ze(10,1,se,le,fe)}function Ut(se,le,fe,ve){if(Q)return Ze(11,1,se,le,fe,ve)}function jt(se,le,fe,ve){if(Q)return Ze(12,1,se,le,fe,ve)}function nr(se,le,fe,ve){if(Q)return Ze(13,1,se,le,fe,ve)}function ar(se){if(Q)return Ze(14,1,se)}function ce(se,le){if(Q)return Ze(15,1,se,le)}function ge(se,le,fe){if(Q)return Ze(16,1,se,le,fe)}function me(se){Atomics.store(R(),se>>2,1),or()&&xr(se),Atomics.compareExchange(R(),se>>2,1,0)}function _e(se){return $()[se>>>2]+4294967296*R()[se+4>>>2]}function xe(se,le,fe,ve,Se,Te){return Q?Ze(17,1,se,le,fe,ve,Se,Te):-52}function Ce(se,le,fe,ve,Se,Te){if(Q)return Ze(18,1,se,le,fe,ve,Se,Te)}function Ne(se){var le=Be(se)+1,fe=dr(le);return fe&&Ee(se,E(),fe,le),fe}function Ue(se,le,fe){function ve(ut){return(ut=ut.toTimeString().match(/\(([A-Za-z ]+)\)$/))?ut[1]:"GMT"}if(Q)return Ze(19,1,se,le,fe);var Se=new Date().getFullYear(),Te=new Date(Se,0,1),Fe=new Date(Se,6,1);Se=Te.getTimezoneOffset();var je=Fe.getTimezoneOffset(),st=Math.max(Se,je);R()[se>>2>>>0]=60*st,R()[le>>2>>>0]=Number(Se!=je),se=ve(Te),le=ve(Fe),se=Ne(se),le=Ne(le),je>2>>>0]=se,$()[fe+4>>2>>>0]=le):($()[fe>>2>>>0]=le,$()[fe+4>>2>>>0]=se)}function Ze(se,le){var fe=arguments.length-2,ve=arguments;return Wt(()=>{for(var Se=fr(8*fe),Te=Se>>3,Fe=0;Fe>>0]=je}return wr(se,fe,Se,le)})}O.executeNotifiedProxyingQueue=me,Nt=J?()=>{var se=process.hrtime();return 1e3*se[0]+se[1]/1e6}:Q?()=>performance.now()-O.__performance_now_clock_drift:()=>performance.now();var nt,vt=[],Lt={};function Et(){if(!nt){var se,le={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",_:j||"./this.program"};for(se in Lt)Lt[se]===void 0?delete le[se]:le[se]=Lt[se];var fe=[];for(se in le)fe.push(se+"="+le[se]);nt=fe}return nt}function Ie(se,le){if(Q)return Ze(20,1,se,le);var fe=0;return Et().forEach(function(ve,Se){var Te=le+fe;for(Se=$()[se+4*Se>>2>>>0]=Te,Te=0;Te>0>>>0]=ve.charCodeAt(Te);E()[Se>>0>>>0]=0,fe+=ve.length+1}),0}function dt(se,le){if(Q)return Ze(21,1,se,le);var fe=Et();$()[se>>2>>>0]=fe.length;var ve=0;return fe.forEach(function(Se){ve+=Se.length+1}),$()[le>>2>>>0]=ve,0}function wt(se){return Q?Ze(22,1,se):52}function zt(se,le,fe,ve){return Q?Ze(23,1,se,le,fe,ve):52}function Xt(se,le,fe,ve,Se){return Q?Ze(24,1,se,le,fe,ve,Se):70}var ur=[null,[],[]];function cr(se,le){var fe=ur[se];le===0||le===10?((se===1?te:oe)($e(fe,0)),fe.length=0):fe.push(le)}function pr(se,le,fe,ve){if(Q)return Ze(25,1,se,le,fe,ve);for(var Se=0,Te=0;Te>2>>>0],je=$()[le+4>>2>>>0];le+=8;for(var st=0;st>>0]);Se+=je}return $()[ve>>2>>>0]=Se,0}var Vt=0;function ir(se){return se%4==0&&(se%100!=0||se%400==0)}var gr=[31,29,31,30,31,30,31,31,30,31,30,31],vr=[31,28,31,30,31,30,31,31,30,31,30,31];function mr(se,le,fe,ve){function Se(Ae,ht,It){for(Ae=typeof Ae=="number"?Ae.toString():Ae||"";Ae.lengthrr?-1:0Kt-Ae.getDate())){Ae.setDate(Ae.getDate()+ht);break}ht-=Kt-Ae.getDate()+1,Ae.setDate(1),11>It?Ae.setMonth(It+1):(Ae.setMonth(0),Ae.setFullYear(Ae.getFullYear()+1))}return It=new Date(Ae.getFullYear()+1,0,4),ht=je(new Date(Ae.getFullYear(),0,4)),It=je(It),0>=Fe(ht,Ae)?0>=Fe(It,Ae)?Ae.getFullYear()+1:Ae.getFullYear():Ae.getFullYear()-1}var ut=R()[ve+40>>2>>>0];for(var Ct in ve={Lc:R()[ve>>2>>>0],Kc:R()[ve+4>>2>>>0],dc:R()[ve+8>>2>>>0],jc:R()[ve+12>>2>>>0],ec:R()[ve+16>>2>>>0],Xb:R()[ve+20>>2>>>0],Tb:R()[ve+24>>2>>>0],Wb:R()[ve+28>>2>>>0],Rc:R()[ve+32>>2>>>0],Jc:R()[ve+36>>2>>>0],Mc:ut?Oe(ut):""},fe=Oe(fe),ut={"%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"})fe=fe.replace(new RegExp(Ct,"g"),ut[Ct]);var Ht="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Zt="January February March April May June July August September October November December".split(" ");for(Ct in ut={"%a":function(Ae){return Ht[Ae.Tb].substring(0,3)},"%A":function(Ae){return Ht[Ae.Tb]},"%b":function(Ae){return Zt[Ae.ec].substring(0,3)},"%B":function(Ae){return Zt[Ae.ec]},"%C":function(Ae){return Te((Ae.Xb+1900)/100|0,2)},"%d":function(Ae){return Te(Ae.jc,2)},"%e":function(Ae){return Se(Ae.jc,2," ")},"%g":function(Ae){return st(Ae).toString().substring(2)},"%G":function(Ae){return st(Ae)},"%H":function(Ae){return Te(Ae.dc,2)},"%I":function(Ae){return(Ae=Ae.dc)==0?Ae=12:12Ae.dc?"AM":"PM"},"%S":function(Ae){return Te(Ae.Lc,2)},"%t":function(){return" "},"%u":function(Ae){return Ae.Tb||7},"%U":function(Ae){return Te(Math.floor((Ae.Wb+7-Ae.Tb)/7),2)},"%V":function(Ae){var ht=Math.floor((Ae.Wb+7-(Ae.Tb+6)%7)/7);if(2>=(Ae.Tb+371-Ae.Wb-2)%7&&ht++,ht)ht==53&&((It=(Ae.Tb+371-Ae.Wb)%7)==4||It==3&&ir(Ae.Xb)||(ht=1));else{ht=52;var It=(Ae.Tb+7-Ae.Wb-1)%7;(It==4||It==5&&ir(Ae.Xb%400-1))&&ht++}return Te(ht,2)},"%w":function(Ae){return Ae.Tb},"%W":function(Ae){return Te(Math.floor((Ae.Wb+7-(Ae.Tb+6)%7)/7),2)},"%y":function(Ae){return(Ae.Xb+1900).toString().substring(2)},"%Y":function(Ae){return Ae.Xb+1900},"%z":function(Ae){var ht=0<=(Ae=Ae.Jc);return Ae=Math.abs(Ae)/60,(ht?"+":"-")+String("0000"+(Ae/60*100+Ae%60)).slice(-4)},"%Z":function(Ae){return Ae.Mc},"%%":function(){return"%"}},fe=fe.replace(/%%/g,"\0\0"),ut)fe.includes(Ct)&&(fe=fe.replace(new RegExp(Ct,"g"),ut[Ct](ve)));return Ct=function(Ae){var ht=Array(Be(Ae)+1);return Ee(Ae,ht,0,ht.length),ht}(fe=fe.replace(/\0\0/g,"%")),Ct.length>le?0:(function(Ae,ht){E().set(Ae,ht>>>0)}(Ct,se),Ct.length-1)}Ye.fc();var Fr=[null,ft,St,Rt,Qt,Ft,er,Tt,be,Ve,Yt,Ut,jt,nr,ar,ce,ge,xe,Ce,Ue,Ie,dt,wt,zt,Xt,pr],Vr={b:function(se){return dr(se+24)+24},n:function(se){return(se=new Qe(se)).uc()||(se.hc(!0),et--),se.ic(!1),$t.push(se),se.sc(),se.vc()},ma:function(se){throw oe("Unexpected exception thrown, this is not properly supported - aborting"),De=!0,se},x:function(){ot(0);var se=$t.pop();if(se.Hc()&&!se.kc()){var le=se.Dc();le&&ze(le)(se.Zb),Jt(se.Zb)}Xe=0},e:function(){var se=Xe;if(!se)return Vt=0;var le=new Qe(se);le.cc(se);var fe=le.bc();if(!fe)return Vt=0,se;for(var ve=Array.prototype.slice.call(arguments),Se=0;Seme(ve));else if(Q)postMessage({targetThread:se,cmd:"processProxyingQueue",queue:ve});else{if(!(se=Ye.Vb[se]))return;se.postMessage({cmd:"processProxyingQueue",queue:ve})}return 1},Ea:function(){return-1},Pa:function(se,le){se=new Date(1e3*_e(se)),R()[le>>2>>>0]=se.getUTCSeconds(),R()[le+4>>2>>>0]=se.getUTCMinutes(),R()[le+8>>2>>>0]=se.getUTCHours(),R()[le+12>>2>>>0]=se.getUTCDate(),R()[le+16>>2>>>0]=se.getUTCMonth(),R()[le+20>>2>>>0]=se.getUTCFullYear()-1900,R()[le+24>>2>>>0]=se.getUTCDay(),se=(se.getTime()-Date.UTC(se.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,R()[le+28>>2>>>0]=se},Qa:function(se,le){se=new Date(1e3*_e(se)),R()[le>>2>>>0]=se.getSeconds(),R()[le+4>>2>>>0]=se.getMinutes(),R()[le+8>>2>>>0]=se.getHours(),R()[le+12>>2>>>0]=se.getDate(),R()[le+16>>2>>>0]=se.getMonth(),R()[le+20>>2>>>0]=se.getFullYear()-1900,R()[le+24>>2>>>0]=se.getDay();var fe=new Date(se.getFullYear(),0,1),ve=(se.getTime()-fe.getTime())/864e5|0;R()[le+28>>2>>>0]=ve,R()[le+36>>2>>>0]=-60*se.getTimezoneOffset(),ve=new Date(se.getFullYear(),6,1).getTimezoneOffset(),se=0|(ve!=(fe=fe.getTimezoneOffset())&&se.getTimezoneOffset()==Math.min(fe,ve)),R()[le+32>>2>>>0]=se},Ra:function(se){var le=new Date(R()[se+20>>2>>>0]+1900,R()[se+16>>2>>>0],R()[se+12>>2>>>0],R()[se+8>>2>>>0],R()[se+4>>2>>>0],R()[se>>2>>>0],0),fe=R()[se+32>>2>>>0],ve=le.getTimezoneOffset(),Se=new Date(le.getFullYear(),0,1),Te=new Date(le.getFullYear(),6,1).getTimezoneOffset(),Fe=Se.getTimezoneOffset(),je=Math.min(Fe,Te);return 0>fe?R()[se+32>>2>>>0]=Number(Te!=Fe&&je==ve):0>2>>>0]=le.getDay(),fe=(le.getTime()-Se.getTime())/864e5|0,R()[se+28>>2>>>0]=fe,R()[se>>2>>>0]=le.getSeconds(),R()[se+4>>2>>>0]=le.getMinutes(),R()[se+8>>2>>>0]=le.getHours(),R()[se+12>>2>>>0]=le.getDate(),R()[se+16>>2>>>0]=le.getMonth(),le.getTime()/1e3|0},Aa:xe,Ba:Ce,Sa:function se(le,fe,ve){se.Ac||(se.Ac=!0,Ue(le,fe,ve))},y:function(){qe("")},U:function(){if(!J&&!q){var se="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";kt||(kt={}),kt[se]||(kt[se]=1,J&&(se="warning: "+se),oe(se))}},ra:function(){return 4294901760},B:Nt,Ia:function(se,le,fe){P().copyWithin(se>>>0,le>>>0,le+fe>>>0)},F:function(){return J?_(3993).cpus().length:navigator.hardwareConcurrency},Da:function(se,le,fe){vt.length=le,fe>>=3;for(var ve=0;ve>>0];return(0>se?Mt[-se-1]:Fr[se]).apply(null,vt)},qa:function(se){var le=P().length;if((se>>>=0)<=le||4294901760=fe;fe*=2){var ve=le*(1+.2/fe);ve=Math.min(ve,se+100663296);var Se=Math;ve=Math.max(se,ve),Se=Se.min.call(Se,4294901760,ve+(65536-ve%65536)%65536);e:{try{de.grow(Se-he.byteLength+65535>>>16),He(de.buffer);var Te=1;break e}catch{}Te=void 0}if(Te)return!0}return!1},Na:function(){throw"unwind"},Ga:Ie,Ha:dt,J:Gt,I:wt,S:zt,ga:Xt,R:pr,d:function(){return Vt},na:function se(le,fe){se.lc||(se.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Se=new Uint8Array(1);return()=>(crypto.getRandomValues(Se),Se[0])}if(J)try{var Te=_(Object(function(){var Fe=new Error("Cannot find module 'crypto'");throw Fe.code="MODULE_NOT_FOUND",Fe}()));return()=>Te.randomBytes(1)[0]}catch{}return()=>qe("randomDevice")}());for(var ve=0;ve>0>>>0]=se.lc();return 0},ia:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},ja:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},K:function(se){var le=it();try{return ze(se)()}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},f:function(se,le){var fe=it();try{return ze(se)(le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},P:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},Q:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},k:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},p:function(se,le,fe,ve){var Se=it();try{return ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},q:function(se,le,fe,ve,Se){var Te=it();try{return ze(se)(le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},N:function(se,le,fe,ve,Se,Te){var Fe=it();try{return ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},s:function(se,le,fe,ve,Se,Te){var Fe=it();try{return ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},w:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{return ze(se)(le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},L:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{return ze(se)(le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},E:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht){var Zt=it();try{return ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht)}catch(Ae){if(at(Zt),Ae!==Ae+0)throw Ae;ot(1,0)}},aa:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{return Rr(se,le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},_:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{return Mr(se,le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},Z:function(se,le,fe,ve,Se){var Te=it();try{return $r(se,le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},ca:function(se,le,fe,ve){var Se=it();try{return Dr(se,le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},$:function(se){var le=it();try{return Cr(se)}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},ba:function(se,le){var fe=it();try{return Or(se,le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},Y:function(se,le,fe){var ve=it();try{return Er(se,le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},g:function(se){var le=it();try{ze(se)()}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},r:function(se,le){var fe=it();try{ze(se)(le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},i:function(se,le,fe){var ve=it();try{ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},ha:function(se,le,fe,ve){var Se=it();try{ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},m:function(se,le,fe,ve){var Se=it();try{ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},v:function(se,le,fe,ve,Se){var Te=it();try{ze(se)(le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},u:function(se,le,fe,ve,Se,Te){var Fe=it();try{ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},O:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{ze(se)(le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},A:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},ka:function(se,le,fe,ve,Se,Te,Fe,je,st){var ut=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st)}catch(Ct){if(at(ut),Ct!==Ct+0)throw Ct;ot(1,0)}},C:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct){var Ht=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct)}catch(Zt){if(at(Ht),Zt!==Zt+0)throw Zt;ot(1,0)}},D:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht,Zt,Ae,ht,It){var Kt=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht,Zt,Ae,ht,It)}catch(rr){if(at(Kt),rr!==rr+0)throw rr;ot(1,0)}},fa:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{Pr(se,le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},da:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht){var Zt=it();try{kr(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht)}catch(Ae){if(at(Zt),Ae!==Ae+0)throw Ae;ot(1,0)}},ea:function(se,le,fe,ve,Se,Te){var Fe=it();try{Lr(se,le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},o:function(se){return se},a:de||O.wasmMemory,G:function(se){Vt=se},la:mr,z:function(se,le,fe,ve){return mr(se,le,fe,ve)}};(function(){function se(Se,Te){O.asm=Se.exports,Ye.qc.push(O.asm.sb),Ke=O.asm.ub,tt.unshift(O.asm.Va),pe=Te,Q||(yt--,O.monitorRunDependencies&&O.monitorRunDependencies(yt),yt==0&&At&&(Se=At,At=null,Se()))}function le(Se){se(Se.instance,Se.module)}function fe(Se){return function(){if(!ne&&(K||q)){if(typeof fetch=="function"&&!ct.startsWith("file://"))return fetch(ct,{credentials:"same-origin"}).then(function(Te){if(!Te.ok)throw"failed to load wasm binary file at '"+ct+"'";return Te.arrayBuffer()}).catch(function(){return xt()});if(W)return new Promise(function(Te,Fe){W(ct,function(je){Te(new Uint8Array(je))},Fe)})}return Promise.resolve().then(function(){return xt()})}().then(function(Te){return WebAssembly.instantiate(Te,ve)}).then(function(Te){return Te}).then(Se,function(Te){oe("failed to asynchronously prepare wasm: "+Te),qe(Te)})}var ve={a:Vr};if(Q||(yt++,O.monitorRunDependencies&&O.monitorRunDependencies(yt)),O.instantiateWasm)try{return O.instantiateWasm(ve,se)}catch(Se){return oe("Module.instantiateWasm callback failed with error: "+Se),!1}(ne||typeof WebAssembly.instantiateStreaming!="function"||Bt()||ct.startsWith("file://")||J||typeof fetch!="function"?fe(le):fetch(ct,{credentials:"same-origin"}).then(function(Se){return WebAssembly.instantiateStreaming(Se,ve).then(le,function(Te){return oe("wasm streaming compile failed: "+Te),oe("falling back to ArrayBuffer instantiation"),fe(le)})})).catch(F)})(),O.___wasm_call_ctors=function(){return(O.___wasm_call_ctors=O.asm.Va).apply(null,arguments)},O._OrtInit=function(){return(O._OrtInit=O.asm.Wa).apply(null,arguments)},O._OrtCreateSessionOptions=function(){return(O._OrtCreateSessionOptions=O.asm.Xa).apply(null,arguments)},O._OrtAppendExecutionProvider=function(){return(O._OrtAppendExecutionProvider=O.asm.Ya).apply(null,arguments)},O._OrtAddSessionConfigEntry=function(){return(O._OrtAddSessionConfigEntry=O.asm.Za).apply(null,arguments)},O._OrtReleaseSessionOptions=function(){return(O._OrtReleaseSessionOptions=O.asm._a).apply(null,arguments)},O._OrtCreateSession=function(){return(O._OrtCreateSession=O.asm.$a).apply(null,arguments)},O._OrtReleaseSession=function(){return(O._OrtReleaseSession=O.asm.ab).apply(null,arguments)},O._OrtGetInputCount=function(){return(O._OrtGetInputCount=O.asm.bb).apply(null,arguments)},O._OrtGetOutputCount=function(){return(O._OrtGetOutputCount=O.asm.cb).apply(null,arguments)},O._OrtGetInputName=function(){return(O._OrtGetInputName=O.asm.db).apply(null,arguments)},O._OrtGetOutputName=function(){return(O._OrtGetOutputName=O.asm.eb).apply(null,arguments)},O._OrtFree=function(){return(O._OrtFree=O.asm.fb).apply(null,arguments)},O._OrtCreateTensor=function(){return(O._OrtCreateTensor=O.asm.gb).apply(null,arguments)},O._OrtGetTensorData=function(){return(O._OrtGetTensorData=O.asm.hb).apply(null,arguments)},O._OrtReleaseTensor=function(){return(O._OrtReleaseTensor=O.asm.ib).apply(null,arguments)},O._OrtCreateRunOptions=function(){return(O._OrtCreateRunOptions=O.asm.jb).apply(null,arguments)},O._OrtAddRunConfigEntry=function(){return(O._OrtAddRunConfigEntry=O.asm.kb).apply(null,arguments)},O._OrtReleaseRunOptions=function(){return(O._OrtReleaseRunOptions=O.asm.lb).apply(null,arguments)},O._OrtRun=function(){return(O._OrtRun=O.asm.mb).apply(null,arguments)},O._OrtEndProfiling=function(){return(O._OrtEndProfiling=O.asm.nb).apply(null,arguments)};var or=O._pthread_self=function(){return(or=O._pthread_self=O.asm.ob).apply(null,arguments)},dr=O._malloc=function(){return(dr=O._malloc=O.asm.pb).apply(null,arguments)},yr=O._free=function(){return(yr=O._free=O.asm.qb).apply(null,arguments)},_r=O._fflush=function(){return(_r=O._fflush=O.asm.rb).apply(null,arguments)};O.__emscripten_tls_init=function(){return(O.__emscripten_tls_init=O.asm.sb).apply(null,arguments)};var br=O.___funcs_on_exit=function(){return(br=O.___funcs_on_exit=O.asm.tb).apply(null,arguments)},Sr=O.__emscripten_thread_init=function(){return(Sr=O.__emscripten_thread_init=O.asm.vb).apply(null,arguments)};O.__emscripten_thread_crashed=function(){return(O.__emscripten_thread_crashed=O.asm.wb).apply(null,arguments)};var sr,wr=O._emscripten_run_in_main_runtime_thread_js=function(){return(wr=O._emscripten_run_in_main_runtime_thread_js=O.asm.xb).apply(null,arguments)},xr=O.__emscripten_proxy_execute_task_queue=function(){return(xr=O.__emscripten_proxy_execute_task_queue=O.asm.yb).apply(null,arguments)},hr=O.__emscripten_thread_free_data=function(){return(hr=O.__emscripten_thread_free_data=O.asm.zb).apply(null,arguments)},Tr=O.__emscripten_thread_exit=function(){return(Tr=O.__emscripten_thread_exit=O.asm.Ab).apply(null,arguments)},ot=O._setThrew=function(){return(ot=O._setThrew=O.asm.Bb).apply(null,arguments)},Ir=O._emscripten_stack_set_limits=function(){return(Ir=O._emscripten_stack_set_limits=O.asm.Cb).apply(null,arguments)},it=O.stackSave=function(){return(it=O.stackSave=O.asm.Db).apply(null,arguments)},at=O.stackRestore=function(){return(at=O.stackRestore=O.asm.Eb).apply(null,arguments)},fr=O.stackAlloc=function(){return(fr=O.stackAlloc=O.asm.Fb).apply(null,arguments)},lr=O.___cxa_can_catch=function(){return(lr=O.___cxa_can_catch=O.asm.Gb).apply(null,arguments)},Ar=O.___cxa_is_pointer_type=function(){return(Ar=O.___cxa_is_pointer_type=O.asm.Hb).apply(null,arguments)},Cr=O.dynCall_j=function(){return(Cr=O.dynCall_j=O.asm.Ib).apply(null,arguments)},Mr=O.dynCall_iiiiij=function(){return(Mr=O.dynCall_iiiiij=O.asm.Jb).apply(null,arguments)},Er=O.dynCall_jii=function(){return(Er=O.dynCall_jii=O.asm.Kb).apply(null,arguments)},Pr=O.dynCall_viiiiij=function(){return(Pr=O.dynCall_viiiiij=O.asm.Lb).apply(null,arguments)},Lr=O.dynCall_vjji=function(){return(Lr=O.dynCall_vjji=O.asm.Mb).apply(null,arguments)},kr=O.dynCall_viiijjjii=function(){return(kr=O.dynCall_viiijjjii=O.asm.Nb).apply(null,arguments)},Dr=O.dynCall_iij=function(){return(Dr=O.dynCall_iij=O.asm.Ob).apply(null,arguments)},Or=O.dynCall_ji=function(){return(Or=O.dynCall_ji=O.asm.Pb).apply(null,arguments)},Rr=O.dynCall_iiiiiij=function(){return(Rr=O.dynCall_iiiiiij=O.asm.Qb).apply(null,arguments)},$r=O.dynCall_iiij=function(){return($r=O.dynCall_iiij=O.asm.Rb).apply(null,arguments)};function Br(){function se(){if(!sr&&(sr=!0,O.calledRun=!0,!De)&&(Q||Pt(tt),L(O),O.onRuntimeInitialized&&O.onRuntimeInitialized(),!Q)){if(O.postRun)for(typeof O.postRun=="function"&&(O.postRun=[O.postRun]);O.postRun.length;){var le=O.postRun.shift();pt.unshift(le)}Pt(pt)}}if(!(0{var T,C=(T=(T=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(M){var E,P,R;M=M||{},E||(E=M!==void 0?M:{}),E.ready=new Promise(function(ce,ge){P=ce,R=ge});var $,G,O,L,F,V,W=Object.assign({},E),z="./this.program",Z=(ce,ge)=>{throw ge},H=typeof window=="object",Y=typeof importScripts=="function",U=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",j="";U?(j=Y?_(908).dirname(j)+"/":"//",V=()=>{F||(L=_(1384),F=_(908))},$=function(ce,ge){return V(),ce=F.normalize(ce),L.readFileSync(ce,ge?void 0:"utf8")},O=ce=>((ce=$(ce,!0)).buffer||(ce=new Uint8Array(ce)),ce),G=(ce,ge,me)=>{V(),ce=F.normalize(ce),L.readFile(ce,function(_e,xe){_e?me(_e):ge(xe.buffer)})},1{if(J||0{var ge=new XMLHttpRequest;return ge.open("GET",ce,!1),ge.send(null),ge.responseText},Y&&(O=ce=>{var ge=new XMLHttpRequest;return ge.open("GET",ce,!1),ge.responseType="arraybuffer",ge.send(null),new Uint8Array(ge.response)}),G=(ce,ge,me)=>{var _e=new XMLHttpRequest;_e.open("GET",ce,!0),_e.responseType="arraybuffer",_e.onload=()=>{_e.status==200||_e.status==0&&_e.response?ge(_e.response):me()},_e.onerror=me,_e.send(null)});var X,K=E.print||console.log.bind(console),q=E.printErr||console.warn.bind(console);Object.assign(E,W),W=null,E.thisProgram&&(z=E.thisProgram),E.quit&&(Z=E.quit),E.wasmBinary&&(X=E.wasmBinary);var J=E.noExitRuntime||!1;typeof WebAssembly!="object"&&He("no native wasm support detected");var Q,ee,re,ie,ae,ne,te=!1,oe=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ue(ce,ge,me){var _e=(ge>>>=0)+me;for(me=ge;ce[me]&&!(me>=_e);)++me;if(16(xe=(240&xe)==224?(15&xe)<<12|Ce<<6|Ne:(7&xe)<<18|Ce<<12|Ne<<6|63&ce[ge++])?_e+=String.fromCharCode(xe):(xe-=65536,_e+=String.fromCharCode(55296|xe>>10,56320|1023&xe))}}else _e+=String.fromCharCode(xe)}return _e}function de(ce,ge){return(ce>>>=0)?ue(ie,ce,ge):""}function pe(ce,ge,me,_e){if(!(0<_e))return 0;var xe=me>>>=0;_e=me+_e-1;for(var Ce=0;Ce=Ne&&(Ne=65536+((1023&Ne)<<10)|1023&ce.charCodeAt(++Ce)),127>=Ne){if(me>=_e)break;ge[me++>>>0]=Ne}else{if(2047>=Ne){if(me+1>=_e)break;ge[me++>>>0]=192|Ne>>6}else{if(65535>=Ne){if(me+2>=_e)break;ge[me++>>>0]=224|Ne>>12}else{if(me+3>=_e)break;ge[me++>>>0]=240|Ne>>18,ge[me++>>>0]=128|Ne>>12&63}ge[me++>>>0]=128|Ne>>6&63}ge[me++>>>0]=128|63&Ne}}return ge[me>>>0]=0,me-xe}function he(ce){for(var ge=0,me=0;me=_e?ge++:2047>=_e?ge+=2:55296<=_e&&57343>=_e?(ge+=4,++me):ge+=3}return ge}function we(){var ce=Q.buffer;ee=ce,E.HEAP8=re=new Int8Array(ce),E.HEAP16=new Int16Array(ce),E.HEAP32=ae=new Int32Array(ce),E.HEAPU8=ie=new Uint8Array(ce),E.HEAPU16=new Uint16Array(ce),E.HEAPU32=ne=new Uint32Array(ce),E.HEAPF32=new Float32Array(ce),E.HEAPF64=new Float64Array(ce)}var ye,Me=[],Pe=[],Re=[],De=[],Le=0;function $e(){var ce=E.preRun.shift();Me.unshift(ce)}var Oe,Ee=0,Be=null;function He(ce){throw E.onAbort&&E.onAbort(ce),q(ce="Aborted("+ce+")"),te=!0,ce=new WebAssembly.RuntimeError(ce+". Build with -sASSERTIONS for more info."),R(ce),ce}function We(){return Oe.startsWith("data:application/octet-stream;base64,")}if(Oe="ort-wasm.wasm",!We()){var Ke=Oe;Oe=E.locateFile?E.locateFile(Ke,j):j+Ke}function Je(){var ce=Oe;try{if(ce==Oe&&X)return new Uint8Array(X);if(O)return O(ce);throw"both async and sync fetching of the wasm failed"}catch(ge){He(ge)}}function tt(ce){this.name="ExitStatus",this.message="Program terminated with exit("+ce+")",this.status=ce}function mt(ce){for(;0>2>>>0]=ge},this.Eb=function(){return ne[this.zb+4>>2>>>0]},this.Sb=function(ge){ne[this.zb+8>>2>>>0]=ge},this.Wb=function(){return ne[this.zb+8>>2>>>0]},this.Tb=function(){ae[this.zb>>2>>>0]=0},this.Ib=function(ge){re[this.zb+12>>0>>>0]=ge?1:0},this.Pb=function(){return re[this.zb+12>>0>>>0]!=0},this.Jb=function(ge){re[this.zb+13>>0>>>0]=ge?1:0},this.Lb=function(){return re[this.zb+13>>0>>>0]!=0},this.Rb=function(ge,me){this.Fb(0),this.Ub(ge),this.Sb(me),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){ae[this.zb>>2>>>0]+=1},this.Xb=function(){var ge=ae[this.zb>>2>>>0];return ae[this.zb>>2>>>0]=ge-1,ge===1},this.Fb=function(ge){ne[this.zb+16>>2>>>0]=ge},this.Ob=function(){return ne[this.zb+16>>2>>>0]},this.Qb=function(){if(qt(this.Eb()))return ne[this.Db>>2>>>0];var ge=this.Ob();return ge!==0?ge:this.Db}}function yt(ce){return kt(new ct(ce).zb)}var At=[];function qe(ce){var ge=At[ce];return ge||(ce>=At.length&&(At.length=ce+1),At[ce]=ge=ye.get(ce)),ge}function Bt(ce){var ge=he(ce)+1,me=ze(ge);return me&&pe(ce,re,me,ge),me}var xt={};function Mt(){if(!Dt){var ce,ge={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",_:z||"./this.program"};for(ce in xt)xt[ce]===void 0?delete ge[ce]:ge[ce]=xt[ce];var me=[];for(ce in ge)me.push(ce+"="+ge[ce]);Dt=me}return Dt}var Dt,Ot=[null,[],[]];function _t(ce,ge){var me=Ot[ce];ge===0||ge===10?((ce===1?K:q)(ue(me,0)),me.length=0):me.push(ge)}var ft=0;function Gt(ce){return ce%4==0&&(ce%100!=0||ce%400==0)}var Ye=[31,29,31,30,31,30,31,31,30,31,30,31],Pt=[31,28,31,30,31,30,31,31,30,31,30,31];function Wt(ce,ge,me,_e){function xe(Ie,dt,wt){for(Ie=typeof Ie=="number"?Ie.toString():Ie||"";Ie.lengthXt?-1:0zt-Ie.getDate())){Ie.setDate(Ie.getDate()+dt);break}dt-=zt-Ie.getDate()+1,Ie.setDate(1),11>wt?Ie.setMonth(wt+1):(Ie.setMonth(0),Ie.setFullYear(Ie.getFullYear()+1))}return wt=new Date(Ie.getFullYear()+1,0,4),dt=Ue(new Date(Ie.getFullYear(),0,4)),wt=Ue(wt),0>=Ne(dt,Ie)?0>=Ne(wt,Ie)?Ie.getFullYear()+1:Ie.getFullYear():Ie.getFullYear()-1}var nt=ae[_e+40>>2>>>0];for(var vt in _e={$b:ae[_e>>2>>>0],Zb:ae[_e+4>>2>>>0],Gb:ae[_e+8>>2>>>0],Kb:ae[_e+12>>2>>>0],Hb:ae[_e+16>>2>>>0],Cb:ae[_e+20>>2>>>0],Ab:ae[_e+24>>2>>>0],Bb:ae[_e+28>>2>>>0],bc:ae[_e+32>>2>>>0],Yb:ae[_e+36>>2>>>0],ac:nt?de(nt):""},me=de(me),nt={"%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"})me=me.replace(new RegExp(vt,"g"),nt[vt]);var Lt="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Et="January February March April May June July August September October November December".split(" ");for(vt in nt={"%a":function(Ie){return Lt[Ie.Ab].substring(0,3)},"%A":function(Ie){return Lt[Ie.Ab]},"%b":function(Ie){return Et[Ie.Hb].substring(0,3)},"%B":function(Ie){return Et[Ie.Hb]},"%C":function(Ie){return Ce((Ie.Cb+1900)/100|0,2)},"%d":function(Ie){return Ce(Ie.Kb,2)},"%e":function(Ie){return xe(Ie.Kb,2," ")},"%g":function(Ie){return Ze(Ie).toString().substring(2)},"%G":function(Ie){return Ze(Ie)},"%H":function(Ie){return Ce(Ie.Gb,2)},"%I":function(Ie){return(Ie=Ie.Gb)==0?Ie=12:12Ie.Gb?"AM":"PM"},"%S":function(Ie){return Ce(Ie.$b,2)},"%t":function(){return" "},"%u":function(Ie){return Ie.Ab||7},"%U":function(Ie){return Ce(Math.floor((Ie.Bb+7-Ie.Ab)/7),2)},"%V":function(Ie){var dt=Math.floor((Ie.Bb+7-(Ie.Ab+6)%7)/7);if(2>=(Ie.Ab+371-Ie.Bb-2)%7&&dt++,dt)dt==53&&((wt=(Ie.Ab+371-Ie.Bb)%7)==4||wt==3&&Gt(Ie.Cb)||(dt=1));else{dt=52;var wt=(Ie.Ab+7-Ie.Bb-1)%7;(wt==4||wt==5&&Gt(Ie.Cb%400-1))&&dt++}return Ce(dt,2)},"%w":function(Ie){return Ie.Ab},"%W":function(Ie){return Ce(Math.floor((Ie.Bb+7-(Ie.Ab+6)%7)/7),2)},"%y":function(Ie){return(Ie.Cb+1900).toString().substring(2)},"%Y":function(Ie){return Ie.Cb+1900},"%z":function(Ie){var dt=0<=(Ie=Ie.Yb);return Ie=Math.abs(Ie)/60,(dt?"+":"-")+String("0000"+(Ie/60*100+Ie%60)).slice(-4)},"%Z":function(Ie){return Ie.ac},"%%":function(){return"%"}},me=me.replace(/%%/g,"\0\0"),nt)me.includes(vt)&&(me=me.replace(new RegExp(vt,"g"),nt[vt](_e)));return vt=function(Ie){var dt=Array(he(Ie)+1);return pe(Ie,dt,0,dt.length),dt}(me=me.replace(/\0\0/g,"%")),vt.length>ge?0:(re.set(vt,ce>>>0),vt.length-1)}var St={a:function(ce){return ze(ce+24)+24},m:function(ce){return(ce=new ct(ce)).Pb()||(ce.Ib(!0),bt--),ce.Jb(!1),pt.push(ce),ce.Nb(),ce.Qb()},ia:function(ce){throw q("Unexpected exception thrown, this is not properly supported - aborting"),te=!0,ce},w:function(){et(0);var ce=pt.pop();if(ce.Xb()&&!ce.Lb()){var ge=ce.Wb();ge&&qe(ge)(ce.Db),yt(ce.Db)}gt=0},d:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},k:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},g:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},s:yt,L:function(){var ce=pt.pop();ce||He("no exception to throw");var ge=ce.Db;throw ce.Lb()||(pt.push(ce),ce.Jb(!0),ce.Ib(!1),bt++),gt=ge,ge},b:function(ce,ge,me){throw new ct(ce).Rb(ge,me),gt=ce,bt++,ce},la:function(){return bt},i:function(ce){throw gt||(gt=ce),ce},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){He("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){He("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(ce,ge){ce=new Date(1e3*(ne[ce>>>2]+4294967296*ae[ce+4>>>2])),ae[ge>>2>>>0]=ce.getUTCSeconds(),ae[ge+4>>2>>>0]=ce.getUTCMinutes(),ae[ge+8>>2>>>0]=ce.getUTCHours(),ae[ge+12>>2>>>0]=ce.getUTCDate(),ae[ge+16>>2>>>0]=ce.getUTCMonth(),ae[ge+20>>2>>>0]=ce.getUTCFullYear()-1900,ae[ge+24>>2>>>0]=ce.getUTCDay(),ae[ge+28>>2>>>0]=(ce.getTime()-Date.UTC(ce.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(ce,ge){ce=new Date(1e3*(ne[ce>>>2]+4294967296*ae[ce+4>>>2])),ae[ge>>2>>>0]=ce.getSeconds(),ae[ge+4>>2>>>0]=ce.getMinutes(),ae[ge+8>>2>>>0]=ce.getHours(),ae[ge+12>>2>>>0]=ce.getDate(),ae[ge+16>>2>>>0]=ce.getMonth(),ae[ge+20>>2>>>0]=ce.getFullYear()-1900,ae[ge+24>>2>>>0]=ce.getDay();var me=new Date(ce.getFullYear(),0,1);ae[ge+28>>2>>>0]=(ce.getTime()-me.getTime())/864e5|0,ae[ge+36>>2>>>0]=-60*ce.getTimezoneOffset();var _e=new Date(ce.getFullYear(),6,1).getTimezoneOffset();me=me.getTimezoneOffset(),ae[ge+32>>2>>>0]=0|(_e!=me&&ce.getTimezoneOffset()==Math.min(me,_e))},Fa:function(ce){var ge=new Date(ae[ce+20>>2>>>0]+1900,ae[ce+16>>2>>>0],ae[ce+12>>2>>>0],ae[ce+8>>2>>>0],ae[ce+4>>2>>>0],ae[ce>>2>>>0],0),me=ae[ce+32>>2>>>0],_e=ge.getTimezoneOffset(),xe=new Date(ge.getFullYear(),0,1),Ce=new Date(ge.getFullYear(),6,1).getTimezoneOffset(),Ne=xe.getTimezoneOffset(),Ue=Math.min(Ne,Ce);return 0>me?ae[ce+32>>2>>>0]=Number(Ce!=Ne&&Ue==_e):0>2>>>0]=ge.getDay(),ae[ce+28>>2>>>0]=(ge.getTime()-xe.getTime())/864e5|0,ae[ce>>2>>>0]=ge.getSeconds(),ae[ce+4>>2>>>0]=ge.getMinutes(),ae[ce+8>>2>>>0]=ge.getHours(),ae[ce+12>>2>>>0]=ge.getDate(),ae[ce+16>>2>>>0]=ge.getMonth(),ge.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function ce(ge,me,_e){ce.Vb||(ce.Vb=!0,function(xe,Ce,Ne){function Ue(Et){return(Et=Et.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Et[1]:"GMT"}var Ze=new Date().getFullYear(),nt=new Date(Ze,0,1),vt=new Date(Ze,6,1);Ze=nt.getTimezoneOffset();var Lt=vt.getTimezoneOffset();ae[xe>>2>>>0]=60*Math.max(Ze,Lt),ae[Ce>>2>>>0]=Number(Ze!=Lt),xe=Ue(nt),Ce=Ue(vt),xe=Bt(xe),Ce=Bt(Ce),Lt>2>>>0]=xe,ne[Ne+4>>2>>>0]=Ce):(ne[Ne>>2>>>0]=Ce,ne[Ne+4>>2>>>0]=xe)}(ge,me,_e))},B:function(){He("")},ma:function(){return 4294901760},I:U?()=>{var ce=process.hrtime();return 1e3*ce[0]+ce[1]/1e6}:()=>performance.now(),xa:function(ce,ge,me){ie.copyWithin(ce>>>0,ge>>>0,ge+me>>>0)},G:function(ce){var ge=ie.length;if(4294901760<(ce>>>=0))return!1;for(var me=1;4>=me;me*=2){var _e=ge*(1+.2/me);_e=Math.min(_e,ce+100663296);var xe=Math;_e=Math.max(ce,_e),xe=xe.min.call(xe,4294901760,_e+(65536-_e%65536)%65536);e:{try{Q.grow(xe-ee.byteLength+65535>>>16),we();var Ce=1;break e}catch{}Ce=void 0}if(Ce)return!0}return!1},va:function(ce,ge){var me=0;return Mt().forEach(function(_e,xe){var Ce=ge+me;for(xe=ne[ce+4*xe>>2>>>0]=Ce,Ce=0;Ce<_e.length;++Ce)re[xe++>>0>>>0]=_e.charCodeAt(Ce);re[xe>>0>>>0]=0,me+=_e.length+1}),0},wa:function(ce,ge){var me=Mt();ne[ce>>2>>>0]=me.length;var _e=0;return me.forEach(function(xe){_e+=xe.length+1}),ne[ge>>2>>>0]=_e,0},ba:function(ce){J||0>2>>>0],Ue=ne[ge+4>>2>>>0];ge+=8;for(var Ze=0;Ze>>0]);xe+=Ue}return ne[_e>>2>>>0]=xe,0},c:function(){return ft},ja:function ce(ge,me){ce.Mb||(ce.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var xe=new Uint8Array(1);return()=>(crypto.getRandomValues(xe),xe[0])}if(U)try{var Ce=_(Object(function(){var Ne=new Error("Cannot find module 'crypto'");throw Ne.code="MODULE_NOT_FOUND",Ne}()));return()=>Ce.randomBytes(1)[0]}catch{}return()=>He("randomDevice")}());for(var _e=0;_e>0>>>0]=ce.Mb();return 0},ea:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},fa:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},J:function(ce){var ge=Xe();try{return qe(ce)()}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},e:function(ce,ge){var me=Xe();try{return qe(ce)(ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},N:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},O:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},j:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},o:function(ce,ge,me,_e){var xe=Xe();try{return qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},p:function(ce,ge,me,_e,xe){var Ce=Xe();try{return qe(ce)(ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},M:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{return qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},r:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{return qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},v:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},K:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},D:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt){var Et=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt)}catch(Ie){if(Qe(Et),Ie!==Ie+0)throw Ie;et(1,0)}},X:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{return jt(ce,ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},V:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{return Ft(ce,ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},U:function(ce,ge,me,_e,xe){var Ce=Xe();try{return nr(ce,ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},Z:function(ce,ge,me,_e){var xe=Xe();try{return Yt(ce,ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},W:function(ce){var ge=Xe();try{return Qt(ce)}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},Y:function(ce,ge){var me=Xe();try{return Ut(ce,ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},T:function(ce,ge,me){var _e=Xe();try{return er(ce,ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},f:function(ce){var ge=Xe();try{qe(ce)()}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},q:function(ce,ge){var me=Xe();try{qe(ce)(ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},h:function(ce,ge,me){var _e=Xe();try{qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},da:function(ce,ge,me,_e){var xe=Xe();try{qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},l:function(ce,ge,me,_e){var xe=Xe();try{qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},t:function(ce,ge,me,_e,xe){var Ce=Xe();try{qe(ce)(ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},u:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},x:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},z:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},ga:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze){var nt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze)}catch(vt){if(Qe(nt),vt!==vt+0)throw vt;et(1,0)}},A:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt){var Lt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt)}catch(Et){if(Qe(Lt),Et!==Et+0)throw Et;et(1,0)}},C:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt,Et,Ie,dt,wt){var zt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt,Et,Ie,dt,wt)}catch(Xt){if(Qe(zt),Xt!==Xt+0)throw Xt;et(1,0)}},aa:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{Tt(ce,ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},_:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt){var Et=Xe();try{Ve(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt)}catch(Ie){if(Qe(Et),Ie!==Ie+0)throw Ie;et(1,0)}},$:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{be(ce,ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},n:function(ce){return ce},F:function(ce){ft=ce},ha:Wt,y:function(ce,ge,me,_e){return Wt(ce,ge,me,_e)}};(function(){function ce(xe){E.asm=xe.exports,Q=E.asm.Ka,we(),ye=E.asm.ib,Pe.unshift(E.asm.La),Ee--,E.monitorRunDependencies&&E.monitorRunDependencies(Ee),Ee==0&&Be&&(xe=Be,Be=null,xe())}function ge(xe){ce(xe.instance)}function me(xe){return function(){if(!X&&(H||Y)){if(typeof fetch=="function"&&!Oe.startsWith("file://"))return fetch(Oe,{credentials:"same-origin"}).then(function(Ce){if(!Ce.ok)throw"failed to load wasm binary file at '"+Oe+"'";return Ce.arrayBuffer()}).catch(function(){return Je()});if(G)return new Promise(function(Ce,Ne){G(Oe,function(Ue){Ce(new Uint8Array(Ue))},Ne)})}return Promise.resolve().then(function(){return Je()})}().then(function(Ce){return WebAssembly.instantiate(Ce,_e)}).then(function(Ce){return Ce}).then(xe,function(Ce){q("failed to asynchronously prepare wasm: "+Ce),He(Ce)})}var _e={a:St};if(Ee++,E.monitorRunDependencies&&E.monitorRunDependencies(Ee),E.instantiateWasm)try{return E.instantiateWasm(_e,ce)}catch(xe){return q("Module.instantiateWasm callback failed with error: "+xe),!1}(X||typeof WebAssembly.instantiateStreaming!="function"||We()||Oe.startsWith("file://")||U||typeof fetch!="function"?me(ge):fetch(Oe,{credentials:"same-origin"}).then(function(xe){return WebAssembly.instantiateStreaming(xe,_e).then(ge,function(Ce){return q("wasm streaming compile failed: "+Ce),q("falling back to ArrayBuffer instantiation"),me(ge)})})).catch(R)})(),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 Ge,ze=E._malloc=function(){return(ze=E._malloc=E.asm.eb).apply(null,arguments)},kt=E._free=function(){return(kt=E._free=E.asm.fb).apply(null,arguments)},Nt=E._fflush=function(){return(Nt=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)},et=E._setThrew=function(){return(et=E._setThrew=E.asm.jb).apply(null,arguments)},Xe=E.stackSave=function(){return(Xe=E.stackSave=E.asm.kb).apply(null,arguments)},Qe=E.stackRestore=function(){return(Qe=E.stackRestore=E.asm.lb).apply(null,arguments)},Jt=E.stackAlloc=function(){return(Jt=E.stackAlloc=E.asm.mb).apply(null,arguments)},Rt=E.___cxa_can_catch=function(){return(Rt=E.___cxa_can_catch=E.asm.nb).apply(null,arguments)},qt=E.___cxa_is_pointer_type=function(){return(qt=E.___cxa_is_pointer_type=E.asm.ob).apply(null,arguments)},Qt=E.dynCall_j=function(){return(Qt=E.dynCall_j=E.asm.pb).apply(null,arguments)},Ft=E.dynCall_iiiiij=function(){return(Ft=E.dynCall_iiiiij=E.asm.qb).apply(null,arguments)},er=E.dynCall_jii=function(){return(er=E.dynCall_jii=E.asm.rb).apply(null,arguments)},Tt=E.dynCall_viiiiij=function(){return(Tt=E.dynCall_viiiiij=E.asm.sb).apply(null,arguments)},be=E.dynCall_vjji=function(){return(be=E.dynCall_vjji=E.asm.tb).apply(null,arguments)},Ve=E.dynCall_viiijjjii=function(){return(Ve=E.dynCall_viiijjjii=E.asm.ub).apply(null,arguments)},Yt=E.dynCall_iij=function(){return(Yt=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)},jt=E.dynCall_iiiiiij=function(){return(jt=E.dynCall_iiiiiij=E.asm.xb).apply(null,arguments)},nr=E.dynCall_iiij=function(){return(nr=E.dynCall_iiij=E.asm.yb).apply(null,arguments)};function ar(){function ce(){if(!Ge&&(Ge=!0,E.calledRun=!0,!te)){if(mt(Pe),P(E),E.onRuntimeInitialized&&E.onRuntimeInitialized(),E.postRun)for(typeof E.postRun=="function"&&(E.postRun=[E.postRun]);E.postRun.length;){var ge=E.postRun.shift();De.unshift(ge)}mt(De)}}if(!(0{x.exports=function(c,_){for(var T=new Array(arguments.length-1),C=0,M=2,E=!0;M{var _=c;_.length=function(P){var R=P.length;if(!R)return 0;for(var $=0;--R%4>1&&P.charAt(R)==="=";)++$;return Math.ceil(3*P.length)/4-$};for(var T=new Array(64),C=new Array(123),M=0;M<64;)C[T[M]=M<26?M+65:M<52?M+71:M<62?M-4:M-59|43]=M++;_.encode=function(P,R,$){for(var G,O=null,L=[],F=0,V=0;R<$;){var W=P[R++];switch(V){case 0:L[F++]=T[W>>2],G=(3&W)<<4,V=1;break;case 1:L[F++]=T[G|W>>4],G=(15&W)<<2,V=2;break;case 2:L[F++]=T[G|W>>6],L[F++]=T[63&W],V=0}F>8191&&((O||(O=[])).push(String.fromCharCode.apply(String,L)),F=0)}return V&&(L[F++]=T[G],L[F++]=61,V===1&&(L[F++]=61)),O?(F&&O.push(String.fromCharCode.apply(String,L.slice(0,F))),O.join("")):String.fromCharCode.apply(String,L.slice(0,F))};var E="invalid encoding";_.decode=function(P,R,$){for(var G,O=$,L=0,F=0;F1)break;if((V=C[V])===void 0)throw Error(E);switch(L){case 0:G=V,L=1;break;case 1:R[$++]=G<<2|(48&V)>>4,G=V,L=2;break;case 2:R[$++]=(15&G)<<4|(60&V)>>2,G=V,L=3;break;case 3:R[$++]=(3&G)<<6|V,L=0}}if(L===1)throw Error(E);return $-O},_.test=function(P){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(P)}},9211:x=>{function c(){this._listeners={}}x.exports=c,c.prototype.on=function(_,T,C){return(this._listeners[_]||(this._listeners[_]=[])).push({fn:T,ctx:C||this}),this},c.prototype.off=function(_,T){if(_===void 0)this._listeners={};else if(T===void 0)this._listeners[_]=[];else for(var C=this._listeners[_],M=0;M{function c(E){return typeof Float32Array<"u"?function(){var P=new Float32Array([-0]),R=new Uint8Array(P.buffer),$=R[3]===128;function G(V,W,z){P[0]=V,W[z]=R[0],W[z+1]=R[1],W[z+2]=R[2],W[z+3]=R[3]}function O(V,W,z){P[0]=V,W[z]=R[3],W[z+1]=R[2],W[z+2]=R[1],W[z+3]=R[0]}function L(V,W){return R[0]=V[W],R[1]=V[W+1],R[2]=V[W+2],R[3]=V[W+3],P[0]}function F(V,W){return R[3]=V[W],R[2]=V[W+1],R[1]=V[W+2],R[0]=V[W+3],P[0]}E.writeFloatLE=$?G:O,E.writeFloatBE=$?O:G,E.readFloatLE=$?L:F,E.readFloatBE=$?F:L}():function(){function P($,G,O,L){var F=G<0?1:0;if(F&&(G=-G),G===0)$(1/G>0?0:2147483648,O,L);else if(isNaN(G))$(2143289344,O,L);else if(G>34028234663852886e22)$((F<<31|2139095040)>>>0,O,L);else if(G<11754943508222875e-54)$((F<<31|Math.round(G/1401298464324817e-60))>>>0,O,L);else{var V=Math.floor(Math.log(G)/Math.LN2);$((F<<31|V+127<<23|8388607&Math.round(G*Math.pow(2,-V)*8388608))>>>0,O,L)}}function R($,G,O){var L=$(G,O),F=2*(L>>31)+1,V=L>>>23&255,W=8388607&L;return V===255?W?NaN:F*(1/0):V===0?1401298464324817e-60*F*W:F*Math.pow(2,V-150)*(W+8388608)}E.writeFloatLE=P.bind(null,_),E.writeFloatBE=P.bind(null,T),E.readFloatLE=R.bind(null,C),E.readFloatBE=R.bind(null,M)}(),typeof Float64Array<"u"?function(){var P=new Float64Array([-0]),R=new Uint8Array(P.buffer),$=R[7]===128;function G(V,W,z){P[0]=V,W[z]=R[0],W[z+1]=R[1],W[z+2]=R[2],W[z+3]=R[3],W[z+4]=R[4],W[z+5]=R[5],W[z+6]=R[6],W[z+7]=R[7]}function O(V,W,z){P[0]=V,W[z]=R[7],W[z+1]=R[6],W[z+2]=R[5],W[z+3]=R[4],W[z+4]=R[3],W[z+5]=R[2],W[z+6]=R[1],W[z+7]=R[0]}function L(V,W){return R[0]=V[W],R[1]=V[W+1],R[2]=V[W+2],R[3]=V[W+3],R[4]=V[W+4],R[5]=V[W+5],R[6]=V[W+6],R[7]=V[W+7],P[0]}function F(V,W){return R[7]=V[W],R[6]=V[W+1],R[5]=V[W+2],R[4]=V[W+3],R[3]=V[W+4],R[2]=V[W+5],R[1]=V[W+6],R[0]=V[W+7],P[0]}E.writeDoubleLE=$?G:O,E.writeDoubleBE=$?O:G,E.readDoubleLE=$?L:F,E.readDoubleBE=$?F:L}():function(){function P($,G,O,L,F,V){var W=L<0?1:0;if(W&&(L=-L),L===0)$(0,F,V+G),$(1/L>0?0:2147483648,F,V+O);else if(isNaN(L))$(0,F,V+G),$(2146959360,F,V+O);else if(L>17976931348623157e292)$(0,F,V+G),$((W<<31|2146435072)>>>0,F,V+O);else{var z;if(L<22250738585072014e-324)$((z=L/5e-324)>>>0,F,V+G),$((W<<31|z/4294967296)>>>0,F,V+O);else{var Z=Math.floor(Math.log(L)/Math.LN2);Z===1024&&(Z=1023),$(4503599627370496*(z=L*Math.pow(2,-Z))>>>0,F,V+G),$((W<<31|Z+1023<<20|1048576*z&1048575)>>>0,F,V+O)}}}function R($,G,O,L,F){var V=$(L,F+G),W=$(L,F+O),z=2*(W>>31)+1,Z=W>>>20&2047,H=4294967296*(1048575&W)+V;return Z===2047?H?NaN:z*(1/0):Z===0?5e-324*z*H:z*Math.pow(2,Z-1075)*(H+4503599627370496)}E.writeDoubleLE=P.bind(null,_,0,4),E.writeDoubleBE=P.bind(null,T,4,0),E.readDoubleLE=R.bind(null,C,0,4),E.readDoubleBE=R.bind(null,M,4,0)}(),E}function _(E,P,R){P[R]=255&E,P[R+1]=E>>>8&255,P[R+2]=E>>>16&255,P[R+3]=E>>>24}function T(E,P,R){P[R]=E>>>24,P[R+1]=E>>>16&255,P[R+2]=E>>>8&255,P[R+3]=255&E}function C(E,P){return(E[P]|E[P+1]<<8|E[P+2]<<16|E[P+3]<<24)>>>0}function M(E,P){return(E[P]<<24|E[P+1]<<16|E[P+2]<<8|E[P+3])>>>0}x.exports=c(c)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(x){}return null}module.exports=inquire},6662:x=>{x.exports=function(c,_,T){var C=T||8192,M=C>>>1,E=null,P=C;return function(R){if(R<1||R>M)return c(R);P+R>C&&(E=c(C),P=0);var $=_.call(E,P,P+=R);return 7&P&&(P=1+(7|P)),$}}},4997:(x,c)=>{var _=c;_.length=function(T){for(var C=0,M=0,E=0;E191&&E<224?R[$++]=(31&E)<<6|63&T[C++]:E>239&&E<365?(E=((7&E)<<18|(63&T[C++])<<12|(63&T[C++])<<6|63&T[C++])-65536,R[$++]=55296+(E>>10),R[$++]=56320+(1023&E)):R[$++]=(15&E)<<12|(63&T[C++])<<6|63&T[C++],$>8191&&((P||(P=[])).push(String.fromCharCode.apply(String,R)),$=0);return P?($&&P.push(String.fromCharCode.apply(String,R.slice(0,$))),P.join("")):String.fromCharCode.apply(String,R.slice(0,$))},_.write=function(T,C,M){for(var E,P,R=M,$=0;$>6|192,C[M++]=63&E|128):(64512&E)==55296&&(64512&(P=T.charCodeAt($+1)))==56320?(E=65536+((1023&E)<<10)+(1023&P),++$,C[M++]=E>>18|240,C[M++]=E>>12&63|128,C[M++]=E>>6&63|128,C[M++]=63&E|128):(C[M++]=E>>12|224,C[M++]=E>>6&63|128,C[M++]=63&E|128);return M-R}},3442:(x,c)=>{c.__esModule=!0;var _=function(){function T(C){if(!C)throw new TypeError("Invalid argument; `value` has no value.");this.value=T.EMPTY,C&&T.isGuid(C)&&(this.value=C)}return T.isGuid=function(C){var M=C.toString();return C&&(C instanceof T||T.validator.test(M))},T.create=function(){return new T([T.gen(2),T.gen(1),T.gen(1),T.gen(1),T.gen(3)].join("-"))},T.createEmpty=function(){return new T("emptyguid")},T.parse=function(C){return new T(C)},T.raw=function(){return[T.gen(2),T.gen(1),T.gen(1),T.gen(1),T.gen(3)].join("-")},T.gen=function(C){for(var M="",E=0;E{x.exports=_;var c=null;try{c=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 _(J,Q,ee){this.low=0|J,this.high=0|Q,this.unsigned=!!ee}function T(J){return(J&&J.__isLong__)===!0}_.prototype.__isLong__,Object.defineProperty(_.prototype,"__isLong__",{value:!0}),_.isLong=T;var C={},M={};function E(J,Q){var ee,re,ie;return Q?(ie=0<=(J>>>=0)&&J<256)&&(re=M[J])?re:(ee=R(J,(0|J)<0?-1:0,!0),ie&&(M[J]=ee),ee):(ie=-128<=(J|=0)&&J<128)&&(re=C[J])?re:(ee=R(J,J<0?-1:0,!1),ie&&(C[J]=ee),ee)}function P(J,Q){if(isNaN(J))return Q?Z:z;if(Q){if(J<0)return Z;if(J>=F)return X}else{if(J<=-V)return K;if(J+1>=V)return j}return J<0?P(-J,Q).neg():R(J%L|0,J/L|0,Q)}function R(J,Q,ee){return new _(J,Q,ee)}_.fromInt=E,_.fromNumber=P,_.fromBits=R;var $=Math.pow;function G(J,Q,ee){if(J.length===0)throw Error("empty string");if(J==="NaN"||J==="Infinity"||J==="+Infinity"||J==="-Infinity")return z;if(typeof Q=="number"?(ee=Q,Q=!1):Q=!!Q,(ee=ee||10)<2||360)throw Error("interior hyphen");if(re===0)return G(J.substring(1),Q,ee).neg();for(var ie=P($(ee,8)),ae=z,ne=0;ne>>0:this.low},q.toNumber=function(){return this.unsigned?(this.high>>>0)*L+(this.low>>>0):this.high*L+(this.low>>>0)},q.toString=function(J){if((J=J||10)<2||36>>0).toString(J);if((ae=te).isZero())return oe+ne;for(;oe.length<6;)oe="0"+oe;ne=""+oe+ne}},q.getHighBits=function(){return this.high},q.getHighBitsUnsigned=function(){return this.high>>>0},q.getLowBits=function(){return this.low},q.getLowBitsUnsigned=function(){return this.low>>>0},q.getNumBitsAbs=function(){if(this.isNegative())return this.eq(K)?64:this.neg().getNumBitsAbs();for(var J=this.high!=0?this.high:this.low,Q=31;Q>0&&!(J&1<=0},q.isOdd=function(){return(1&this.low)==1},q.isEven=function(){return(1&this.low)==0},q.equals=function(J){return T(J)||(J=O(J)),(this.unsigned===J.unsigned||this.high>>>31!=1||J.high>>>31!=1)&&this.high===J.high&&this.low===J.low},q.eq=q.equals,q.notEquals=function(J){return!this.eq(J)},q.neq=q.notEquals,q.ne=q.notEquals,q.lessThan=function(J){return this.comp(J)<0},q.lt=q.lessThan,q.lessThanOrEqual=function(J){return this.comp(J)<=0},q.lte=q.lessThanOrEqual,q.le=q.lessThanOrEqual,q.greaterThan=function(J){return this.comp(J)>0},q.gt=q.greaterThan,q.greaterThanOrEqual=function(J){return this.comp(J)>=0},q.gte=q.greaterThanOrEqual,q.ge=q.greaterThanOrEqual,q.compare=function(J){if(T(J)||(J=O(J)),this.eq(J))return 0;var Q=this.isNegative(),ee=J.isNegative();return Q&&!ee?-1:!Q&&ee?1:this.unsigned?J.high>>>0>this.high>>>0||J.high===this.high&&J.low>>>0>this.low>>>0?-1:1:this.sub(J).isNegative()?-1:1},q.comp=q.compare,q.negate=function(){return!this.unsigned&&this.eq(K)?K:this.not().add(H)},q.neg=q.negate,q.add=function(J){T(J)||(J=O(J));var Q=this.high>>>16,ee=65535&this.high,re=this.low>>>16,ie=65535&this.low,ae=J.high>>>16,ne=65535&J.high,te=J.low>>>16,oe=0,ue=0,de=0,pe=0;return de+=(pe+=ie+(65535&J.low))>>>16,ue+=(de+=re+te)>>>16,oe+=(ue+=ee+ne)>>>16,oe+=Q+ae,R((de&=65535)<<16|(pe&=65535),(oe&=65535)<<16|(ue&=65535),this.unsigned)},q.subtract=function(J){return T(J)||(J=O(J)),this.add(J.neg())},q.sub=q.subtract,q.multiply=function(J){if(this.isZero())return z;if(T(J)||(J=O(J)),c)return R(c.mul(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned);if(J.isZero())return z;if(this.eq(K))return J.isOdd()?K:z;if(J.eq(K))return this.isOdd()?K:z;if(this.isNegative())return J.isNegative()?this.neg().mul(J.neg()):this.neg().mul(J).neg();if(J.isNegative())return this.mul(J.neg()).neg();if(this.lt(W)&&J.lt(W))return P(this.toNumber()*J.toNumber(),this.unsigned);var Q=this.high>>>16,ee=65535&this.high,re=this.low>>>16,ie=65535&this.low,ae=J.high>>>16,ne=65535&J.high,te=J.low>>>16,oe=65535&J.low,ue=0,de=0,pe=0,he=0;return pe+=(he+=ie*oe)>>>16,de+=(pe+=re*oe)>>>16,pe&=65535,de+=(pe+=ie*te)>>>16,ue+=(de+=ee*oe)>>>16,de&=65535,ue+=(de+=re*te)>>>16,de&=65535,ue+=(de+=ie*ne)>>>16,ue+=Q*oe+ee*te+re*ne+ie*ae,R((pe&=65535)<<16|(he&=65535),(ue&=65535)<<16|(de&=65535),this.unsigned)},q.mul=q.multiply,q.divide=function(J){if(T(J)||(J=O(J)),J.isZero())throw Error("division by zero");var Q,ee,re;if(c)return this.unsigned||this.high!==-2147483648||J.low!==-1||J.high!==-1?R((this.unsigned?c.div_u:c.div_s)(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Z:z;if(this.unsigned){if(J.unsigned||(J=J.toUnsigned()),J.gt(this))return Z;if(J.gt(this.shru(1)))return Y;re=Z}else{if(this.eq(K))return J.eq(H)||J.eq(U)?K:J.eq(K)?H:(Q=this.shr(1).div(J).shl(1)).eq(z)?J.isNegative()?H:U:(ee=this.sub(J.mul(Q)),re=Q.add(ee.div(J)));if(J.eq(K))return this.unsigned?Z:z;if(this.isNegative())return J.isNegative()?this.neg().div(J.neg()):this.neg().div(J).neg();if(J.isNegative())return this.div(J.neg()).neg();re=z}for(ee=this;ee.gte(J);){Q=Math.max(1,Math.floor(ee.toNumber()/J.toNumber()));for(var ie=Math.ceil(Math.log(Q)/Math.LN2),ae=ie<=48?1:$(2,ie-48),ne=P(Q),te=ne.mul(J);te.isNegative()||te.gt(ee);)te=(ne=P(Q-=ae,this.unsigned)).mul(J);ne.isZero()&&(ne=H),re=re.add(ne),ee=ee.sub(te)}return re},q.div=q.divide,q.modulo=function(J){return T(J)||(J=O(J)),c?R((this.unsigned?c.rem_u:c.rem_s)(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned):this.sub(this.div(J).mul(J))},q.mod=q.modulo,q.rem=q.modulo,q.not=function(){return R(~this.low,~this.high,this.unsigned)},q.and=function(J){return T(J)||(J=O(J)),R(this.low&J.low,this.high&J.high,this.unsigned)},q.or=function(J){return T(J)||(J=O(J)),R(this.low|J.low,this.high|J.high,this.unsigned)},q.xor=function(J){return T(J)||(J=O(J)),R(this.low^J.low,this.high^J.high,this.unsigned)},q.shiftLeft=function(J){return T(J)&&(J=J.toInt()),(J&=63)==0?this:J<32?R(this.low<>>32-J,this.unsigned):R(0,this.low<>>J|this.high<<32-J,this.high>>J,this.unsigned):R(this.high>>J-32,this.high>=0?0:-1,this.unsigned)},q.shr=q.shiftRight,q.shiftRightUnsigned=function(J){if(T(J)&&(J=J.toInt()),(J&=63)==0)return this;var Q=this.high;return J<32?R(this.low>>>J|Q<<32-J,Q>>>J,this.unsigned):R(J===32?Q:Q>>>J-32,0,this.unsigned)},q.shru=q.shiftRightUnsigned,q.shr_u=q.shiftRightUnsigned,q.toSigned=function(){return this.unsigned?R(this.low,this.high,!1):this},q.toUnsigned=function(){return this.unsigned?this:R(this.low,this.high,!0)},q.toBytes=function(J){return J?this.toBytesLE():this.toBytesBE()},q.toBytesLE=function(){var J=this.high,Q=this.low;return[255&Q,Q>>>8&255,Q>>>16&255,Q>>>24,255&J,J>>>8&255,J>>>16&255,J>>>24]},q.toBytesBE=function(){var J=this.high,Q=this.low;return[J>>>24,J>>>16&255,J>>>8&255,255&J,Q>>>24,Q>>>16&255,Q>>>8&255,255&Q]},_.fromBytes=function(J,Q,ee){return ee?_.fromBytesLE(J,Q):_.fromBytesBE(J,Q)},_.fromBytesLE=function(J,Q){return new _(J[0]|J[1]<<8|J[2]<<16|J[3]<<24,J[4]|J[5]<<8|J[6]<<16|J[7]<<24,Q)},_.fromBytesBE=function(J,Q){return new _(J[4]<<24|J[5]<<16|J[6]<<8|J[7],J[0]<<24|J[1]<<16|J[2]<<8|J[3],Q)}},1446:(x,c,_)=>{var T,C,M,E=_(2100),P=E.Reader,R=E.Writer,$=E.util,G=E.roots.default||(E.roots.default={});G.onnx=((M={}).Version=(T={},(C=Object.create(T))[T[0]="_START_VERSION"]=0,C[T[1]="IR_VERSION_2017_10_10"]=1,C[T[2]="IR_VERSION_2017_10_30"]=2,C[T[3]="IR_VERSION_2017_11_3"]=3,C[T[4]="IR_VERSION_2019_1_22"]=4,C[T[5]="IR_VERSION"]=5,C),M.AttributeProto=function(){function O(L){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.name=L.string();break;case 21:W.refAttrName=L.string();break;case 13:W.docString=L.string();break;case 20:W.type=L.int32();break;case 2:W.f=L.float();break;case 3:W.i=L.int64();break;case 4:W.s=L.bytes();break;case 5:W.t=G.onnx.TensorProto.decode(L,L.uint32());break;case 6:W.g=G.onnx.GraphProto.decode(L,L.uint32());break;case 7:if(W.floats&&W.floats.length||(W.floats=[]),(7&z)==2)for(var Z=L.uint32()+L.pos;L.pos>>0,L.i.high>>>0).toNumber())),L.s!=null&&(typeof L.s=="string"?$.base64.decode(L.s,F.s=$.newBuffer($.base64.length(L.s)),0):L.s.length&&(F.s=L.s)),L.t!=null){if(typeof L.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");F.t=G.onnx.TensorProto.fromObject(L.t)}if(L.g!=null){if(typeof L.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");F.g=G.onnx.GraphProto.fromObject(L.g)}if(L.floats){if(!Array.isArray(L.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");F.floats=[];for(var V=0;V>>0,L.ints[V].high>>>0).toNumber())}if(L.strings){if(!Array.isArray(L.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(F.strings=[],V=0;V>>0,L.i.high>>>0).toNumber():L.i),L.s!=null&&L.hasOwnProperty("s")&&(V.s=F.bytes===String?$.base64.encode(L.s,0,L.s.length):F.bytes===Array?Array.prototype.slice.call(L.s):L.s),L.t!=null&&L.hasOwnProperty("t")&&(V.t=G.onnx.TensorProto.toObject(L.t,F)),L.g!=null&&L.hasOwnProperty("g")&&(V.g=G.onnx.GraphProto.toObject(L.g,F)),L.floats&&L.floats.length){V.floats=[];for(var z=0;z>>0,L.ints[z].high>>>0).toNumber():L.ints[z];if(L.strings&&L.strings.length)for(V.strings=[],z=0;z>>3){case 1:W.name=L.string();break;case 2:W.type=G.onnx.TypeProto.decode(L,L.uint32());break;case 3:W.docString=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.name!=null&&L.hasOwnProperty("name")&&!$.isString(L.name))return"name: string expected";if(L.type!=null&&L.hasOwnProperty("type")){var F=G.onnx.TypeProto.verify(L.type);if(F)return"type."+F}return L.docString!=null&&L.hasOwnProperty("docString")&&!$.isString(L.docString)?"docString: string expected":null},O.fromObject=function(L){if(L instanceof G.onnx.ValueInfoProto)return L;var F=new G.onnx.ValueInfoProto;if(L.name!=null&&(F.name=String(L.name)),L.type!=null){if(typeof L.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");F.type=G.onnx.TypeProto.fromObject(L.type)}return L.docString!=null&&(F.docString=String(L.docString)),F},O.toObject=function(L,F){F||(F={});var V={};return F.defaults&&(V.name="",V.type=null,V.docString=""),L.name!=null&&L.hasOwnProperty("name")&&(V.name=L.name),L.type!=null&&L.hasOwnProperty("type")&&(V.type=G.onnx.TypeProto.toObject(L.type,F)),L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M.NodeProto=function(){function O(L){if(this.input=[],this.output=[],this.attribute=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.input&&W.input.length||(W.input=[]),W.input.push(L.string());break;case 2:W.output&&W.output.length||(W.output=[]),W.output.push(L.string());break;case 3:W.name=L.string();break;case 4:W.opType=L.string();break;case 7:W.domain=L.string();break;case 5:W.attribute&&W.attribute.length||(W.attribute=[]),W.attribute.push(G.onnx.AttributeProto.decode(L,L.uint32()));break;case 6:W.docString=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.input!=null&&L.hasOwnProperty("input")){if(!Array.isArray(L.input))return"input: array expected";for(var F=0;F>>3){case 1:W.irVersion=L.int64();break;case 8:W.opsetImport&&W.opsetImport.length||(W.opsetImport=[]),W.opsetImport.push(G.onnx.OperatorSetIdProto.decode(L,L.uint32()));break;case 2:W.producerName=L.string();break;case 3:W.producerVersion=L.string();break;case 4:W.domain=L.string();break;case 5:W.modelVersion=L.int64();break;case 6:W.docString=L.string();break;case 7:W.graph=G.onnx.GraphProto.decode(L,L.uint32());break;case 14:W.metadataProps&&W.metadataProps.length||(W.metadataProps=[]),W.metadataProps.push(G.onnx.StringStringEntryProto.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.irVersion!=null&&L.hasOwnProperty("irVersion")&&!($.isInteger(L.irVersion)||L.irVersion&&$.isInteger(L.irVersion.low)&&$.isInteger(L.irVersion.high)))return"irVersion: integer|Long expected";if(L.opsetImport!=null&&L.hasOwnProperty("opsetImport")){if(!Array.isArray(L.opsetImport))return"opsetImport: array expected";for(var F=0;F>>0,L.irVersion.high>>>0).toNumber())),L.opsetImport){if(!Array.isArray(L.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");F.opsetImport=[];for(var V=0;V>>0,L.modelVersion.high>>>0).toNumber())),L.docString!=null&&(F.docString=String(L.docString)),L.graph!=null){if(typeof L.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");F.graph=G.onnx.GraphProto.fromObject(L.graph)}if(L.metadataProps){if(!Array.isArray(L.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(F.metadataProps=[],V=0;V>>0,L.irVersion.high>>>0).toNumber():L.irVersion),L.producerName!=null&&L.hasOwnProperty("producerName")&&(V.producerName=L.producerName),L.producerVersion!=null&&L.hasOwnProperty("producerVersion")&&(V.producerVersion=L.producerVersion),L.domain!=null&&L.hasOwnProperty("domain")&&(V.domain=L.domain),L.modelVersion!=null&&L.hasOwnProperty("modelVersion")&&(typeof L.modelVersion=="number"?V.modelVersion=F.longs===String?String(L.modelVersion):L.modelVersion:V.modelVersion=F.longs===String?$.Long.prototype.toString.call(L.modelVersion):F.longs===Number?new $.LongBits(L.modelVersion.low>>>0,L.modelVersion.high>>>0).toNumber():L.modelVersion),L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),L.graph!=null&&L.hasOwnProperty("graph")&&(V.graph=G.onnx.GraphProto.toObject(L.graph,F)),L.opsetImport&&L.opsetImport.length){V.opsetImport=[];for(var z=0;z>>3){case 1:W.key=L.string();break;case 2:W.value=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){return typeof L!="object"||L===null?"object expected":L.key!=null&&L.hasOwnProperty("key")&&!$.isString(L.key)?"key: string expected":L.value!=null&&L.hasOwnProperty("value")&&!$.isString(L.value)?"value: string expected":null},O.fromObject=function(L){if(L instanceof G.onnx.StringStringEntryProto)return L;var F=new G.onnx.StringStringEntryProto;return L.key!=null&&(F.key=String(L.key)),L.value!=null&&(F.value=String(L.value)),F},O.toObject=function(L,F){F||(F={});var V={};return F.defaults&&(V.key="",V.value=""),L.key!=null&&L.hasOwnProperty("key")&&(V.key=L.key),L.value!=null&&L.hasOwnProperty("value")&&(V.value=L.value),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M.TensorAnnotation=function(){function O(L){if(this.quantParameterTensorNames=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.tensorName=L.string();break;case 2:W.quantParameterTensorNames&&W.quantParameterTensorNames.length||(W.quantParameterTensorNames=[]),W.quantParameterTensorNames.push(G.onnx.StringStringEntryProto.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.tensorName!=null&&L.hasOwnProperty("tensorName")&&!$.isString(L.tensorName))return"tensorName: string expected";if(L.quantParameterTensorNames!=null&&L.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(L.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var F=0;F>>3){case 1:W.node&&W.node.length||(W.node=[]),W.node.push(G.onnx.NodeProto.decode(L,L.uint32()));break;case 2:W.name=L.string();break;case 5:W.initializer&&W.initializer.length||(W.initializer=[]),W.initializer.push(G.onnx.TensorProto.decode(L,L.uint32()));break;case 10:W.docString=L.string();break;case 11:W.input&&W.input.length||(W.input=[]),W.input.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 12:W.output&&W.output.length||(W.output=[]),W.output.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 13:W.valueInfo&&W.valueInfo.length||(W.valueInfo=[]),W.valueInfo.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 14:W.quantizationAnnotation&&W.quantizationAnnotation.length||(W.quantizationAnnotation=[]),W.quantizationAnnotation.push(G.onnx.TensorAnnotation.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.node!=null&&L.hasOwnProperty("node")){if(!Array.isArray(L.node))return"node: array expected";for(var F=0;F>>3){case 1:if(W.dims&&W.dims.length||(W.dims=[]),(7&z)==2)for(var Z=L.uint32()+L.pos;L.pos>>0,L.dims[V].high>>>0).toNumber())}if(L.dataType!=null&&(F.dataType=0|L.dataType),L.segment!=null){if(typeof L.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");F.segment=G.onnx.TensorProto.Segment.fromObject(L.segment)}if(L.floatData){if(!Array.isArray(L.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(F.floatData=[],V=0;V>>0,L.int64Data[V].high>>>0).toNumber())}if(L.name!=null&&(F.name=String(L.name)),L.docString!=null&&(F.docString=String(L.docString)),L.rawData!=null&&(typeof L.rawData=="string"?$.base64.decode(L.rawData,F.rawData=$.newBuffer($.base64.length(L.rawData)),0):L.rawData.length&&(F.rawData=L.rawData)),L.externalData){if(!Array.isArray(L.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(F.externalData=[],V=0;V>>0,L.uint64Data[V].high>>>0).toNumber(!0))}return F},O.toObject=function(L,F){F||(F={});var V={};if((F.arrays||F.defaults)&&(V.dims=[],V.floatData=[],V.int32Data=[],V.stringData=[],V.int64Data=[],V.doubleData=[],V.uint64Data=[],V.externalData=[]),F.defaults&&(V.dataType=0,V.segment=null,V.name="",F.bytes===String?V.rawData="":(V.rawData=[],F.bytes!==Array&&(V.rawData=$.newBuffer(V.rawData))),V.docString="",V.dataLocation=F.enums===String?"DEFAULT":0),L.dims&&L.dims.length){V.dims=[];for(var W=0;W>>0,L.dims[W].high>>>0).toNumber():L.dims[W]}if(L.dataType!=null&&L.hasOwnProperty("dataType")&&(V.dataType=L.dataType),L.segment!=null&&L.hasOwnProperty("segment")&&(V.segment=G.onnx.TensorProto.Segment.toObject(L.segment,F)),L.floatData&&L.floatData.length)for(V.floatData=[],W=0;W>>0,L.int64Data[W].high>>>0).toNumber():L.int64Data[W];if(L.name!=null&&L.hasOwnProperty("name")&&(V.name=L.name),L.rawData!=null&&L.hasOwnProperty("rawData")&&(V.rawData=F.bytes===String?$.base64.encode(L.rawData,0,L.rawData.length):F.bytes===Array?Array.prototype.slice.call(L.rawData):L.rawData),L.doubleData&&L.doubleData.length)for(V.doubleData=[],W=0;W>>0,L.uint64Data[W].high>>>0).toNumber(!0):L.uint64Data[W];if(L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),L.externalData&&L.externalData.length)for(V.externalData=[],W=0;W>>3){case 1:z.begin=F.int64();break;case 2:z.end=F.int64();break;default:F.skipType(7&Z)}}return z},L.decodeDelimited=function(F){return F instanceof P||(F=new P(F)),this.decode(F,F.uint32())},L.verify=function(F){return typeof F!="object"||F===null?"object expected":F.begin!=null&&F.hasOwnProperty("begin")&&!($.isInteger(F.begin)||F.begin&&$.isInteger(F.begin.low)&&$.isInteger(F.begin.high))?"begin: integer|Long expected":F.end!=null&&F.hasOwnProperty("end")&&!($.isInteger(F.end)||F.end&&$.isInteger(F.end.low)&&$.isInteger(F.end.high))?"end: integer|Long expected":null},L.fromObject=function(F){if(F instanceof G.onnx.TensorProto.Segment)return F;var V=new G.onnx.TensorProto.Segment;return F.begin!=null&&($.Long?(V.begin=$.Long.fromValue(F.begin)).unsigned=!1:typeof F.begin=="string"?V.begin=parseInt(F.begin,10):typeof F.begin=="number"?V.begin=F.begin:typeof F.begin=="object"&&(V.begin=new $.LongBits(F.begin.low>>>0,F.begin.high>>>0).toNumber())),F.end!=null&&($.Long?(V.end=$.Long.fromValue(F.end)).unsigned=!1:typeof F.end=="string"?V.end=parseInt(F.end,10):typeof F.end=="number"?V.end=F.end:typeof F.end=="object"&&(V.end=new $.LongBits(F.end.low>>>0,F.end.high>>>0).toNumber())),V},L.toObject=function(F,V){V||(V={});var W={};if(V.defaults){if($.Long){var z=new $.Long(0,0,!1);W.begin=V.longs===String?z.toString():V.longs===Number?z.toNumber():z}else W.begin=V.longs===String?"0":0;$.Long?(z=new $.Long(0,0,!1),W.end=V.longs===String?z.toString():V.longs===Number?z.toNumber():z):W.end=V.longs===String?"0":0}return F.begin!=null&&F.hasOwnProperty("begin")&&(typeof F.begin=="number"?W.begin=V.longs===String?String(F.begin):F.begin:W.begin=V.longs===String?$.Long.prototype.toString.call(F.begin):V.longs===Number?new $.LongBits(F.begin.low>>>0,F.begin.high>>>0).toNumber():F.begin),F.end!=null&&F.hasOwnProperty("end")&&(typeof F.end=="number"?W.end=V.longs===String?String(F.end):F.end:W.end=V.longs===String?$.Long.prototype.toString.call(F.end):V.longs===Number?new $.LongBits(F.end.low>>>0,F.end.high>>>0).toNumber():F.end),W},L.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},L}(),O.DataLocation=function(){var L={},F=Object.create(L);return F[L[0]="DEFAULT"]=0,F[L[1]="EXTERNAL"]=1,F}(),O}(),M.TensorShapeProto=function(){function O(L){if(this.dim=[],L)for(var F=Object.keys(L),V=0;V>>3==1?(W.dim&&W.dim.length||(W.dim=[]),W.dim.push(G.onnx.TensorShapeProto.Dimension.decode(L,L.uint32()))):L.skipType(7&z)}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.dim!=null&&L.hasOwnProperty("dim")){if(!Array.isArray(L.dim))return"dim: array expected";for(var F=0;F>>3){case 1:Z.dimValue=V.int64();break;case 2:Z.dimParam=V.string();break;case 3:Z.denotation=V.string();break;default:V.skipType(7&H)}}return Z},L.decodeDelimited=function(V){return V instanceof P||(V=new P(V)),this.decode(V,V.uint32())},L.verify=function(V){if(typeof V!="object"||V===null)return"object expected";var W={};if(V.dimValue!=null&&V.hasOwnProperty("dimValue")&&(W.value=1,!($.isInteger(V.dimValue)||V.dimValue&&$.isInteger(V.dimValue.low)&&$.isInteger(V.dimValue.high))))return"dimValue: integer|Long expected";if(V.dimParam!=null&&V.hasOwnProperty("dimParam")){if(W.value===1)return"value: multiple values";if(W.value=1,!$.isString(V.dimParam))return"dimParam: string expected"}return V.denotation!=null&&V.hasOwnProperty("denotation")&&!$.isString(V.denotation)?"denotation: string expected":null},L.fromObject=function(V){if(V instanceof G.onnx.TensorShapeProto.Dimension)return V;var W=new G.onnx.TensorShapeProto.Dimension;return V.dimValue!=null&&($.Long?(W.dimValue=$.Long.fromValue(V.dimValue)).unsigned=!1:typeof V.dimValue=="string"?W.dimValue=parseInt(V.dimValue,10):typeof V.dimValue=="number"?W.dimValue=V.dimValue:typeof V.dimValue=="object"&&(W.dimValue=new $.LongBits(V.dimValue.low>>>0,V.dimValue.high>>>0).toNumber())),V.dimParam!=null&&(W.dimParam=String(V.dimParam)),V.denotation!=null&&(W.denotation=String(V.denotation)),W},L.toObject=function(V,W){W||(W={});var z={};return W.defaults&&(z.denotation=""),V.dimValue!=null&&V.hasOwnProperty("dimValue")&&(typeof V.dimValue=="number"?z.dimValue=W.longs===String?String(V.dimValue):V.dimValue:z.dimValue=W.longs===String?$.Long.prototype.toString.call(V.dimValue):W.longs===Number?new $.LongBits(V.dimValue.low>>>0,V.dimValue.high>>>0).toNumber():V.dimValue,W.oneofs&&(z.value="dimValue")),V.dimParam!=null&&V.hasOwnProperty("dimParam")&&(z.dimParam=V.dimParam,W.oneofs&&(z.value="dimParam")),V.denotation!=null&&V.hasOwnProperty("denotation")&&(z.denotation=V.denotation),z},L.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},L}(),O}(),M.TypeProto=function(){function O(F){if(F)for(var V=Object.keys(F),W=0;W>>3){case 1:z.tensorType=G.onnx.TypeProto.Tensor.decode(F,F.uint32());break;case 6:z.denotation=F.string();break;default:F.skipType(7&Z)}}return z},O.decodeDelimited=function(F){return F instanceof P||(F=new P(F)),this.decode(F,F.uint32())},O.verify=function(F){if(typeof F!="object"||F===null)return"object expected";if(F.tensorType!=null&&F.hasOwnProperty("tensorType")){var V=G.onnx.TypeProto.Tensor.verify(F.tensorType);if(V)return"tensorType."+V}return F.denotation!=null&&F.hasOwnProperty("denotation")&&!$.isString(F.denotation)?"denotation: string expected":null},O.fromObject=function(F){if(F instanceof G.onnx.TypeProto)return F;var V=new G.onnx.TypeProto;if(F.tensorType!=null){if(typeof F.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");V.tensorType=G.onnx.TypeProto.Tensor.fromObject(F.tensorType)}return F.denotation!=null&&(V.denotation=String(F.denotation)),V},O.toObject=function(F,V){V||(V={});var W={};return V.defaults&&(W.denotation=""),F.tensorType!=null&&F.hasOwnProperty("tensorType")&&(W.tensorType=G.onnx.TypeProto.Tensor.toObject(F.tensorType,V),V.oneofs&&(W.value="tensorType")),F.denotation!=null&&F.hasOwnProperty("denotation")&&(W.denotation=F.denotation),W},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O.Tensor=function(){function F(V){if(V)for(var W=Object.keys(V),z=0;z>>3){case 1:Z.elemType=V.int32();break;case 2:Z.shape=G.onnx.TensorShapeProto.decode(V,V.uint32());break;default:V.skipType(7&H)}}return Z},F.decodeDelimited=function(V){return V instanceof P||(V=new P(V)),this.decode(V,V.uint32())},F.verify=function(V){if(typeof V!="object"||V===null)return"object expected";if(V.elemType!=null&&V.hasOwnProperty("elemType")&&!$.isInteger(V.elemType))return"elemType: integer expected";if(V.shape!=null&&V.hasOwnProperty("shape")){var W=G.onnx.TensorShapeProto.verify(V.shape);if(W)return"shape."+W}return null},F.fromObject=function(V){if(V instanceof G.onnx.TypeProto.Tensor)return V;var W=new G.onnx.TypeProto.Tensor;if(V.elemType!=null&&(W.elemType=0|V.elemType),V.shape!=null){if(typeof V.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");W.shape=G.onnx.TensorShapeProto.fromObject(V.shape)}return W},F.toObject=function(V,W){W||(W={});var z={};return W.defaults&&(z.elemType=0,z.shape=null),V.elemType!=null&&V.hasOwnProperty("elemType")&&(z.elemType=V.elemType),V.shape!=null&&V.hasOwnProperty("shape")&&(z.shape=G.onnx.TensorShapeProto.toObject(V.shape,W)),z},F.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},F}(),O}(),M.OperatorSetIdProto=function(){function O(L){if(L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.domain=L.string();break;case 2:W.version=L.int64();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){return typeof L!="object"||L===null?"object expected":L.domain!=null&&L.hasOwnProperty("domain")&&!$.isString(L.domain)?"domain: string expected":L.version!=null&&L.hasOwnProperty("version")&&!($.isInteger(L.version)||L.version&&$.isInteger(L.version.low)&&$.isInteger(L.version.high))?"version: integer|Long expected":null},O.fromObject=function(L){if(L instanceof G.onnx.OperatorSetIdProto)return L;var F=new G.onnx.OperatorSetIdProto;return L.domain!=null&&(F.domain=String(L.domain)),L.version!=null&&($.Long?(F.version=$.Long.fromValue(L.version)).unsigned=!1:typeof L.version=="string"?F.version=parseInt(L.version,10):typeof L.version=="number"?F.version=L.version:typeof L.version=="object"&&(F.version=new $.LongBits(L.version.low>>>0,L.version.high>>>0).toNumber())),F},O.toObject=function(L,F){F||(F={});var V={};if(F.defaults)if(V.domain="",$.Long){var W=new $.Long(0,0,!1);V.version=F.longs===String?W.toString():F.longs===Number?W.toNumber():W}else V.version=F.longs===String?"0":0;return L.domain!=null&&L.hasOwnProperty("domain")&&(V.domain=L.domain),L.version!=null&&L.hasOwnProperty("version")&&(typeof L.version=="number"?V.version=F.longs===String?String(L.version):L.version:V.version=F.longs===String?$.Long.prototype.toString.call(L.version):F.longs===Number?new $.LongBits(L.version.low>>>0,L.version.high>>>0).toNumber():L.version),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M),x.exports=G},2100:(x,c,_)=>{x.exports=_(9482)},9482:(x,c,_)=>{var T=c;function C(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}T.build="minimal",T.Writer=_(1173),T.BufferWriter=_(3155),T.Reader=_(1408),T.BufferReader=_(593),T.util=_(9693),T.rpc=_(5994),T.roots=_(5054),T.configure=C,C()},1408:(x,c,_)=>{x.exports=R;var T,C=_(9693),M=C.LongBits,E=C.utf8;function P(W,z){return RangeError("index out of range: "+W.pos+" + "+(z||1)+" > "+W.len)}function R(W){this.buf=W,this.pos=0,this.len=W.length}var $,G=typeof Uint8Array<"u"?function(W){if(W instanceof Uint8Array||Array.isArray(W))return new R(W);throw Error("illegal buffer")}:function(W){if(Array.isArray(W))return new R(W);throw Error("illegal buffer")},O=function(){return C.Buffer?function(W){return(R.create=function(z){return C.Buffer.isBuffer(z)?new T(z):G(z)})(W)}:G};function L(){var W=new M(0,0),z=0;if(!(this.len-this.pos>4)){for(;z<3;++z){if(this.pos>=this.len)throw P(this);if(W.lo=(W.lo|(127&this.buf[this.pos])<<7*z)>>>0,this.buf[this.pos++]<128)return W}return W.lo=(W.lo|(127&this.buf[this.pos++])<<7*z)>>>0,W}for(;z<4;++z)if(W.lo=(W.lo|(127&this.buf[this.pos])<<7*z)>>>0,this.buf[this.pos++]<128)return W;if(W.lo=(W.lo|(127&this.buf[this.pos])<<28)>>>0,W.hi=(W.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return W;if(z=0,this.len-this.pos>4){for(;z<5;++z)if(W.hi=(W.hi|(127&this.buf[this.pos])<<7*z+3)>>>0,this.buf[this.pos++]<128)return W}else for(;z<5;++z){if(this.pos>=this.len)throw P(this);if(W.hi=(W.hi|(127&this.buf[this.pos])<<7*z+3)>>>0,this.buf[this.pos++]<128)return W}throw Error("invalid varint encoding")}function F(W,z){return(W[z-4]|W[z-3]<<8|W[z-2]<<16|W[z-1]<<24)>>>0}function V(){if(this.pos+8>this.len)throw P(this,8);return new M(F(this.buf,this.pos+=4),F(this.buf,this.pos+=4))}R.create=O(),R.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice,R.prototype.uint32=($=4294967295,function(){if($=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||($=($|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||($=($|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||($=($|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||($=($|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return $;if((this.pos+=5)>this.len)throw this.pos=this.len,P(this,10);return $}),R.prototype.int32=function(){return 0|this.uint32()},R.prototype.sint32=function(){var W=this.uint32();return W>>>1^-(1&W)|0},R.prototype.bool=function(){return this.uint32()!==0},R.prototype.fixed32=function(){if(this.pos+4>this.len)throw P(this,4);return F(this.buf,this.pos+=4)},R.prototype.sfixed32=function(){if(this.pos+4>this.len)throw P(this,4);return 0|F(this.buf,this.pos+=4)},R.prototype.float=function(){if(this.pos+4>this.len)throw P(this,4);var W=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,W},R.prototype.double=function(){if(this.pos+8>this.len)throw P(this,4);var W=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,W},R.prototype.bytes=function(){var W=this.uint32(),z=this.pos,Z=this.pos+W;if(Z>this.len)throw P(this,W);return this.pos+=W,Array.isArray(this.buf)?this.buf.slice(z,Z):z===Z?new this.buf.constructor(0):this._slice.call(this.buf,z,Z)},R.prototype.string=function(){var W=this.bytes();return E.read(W,0,W.length)},R.prototype.skip=function(W){if(typeof W=="number"){if(this.pos+W>this.len)throw P(this,W);this.pos+=W}else do if(this.pos>=this.len)throw P(this);while(128&this.buf[this.pos++]);return this},R.prototype.skipType=function(W){switch(W){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(W=7&this.uint32())!=4;)this.skipType(W);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+W+" at offset "+this.pos)}return this},R._configure=function(W){T=W,R.create=O(),T._configure();var z=C.Long?"toLong":"toNumber";C.merge(R.prototype,{int64:function(){return L.call(this)[z](!1)},uint64:function(){return L.call(this)[z](!0)},sint64:function(){return L.call(this).zzDecode()[z](!1)},fixed64:function(){return V.call(this)[z](!0)},sfixed64:function(){return V.call(this)[z](!1)}})}},593:(x,c,_)=>{x.exports=M;var T=_(1408);(M.prototype=Object.create(T.prototype)).constructor=M;var C=_(9693);function M(E){T.call(this,E)}M._configure=function(){C.Buffer&&(M.prototype._slice=C.Buffer.prototype.slice)},M.prototype.string=function(){var E=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+E,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+E,this.len))},M._configure()},5054:x=>{x.exports={}},5994:(x,c,_)=>{c.Service=_(7948)},7948:(x,c,_)=>{x.exports=C;var T=_(9693);function C(M,E,P){if(typeof M!="function")throw TypeError("rpcImpl must be a function");T.EventEmitter.call(this),this.rpcImpl=M,this.requestDelimited=Boolean(E),this.responseDelimited=Boolean(P)}(C.prototype=Object.create(T.EventEmitter.prototype)).constructor=C,C.prototype.rpcCall=function M(E,P,R,$,G){if(!$)throw TypeError("request must be specified");var O=this;if(!G)return T.asPromise(M,O,E,P,R,$);if(O.rpcImpl)try{return O.rpcImpl(E,P[O.requestDelimited?"encodeDelimited":"encode"]($).finish(),function(L,F){if(L)return O.emit("error",L,E),G(L);if(F!==null){if(!(F instanceof R))try{F=R[O.responseDelimited?"decodeDelimited":"decode"](F)}catch(V){return O.emit("error",V,E),G(V)}return O.emit("data",F,E),G(null,F)}O.end(!0)})}catch(L){return O.emit("error",L,E),void setTimeout(function(){G(L)},0)}else setTimeout(function(){G(Error("already ended"))},0)},C.prototype.end=function(M){return this.rpcImpl&&(M||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(x,c,_)=>{x.exports=C;var T=_(9693);function C(R,$){this.lo=R>>>0,this.hi=$>>>0}var M=C.zero=new C(0,0);M.toNumber=function(){return 0},M.zzEncode=M.zzDecode=function(){return this},M.length=function(){return 1};var E=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(R){if(R===0)return M;var $=R<0;$&&(R=-R);var G=R>>>0,O=(R-G)/4294967296>>>0;return $&&(O=~O>>>0,G=~G>>>0,++G>4294967295&&(G=0,++O>4294967295&&(O=0))),new C(G,O)},C.from=function(R){if(typeof R=="number")return C.fromNumber(R);if(T.isString(R)){if(!T.Long)return C.fromNumber(parseInt(R,10));R=T.Long.fromString(R)}return R.low||R.high?new C(R.low>>>0,R.high>>>0):M},C.prototype.toNumber=function(R){if(!R&&this.hi>>>31){var $=1+~this.lo>>>0,G=~this.hi>>>0;return $||(G=G+1>>>0),-($+4294967296*G)}return this.lo+4294967296*this.hi},C.prototype.toLong=function(R){return T.Long?new T.Long(0|this.lo,0|this.hi,Boolean(R)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(R)}};var P=String.prototype.charCodeAt;C.fromHash=function(R){return R===E?M:new C((P.call(R,0)|P.call(R,1)<<8|P.call(R,2)<<16|P.call(R,3)<<24)>>>0,(P.call(R,4)|P.call(R,5)<<8|P.call(R,6)<<16|P.call(R,7)<<24)>>>0)},C.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)},C.prototype.zzEncode=function(){var R=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^R)>>>0,this.lo=(this.lo<<1^R)>>>0,this},C.prototype.zzDecode=function(){var R=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^R)>>>0,this.hi=(this.hi>>>1^R)>>>0,this},C.prototype.length=function(){var R=this.lo,$=(this.lo>>>28|this.hi<<4)>>>0,G=this.hi>>>24;return G===0?$===0?R<16384?R<128?1:2:R<2097152?3:4:$<16384?$<128?5:6:$<2097152?7:8:G<128?9:10}},9693:function(x,c,_){var T=c;function C(E,P,R){for(var $=Object.keys(P),G=0;G<$.length;++G)E[$[G]]!==void 0&&R||(E[$[G]]=P[$[G]]);return E}function M(E){function P(R,$){if(!(this instanceof P))return new P(R,$);Object.defineProperty(this,"message",{get:function(){return R}}),Error.captureStackTrace?Error.captureStackTrace(this,P):Object.defineProperty(this,"stack",{value:new Error().stack||""}),$&&C(this,$)}return(P.prototype=Object.create(Error.prototype)).constructor=P,Object.defineProperty(P.prototype,"name",{get:function(){return E}}),P.prototype.toString=function(){return this.name+": "+this.message},P}T.asPromise=_(4537),T.base64=_(7419),T.EventEmitter=_(9211),T.float=_(945),T.inquire=_(7199),T.utf8=_(4997),T.pool=_(6662),T.LongBits=_(1945),T.isNode=Boolean(_.g!==void 0&&_.g&&_.g.process&&_.g.process.versions&&_.g.process.versions.node),T.global=T.isNode&&_.g||typeof window<"u"&&window||typeof self<"u"&&self||this,T.emptyArray=Object.freeze?Object.freeze([]):[],T.emptyObject=Object.freeze?Object.freeze({}):{},T.isInteger=Number.isInteger||function(E){return typeof E=="number"&&isFinite(E)&&Math.floor(E)===E},T.isString=function(E){return typeof E=="string"||E instanceof String},T.isObject=function(E){return E&&typeof E=="object"},T.isset=T.isSet=function(E,P){var R=E[P];return!(R==null||!E.hasOwnProperty(P))&&(typeof R!="object"||(Array.isArray(R)?R.length:Object.keys(R).length)>0)},T.Buffer=function(){try{var E=T.inquire("buffer").Buffer;return E.prototype.utf8Write?E:null}catch{return null}}(),T._Buffer_from=null,T._Buffer_allocUnsafe=null,T.newBuffer=function(E){return typeof E=="number"?T.Buffer?T._Buffer_allocUnsafe(E):new T.Array(E):T.Buffer?T._Buffer_from(E):typeof Uint8Array>"u"?E:new Uint8Array(E)},T.Array=typeof Uint8Array<"u"?Uint8Array:Array,T.Long=T.global.dcodeIO&&T.global.dcodeIO.Long||T.global.Long||T.inquire("long"),T.key2Re=/^true|false|0|1$/,T.key32Re=/^-?(?:0|[1-9][0-9]*)$/,T.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,T.longToHash=function(E){return E?T.LongBits.from(E).toHash():T.LongBits.zeroHash},T.longFromHash=function(E,P){var R=T.LongBits.fromHash(E);return T.Long?T.Long.fromBits(R.lo,R.hi,P):R.toNumber(Boolean(P))},T.merge=C,T.lcFirst=function(E){return E.charAt(0).toLowerCase()+E.substring(1)},T.newError=M,T.ProtocolError=M("ProtocolError"),T.oneOfGetter=function(E){for(var P={},R=0;R-1;--G)if(P[$[G]]===1&&this[$[G]]!==void 0&&this[$[G]]!==null)return $[G]}},T.oneOfSetter=function(E){return function(P){for(var R=0;R{x.exports=O;var T,C=_(9693),M=C.LongBits,E=C.base64,P=C.utf8;function R(H,Y,U){this.fn=H,this.len=Y,this.next=void 0,this.val=U}function $(){}function G(H){this.head=H.head,this.tail=H.tail,this.len=H.len,this.next=H.states}function O(){this.len=0,this.head=new R($,0,0),this.tail=this.head,this.states=null}var L=function(){return C.Buffer?function(){return(O.create=function(){return new T})()}:function(){return new O}};function F(H,Y,U){Y[U]=255&H}function V(H,Y){this.len=H,this.next=void 0,this.val=Y}function W(H,Y,U){for(;H.hi;)Y[U++]=127&H.lo|128,H.lo=(H.lo>>>7|H.hi<<25)>>>0,H.hi>>>=7;for(;H.lo>127;)Y[U++]=127&H.lo|128,H.lo=H.lo>>>7;Y[U++]=H.lo}function z(H,Y,U){Y[U]=255&H,Y[U+1]=H>>>8&255,Y[U+2]=H>>>16&255,Y[U+3]=H>>>24}O.create=L(),O.alloc=function(H){return new C.Array(H)},C.Array!==Array&&(O.alloc=C.pool(O.alloc,C.Array.prototype.subarray)),O.prototype._push=function(H,Y,U){return this.tail=this.tail.next=new R(H,Y,U),this.len+=Y,this},V.prototype=Object.create(R.prototype),V.prototype.fn=function(H,Y,U){for(;H>127;)Y[U++]=127&H|128,H>>>=7;Y[U]=H},O.prototype.uint32=function(H){return this.len+=(this.tail=this.tail.next=new V((H>>>=0)<128?1:H<16384?2:H<2097152?3:H<268435456?4:5,H)).len,this},O.prototype.int32=function(H){return H<0?this._push(W,10,M.fromNumber(H)):this.uint32(H)},O.prototype.sint32=function(H){return this.uint32((H<<1^H>>31)>>>0)},O.prototype.uint64=function(H){var Y=M.from(H);return this._push(W,Y.length(),Y)},O.prototype.int64=O.prototype.uint64,O.prototype.sint64=function(H){var Y=M.from(H).zzEncode();return this._push(W,Y.length(),Y)},O.prototype.bool=function(H){return this._push(F,1,H?1:0)},O.prototype.fixed32=function(H){return this._push(z,4,H>>>0)},O.prototype.sfixed32=O.prototype.fixed32,O.prototype.fixed64=function(H){var Y=M.from(H);return this._push(z,4,Y.lo)._push(z,4,Y.hi)},O.prototype.sfixed64=O.prototype.fixed64,O.prototype.float=function(H){return this._push(C.float.writeFloatLE,4,H)},O.prototype.double=function(H){return this._push(C.float.writeDoubleLE,8,H)};var Z=C.Array.prototype.set?function(H,Y,U){Y.set(H,U)}:function(H,Y,U){for(var j=0;j>>0;if(!Y)return this._push(F,1,0);if(C.isString(H)){var U=O.alloc(Y=E.length(H));E.decode(H,U,0),H=U}return this.uint32(Y)._push(Z,Y,H)},O.prototype.string=function(H){var Y=P.length(H);return Y?this.uint32(Y)._push(P.write,Y,H):this._push(F,1,0)},O.prototype.fork=function(){return this.states=new G(this),this.head=this.tail=new R($,0,0),this.len=0,this},O.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 R($,0,0),this.len=0),this},O.prototype.ldelim=function(){var H=this.head,Y=this.tail,U=this.len;return this.reset().uint32(U),U&&(this.tail.next=H.next,this.tail=Y,this.len+=U),this},O.prototype.finish=function(){for(var H=this.head.next,Y=this.constructor.alloc(this.len),U=0;H;)H.fn(H.val,Y,U),U+=H.len,H=H.next;return Y},O._configure=function(H){T=H,O.create=L(),T._configure()}},3155:(x,c,_)=>{x.exports=M;var T=_(1173);(M.prototype=Object.create(T.prototype)).constructor=M;var C=_(9693);function M(){T.call(this)}function E(P,R,$){P.length<40?C.utf8.write(P,R,$):R.utf8Write?R.utf8Write(P,$):R.write(P,$)}M._configure=function(){M.alloc=C._Buffer_allocUnsafe,M.writeBytesBuffer=C.Buffer&&C.Buffer.prototype instanceof Uint8Array&&C.Buffer.prototype.set.name==="set"?function(P,R,$){R.set(P,$)}:function(P,R,$){if(P.copy)P.copy(R,$,0,P.length);else for(var G=0;G>>0;return this.uint32(R),R&&this._push(M.writeBytesBuffer,R,P),this},M.prototype.string=function(P){var R=C.Buffer.byteLength(P);return this.uint32(R),R&&this._push(E,R,P),this},M._configure()},7714:(x,c,_)=>{c.R=void 0;const T=_(6919),C=_(7448);c.R=new class{async init(){}async createSessionHandler(M,E){const P=new T.Session(E);return await P.loadModel(M),new C.OnnxjsSessionHandler(P)}}},4200:(x,c,_)=>{c.c8=c.rX=void 0;const T=_(1670),C=_(5381),M=_(2157),E=_(2306);c.rX=()=>{if((typeof T.env.wasm.initTimeout!="number"||T.env.wasm.initTimeout<0)&&(T.env.wasm.initTimeout=0),typeof T.env.wasm.simd!="boolean"&&(T.env.wasm.simd=!0),typeof T.env.wasm.proxy!="boolean"&&(T.env.wasm.proxy=!1),typeof T.env.wasm.numThreads!="number"||!Number.isInteger(T.env.wasm.numThreads)||T.env.wasm.numThreads<=0){const P=typeof navigator>"u"?(0,C.cpus)().length:navigator.hardwareConcurrency;T.env.wasm.numThreads=Math.min(4,Math.ceil((P||1)/2))}},c.c8=new class{async init(){(0,c.rX)(),await(0,M.initWasm)()}async createSessionHandler(P,R){const $=new E.OnnxruntimeWebAssemblySessionHandler;return await $.loadModel(P,R),Promise.resolve($)}}},6018:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(E,P,R,$){$===void 0&&($=R);var G=Object.getOwnPropertyDescriptor(P,R);G&&!("get"in G?!P.__esModule:G.writable||G.configurable)||(G={enumerable:!0,get:function(){return P[R]}}),Object.defineProperty(E,$,G)}:function(E,P,R,$){$===void 0&&($=R),E[$]=P[R]}),C=this&&this.__exportStar||function(E,P){for(var R in E)R==="default"||Object.prototype.hasOwnProperty.call(P,R)||T(P,E,R)};Object.defineProperty(c,"__esModule",{value:!0}),C(_(1670),c);const M=_(1670);{const E=_(7714).R;(0,M.registerBackend)("webgl",E,-10)}{const E=_(4200).c8;(0,M.registerBackend)("cpu",E,10),(0,M.registerBackend)("wasm",E,10),(0,M.registerBackend)("xnnpack",E,9)}},246:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createAttributeWithCacheKey=void 0;class _{constructor(C){Object.assign(this,C)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(C=>`${this[C]}`).join(";")),this._cacheKey}}c.createAttributeWithCacheKey=T=>new _(T)},7778:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Attribute=void 0;const T=_(1446),C=_(9395),M=_(9162),E=_(2517);var P=C.onnxruntime.experimental.fbs;class R{constructor(G){if(this._attributes=new Map,G!=null){for(const O of G)O instanceof T.onnx.AttributeProto?this._attributes.set(O.name,[R.getValue(O),R.getType(O)]):O instanceof P.Attribute&&this._attributes.set(O.name(),[R.getValue(O),R.getType(O)]);if(this._attributes.sizeM.Tensor.fromProto(F));if(G instanceof P.Attribute)return L.map(F=>M.Tensor.fromOrtTensor(F))}if(O===T.onnx.AttributeProto.AttributeType.STRING&&G instanceof T.onnx.AttributeProto){const F=L;return(0,E.decodeUtf8String)(F)}return O===T.onnx.AttributeProto.AttributeType.STRINGS&&G instanceof T.onnx.AttributeProto?L.map(E.decodeUtf8String):L}static getValueNoCheck(G){return G instanceof T.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(G):this.getValueNoCheckFromOrtFormat(G)}static getValueNoCheckFromOnnxFormat(G){switch(G.type){case T.onnx.AttributeProto.AttributeType.FLOAT:return G.f;case T.onnx.AttributeProto.AttributeType.INT:return G.i;case T.onnx.AttributeProto.AttributeType.STRING:return G.s;case T.onnx.AttributeProto.AttributeType.TENSOR:return G.t;case T.onnx.AttributeProto.AttributeType.GRAPH:return G.g;case T.onnx.AttributeProto.AttributeType.FLOATS:return G.floats;case T.onnx.AttributeProto.AttributeType.INTS:return G.ints;case T.onnx.AttributeProto.AttributeType.STRINGS:return G.strings;case T.onnx.AttributeProto.AttributeType.TENSORS:return G.tensors;case T.onnx.AttributeProto.AttributeType.GRAPHS:return G.graphs;default:throw new Error(`unsupported attribute type: ${T.onnx.AttributeProto.AttributeType[G.type]}`)}}static getValueNoCheckFromOrtFormat(G){switch(G.type()){case P.AttributeType.FLOAT:return G.f();case P.AttributeType.INT:return G.i();case P.AttributeType.STRING:return G.s();case P.AttributeType.TENSOR:return G.t();case P.AttributeType.GRAPH:return G.g();case P.AttributeType.FLOATS:return G.floatsArray();case P.AttributeType.INTS:{const O=[];for(let L=0;L{Object.defineProperty(c,"__esModule",{value:!0}),c.resolveBackend=c.backend=void 0;const T=_(5038),C=new Map;async function M(E){const P=c.backend;if(P[E]!==void 0&&function(R){const $=R;return"initialize"in $&&typeof $.initialize=="function"&&"createSessionHandler"in $&&typeof $.createSessionHandler=="function"&&"dispose"in $&&typeof $.dispose=="function"}(P[E])){const R=P[E];let $=R.initialize();if(typeof $=="object"&&"then"in $&&($=await $),$)return C.set(E,R),R}}c.backend={webgl:new T.WebGLBackend},c.resolveBackend=async function E(P){if(!P)return E(["webgl"]);{const R=typeof P=="string"?[P]:P;for(const $ of R){const G=C.get($);if(G)return G;const O=await M($);if(O)return O}}throw new Error("no available backend to use")}},5038:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLBackend=void 0;const T=_(1670),C=_(6231),M=_(6416),E=_(7305);c.WebGLBackend=class{get contextId(){return T.env.webgl.contextId}set contextId(P){T.env.webgl.contextId=P}get matmulMaxBatchSize(){return T.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(P){T.env.webgl.matmulMaxBatchSize=P}get textureCacheMode(){return T.env.webgl.textureCacheMode}set textureCacheMode(P){T.env.webgl.textureCacheMode=P}get pack(){return T.env.webgl.pack}set pack(P){T.env.webgl.pack=P}get async(){return T.env.webgl.async}set async(P){T.env.webgl.async=P}initialize(){try{return this.glContext=(0,E.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),C.Logger.setWithEnv(T.env),C.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(P){return C.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${P}`),!1}}createSessionHandler(P){return new M.WebGLSessionHandler(this,P)}dispose(){this.glContext.dispose()}}},5107:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoordsGlslLib=void 0;const T=_(2517),C=_(8520),M=_(5060),E=_(7859),P=_(9390);class R extends C.GlslLib{constructor(G){super(G)}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 C.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 C.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 G=this.context.outputTextureLayout;return G.isPacked?this.getPackedOutputSamplingSnippet(G):this.getUnpackedOutputSamplingSnippet(G)}getPackedOutputSamplingSnippet(G){const O=G.unpackedShape,L=[G.width,G.height],F={},V="getOutputCoords";switch(O.length){case 0:F[V]=this.getOutputScalarCoords();break;case 1:F[V]=this.getOutputPacked1DCoords(O,L);break;case 2:F[V]=this.getOutputPacked2DCoords(O,L);break;case 3:F[V]=this.getOutputPacked3DCoords(O,L);break;default:F[V]=this.getOutputPackedNDCoords(O,L)}const W=`
void setOutput(vec4 val) {
${(0,M.getGlsl)(this.context.glContext.version).output} = val;
}
`;return F.floatTextureSetRGBA=new C.GlslLibRoutine(W),F}getUnpackedOutputSamplingSnippet(G){const O=G.unpackedShape,L=[G.width,G.height],F={},V="getOutputCoords";switch(O.length){case 0:F[V]=this.getOutputScalarCoords();break;case 1:F[V]=this.getOutputUnpacked1DCoords(O,L);break;case 2:F[V]=this.getOutputUnpacked2DCoords(O,L);break;case 3:F[V]=this.getOutputUnpacked3DCoords(O,L);break;case 4:F[V]=this.getOutputUnpacked4DCoords(O,L);break;case 5:F[V]=this.getOutputUnpacked5DCoords(O,L);break;case 6:F[V]=this.getOutputUnpacked6DCoords(O,L);break;default:throw new Error(`Unsupported output dimensionality: ${O.length}`)}const W=`
void setOutput(float val) {
${(0,M.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0);
}
`;return F.floatTextureSetR=new C.GlslLibRoutine(W),F}getOutputScalarCoords(){return new C.GlslLibRoutine(`
int getOutputCoords() {
return 0;
}
`)}getOutputPacked1DCoords(G,O){const L=O;let F="";return L[0]===1?(F=`
int getOutputCoords() {
return 2 * int(TexCoords.y * ${L[1]}.0);
}
`,new C.GlslLibRoutine(F)):L[1]===1?(F=`
int getOutputCoords() {
return 2 * int(TexCoords.x * ${L[0]}.0);
}
`,new C.GlslLibRoutine(F)):(F=`
int getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${L[0]}, ${L[1]}));
return 2 * (resTexRC.y * ${L[0]} + resTexRC.x);
}
`,new C.GlslLibRoutine(F))}getOutputPacked2DCoords(G,O){let L="";if(T.ArrayUtil.arraysEqual(G,O))return L=`
ivec2 getOutputCoords() {
return 2 * ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]}));
}
`,new C.GlslLibRoutine(L);const F=O,V=Math.ceil(G[1]/2);return L=`
ivec2 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${F[0]}, ${F[1]}));
int index = resTexRC.y * ${F[0]} + resTexRC.x;
// reverse r and c order for packed texture
int r = imod(index, ${V}) * 2;
int c = 2 * (index / ${V});
return ivec2(r, c);
}
`,new C.GlslLibRoutine(L)}getOutputPacked3DCoords(G,O){const L=[O[0],O[1]],F=Math.ceil(G[2]/2),V=F*Math.ceil(G[1]/2),W=`
ivec3 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${L[0]}, ${L[1]}));
int index = resTexRC.y * ${L[0]} + resTexRC.x;
int b = index / ${V};
index -= b * ${V};
// reverse r and c order for packed texture
int r = imod(index, ${F}) * 2;
int c = 2 * (index / ${F});
return ivec3(b, r, c);
}
`;return new C.GlslLibRoutine(W)}getOutputPackedNDCoords(G,O){const L=[O[0],O[1]],F=Math.ceil(G[G.length-1]/2),V=F*Math.ceil(G[G.length-2]/2);let W=V,z="",Z="b, r, c";for(let Y=2;Y=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=`
ivec3 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${O[0]}, ${O[1]}));
int index = resTexRC.y * ${O[0]} + resTexRC.x;
${z}
return ivec3(r, c, d);
}
`,new C.GlslLibRoutine(L)}getOutputUnpacked4DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=`
ivec4 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${O[0]}, ${O[1]}));
int index = resTexRC.y * ${O[0]} + resTexRC.x;
${z}
return ivec4(r, c, d, d2);
}
`,new C.GlslLibRoutine(L)}getOutputUnpacked5DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2","d3"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=`
ivec5 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${O[0]}, ${O[1]}));
int index = resTexRC.y * ${O[0]} + resTexRC.x;
${z}
return ivec5(r, c, d, d2, d3);
}
`,new C.GlslLibRoutine(L)}getOutputUnpacked6DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2","d3","d4"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=`
ivec6 getOutputCoords() {
ivec2 resTexRC = ivec2(TexCoords.xy *
vec2(${O[0]}, ${O[1]}));
int index = resTexRC.y * ${O[0]} + resTexRC.x;
${z}
return ivec6(r, c, d, d2, d3, d4);
}
`,new C.GlslLibRoutine(L)}getCommonUtilFuncs(){const G={};let O="uvFromFlat";G[O]=new C.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);
}
`),O="packedUVfrom1D",G[O]=new C.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);
}
`),O="packedUVfrom2D",G[O]=new C.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);
}
`),O="packedUVfrom3D",G[O]=new C.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);
}
`),O="sampleTexture";const L=(0,M.getGlsl)(this.context.glContext.version);return G[O]=new C.GlslLibRoutine(`
float sampleTexture(sampler2D textureSampler, vec2 uv) {
return ${L.texture2D}(textureSampler, uv).r;
}`),G}getInputsSamplingSnippets(){const G={},O=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((L,F)=>{const V=this.context.inputTextureLayouts[F],W=(0,P.generateShaderFuncNameFromInputSamplerName)(L);V.isPacked?G[W]=this.getPackedSamplerFromInput(W,L,V):G[W]=this.getUnpackedSamplerFromInput(W,L,V);const z=(0,P.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(L);V.unpackedShape.length<=O.unpackedShape.length&&(V.isPacked?G[z]=this.getPackedSamplerAtOutputCoords(z,V,O,L):G[z]=this.getUnpackedSamplerAtOutputCoords(z,V,O,L))}),G}getPackedSamplerAtOutputCoords(G,O,L,F){const V=O.unpackedShape,W=L.unpackedShape,z=F,Z=(0,P.generateShaderFuncNameFromInputSamplerName)(z),H=V.length,Y=W.length,U=T.BroadcastUtil.getBroadcastDims(V,W),j=(0,P.getCoordsDataType)(Y),X=Y-H;let K;const q=(0,P.getGlChannels)();K=H===0?"":Y<2&&U.length>=1?"coords = 0;":U.map(ae=>`coords.${q[ae+X]} = 0;`).join(`
`);let J="";J=Y<2&&H>0?"coords":V.map((ae,ne)=>`coords.${q[ne+X]}`).join(", ");let Q="return outputValue;";const ee=T.ShapeUtil.size(V)===1,re=T.ShapeUtil.size(W)===1;if(H!==1||ee||re){if(ee&&!re)Q=Y===1?`
return vec4(outputValue.x, outputValue.x, 0., 0.);
`:`
return vec4(outputValue.x);
`;else if(U.length){const ae=H-2,ne=H-1;U.indexOf(ae)>-1&&U.indexOf(ne)>-1?Q="return vec4(outputValue.x);":U.indexOf(ae)>-1?Q="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":U.indexOf(ne)>-1&&(Q="return vec4(outputValue.xx, outputValue.zz);")}}else Q=`
return vec4(outputValue.xy, outputValue.xy);
`;const ie=`
vec4 ${G}() {
${j} coords = getOutputCoords();
int lastDim = coords.${q[Y-1]};
coords.${q[Y-1]} = coords.${q[Y-2]};
coords.${q[Y-2]} = lastDim;
${K}
vec4 outputValue = ${Z}(${J});
${Q}
}
`;return new C.GlslLibRoutine(ie,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(G,O,L,F){const V=[L.width,L.height],W=[O.width,O.height],z=O.unpackedShape.length,Z=L.unpackedShape.length,H=O.unpackedShape,Y=L.unpackedShape,U=(0,P.generateShaderFuncNameFromInputSamplerName)(F);if(z===Z&&T.ArrayUtil.arraysEqual(W,V)){const re=`
float ${G}() {
return sampleTexture(${F}, TexCoords);
}
`;return new C.GlslLibRoutine(re,["coordinates.sampleTexture"])}const j=(0,P.getCoordsDataType)(Z),X=T.BroadcastUtil.getBroadcastDims(H,Y),K=Z-z;let q;const J=(0,P.getGlChannels)();q=z===0?"":Z<2&&X.length>=1?"coords = 0;":X.map(re=>`coords.${J[re+K]} = 0;`).join(`
`);let Q="";Q=Z<2&&z>0?"coords":O.unpackedShape.map((re,ie)=>`coords.${J[ie+K]}`).join(", ");const ee=`
float ${G}() {
${j} coords = getOutputCoords();
${q}
return ${U}(${Q});
}
`;return new C.GlslLibRoutine(ee,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(G,O,L){switch(L.unpackedShape.length){case 0:return this.getPackedSamplerScalar(G,O);case 1:return this.getPackedSampler1D(G,O,L);case 2:return this.getPackedSampler2D(G,O,L);case 3:return this.getPackedSampler3D(G,O,L);default:return this.getPackedSamplerND(G,O,L)}}getUnpackedSamplerFromInput(G,O,L){const F=L.unpackedShape;switch(F.length){case 0:return this.getUnpackedSamplerScalar(G,O,L);case 1:return this.getUnpackedSampler1D(G,O,L);case 2:return this.getUnpackedSampler2D(G,O,L);case 3:return this.getUnpackedSampler3D(G,O,L);case 4:return this.getUnpackedSampler4D(G,O,L);case 5:return this.getUnpackedSampler5D(G,O,L);case 6:return this.getUnpackedSampler6D(G,O,L);default:throw new Error(`Unsupported dimension ${F.length}-D`)}}getPackedSamplerScalar(G,O){const L=`
vec4 ${G}() {
return ${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${O}, halfCR);
}
`;return new C.GlslLibRoutine(L)}getPackedSampler1D(G,O,L){const F=[L.width,L.height],V=[F[1],F[0]],W=(0,M.getGlsl)(this.context.glContext.version),z=`vec4 ${G}(int index) {
vec2 uv = packedUVfrom1D(
${V[0]}, ${V[1]}, index);
return ${W.texture2D}(${O}, uv);
}`;return new C.GlslLibRoutine(z,["coordinates.packedUVfrom1D"])}getPackedSampler2D(G,O,L){const F=L.unpackedShape,V=[L.width,L.height],W=(0,M.getGlsl)(this.context.glContext.version),z=V[0],Z=V[1];if(V!=null&&T.ArrayUtil.arraysEqual(F,V)){const j=`vec4 ${G}(int row, int col) {
vec2 uv = (vec2(col, row) + halfCR) / vec2(${Z}.0, ${z}.0);
return ${W.texture2D}(${O}, uv);
}`;return new C.GlslLibRoutine(j)}const H=V,Y=Math.ceil(F[1]/2),U=`vec4 ${G}(int row, int col) {
vec2 uv = packedUVfrom2D(${H[1]}, ${H[0]}, ${Y}, row, col);
return ${W.texture2D}(${O}, uv);
}`;return new C.GlslLibRoutine(U,["coordinates.packedUVfrom2D"])}getPackedSampler3D(G,O,L){const F=L.unpackedShape,V=[L.width,L.height],W=[V[0],V[1]],z=(0,M.getGlsl)(this.context.glContext.version);if(F[0]===1){const j=F.slice(1),X=[1,2],K=(0,P.squeezeInputShape)(F,j),q=["b","row","col"],J=JSON.parse(JSON.stringify(L));J.unpackedShape=K;const Q=this.getPackedSamplerFromInput(G,O,J),ee=`${Q.routineBody}
vec4 ${G}(int b, int row, int col) {
return ${G}(${(0,P.getSqueezedParams)(q,X)});
} `;return new C.GlslLibRoutine(ee,Q.dependencies)}const Z=W[0],H=W[1],Y=Math.ceil(F[2]/2),U=`vec4 ${G}(int b, int row, int col) {
vec2 uv = packedUVfrom3D(
${H}, ${Z}, ${Y*Math.ceil(F[1]/2)}, ${Y}, b, row, col);
return ${z.texture2D}(${O}, uv);}`;return new C.GlslLibRoutine(U,["coordinates.packedUVfrom3D"])}getPackedSamplerND(G,O,L){const F=L.unpackedShape,V=F.length,W=[L.width,L.height],z=(0,M.getGlsl)(this.context.glContext.version),Z=[W[0],W[1]],H=Z[1],Y=Z[0],U=Math.ceil(F[V-1]/2);let j=U*Math.ceil(F[V-2]/2),X="int b, int row, int col",K=`b * ${j} + (row / 2) * ${U} + (col / 2)`;for(let J=2;J{const F=this.context.inputTextureLayouts[L],V=(F.unpackedShape.length>0?F.unpackedShape:F.shape).length;let W=`_${O}`;G[W]=new C.GlslLibRoutine(this.getValueFromSingle(O,V,F.width,F.height,!1),[`shapeUtils.indicesToOffset${W}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),W+="_T",G[W]=new C.GlslLibRoutine(this.getValueFromSingle(O,V,F.width,F.height,!0),[`shapeUtils.indicesToOffset${W}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),G}getValueFromSingle(G,O,L,F,V){let W=`_${G}`;return V&&(W+="_T"),`
float ${W}(int m[${O}]) {
int offset = indicesToOffset${W}(m);
vec2 coords = offsetToCoords(offset, ${L}, ${F});
float value = getColorAsFloat(${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${G}, coords));
return value;
}
`}getPackedValueFrom(G,O,L,F,V){let W=`_${G}_Pack`;return V&&(W+="_T"),`
vec4 ${W}(int m[${O}]) {
int offset = indicesToOffset_${G}(m);
vec2 coords = offsetToCoords(offset, ${L}, ${F});
return ${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${G}, coords);
}
`}}c.CoordsGlslLib=R},8520:(x,c)=>{var _;Object.defineProperty(c,"__esModule",{value:!0}),c.TopologicalSortGlslRoutines=c.GlslLibRoutineNode=c.GlslLibRoutine=c.GlslLib=c.GlslContext=c.FunctionType=void 0,(_=c.FunctionType||(c.FunctionType={}))[_.ValueBased=0]="ValueBased",_[_.Positional=1]="Positional",c.GlslContext=class{constructor(T,C,M,E){this.glContext=T,this.programInfo=C,this.inputTextureLayouts=M,this.outputTextureLayout=E}},c.GlslLib=class{constructor(T){this.context=T}},c.GlslLibRoutine=class{constructor(T,C){this.routineBody=T,this.dependencies=C}},c.GlslLibRoutineNode=class{constructor(T,C,M){this.name=T,this.dependencies=M||[],C&&(this.routineBody=C)}addDependency(T){T&&this.dependencies.push(T)}},c.TopologicalSortGlslRoutines=class{static returnOrderedNodes(T){if(!T||T.length===0)return[];if(T.length===1)return T;const C=new Set,M=new Set,E=new Array;return this.createOrderedNodes(T,C,M,E),E}static createOrderedNodes(T,C,M,E){for(let P=0;P0)for(let R=0;R{Object.defineProperty(c,"__esModule",{value:!0}),c.EncodingGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new T.GlslLibRoutine(`highp vec4 encode(highp float f) {
return vec4(f, 0.0, 0.0, 0.0);
}
`)}}decodeFloat32(){return{decode:new T.GlslLibRoutine(`highp float decode(highp vec4 rgba) {
return rgba.r;
}
`)}}encodeUint8(){const E=C.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new T.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)));
${E}
rgba = rgba / 255.0; // values need to be normalized to [0,1]
return rgba;
}
`)}}decodeUint8(){const E=C.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new T.GlslLibRoutine(`
highp float decode(highp vec4 rgba) {
rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]
${E}
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 E=new ArrayBuffer(4),P=new Uint32Array(E),R=new Uint8Array(E);if(P[0]=3735928559,R[0]===239)return!0;if(R[0]===222)return!1;throw new Error("unknown endianness")}}c.EncodingGlslLib=C},9894:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FragColorGlslLib=void 0;const T=_(8520),C=_(5060);class M extends T.GlslLib{constructor(P){super(P)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const P=(0,C.getGlsl)(this.context.glContext.version);return{setFragColor:new T.GlslLibRoutine(`
void setFragColor(float value) {
${P.output} = encode(value);
}
`,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new T.GlslLibRoutine(`
float getColorAsFloat(vec4 color) {
return decode(color);
}
`,["encoding.decode"])}}}c.FragColorGlslLib=M},2848:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.replaceInlines=void 0;const _=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;c.replaceInlines=function(T){const C={};let M;for(;(M=_.exec(T))!==null;){const E=M[3].split(",").map(P=>{const R=P.trim().split(" ");return R&&R.length===2?{type:R[0],name:R[1]}:null}).filter(P=>P!==null);C[M[2]]={params:E,body:M[4]}}for(const E in C){const P="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",E),R=new RegExp(P,"gm");for(;(M=R.exec(T))!==null;){const $=M[1],G=M[2],O=M[3].split(","),L=$?`${$} ${G};`:"";let F=C[E].body,V="";C[E].params.forEach((z,Z)=>{z&&(V+=`${z.type} ${z.name} = ${O[Z]};
`)}),F=`${V}
${F}`,F=F.replace("return",`${G} = `);const W=`
${L}
{
${F}
}
`;T=T.replace(M[0],W)}}return T.replace(_,"")}},8879:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.GlslPreprocessor=void 0;const T=_(8520),C=_(2848),M=_(5483),E=_(5060);c.GlslPreprocessor=class{constructor(P,R,$,G){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new T.GlslContext(P,R,$,G),Object.keys(M.glslRegistry).forEach(L=>{const F=new M.glslRegistry[L](this.context);this.libs[L]=F});const O=this.glslLibRoutineDependencyGraph;for(const L in this.libs){const F=this.libs[L].getFunctions();for(const V in F){const W=L+"."+V;let z;O[W]?(z=O[W],z.routineBody=F[V].routineBody):(z=new T.GlslLibRoutineNode(W,F[V].routineBody),O[W]=z);const Z=F[V].dependencies;if(Z)for(let H=0;H{const G=$.split(".")[1];P.indexOf(G)!==-1&&R.push(this.glslLibRoutineDependencyGraph[$])}),T.TopologicalSortGlslRoutines.returnOrderedNodes(R)}getUniforms(P,R){const $=[];if(P)for(const G of P)$.push(`uniform sampler2D ${G};`);if(R)for(const G of R)$.push(`uniform ${G.type} ${G.name}${G.arrayLength?`[${G.arrayLength}]`:""};`);return $.join(`
`)}}},5483:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.glslRegistry=void 0;const T=_(5107),C=_(7341),M=_(9894),E=_(2655),P=_(3891);c.glslRegistry={encoding:C.EncodingGlslLib,fragcolor:M.FragColorGlslLib,vec:P.VecGlslLib,shapeUtils:E.ShapeUtilsGlslLib,coordinates:T.CoordsGlslLib}},2655:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ShapeUtilsGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}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 E=this.context.outputTextureLayout.shape.length,P={};return this.context.programInfo.inputNames.forEach((R,$)=>{const G=this.context.inputTextureLayouts[$].unpackedShape;if(G.length<=E){const O=G.length,L=E-O,F=`bcastIndices_${R}`;let V="";for(let z=0;z{const G=this.context.inputTextureLayouts[$].shape;if(!(G.length<2||G.length>E)){const O=G.length,L=E-O,F=`bcastMatmulIndices_${R}`;let V="";for(let z=0;z{const $=this.context.inputTextureLayouts[R].shape,G=this.context.inputTextureLayouts[R].strides,O=$.length;let L=`indicesToOffset_${P}`;E[L]=new T.GlslLibRoutine(C.indexToOffsetSingle(L,O,G)),L=`indicesToOffset_${P}_T`,E[L]=new T.GlslLibRoutine(C.indexToOffsetSingle(L,O,G.slice().reverse()))}),E}static indexToOffsetSingle(E,P,R){let $="";for(let G=P-1;G>=0;--G)$+=`
offset += indices[${G}] * ${R[G]};
`;return`
int ${E}(int indices[${P}]) {
int offset = 0;
${$}
return offset;
}
`}offsetToIndices(){const E={};return this.context.programInfo.inputNames.forEach((P,R)=>{const $=this.context.inputTextureLayouts[R].shape,G=this.context.inputTextureLayouts[R].strides,O=$.length;let L=`offsetToIndices_${P}`;E[L]=new T.GlslLibRoutine(C.offsetToIndicesSingle(L,O,G)),L=`offsetToIndices_${P}_T`,E[L]=new T.GlslLibRoutine(C.offsetToIndicesSingle(L,O,G.slice().reverse()))}),E}static offsetToIndicesSingle(E,P,R){const $=[];for(let G=0;G{const $=this.context.inputTextureLayouts[R].shape,G=$.length,O=`incrementIndices_${P}`;let L="";for(let V=0;V= 0; --i) {
if(i > axis) continue;
indices[i] += 1;
if(indices[i] < shape[i]) {
break;
}
indices[i] = 0;
}
}
`;E[O]=new T.GlslLibRoutine(F)}),E}}c.ShapeUtilsGlslLib=C},5060:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getDefaultFragShaderMain=c.getFragShaderPreamble=c.getVertexShaderSource=c.getGlsl=void 0;const _={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},T={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function C(M){return M===1?_:T}c.getGlsl=C,c.getVertexShaderSource=function(M){const E=C(M);return`${E.version}
precision highp float;
${E.attribute} vec3 position;
${E.attribute} vec2 textureCoord;
${E.varyingVertex} vec2 TexCoords;
void main()
{
gl_Position = vec4(position, 1.0);
TexCoords = textureCoord;
}`},c.getFragShaderPreamble=function(M){const E=C(M);return`${E.version}
precision highp float;
precision highp int;
precision highp sampler2D;
${E.varyingFrag} vec2 TexCoords;
${E.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);
}
`},c.getDefaultFragShaderMain=function(M,E){return`
void main() {
int indices[${E}];
toVec(TexCoords, indices);
vec4 result = vec4(process(indices));
${C(M).output} = result;
}
`}},3891:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VecGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const E=this.context.outputTextureLayout.shape.length,P={add:"+=",sub:"-=",mul:"*=",div:"/="},R={};for(const $ in P){const G=`${$}Vec`;let O="";for(let F=0;F{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLInferenceHandler=void 0;const T=_(6231),C=_(9162),M=_(2517),E=_(2403),P=_(7019),R=_(8710),$=_(5611),G=_(4057),O=_(2039);c.WebGLInferenceHandler=class{constructor(L){this.session=L,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(L,F){return(0,G.calculateTextureWidthAndHeight)(this.session.layoutStrategy,L,F)}executeProgram(L,F){if(F.length{const X=j.map(q=>`${q.unpackedShape.join(",")};${q.width}x${q.height}`).join("_");let K=U.name;return U.cacheHint&&(K+="["+U.cacheHint+"]"),K+=":"+X,K})(L,V);let z=this.session.programManager.getArtifact(W);const Z=z?z.programInfo:typeof L.get=="function"?L.get():L,H=(0,G.createTextureLayoutFromTextureType)(this.session.layoutStrategy,Z.output.dims,Z.output.textureType),Y=this.createTextureData(H,Z.output.type);return z||(z=this.session.programManager.build(Z,V,Y),this.session.programManager.setArtifact(W,z)),this.runProgram(z,V,Y),Y}run(L,F){return this.executeProgram(L,F).tensor}runProgram(L,F,V){for(let W=0;Wthis.readTexture(Z),async H=>this.readTextureAsync(Z),void 0,z),texture:V});return this.setTextureData(Z.tensor.dataId,Z,L.isPacked),Z}getTextureData(L,F=!1){return this.session.isInitializer(L)?this.session.getTextureData(L,F):F?this.packedTextureDataCache.get(L):this.unpackedTextureDataCache.get(L)}setTextureData(L,F,V=!1){this.session.isInitializer(L)?this.session.setTextureData(L,F,V):(V?this.packedTextureDataCache:this.unpackedTextureDataCache).set(L,F)}isTextureLayoutCached(L,F=!1){return!!this.getTextureData(L.dataId,F)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(L=>this.session.textureManager.releaseTexture(L)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(L=>this.session.textureManager.releaseTexture(L)),this.unpackedTextureDataCache=new Map}readTexture(L){return L.isPacked?this.readTexture(this.unpack(L)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(L,L.tensor.type,L.channels):this.session.textureManager.readUint8TextureAsFloat((0,R.encodeAsUint8)(this,L))}async readTextureAsync(L){return L.isPacked?this.readTextureAsync(this.unpack(L)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(L,L.tensor.type,L.channels):this.session.textureManager.readUint8TextureAsFloat((0,R.encodeAsUint8)(this,L))}pack(L){return this.executeProgram((0,E.createPackProgramInfoLoader)(this,L.tensor),[L.tensor])}unpack(L){return this.executeProgram((0,$.createUnpackProgramInfoLoader)(this,L.tensor),[L.tensor])}}},1640:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(de,pe,he,we){we===void 0&&(we=he);var ye=Object.getOwnPropertyDescriptor(pe,he);ye&&!("get"in ye?!pe.__esModule:ye.writable||ye.configurable)||(ye={enumerable:!0,get:function(){return pe[he]}}),Object.defineProperty(de,we,ye)}:function(de,pe,he,we){we===void 0&&(we=he),de[we]=pe[he]}),C=this&&this.__setModuleDefault||(Object.create?function(de,pe){Object.defineProperty(de,"default",{enumerable:!0,value:pe})}:function(de,pe){de.default=pe}),M=this&&this.__importStar||function(de){if(de&&de.__esModule)return de;var pe={};if(de!=null)for(var he in de)he!=="default"&&Object.prototype.hasOwnProperty.call(de,he)&&T(pe,de,he);return C(pe,de),pe};Object.defineProperty(c,"__esModule",{value:!0}),c.WEBGL_OP_RESOLVE_RULES=void 0;const E=_(2898),P=M(_(7839)),R=_(4196),$=_(2069),G=_(8138),O=_(9663),L=_(5193),F=_(7992),V=_(1253),W=_(4776),z=_(6572),Z=_(3346),H=_(5623),Y=_(2870),U=_(2143),j=_(4939),X=_(718),K=_(2268),q=_(8117),J=_(2278),Q=_(5524),ee=_(5975),re=_(3933),ie=_(6558),ae=_(5723),ne=_(3738),te=M(_(4909)),oe=_(8428),ue=_(9793);c.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",te.abs],["Acos","","7+",te.acos],["Add","","7+",P.add],["And","","7+",P.and],["Asin","","7+",te.asin],["Atan","","7+",te.atan],["AveragePool","","7+",U.averagePool,U.parseAveragePoolAttributes],["BatchNormalization","","7+",E.batchNormalization,E.parseBatchNormalizationAttributes],["Cast","","6+",R.cast,R.parseCastAttributes],["Ceil","","6+",te.ceil],["Clip","","6-10",te.clip,te.parseClipAttributes],["Clip","","11+",te.clipV11],["Concat","","4+",$.concat,$.parseConcatAttributes],["Conv","","1+",G.conv,G.parseConvAttributes],["ConvTranspose","","1+",O.convTranspose,O.parseConvTransposeAttributes],["Cos","","7+",te.cos],["Div","","7+",P.div],["Dropout","","7+",te.identity],["DepthToSpace","","1+",L.depthToSpace,L.parseDepthToSpaceAttributes],["Equal","","7+",P.equal],["Elu","","6+",te.elu,te.parseEluAttributes],["Exp","","6+",te.exp],["Flatten","","1+",F.flatten,F.parseFlattenAttributes],["Floor","","6+",te.floor],["FusedConv","com.microsoft","1+",G.conv,G.parseConvAttributes],["Gather","","1+",V.gather,V.parseGatherAttributes],["Gemm","","7-10",W.gemm,W.parseGemmAttributesV7],["Gemm","","11+",W.gemm,W.parseGemmAttributesV11],["GlobalAveragePool","","1+",U.globalAveragePool,U.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",U.globalMaxPool],["Greater","","7+",P.greater],["Identity","","1+",te.identity],["ImageScaler","","1+",z.imageScaler,z.parseImageScalerAttributes],["InstanceNormalization","","6+",Z.instanceNormalization,Z.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",te.leakyRelu,te.parseLeakyReluAttributes],["Less","","7+",P.less],["Log","","6+",te.log],["MatMul","","1+",H.matMul,H.parseMatMulAttributes],["MaxPool","","1+",U.maxPool,U.parseMaxPoolAttributes],["Mul","","7+",P.mul],["Neg","","6+",te.neg],["Not","","1+",te.not],["Or","","7+",P.or],["Pad","","2-10",Y.padV2,Y.parsePadAttributesV2],["Pad","","11+",Y.padV11,Y.parsePadAttributesV11],["Pow","","7+",P.pow],["PRelu","","7+",P.pRelu],["ReduceLogSum","","1+",j.reduceLogSum,j.parseReduceAttributes],["ReduceMax","","1+",j.reduceMax,j.parseReduceAttributes],["ReduceMean","","1+",j.reduceMean,j.parseReduceAttributes],["ReduceMin","","1+",j.reduceMin,j.parseReduceAttributes],["ReduceProd","","1+",j.reduceProd,j.parseReduceAttributes],["ReduceSum","","1-12",j.reduceSum,j.parseReduceAttributes],["ReduceSumSquare","","1+",j.reduceLogSumSquare,j.parseReduceAttributes],["Relu","","6+",te.relu],["Reshape","","5+",X.reshape],["Resize","","10",K.resize,K.parseResizeAttributesV10],["Resize","","11+",K.resize,K.parseResizeAttributesV11],["Shape","","1+",q.shape],["Sigmoid","","6+",te.sigmoid],["Sin","","7+",te.sin],["Slice","","10+",J.sliceV10],["Slice","","1-9",J.slice,J.parseSliceAttributes],["Softmax","","1-12",Q.softmax,Q.parseSoftmaxAttributes],["Softmax","","13+",Q.softmaxV13,Q.parseSoftmaxAttributesV13],["Split","","2-12",ee.split,ee.parseSplitAttributes],["Sqrt","","6+",te.sqrt],["Squeeze","","1-12",re.squeeze,re.parseSqueezeAttributes],["Squeeze","","13+",re.squeezeV13],["Sub","","7+",P.sub],["Sum","","6+",ie.sum],["Tan","","7+",te.tan],["Tanh","","6+",te.tanh],["Tile","","6+",ae.tile],["Transpose","","1+",ne.transpose,ne.parseTransposeAttributes],["Upsample","","7-8",ue.upsample,ue.parseUpsampleAttributesV7],["Upsample","","9",ue.upsample,ue.parseUpsampleAttributesV9],["Unsqueeze","","1-12",oe.unsqueeze,oe.parseUnsqueezeAttributes],["Unsqueeze","","13+",oe.unsqueezeV13],["Xor","","7+",P.xor]]},2898:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseBatchNormalizationAttributes=c.batchNormalization=void 0;const T=_(246),C=_(5060),M=_(2039),E={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]};c.batchNormalization=($,G,O)=>(R(G),[$.run(Object.assign(Object.assign({},E),{cacheHint:O.cacheKey,get:()=>P($,G,O)}),G)]),c.parseBatchNormalizationAttributes=$=>{const G=$.attributes.getFloat("epsilon",1e-5),O=$.attributes.getFloat("momentum",.9),L=$.attributes.getInt("spatial",1);return(0,T.createAttributeWithCacheKey)({epsilon:G,momentum:O,spatial:L})};const P=($,G,O)=>{const L=(0,C.getGlsl)($.session.backend.glContext.version),F=G[0].dims.length,[V,W]=$.calculateTextureWidthAndHeight(G[1].dims,M.TextureType.unpacked),z=`
float process(int[${F}] indices) {
vec2 position = offsetToCoords(indices[1], ${V}, ${W});
float scale = getColorAsFloat(${L.texture2D}(Scale, position));
float mean = getColorAsFloat(${L.texture2D}(Mean, position));
float variance = getColorAsFloat(${L.texture2D}(Variance, position));
float b = getColorAsFloat(${L.texture2D}(B, position));
return scale * ( (_A(indices) - mean) / sqrt(variance + float(${O.epsilon})) ) + b;
}`;return Object.assign(Object.assign({},E),{output:{dims:G[0].dims,type:G[0].type,textureType:M.TextureType.unpacked},shaderSource:z})},R=$=>{if(!$||$.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const G=$[0],O=$[1],L=$[2],F=$[3],V=$[4];if(G.dims.length<3||O.dims.length!==1||L.dims.length!==1||F.dims.length!==1||V.dims.length!==1)throw new Error("invalid input shape.");if(O.dims[0]!==G.dims[1]||L.dims[0]!==G.dims[1]||F.dims[0]!==G.dims[1]||V.dims[0]!==G.dims[1])throw new Error("invalid input shape.");if(G.type!=="float32"&&G.type!=="float64"||O.type!=="float32"&&O.type!=="float64"||L.type!=="float32"&&L.type!=="float64"||F.type!=="float32"&&F.type!=="float64"||V.type!=="float32"&&V.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.xor=c.sub=c.pRelu=c.pow=c.or=c.mul=c.less=c.greater=c.equal=c.div=c.and=c.add=c.glslPRelu=c.glslPow=c.glslXor=c.glslOr=c.glslAnd=c.glslLess=c.glslGreater=c.glslEqual=c.glslSub=c.glslMul=c.glslDiv=c.glslAdd=void 0;const T=_(2517),C=_(8520),M=_(5060),E=_(2039);function P(){const j="add_";return{body:`
float ${j}(float a, float b) {
return a + b;
}
vec4 ${j}(vec4 v1, vec4 v2) {
return v1 + v2;
}
`,name:j,type:C.FunctionType.ValueBased}}function R(){const j="div_";return{body:`
float ${j}(float a, float b) {
return a / b;
}
vec4 ${j}(vec4 v1, vec4 v2) {
return v1 / v2;
}
`,name:j,type:C.FunctionType.ValueBased}}function $(){const j="mul_";return{body:`
float ${j}(float a, float b) {
return a * b;
}
vec4 ${j}(vec4 v1, vec4 v2) {
return v1 * v2;
}
`,name:j,type:C.FunctionType.ValueBased}}function G(){const j="sub_";return{body:`
float ${j}(float a, float b) {
return a - b;
}
vec4 ${j}(vec4 v1, vec4 v2) {
return v1 - v2;
}
`,name:j,type:C.FunctionType.ValueBased}}function O(){const j="equal_";return{body:`
float ${j}(float a, float b) {
return float(a == b);
}
vec4 ${j}(vec4 v1, vec4 v2) {
return vec4(equal(v1, v2));
}
`,name:j,type:C.FunctionType.ValueBased}}function L(){const j="greater_";return{body:`
float ${j}(float a, float b) {
return float(a > b);
}
vec4 ${j}(vec4 v1, vec4 v2) {
return vec4( v1.r > v2.r ,
v1.g > v2.g,
v1.b > v2.b,
v1.a > v2.a );
}
`,name:j,type:C.FunctionType.ValueBased}}function F(){const j="less_";return{body:`
float ${j}(float a, float b) {
return float(a < b);
}
vec4 ${j}(vec4 v1, vec4 v2) {
return vec4( v1.r < v2.r ,
v1.g < v2.g,
v1.b < v2.b,
v1.a < v2.a );
}
`,name:j,type:C.FunctionType.ValueBased}}function V(){const j="and_";return{body:`
float ${j}(float a, float b) {
return float( bool(a) && bool(b) );
}
vec4 ${j}(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:j,type:C.FunctionType.ValueBased}}function W(){const j="or_";return{body:`
float ${j}(float a, float b) {
return float( bool(a) || bool(b) );
}
vec4 ${j}(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:j,type:C.FunctionType.ValueBased}}function z(){const j="xor_";return{body:`
float ${j}(float a, float b) {
return float( bool(a) ^^ bool(b) );
}
vec4 ${j}(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:j,type:C.FunctionType.ValueBased}}function Z(){return function(j){const X=`${j}_`;return{body:`
float ${X}(float a, float b) {
return ${j}(a, b);
}
vec4 ${X}(vec4 v1, vec4 v2) {
return ${j}(v1, v2);
}
`,name:X,type:C.FunctionType.ValueBased}}("pow")}function H(){const j="prelu_";return{body:`
float ${j}(float a, float b) {
return a < 0.0 ? a * b: a;
}
vec4 ${j}(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:j,type:C.FunctionType.ValueBased}}c.glslAdd=P,c.glslDiv=R,c.glslMul=$,c.glslSub=G,c.glslEqual=O,c.glslGreater=L,c.glslLess=F,c.glslAnd=V,c.glslOr=W,c.glslXor=z,c.glslPow=Z,c.glslPRelu=H;const Y=(j,X,K,q=X[0].type,J)=>{const Q=j.session.pack?E.TextureType.packed:E.TextureType.unpacked;return{name:K.name,inputNames:["A","B"],inputTypes:[Q,Q],cacheHint:J,get:()=>U(j,X,K,q)}},U=(j,X,K,q=X[0].type)=>{const J=j.session.pack?E.TextureType.packed:E.TextureType.unpacked,Q=!T.ShapeUtil.areEqual(X[0].dims,X[1].dims);let ee=X[0].dims;const re=j.session.pack;if(Q){const ne=T.BroadcastUtil.calcShape(X[0].dims,X[1].dims,!1);if(!ne)throw new Error("Can't perform binary op on the given tensors");ee=ne;const te=ee.length,oe=X[0].dims.length!==0?X[0].dims.length:1,ue=X[1].dims.length!==0?X[1].dims.length:1,de=X[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",pe=X[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",he=(0,M.getGlsl)(j.session.backend.glContext.version),we=re?`
${K.body}
void main() {
vec4 a = getAAtOutCoords();
vec4 b = getBAtOutCoords();
vec4 result = ${K.name}(a, b);
${he.output} = result;
}`:`
${K.body}
float process(int indices[${te}]) {
int aindices[${oe}];
int bindices[${ue}];
${de}
${pe}
return ${K.name}(_A(aindices), _B(bindices));
}`;return{name:K.name,inputNames:["A","B"],inputTypes:[J,J],output:{dims:ee,type:q,textureType:J},shaderSource:we,hasMain:re}}const ie=(0,M.getGlsl)(j.session.backend.glContext.version),ae=`
${K.body}
void main() {
vec4 v1 = ${ie.texture2D}(A, TexCoords);
vec4 v2 = ${ie.texture2D}(B, TexCoords);
vec4 result = ${K.name}(v1, v2);
${ie.output} = result;
}
`;return{name:K.name,inputNames:["A","B"],inputTypes:[J,J],output:{dims:X[0].dims,type:q,textureType:J},shaderSource:ae,hasMain:!0}};c.add=(j,X)=>[j.run(Y(j,X,P()),X)],c.and=(j,X)=>[j.run(Y(j,X,V(),"bool"),X)],c.div=(j,X)=>[j.run(Y(j,X,R()),X)],c.equal=(j,X)=>[j.run(Y(j,X,O(),"bool"),X)],c.greater=(j,X)=>[j.run(Y(j,X,L(),"bool"),X)],c.less=(j,X)=>[j.run(Y(j,X,F(),"bool"),X)],c.mul=(j,X)=>[j.run(Y(j,X,$()),X)],c.or=(j,X)=>[j.run(Y(j,X,W(),"bool"),X)],c.pow=(j,X)=>[j.run(Y(j,X,Z()),X)],c.pRelu=(j,X)=>[j.run(Y(j,X,H()),X)],c.sub=(j,X)=>[j.run(Y(j,X,G()),X)],c.xor=(j,X)=>[j.run(Y(j,X,z(),"bool"),X)]},4196:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseCastAttributes=c.cast=void 0;const T=_(2517);c.cast=(M,E,P)=>(C(E),[M.cast(E[0],P)]),c.parseCastAttributes=M=>T.ProtoUtil.tensorDataTypeFromProto(M.attributes.getInt("to"));const C=M=>{if(!M||M.length!==1)throw new Error("Cast requires 1 input.");if(M[0].type==="string")throw new Error("Invalid input type.")}},1163:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedConcatProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827);c.createPackedConcatProgramInfoLoader=(R,$,G)=>{const O=(L=$.length,F=G.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:L},(V,W)=>`X${W}`),inputTypes:Array(L).fill(C.TextureType.packed),cacheHint:F});var L,F;return Object.assign(Object.assign({},O),{get:()=>((V,W,z,Z)=>{const H=z[0].dims.slice();if(Z>=H.length||Z<-1*H.length)throw new Error("axis specified for concat doesn't match input dimensionality");Z<0&&(Z=H.length+Z);const Y=H.slice(0);for(let de=1;dede.dims),J=(0,M.getGlChannels)(U),Q=new Array(q.length-1);Q[0]=q[0][Z];for(let de=1;de= ${Q[de-1]}) {
return getChannel(
getX${de}(${P(J,ee,pe)}),
vec2(${P(re,ee,pe)}));
}`}const ne=Q.length,te=Q[Q.length-1];ae+=`
return getChannel(
getX${ne}(${P(J,ee,te)}),
vec2(${P(re,ee,te)}));`;const oe=(0,T.getGlsl)(V.session.backend.glContext.version),ue=`
${K}
float getValue(${J.map(de=>"int "+de)}) {
${ae}
}
void main() {
${X} coords = getOutputCoords();
int lastDim = coords.${J[U-1]};
coords.${J[U-1]} = coords.${J[U-2]};
coords.${J[U-2]} = lastDim;
vec4 result = vec4(getValue(${j}), 0., 0., 0.);
${j[U-1]} = ${j[U-1]} + 1;
if (${j[U-1]} < ${Y[U-1]}) {
result.g = getValue(${j});
}
${j[U-2]} = ${j[U-2]} + 1;
if (${j[U-2]} < ${Y[U-2]}) {
result.a = getValue(${j});
}
${j[U-1]} = ${j[U-1]} - 1;
if (${j[U-2]} < ${Y[U-2]} &&
${j[U-1]} < ${Y[U-1]}) {
result.b = getValue(${j});
}
${oe.output} = result;
}
`;return Object.assign(Object.assign({},W),{output:{dims:Y,type:z[0].type,textureType:C.TextureType.packed},shaderSource:ue,hasMain:!0})})(R,O,$,G.axis)})};const P=(R,$,G)=>{const O=R.indexOf($);return R.map((L,F)=>F===O?`${L} - ${G}`:L).join()}},2069:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConcatAttributes=c.concat=void 0;const T=_(246),C=_(2039),M=_(1163);c.concat=(L,F,V)=>(O(F),L.session.pack&&F[0].dims.length>1?[L.run((0,M.createPackedConcatProgramInfoLoader)(L,F,V),F)]:[L.run(E(L,F,V),F)]);const E=(L,F,V)=>{const W=(z=F.length,Z=V.cacheKey,{name:"Concat",inputNames:Array.from({length:z},(H,Y)=>`X${Y}`),inputTypes:Array(z).fill(C.TextureType.unpacked),cacheHint:Z});var z,Z;return Object.assign(Object.assign({},W),{get:()=>((H,Y,U,j)=>{const X=U[0].dims.slice();if(j>=X.length||j<-1*X.length)throw new Error("axis specified for concat doesn't match input dimensionality");j<0&&(j=X.length+j);const K=X.slice(0);for(let ie=1;ie`int getTextureWhereDataResides(int index) {
${L.map((F,V)=>`if(index<${F}) {return ${V};}
`).join("")}
}`,R=L=>P(L),$=(L,F)=>{const V=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${F}]) {`];for(let W=0;W{const F=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let V=0;V(0,T.createAttributeWithCacheKey)({axis:L.attributes.getInt("axis")});const O=L=>{if(!L||L.length<1)throw new Error("too few inputs");const F=L[0].type,V=L[0].dims.length;if(F==="string")throw new Error("string tensor is not supported yet");for(const W of L){if(W.type!==F)throw new Error("input tensors should be one type");if(W.dims.length!==V)throw new Error("input tensors should have the same shape")}}},4770:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackedGroupedConvProgramInfoLoader=void 0;const T=_(6231),C=_(5060),M=_(2039),E=_(8138),P=_(2823);c.createUnpackedGroupedConvProgramInfoLoader=(R,$,G)=>{const O=(L=$.length>2,F=G.cacheKey,{name:"GroupedConv",inputNames:L?["X","W","Bias"]:["X","W"],inputTypes:L?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],cacheHint:F});var L,F;return Object.assign(Object.assign({},O),{get:()=>((V,W,z,Z)=>{const H=W.length>2?"value += getBias(output_channel);":"",Y=W[0].dims.slice(),U=W[1].dims.slice(),j=U[0]/Z.group;T.Logger.verbose("GroupedConv",`autpPad:${Z.autoPad}, dilations:${Z.dilations}, group:${Z.group}, kernelShape:${Z.kernelShape}, pads:${Z.pads}, strides:${Z.strides}`);const X=(0,E.calculateOutputShape)(Y,U,Z.dilations,Z.pads,Z.strides),K=(0,C.getGlsl)(V.session.backend.glContext.version),{activationFunction:q,applyActivation:J}=(0,P.getActivationSnippet)(Z),Q=`
const ivec2 strides = ivec2(${Z.strides[0]}, ${Z.strides[1]});
const ivec2 pads = ivec2(${Z.pads[0]}, ${Z.pads[1]});
${q}
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 / ${j};
float value = 0.0;
for (int wInChannel = 0; wInChannel < ${U[1]}; wInChannel++) {
int input_channel = group_id * ${U[1]} + wInChannel;
for (int wHeight = 0; wHeight < ${U[2]}; wHeight++) {
int xHeight = xRCCorner.x + wHeight * ${Z.dilations[0]};
if (xHeight < 0 || xHeight >= ${Y[2]}) {
continue;
}
for (int wWidth = 0; wWidth < ${U[3]}; wWidth++) {
int xWidth = xRCCorner.y + wWidth * ${Z.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;
}
}
}
${H}
${J}
${K.output} = vec4(value, .0, .0, .0);
}
`;return Object.assign(Object.assign({},z),{output:{dims:X,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:Q,hasMain:!0})})(R,$,O,G)})}},1386:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.conv2DPacked=c.conv2DPackedPointwise=void 0;const T=_(8138),C=_(8555),M=_(708);c.conv2DPackedPointwise=(E,P,R)=>{const $=P[0].dims,G=P[1].dims,O=(0,T.calculateOutputShape)($,G,R.dilations,R.pads,R.strides),L=E.reshapePacked(P[0],[$[1],$[2]*$[3]]),F=E.reshapePacked(P[1],[G[0],G[1]]),V=P.length>2?[F,L,P[2]]:[F,L],W=E.run((0,M.createPackedMatmulProgramInfoLoader)(E,V,R),V);return E.reshapePacked(W,O)},c.conv2DPacked=(E,P,R)=>{const $=P[0].dims,G=P[1].dims,O=(0,T.calculateOutputShape)($,G,R.dilations,R.pads,R.strides),L=E.run((0,C.createPackedIm2ColProgramInfoLoader)(E,P[0],P[1],O,R),[P[0]]),F=E.reshapePacked(P[1],[G[0],G[1]*G[2]*G[3]]),V=P.length===3?[F,L,P[2]]:[F,L],W=E.run((0,M.createPackedMatmulProgramInfoLoader)(E,V,R),V);return E.reshapePacked(W,O)}},9663:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvTransposeAttributes=c.convTranspose=void 0;const T=_(246),C=_(5060),M=_(2039),E=_(2823),P=(F,V,W,z,Z,H)=>(F-1)*V+W+(z-1)*Z+1-H,R=(F,V,W,z,Z)=>{const H=Math.floor(F/2);V==="SAME_UPPER"?(W[z]=H,W[Z]=F-H):V==="SAME_LOWER"&&(W[z]=F-H,W[Z]=H)};c.convTranspose=(F,V,W)=>(L(V,W),$(F,V,W));const $=(F,V,W)=>{const z=O(W,V);return[G(F,V,z)]},G=(F,V,W)=>F.run(((z,Z,H)=>{const Y=(U=Z.length>2,j=H.cacheKey,{name:"ConvTranspose",inputNames:U?["X","W","B"]:["X","W"],inputTypes:U?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],cacheHint:j});var U,j;return Object.assign(Object.assign({},Y),{get:()=>((X,K,q,J)=>{const Q=K.length>2?"getB(output_channel)":"0.0",ee=K[0].dims,re=K[1].dims,ie=re[1],ae=re[0]/J.group,ne=[K[0].dims[0],K[1].dims[1]*J.group,...J.outputShape],te=(0,C.getGlsl)(X.session.backend.glContext.version),{activationFunction:oe,applyActivation:ue}=(0,E.getActivationSnippet)(J),de=`
const ivec2 strides = ivec2(${J.strides[0]}, ${J.strides[1]});
const ivec2 pads = ivec2(${J.pads[0]}, ${J.pads[1]});
${oe}
void main() {
ivec4 coords = getOutputCoords();
int batch = coords.x;
int output_channel = coords.y;
ivec2 loc = coords.zw + pads;
int group_id = output_channel / ${ie};
int wOutChannel = output_channel - group_id * ${ie};
float value = ${Q};
for (int inChannelOffset = 0; inChannelOffset < ${ae}; inChannelOffset++) {
int input_channel = group_id * ${ae} + inChannelOffset;
for (int wWOff = 0; wWOff < ${re[2]}; wWOff++) {
for (int wHOff = 0; wHOff < ${re[3]}; wHOff++) {
ivec2 wOff = ivec2(wWOff * ${J.dilations[0]}, wHOff * ${J.dilations[1]});
ivec2 wLoc = loc - wOff;
ivec2 wLocIn = wLoc / strides;
if (
wLocIn * strides == wLoc &&
wLocIn.x >= 0 && wLocIn.x < ${ee[2]} &&
wLocIn.y >= 0 && wLocIn.y < ${ee[3]}
) {
float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);
float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);
value += xVal * wVal;
}
}
}
}
${ue}
${te.output} = vec4(value, .0, .0, .0);
}
`;return Object.assign(Object.assign({},q),{output:{dims:ne,type:K[0].type,textureType:M.TextureType.unpacked},shaderSource:de,hasMain:!0})})(z,Z,Y,H)})})(F,V,W),V),O=(F,V)=>{const W=F.kernelShape.slice();if(F.kernelShape.length===0)for(let Y=2;Y{const ee=Y.length-2,re=Q.length===0;for(let ie=0;ie{const V=F.attributes,W=(0,E.parseInternalActivationAttributes)(V),z=V.getString("auto_pad","NOTSET"),Z=V.getInts("dilations",[1,1]),H=V.getInt("group",1),Y=V.getInts("kernel_shape",[]),U=V.getInts("output_padding",[0,0]),j=V.getInts("output_shape",[]),X=V.getInts("pads",[0,0,0,0]),K=V.getInts("strides",[1,1]);return(0,T.createAttributeWithCacheKey)(Object.assign({autoPad:z,dilations:Z,group:H,kernelShape:Y,outputPadding:U,outputShape:j,pads:X,strides:K},W))};const L=(F,V)=>{if(!F||F.length!==2&&F.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(F[0].dims.length!==4||F[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(F[0].dims[1]!==F[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const W=F[1].dims[1]*V.group;if(F.length===3&&(F[2].dims.length!==1||F[2].dims[0]!==W))throw new Error("invalid bias");const z=F[0].dims.length-2;if(V.dilations.length!==z)throw new Error(`dilations should be ${z}D`);if(V.strides.length!==z)throw new Error(`strides should be ${z}D`);if(V.pads.length!==2*z)throw new Error(`pads should be ${2*z}D`);if(V.outputPadding.length!==z)throw new Error(`output_padding should be ${z}D`);if(V.kernelShape.length!==0&&V.kernelShape.length!==F[1].dims.length-2)throw new Error("invalid kernel shape");if(V.outputShape.length!==0&&V.outputShape.length!==F[0].dims.length-2)throw new Error("invalid output shape");if(F[0].type!=="float32"||F[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(F.length===3&&F[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvAttributes=c.conv=c.calculateOutputShape=void 0;const T=_(246),C=_(2517),M=_(4770),E=_(1386),P=_(9828),R=_(2823),$=_(3248),G=_(5623);c.calculateOutputShape=(z,Z,H,Y,U)=>{const j=z[0],X=z.slice(2),K=X.length,q=Z[0],J=Z.slice(2).map((ee,re)=>ee+(ee-1)*(H[re]-1)),Q=X.map((ee,re)=>ee+Y[re]+Y[re+K]).map((ee,re)=>Math.floor((ee-J[re]+U[re])/U[re]));return[j,q].concat(...Q)},c.conv=(z,Z,H)=>(W(Z,H),O(z,Z,H));const O=(z,Z,H)=>{const Y=V(H,Z),U=z.session.pack,j=Y.kernelShape[0]===1&&Y.kernelShape[1]===1;return Y.group>1?[z.run((0,M.createUnpackedGroupedConvProgramInfoLoader)(z,Z,Y),Z)]:j&&U?[L(z,Z,Y)]:U&&Z[0].dims.length===4&&Z[0].dims[0]===1&&!j?[(0,E.conv2DPacked)(z,Z,Y)]:[F(z,Z,Y)]},L=(z,Z,H)=>{const Y=Z[0].dims,U=Z[1].dims,j=(0,c.calculateOutputShape)(Y,U,H.dilations,H.pads,H.strides),X=z.reshapeUnpacked(Z[0],[Y[1],Y[2]*Y[3]]),K=z.reshapeUnpacked(Z[1],[U[0],U[1]]),q=Z.length>2?[K,X,Z[2]]:[K,X],J=z.run((0,G.createMatmulProgramInfoLoader)(q,H),q);return z.reshapeUnpacked(J,j)},F=(z,Z,H)=>{const Y=Z[0].dims,U=Z[1].dims,j=(0,c.calculateOutputShape)(Y,U,H.dilations,H.pads,H.strides),X=z.run((0,$.createIm2ColProgramInfoLoader)(z,Z[0],Z[1],j,H),[Z[0]]),K=Z.length===3?[X,Z[1],Z[2]]:[X,Z[1]];return z.run((0,P.createDotProductProgramInfoLoader)(z,Z,j,H),K)},V=(z,Z)=>{const H=z.kernelShape.slice();if(z.kernelShape.length===0)for(let j=2;j{const Z=z.attributes,H=(0,R.parseInternalActivationAttributes)(Z),Y=Z.getString("auto_pad","NOTSET"),U=Z.getInts("dilations",[1,1]),j=Z.getInt("group",1),X=Z.getInts("kernel_shape",[]),K=Z.getInts("pads",[0,0,0,0]),q=Z.getInts("strides",[1,1]);return(0,T.createAttributeWithCacheKey)(Object.assign({autoPad:Y,dilations:U,group:j,kernelShape:X,pads:K,strides:q},H))};const W=(z,Z)=>{if(!z||z.length!==2&&z.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(z[0].dims.length!==4||z[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(z[0].dims[1]!==z[1].dims[1]*Z.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(z.length===3&&(z[2].dims.length!==1||z[1].dims[0]!==z[2].dims[0]))throw new Error("invalid bias");const H=z[0].dims.length-2;if(Z.dilations.length!==H)throw new Error(`dilations should be ${H}D`);if(Z.strides.length!==H)throw new Error(`strides should be ${H}D`);if(Z.pads.length!==2*H)throw new Error(`pads should be ${2*H}D`);if(Z.kernelShape.length!==0&&Z.kernelShape.length!==z[1].dims.length-2)throw new Error("invalid kernel shape");if(z[0].type!=="float32"||z[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(z.length===3&&z[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseDepthToSpaceAttributes=c.depthToSpace=void 0;const T=_(3738);c.depthToSpace=(M,E,P)=>{C(E);const R=P.blocksize,$=R*R,G=P.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],O=P.mode==="DCR"?[E[0].dims[0],R,R,E[0].dims[1]/$,E[0].dims[2],E[0].dims[3]]:[E[0].dims[0],E[0].dims[1]/$,R,R,E[0].dims[2],E[0].dims[3]],L=M.reshapeUnpacked(E[0],O),F={perm:G,cacheKey:`${G}`},[V]=(0,T.transpose)(M,[L],F),W=[E[0].dims[0],E[0].dims[1]/$,E[0].dims[2]*R,E[0].dims[3]*R];return[M.reshapeUnpacked(V,W)]},c.parseDepthToSpaceAttributes=M=>{const E=M.attributes.getInt("blocksize");if(E<1)throw new Error(`blocksize must be >= 1, but got : ${E} for DepthToSpace`);const P=M.attributes.getString("mode","DCR");if(P!=="DCR"&&P!=="CRD")throw new Error(`unrecognized mode: ${P} for DepthToSpace`);return{mode:P,blocksize:E}};const C=M=>{if(M.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${M.length}`);if(M[0].type==="string"||M[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDotProductProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(2823),P=_(3248);c.createDotProductProgramInfoLoader=(R,$,G,O)=>{const L=((F,V)=>({name:"ConvDotProduct",inputNames:F?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:F?[M.TextureType.unpacked,M.TextureType.packedLastDimension,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.packedLastDimension],cacheKey:V.activationCacheKey}))($.length>2,O);return Object.assign(Object.assign({},L),{get:()=>((F,V,W,z,Z)=>{const H=W[0].dims,Y=W[1].dims,U=[Y[0],Math.ceil(H[1]*Y[2]*Y[3]/4)],j=(0,P.calculateIm2ColDims)(H,Y,z),[X,K]=F.calculateTextureWidthAndHeight(U,M.TextureType.packedLastDimension),q=T.ShapeUtil.computeStrides(j),[J,Q]=F.calculateTextureWidthAndHeight(j,M.TextureType.packedLastDimension),ee=z.length,re=W.length<3?"0.0":"_B(b)",ie=Math.ceil(H[1]*Y[2]*Y[3]/4),{activationFunction:ae,applyActivation:ne}=(0,E.getActivationSnippet)(Z),te=(0,C.getGlsl)(F.session.backend.glContext.version),oe=`
${ae}
float process(int indices[${ee}]) {
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] * ${q[0]} + im2col[1] * ${q[1]} + im2col[2] * ${q[2]};
int kernelOffset = indices[1] * ${U[1]};
float value = ${re};
for (int i = 0; i < ${ie}; ++i) {
vec2 im2colCoords = offsetToCoords(im2colOffset, ${J}, ${Q});
vec2 kernelCoords = offsetToCoords(kernelOffset, ${X}, ${K});
value += dot(${te.texture2D}(Im2Col, im2colCoords), ${te.texture2D}(K, kernelCoords));
++im2colOffset;
++kernelOffset;
}
${ne}
return value;
}`;return Object.assign(Object.assign({},V),{output:{dims:z,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:oe})})(R,L,$,G,O)})}},7992:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseFlattenAttributes=c.flatten=void 0;const T=_(2517);c.flatten=(M,E,P)=>{C(E,P);const R=T.ShapeUtil.flattenShape(E[0].dims,P);return[M.reshapeUnpacked(E[0],R)]},c.parseFlattenAttributes=M=>M.attributes.getInt("axis",1);const C=(M,E)=>{if(!M||M.length!==1)throw new Error("Flatten requires 1 input.");const P=M[0].dims.length;if(P===0)throw new Error("scalar tensor is not supported.");if(E<-P||E>P)throw new Error("Invalid axis");if(M[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInternalActivationAttributes=c.getActivationSnippet=void 0;const T=_(2517),C=_(4909);c.getActivationSnippet=function(M){let E;switch(M.activation){case"Relu":E=(0,C.glslRelu)();break;case"Sigmoid":E=(0,C.glslSigmoid)();break;case"Clip":E=(0,C.glslClip)(M.clipMin,M.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const P=E.name;return{activationFunction:E.body,applyActivation:`value = ${P}_(value);`}},c.parseInternalActivationAttributes=M=>{const E=M.getString("activation","");if(E==="Clip"){const[P,R]=M.getFloats("activation_params",[T.MIN_CLIP,T.MAX_CLIP]);return{activation:E,clipMax:R,clipMin:P,activationCacheKey:`${E}:${P},${R}`}}return{activation:E,activationCacheKey:E}}},1253:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGatherAttributes=c.gather=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039);c.gather=(G,O,L)=>($(O,L.axis),[G.run(R(G,O,L),O)]),c.parseGatherAttributes=G=>(0,T.createAttributeWithCacheKey)({axis:G.attributes.getInt("axis",0)});const P={name:"Gather",inputNames:["A","B"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked]},R=(G,O,L)=>{const F=Object.assign(Object.assign({},P),{cacheHint:L.cacheKey});return Object.assign(Object.assign({},F),{get:()=>((V,W,z,Z)=>{const H=z[0].dims.slice(),Y=z[1].dims.slice(),U=new Array(H.length+Y.length-1);Z=M.ShapeUtil.normalizeAxis(Z,H.length);const j=[];for(let K=0;K{if(!G||G.length!==2)throw new Error("Gather requires 2 inputs.");const L=G[0].dims.length;if(L<1)throw new Error("Invalid input shape.");if(O<-L||O>L-1)throw new Error("Invalid axis.");if(C.NUMBER_TYPES.indexOf(G[0].type)===-1)throw new Error("Invaid input type.");if(G[1].type!=="int32"&&G[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGemmAttributesV11=c.parseGemmAttributesV7=c.gemm=void 0;const T=_(246),C=_(2517),M=_(2039);c.gemm=(G,O,L)=>($(O,L),[G.run(P(O,L),O)]);const E=(G,O)=>{const L=G.attributes.getInt("transA",0)!==0,F=G.attributes.getInt("transB",0)!==0,V=G.attributes.getFloat("alpha",1),W=G.attributes.getFloat("beta",1);return(0,T.createAttributeWithCacheKey)({transA:L,transB:F,alpha:V,beta:W,isOptionalC:O})};c.parseGemmAttributesV7=G=>E(G,!1),c.parseGemmAttributesV11=G=>E(G,!0);const P=(G,O)=>{const L={name:"Gemm",inputNames:G.length===3?["A","B","C"]:["A","B"],inputTypes:G.length===3?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],key:O.cacheKey};return Object.assign(Object.assign({},L),{get:()=>R(L,G,O)})},R=(G,O,L)=>{const F=O[0].dims.slice(),V=O[1].dims.slice(),[W,z]=C.GemmUtil.getShapeOfGemmResult(F,L.transA,V,L.transB,O.length===3?O[2].dims:void 0),Z=[W,z];if(!Z)throw new Error("Can't use gemm on the given tensors");let H=F[F.length-1],Y="";L.transA&&(H=F[0]),L.transA&&L.transB?Y="value += _A_T(a) * _B_T(b);":L.transA&&!L.transB?Y="value += _A_T(a) * _B(b);":!L.transA&&L.transB?Y="value += _A(a) * _B_T(b);":L.transA||L.transB||(Y="value += _A(a) * _B(b);");const U=Z.length,j=`
float process(int indices[${U}]) {
int a[${U}];
int b[${U}];
${O.length===3?`int c[${O[2].dims.length}];`:""}
copyVec(indices, a);
copyVec(indices, b);
${O.length===3?"bcastIndices_C(indices, c);":""}
float value = 0.0;
for (int k=0; k<${H}; ++k) {
a[${U-1}] = k;
b[${U-2}] = k;
${Y}
}
value = value * alpha;
${O.length===3?"value += beta * _C(c);":""}
return value;
}`;return Object.assign(Object.assign({},G),{output:{dims:Z,type:O[0].type,textureType:M.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:L.alpha},{name:"beta",type:"float",data:L.beta}],shaderSource:j})},$=(G,O)=>{if(!G)throw new Error("Input is missing");if(O.isOptionalC&&(G.length<2||G.length>3))throw new Error("Invaid input shape.");if(!O.isOptionalC&&G.length!==3)throw new Error("Gemm requires 3 inputs");if(G.length===3&&G[2].dims.length!==1&&G[2].dims.length!==2)throw new Error("Invalid input shape of C");if(G[0].type!=="float32"&&G[0].type!=="float64"||G[1].type!=="float32"&&G[1].type!=="float64"||G.length===3&&G[2].type!=="float32"&&G[2].type!=="float64")throw new Error("Invalid input type.");if(G[0].type!==G[1].type||G.length===3&&G[0].type!==G[2].type)throw new Error("Input types are mismatched")}},8555:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedIm2ColProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(2827);c.createPackedIm2ColProgramInfoLoader=(E,P,R,$,G)=>{const O=(L=G.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[C.TextureType.packed],cacheHint:L});var L;return Object.assign(Object.assign({},O),{get:()=>((F,V,W,z,Z,H)=>{const Y=W.dims,U=z.dims,j=Z.length,X=[U[1]*U[2]*U[3],Z[2]*Z[3]],K=U[2]*U[3],q=(0,M.unpackFromChannel)(),J=(0,T.getGlsl)(F.session.backend.glContext.version);let Q="";for(let re=0;re<=1;re++)for(let ie=0;ie<=1;ie++)Q+=`
blockIndex = rc.x + ${ie};
pos = rc.y + ${re};
if(blockIndex < ${X[1]} && pos < ${X[0]}) {
offsetY = int(blockIndex / (${Z[j-1]})) * ${H.strides[0]} -
${H.pads[0]};
d0 = offsetY + ${H.dilations[0]} * (imod(pos, ${K}) / ${U[2]});
if(d0 < ${Y[2]} && d0 >= 0) {
offsetX = imod(blockIndex, ${Z[j-1]}) * ${H.strides[1]} -
${H.pads[1]};
d1 = offsetX + ${H.dilations[1]} * imod(imod(pos, ${K}), ${U[2]});
if(d1 < ${Y[3]} && d1 >= 0) {
ch = int(float(pos)/ ${K}.);
innerDims = vec2(d0, d1);
result[${2*re+ie}] = getChannel(
getA(0, ch, int(innerDims.x),
int(innerDims.y)), innerDims);
}
}
}
`;const ee=`
${q}
void main() {
ivec2 rc = getOutputCoords();
vec4 result = vec4(0.0);
int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
vec2 innerDims;
${Q}
${J.output} = result;
}
`;return Object.assign(Object.assign({},V),{output:{dims:X,type:W.type,textureType:C.TextureType.packed},shaderSource:ee,hasMain:!0})})(E,O,P,R,$,G)})}},3248:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.calculateIm2ColDims=c.createIm2ColProgramInfoLoader=void 0;const T=_(2039);c.createIm2ColProgramInfoLoader=(C,M,E,P,R)=>{const $=(G=R.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[T.TextureType.unpacked],cacheHint:G});var G;return Object.assign(Object.assign({},$),{get:()=>((O,L,F,V,W,z)=>{const Z=F.dims,H=V.dims,Y=W.length,U=(0,c.calculateIm2ColDims)(Z,H,W,4),j=`
const int XC = ${Z[1]};
const int XH = ${Z[2]};
const int XW = ${Z[3]};
const int KH = ${z.kernelShape[0]};
const int KW = ${z.kernelShape[1]};
const int dilationH = ${z.dilations[0]};
const int dilationW = ${z.dilations[1]};
const int strideH = ${z.strides[0]};
const int strideW = ${z.strides[1]};
const int padH = ${z.pads[0]};
const int padW = ${z.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[${Z.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({},L),{output:{dims:U,type:F.type,textureType:T.TextureType.packedLastDimension},shaderSource:j})})(0,$,M,E,P,R)})},c.calculateIm2ColDims=(C,M,E,P=4)=>[E[0],E[2],E[3],Math.ceil(C[1]*M[2]*M[3]/P)]},6572:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseImageScalerAttributes=c.imageScaler=void 0;const T=_(246),C=_(2039);c.imageScaler=($,G,O)=>(R(G),[$.run(E($,G,O),G)]),c.parseImageScalerAttributes=$=>{const G=$.attributes.getFloat("scale"),O=$.attributes.getFloats("bias");return(0,T.createAttributeWithCacheKey)({scale:G,bias:O})};const M={name:"ImageScaler",inputNames:["X"],inputTypes:[C.TextureType.unpacked]},E=($,G,O)=>{const L=Object.assign(Object.assign({},M),{cacheHint:O.cacheKey});return Object.assign(Object.assign({},L),{get:()=>((F,V,W,z)=>{const Z=W[0].dims.slice(),H=Z.length,Y=`
${P(z.bias.length)}
float process(int indices[${H}]) {
return _X(indices) * scale + getBias(bias, indices[1]);
}`;return Object.assign(Object.assign({},V),{output:{dims:Z,type:W[0].type,textureType:C.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:z.bias.length,data:z.bias},{name:"scale",type:"float",data:z.scale}],shaderSource:Y})})(0,L,G,O)})},P=$=>{const G=[`float getBias(float bias[${$}], int channel) {`];for(let O=0;O<$;++O)O===0?G.push(` if (channel == ${O}) { return bias[${O}]; }`):O===$-1?G.push(` else { return bias[${O}]; }`):G.push(` else if (channel == ${O}) { return bias[${O}]; }`);return G.push(" }"),G.join(`
`)},R=$=>{if(!$||$.length!==1)throw new Error("ImageScaler requires 1 input.");if($[0].dims.length!==4)throw new Error("Invalid input shape.");if($[0].type!=="float32"&&$[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInstanceNormalizationAttributes=c.instanceNormalization=void 0;const T=_(5060),C=_(2039);c.instanceNormalization=(G,O,L)=>{$(O);const F=G.run(E(O[0]),O);return[G.run(R(G,O[0],L,F.dims),[O[0],F,O[1],O[2]])]},c.parseInstanceNormalizationAttributes=G=>G.attributes.getFloat("epsilon",1e-5);const M={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[C.TextureType.unpacked]},E=G=>Object.assign(Object.assign({},M),{get:()=>((O,L)=>{const F=L.dims.slice(),V=F[1],W=F[2]*F[3],z=[F[0],V],Z=`
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<${F[2]}; a2++) {
a[2] = a2;
for(int a3=0; a3<${F[3]}; a3++) {
a[3] = a3;
float x = _X(a);
temp += x;
}
}
float mean = temp / float(${W});
temp = 0.0;
for(int a2=0; a2<${F[2]}; a2++) {
a[2] = a2;
for(int a3=0; a3<${F[3]}; a3++) {
a[3] = a3;
float x = _X(a);
temp += (x - mean) * (x - mean);
}
}
v.r = mean;
v.g = temp / float(${W});
return v;
}`;return Object.assign(Object.assign({},O),{output:{dims:z,type:L.type,textureType:C.TextureType.packedLastDimension},shaderSource:Z})})(M,G)}),P={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[C.TextureType.unpacked,C.TextureType.packedLastDimension,C.TextureType.unpacked,C.TextureType.unpacked]},R=(G,O,L,F)=>{const V=Object.assign(Object.assign({},P),{cacheHint:`${L}`});return Object.assign(Object.assign({},V),{get:()=>((W,z,Z,H,Y)=>{const U=(0,T.getGlsl)(W.session.backend.glContext.version),[j,X]=W.calculateTextureWidthAndHeight(Y,C.TextureType.packedLastDimension),[K,q]=[j/4,X],J=`
vec4 get_MeanAndVariance(int[2] mv) {
int offset = indicesToOffset_MeanAndVariance(mv);
vec2 coords = offsetToCoords(offset, ${K}, ${q});
return ${U.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({},z),{output:{dims:Z.dims,type:Z.type,textureType:C.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:H}],shaderSource:J})})(G,V,O,L,F)})},$=G=>{if(!G||G.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const O=G[0],L=G[1],F=G[2];if(O.dims.length<3||L.dims.length!==1||F.dims.length!==1)throw new Error("Invalid input shape.");if(L.dims[0]!==O.dims[1]||F.dims[0]!==O.dims[1])throw new Error("Input shapes are mismatched.");if(O.type!=="float32"&&O.type!=="float64"||L.type!=="float32"&&L.type!=="float64"||F.type!=="float32"&&F.type!=="float64")throw new Error("Invalid input type.");if(G[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedMatmulProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(9390),P=_(2823),R=_(5623);c.createPackedMatmulProgramInfoLoader=($,G,O)=>{const L=(F=G.length>2,V=O.activationCacheKey,{name:"MatMul (packed)",inputNames:F?["A","B","Bias"]:["A","B"],inputTypes:F?[M.TextureType.packed,M.TextureType.packed,M.TextureType.packed]:[M.TextureType.packed,M.TextureType.packed],cacheHint:V});var F,V;return Object.assign(Object.assign({},L),{get:()=>((W,z,Z,H)=>{const Y=Z.length>2,U=Y?"value += getBiasForMatmul();":"",j=Z[0].dims,X=Z[1].dims,K=T.BroadcastUtil.calcShape(j,X,!0),q=!T.ShapeUtil.areEqual(Z[0].dims,Z[1].dims);if(!K)throw new Error("Can't use matmul on the given tensors");const J=j[j.length-1],Q=Math.ceil(J/2),ee=j.length,re=X.length,ie=(0,C.getGlsl)(W.session.backend.glContext.version),ae=(0,E.getCoordsDataType)(K.length),ne=K.length,te=(0,E.getGlChannels)(),{activationFunction:oe,applyActivation:ue}=(0,P.getActivationSnippet)(H),de=Y?`${(0,R.getBiasForMatmul)(ae,te,Z[2].dims,K,!0)}`:"",pe=q?`${function(Me,Pe,Re,De){let Le=[],$e=[];const Oe=Re[0].dims,Ee=Re[1].dims,Be=Oe.length,He=Ee.length,We=De.length,Ke=We-Be,Je=We-He;Le=Oe.map((ct,yt)=>`coords.${Pe[yt+Ke]}`),Le[Be-1]="i*2",Le.join(", "),$e=Ee.map((ct,yt)=>`coords.${Pe[yt+Je]}`),$e[He-2]="i*2",$e.join(", ");const tt=T.BroadcastUtil.getBroadcastDims(Oe,De),mt=T.BroadcastUtil.getBroadcastDims(Ee,De),pt=tt.map(ct=>`coords.${Pe[ct+Ke]} = 0;`).join(`
`),bt=mt.map(ct=>`coords.${Pe[ct+Je]} = 0;`).join(`
`),gt=`int lastDim = coords.${Pe[We-1]};
coords.${Pe[We-1]} = coords.${Pe[We-2]};
coords.${Pe[We-2]} = lastDim;`;return`
vec4 getAAtOutCoordsMatmul(int i) {
${Me} coords = getOutputCoords();
${gt}
${pt}
vec4 outputValue = getA(${Le});
return outputValue;
}
vec4 getBAtOutCoordsMatmul(int i) {
${Me} coords = getOutputCoords();
${gt}
${bt}
vec4 outputValue = getB(${$e});
return outputValue;
}`}(ae,te,Z,K)}`:"",he=q?"getAAtOutCoordsMatmul(i)":`getA(${function(Me,Pe){let Re="";for(let De=0;De{Object.defineProperty(c,"__esModule",{value:!0}),c.getBiasForMatmul=c.createMatmulProgramInfoLoader=c.parseMatMulAttributes=c.matMul=void 0;const T=_(2517),C=_(2039),M=_(9390),E=_(2823),P=_(708);function R(O,L){const F=(V=O.length>2,W=L.activationCacheKey,{name:"MatMul",inputNames:V?["A","B","Bias"]:["A","B"],inputTypes:V?[C.TextureType.unpacked,C.TextureType.unpacked,C.TextureType.unpacked]:[C.TextureType.unpacked,C.TextureType.unpacked],cacheHint:W});var V,W;return Object.assign(Object.assign({},F),{get:()=>function(z,Z,H){const Y=Z[0].dims,U=Z[1].dims,j=T.BroadcastUtil.calcShape(Y,U,!0);if(!j)throw new Error("Can't use matmul on the given tensors");const X=(0,M.getCoordsDataType)(j.length),K=(0,M.getGlChannels)(),{activationFunction:q,applyActivation:J}=(0,E.getActivationSnippet)(H),Q=Z.length>2,ee=Q?"value += getBiasForMatmul();":"",re=Q?`${G(X,K,Z[2].dims,j,!1)}`:"",ie=j.length,ae=Y.length,ne=U.length,te=`
${q}
${re}
float process(int indices[${ie}]) {
int a[${ae}];
int b[${ne}];
bcastMatmulIndices_A(indices, a);
bcastMatmulIndices_B(indices, b);
float value;
for (int k=0; k<${Y[Y.length-1]}; ++k) {
a[${ae-1}] = k;
b[${ne-2}] = k;
value += _A(a) * _B(b);
}
${ee}
${J}
return value;
}`;return Object.assign(Object.assign({},z),{output:{dims:j,type:Z[0].type,textureType:C.TextureType.unpacked},shaderSource:te})}(F,O,L)})}c.matMul=(O,L,F)=>($(L),O.session.pack?[O.run((0,P.createPackedMatmulProgramInfoLoader)(O,L,F),L)]:[O.run(R(L,F),L)]),c.parseMatMulAttributes=O=>(0,E.parseInternalActivationAttributes)(O.attributes),c.createMatmulProgramInfoLoader=R;const $=O=>{if(!O||O.length!==2)throw new Error("MatMul requires 2 inputs.");if(O[0].dims[O[0].dims.length-1]!==O[1].dims[O[1].dims.length-2])throw new Error("shared dimension does not match.");if(O[0].type!=="float32"&&O[0].type!=="float64"||O[1].type!=="float32"&&O[1].type!=="float64")throw new Error("inputs should be float type");if(O[0].type!==O[1].type)throw new Error("inputs types should match")};function G(O,L,F,V,W){let z="";const Z=F.length,H=V.length,Y=H-Z;z=H<2&&Z>0?"coords":F.map((X,K)=>`coords.${L[K+Y]}`).join(", ");const U=T.BroadcastUtil.getBroadcastDims(F,V).map(X=>`coords.${L[X+Y]} = 0;`).join(`
`);let j="vec4(outputValue.xx, outputValue.yy)";return T.ShapeUtil.size(F)===1&&(j="vec4(outputValue.x)"),W?`
vec4 getBiasForMatmul() {
${O} coords = getOutputCoords();
${U}
vec4 outputValue = getBias(${z});
return ${j};
}`:`
float getBiasForMatmul() {
${O} coords = getOutputCoords();
${U}
return getBias(coords.x);
}`}c.getBiasForMatmul=G},2403:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P={name:"pack",inputNames:["A"],inputTypes:[C.TextureType.unpackedReversed]};c.createPackProgramInfoLoader=(R,$)=>Object.assign(Object.assign({},P),{get:()=>((G,O)=>{const L=(0,T.getGlsl)(G.session.backend.glContext.version),F=O.dims,V=F.length,W=O.dims.length,z=(0,M.getCoordsDataType)(W),Z=(0,E.getChannels)("rc",W),H=(Y=W,U=Z,j=F[F.length-2],X=F[F.length-1],Y===0||Y===1?"":`
int r = ${U[Y-2]};
int c = ${U[Y-1]};
int rp1 = ${U[Y-2]} + 1;
int cp1 = ${U[Y-1]} + 1;
bool rEdge = rp1 >= ${X};
bool cEdge = cp1 >= ${j};
`);var Y,U,j,X;let K;K=V===0?[1,1]:V===1?[F[0],1]:[F[W-1],F[W-2]];const q=function(ee,re,ie){if(ee===0)return"false";if(ee===1)return`rc > ${re[0]}`;let ae="";for(let ne=ee-2;ne= ${re[ne-ee+2]}`,ne= ${ee[0]} ? 0. : getA(rc + 1),
0, 0`;let ae="";if(ie>2)for(let ne=0;ne{Object.defineProperty(c,"__esModule",{value:!0}),c.unpackFromChannel=c.getChannels=c.getVecChannels=void 0;const T=_(9390);function C(M,E){return(0,T.getGlChannels)(E).map(P=>`${M}.${P}`)}c.getVecChannels=C,c.getChannels=function(M,E){return E===1?[M]:C(M,E)},c.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:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parsePadAttributesV11=c.padV11=c.parsePadAttributesV2=c.padV2=void 0;const T=_(246),C=_(2517),M=_(5060),E=_(2039),P={name:"Pad",inputNames:["A"],inputTypes:[E.TextureType.unpacked]};c.padV2=(z,Z,H)=>(G(Z),[z.run(Object.assign(Object.assign({},P),{cacheHint:H.cacheKey,get:()=>$(z,Z[0],H)}),Z)]),c.parsePadAttributesV2=z=>{const Z=z.attributes.getString("mode","constant"),H=z.attributes.getFloat("value",0),Y=z.attributes.getInts("pads");return(0,T.createAttributeWithCacheKey)({mode:Z,value:H,pads:Y})},c.padV11=(z,Z,H)=>{O(Z);const Y=R(z,Z,H);return(0,c.padV2)(z,[Z[0]],Y)},c.parsePadAttributesV11=z=>z.attributes.getString("mode","constant");const R=(z,Z,H)=>{if(!z.session.isInitializer(Z[1].dataId)||Z.length>=3&&!z.session.isInitializer(Z[2].dataId))throw new Error("dynamic pad attributes are not allowed");const Y=Array.from(Z[1].integerData),U=Z.length>=3?Z[2].floatData[0]:0;return(0,T.createAttributeWithCacheKey)({mode:H,pads:Y,value:U})},$=(z,Z,H)=>{const Y=C.ShapeUtil.padShape(Z.dims.slice(),H.pads),U=Y.length,j=`
${L(z,Z,H)}
float process(int[${U}] indices) {
return padA(indices);
}`;return{name:"Pad",inputNames:["A"],inputTypes:[E.TextureType.unpacked],output:{dims:Y,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:j}},G=z=>{if(!z||z.length!==1)throw new Error("Pad requires 1 input");if(z[0].type!=="float32"&&z[0].type!=="float64")throw new Error("Invalid input type.")},O=z=>{if(!z||z.length!==2&&z.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(z[1].type!=="int32")throw new Error("Invalid input type.");if(z.length>=3&&z[2].type==="string")throw new Error("Invalid input type.")},L=(z,Z,H)=>{const Y=(0,M.getGlsl)(z.session.backend.glContext.version),[U,j]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),X=C.ShapeUtil.computeStrides(Z.dims);switch(H.mode){case"constant":return F(Y,Z.dims,X,U,j,H.pads,H.value);case"reflect":return V(Y,Z.dims,X,U,j,H.pads);case"edge":return W(Y,Z.dims,X,U,j,H.pads);default:throw new Error("Invalid mode")}},F=(z,Z,H,Y,U,j,X)=>{const K=Z.length;let q="";for(let J=K-1;J>=0;--J)q+=`
k = m[${J}] - ${j[J]};
if (k < 0) return constant;
if (k >= ${Z[J]}) return constant;
offset += k * ${H[J]};
`;return`
float padA(int m[${K}]) {
const float constant = float(${X});
int offset = 0;
int k = 0;
${q}
vec2 coords = offsetToCoords(offset, ${Y}, ${U});
float value = getColorAsFloat(${z.texture2D}(A, coords));
return value;
}
`},V=(z,Z,H,Y,U,j)=>{const X=Z.length;let K="";for(let q=X-1;q>=0;--q)K+=`
k = m[${q}] - ${j[q]};
if (k < 0) { k = -k; }
{
const int _2n_1 = ${2*(Z[q]-1)};
k = int( mod( float(k), float(_2n_1) ) ) ;
if(k >= ${Z[q]}) { k = _2n_1 - k; }
}
offset += k * ${H[q]};
`;return`
float padA(int m[${X}]) {
int offset = 0;
int k = 0;
${K}
vec2 coords = offsetToCoords(offset, ${Y}, ${U});
float value = getColorAsFloat(${z.texture2D}(A, coords));
return value;
}
`},W=(z,Z,H,Y,U,j)=>{const X=Z.length;let K="";for(let q=X-1;q>=0;--q)K+=`
k = m[${q}] - ${j[q]};
if (k < 0) k = 0;
if (k >= ${Z[q]}) k = ${Z[q]-1};
offset += k * ${H[q]};
`;return`
float padA(int m[${X}]) {
int offset = 0;
int k = 0;
${K}
vec2 coords = offsetToCoords(offset, ${Y}, ${U});
float value = getColorAsFloat(${z.texture2D}(A, coords));
return value;
}
`}},2143:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.globalMaxPool=c.parseMaxPoolAttributes=c.maxPool=c.parseGlobalAveragePoolAttributes=c.globalAveragePool=c.parseAveragePoolAttributes=c.averagePool=void 0;const T=_(246),C=_(2517),M=_(2039);c.averagePool=(W,z,Z)=>{O(z);const H={name:"AveragePool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:Z.cacheKey};return[W.run(Object.assign(Object.assign({},H),{get:()=>E(z,H,!1,Z)}),z)]},c.parseAveragePoolAttributes=W=>{const z=W.attributes.getString("auto_pad","NOTSET"),Z=W.attributes.getInt("ceil_mode",0),H=W.attributes.getInt("count_include_pad",0)!==0,Y=W.attributes.getInts("kernel_shape"),U=W.attributes.getInts("strides",[]),j=W.attributes.getInts("pads",[]);if(Z!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,T.createAttributeWithCacheKey)({autoPad:z,ceilMode:Z,countIncludePad:H,kernelShape:Y,strides:U,pads:j})};const E=(W,z,Z,H)=>{const[Y,U]=R(W,H,Z),j=C.ShapeUtil.size(Y.kernelShape);let X="";Y.countIncludePad?X+=`value /= float(${j});`:X+=`value /= float(${j} - pad);`;const K=`
${L(W[0].dims,Y,"value += _X(x);",X,"0.0")}
`;return Object.assign(Object.assign({},z),{output:{dims:U,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:K})};c.globalAveragePool=(W,z,Z)=>{O(z);const H={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:`${Z.countIncludePad}`};return[W.run(Object.assign(Object.assign({},H),{get:()=>E(z,H,!0,Z)}),z)]},c.parseGlobalAveragePoolAttributes=W=>{const z=W.attributes.getInt("count_include_pad",0)!==0;return(0,T.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:z,kernelShape:[],strides:[],pads:[]})},c.maxPool=(W,z,Z)=>{O(z);const H={name:"MaxPool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:Z.cacheKey};return[W.run(Object.assign(Object.assign({},H),{get:()=>P(z,H,!1,Z)}),z)]},c.parseMaxPoolAttributes=W=>{const z=W.attributes.getString("auto_pad","NOTSET"),Z=W.attributes.getInt("ceil_mode",0),H=W.attributes.getInts("kernel_shape"),Y=W.attributes.getInts("strides",[]),U=W.attributes.getInts("pads",[]),j=W.attributes.getInt("storage_order",0),X=W.attributes.getInts("dilations",[]);if(j!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(Z!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,T.createAttributeWithCacheKey)({autoPad:z,ceilMode:Z,countIncludePad:!1,kernelShape:H,strides:Y,pads:U,storageOrder:j,dilations:X})};const P=(W,z,Z,H)=>{const[Y,U]=R(W,H,Z),j=`
${L(W[0].dims,Y,`
value = max(_X(x), value);
`,"","-1e5")}
`;return Object.assign(Object.assign({},z),{output:{dims:U,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:j})},R=(W,z,Z)=>{const H=W[0].dims.slice(),Y=Object.hasOwnProperty.call(z,"dilations"),U=z.kernelShape.slice(),j=z.strides.slice(),X=Y?z.dilations.slice():[],K=z.pads.slice();C.PoolConvUtil.adjustPoolAttributes(Z,H,U,j,X,K);const q=C.PoolConvUtil.computePoolOutputShape(Z,H,j,X,U,K,z.autoPad),J=Object.assign({},z);return Y?Object.assign(J,{kernelShape:U,strides:j,pads:K,dilations:X,cacheKey:z.cacheKey}):Object.assign(J,{kernelShape:U,strides:j,pads:K,cacheKey:z.cacheKey}),[J,q]},$={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},G={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[M.TextureType.unpacked]};c.globalMaxPool=(W,z)=>(O(z),[W.run(Object.assign(Object.assign({},G),{get:()=>P(z,G,!0,$)}),z)]);const O=W=>{if(!W||W.length!==1)throw new Error("Pool ops requires 1 input.");if(W[0].type!=="float32"&&W[0].type!=="float64")throw new Error("Invalid input type.")},L=(W,z,Z,H,Y)=>{const U=W.length;if(z.kernelShape.length<=2){const j=z.kernelShape[z.kernelShape.length-1],X=z.strides[z.strides.length-1],K=z.pads[z.pads.length/2-1],q=z.pads[z.pads.length-1],J=W[U-1];let Q="",ee="",re="";if(Q=K+q!==0?`
for (int i = 0; i < ${j}; i++) {
x[${U} - 1] = indices[${U} - 1] * ${X} - ${K} + i;
if (x[${U} - 1] < 0 || x[${U} - 1] >= ${J}) {
pad++;
continue;
}
${Z}
}`:`
for (int i = 0; i < ${j}; i++) {
x[${U} - 1] = indices[${U} - 1] * ${X} - ${K} + i;
${Z}
}`,z.kernelShape.length===2){const ie=z.kernelShape[z.kernelShape.length-2],ae=z.strides[z.strides.length-2],ne=z.pads[z.pads.length/2-2],te=z.pads[z.pads.length-2],oe=W[U-2];ee=ne+te!==0?`
for (int j = 0; j < ${ie}; j++) {
x[${U} - 2] = indices[${U} - 2] * ${ae} - ${ne} + j;
if (x[${U} - 2] < 0 || x[${U} - 2] >= ${oe}) {
pad+= ${j};
continue;
}
`:`
for (int j = 0; j < ${ie}; j++) {
x[${U} - 2] = indices[${U} - 2] * ${ae} - ${ne} + j;
`,re=`
}
`}return`
float process(int indices[${U}]) {
int x[${U}];
copyVec(indices, x);
float value = ${Y};
int pad = 0;
${ee}
${Q}
${re}
${H}
return value;
}
`}{const j=C.ShapeUtil.size(z.kernelShape),X=C.ShapeUtil.computeStrides(z.kernelShape),K=X.length,q=z.pads.length,J=V(K),Q=F(W,"inputDims"),ee=F(z.pads,"pads"),re=F(X,"kernelStrides"),ie=F(z.strides,"strides");let ae="";return ae=z.pads.reduce((ne,te)=>ne+te)?`
if (x[j] >= inputDims[j] || x[j] < 0) {
pad++;
isPad = true;
break;
}
}
if (!isPad) {
${Z}
}`:`
}
${Z}
`,`
${J}
float process(int indices[${U}]) {
int x[${U}];
copyVec(indices, x);
int offset[${K}];
int pads[${q}];
int inputDims[${U}];
int kernelStrides[${K}];
int strides[${K}];
${ee}
${Q}
${ie}
${re}
float value = ${Y};
int pad = 0;
bool isPad = false;
for (int i = 0; i < ${j}; i++) {
offsetToIndices(i, kernelStrides, offset);
isPad = false;
for (int j = ${U} - ${K}; j < ${U}; j++) {
x[j] = indices[j] * strides[j - ${U} + ${K}]
+ offset[j - ${U} + ${K}] - pads[j - 2];
${ae}
}
${H}
return value;
}
`}},F=(W,z)=>{let Z="";for(let H=0;H`
void offsetToIndices(int offset, int[${W}] strides, out int[${W}] indices) {
if (${W} == 0) {
return;
}
for (int i = 0; i < ${W} - 1; ++i) {
indices[i] = offset / strides[i];
offset -= indices[i] * strides[i];
}
indices[${W} - 1] = offset;
}`},4939:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reduceLogSumSquare=c.reduceLogSum=c.reduceProd=c.reduceMin=c.reduceMax=c.reduceMean=c.reduceSum=c.parseReduceAttributes=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039),P=(G,O,L,F,V)=>{$(O);const W={name:F,inputNames:["A"],inputTypes:[E.TextureType.unpacked]};return[G.run(Object.assign(Object.assign({},W),{cacheHint:L.cacheKey,get:()=>R(G,O,L,F,V,W)}),O)]};c.parseReduceAttributes=G=>{const O=G.attributes.getInts("axes",[]),L=G.attributes.getInt("keepdims",1)===1;return(0,T.createAttributeWithCacheKey)({axes:O,keepDims:L})};const R=(G,O,L,F,V,W)=>{const z=[],Z=O[0].dims.length||1,H=[],Y=M.ShapeUtil.normalizeAxes(L.axes,O[0].dims.length),U=V(O,Y);let j=U[1];for(let K=0;K=0||Y.length===0?(L.keepDims&&z.push(1),j=`
for(int j${K} = 0; j${K} < ${O[0].dims[K]}; j${K}++) {
inputIdx[${K}] = j${K};
${j}
}`):(H.push(`inputIdx[${K}] = outputIdx[${z.length}];`),z.push(O[0].dims[K]));const X=`
float process(int outputIdx[${z.length||1}]) {
float value; // final result
int inputIdx[${Z}]; // addressing input data
${H.join(`
`)}
${U[0]} // init ops for reduce max/min
${j}
${U[2]} // final computation for reduce mean
return value;
}`;return Object.assign(Object.assign({},W),{output:{dims:z,type:O[0].type,textureType:E.TextureType.unpacked},shaderSource:X})},$=G=>{if(!G||G.length!==1)throw new Error("Reduce op requires 1 input.");if(C.NUMBER_TYPES.indexOf(G[0].type)===-1)throw new Error("Invalid input type.")};c.reduceSum=(G,O,L)=>P(G,O,L,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),c.reduceMean=(G,O,L)=>P(G,O,L,"ReduceMean",(F,V)=>{let W=1;for(let z=0;z=0||V.length===0)&&(W*=F[0].dims[z]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${W}.;`]}),c.reduceMax=(G,O,L)=>P(G,O,L,"ReduceMax",(F,V)=>{const W=[];for(let z=0;z=0||V.length===0)&&W.push(`inputIdx[${z}] = 0;`);return[`${W.join(`
`)}
value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),c.reduceMin=(G,O,L)=>P(G,O,L,"ReduceMin",(F,V)=>{const W=[];for(let z=0;z=0||V.length===0)&&W.push(`inputIdx[${z}] = 0;`);return[`${W.join(`
`)}
value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),c.reduceProd=(G,O,L)=>P(G,O,L,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),c.reduceLogSum=(G,O,L)=>P(G,O,L,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),c.reduceLogSumSquare=(G,O,L)=>P(G,O,L,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isReshapeCheap=c.processDims3D=c.createPackedReshape3DProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(2827);c.createPackedReshape3DProgramInfoLoader=(P,R,$)=>{const G=(O=>({name:"Reshape (packed)",inputTypes:[M.TextureType.packed],inputNames:["A"],cacheHint:`${O}`}))($);return Object.assign(Object.assign({},G),{get:()=>((O,L,F,V)=>{const W=L.dims,z=V;let Z="";for(let U=0;U<4;U++){let j="";switch(U){case 0:j="outputCoords = rc;";break;case 1:j="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:j="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:j="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}Z+=`
${j}
${U>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[${U}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);
${U>0?"}":""}
`}const H=(0,C.getGlsl)(O.session.backend.glContext.version),Y=`
${function(U){const j=T.ShapeUtil.computeStrides(U),X=["b","r","c"],K="index";return`
ivec3 inputCoordsFromReshapedOutCoords(int index) {
${j.map((q,J)=>`int ${X[J]} = ${K} / ${q}; ${J===j.length-1?`int ${X[J+1]} = ${K} - ${X[J]} * ${q}`:`index -= ${X[J]} * ${q}`};`).join("")}
return ivec3(b, r, c);
}
`}(W)}
${function(U){const j=T.ShapeUtil.computeStrides(U);return`
int getFlattenedIndex(ivec3 coords) {
// reverse y, z order
return coords.x * ${j[0]} + coords.z * ${j[1]} + coords.y;
}
`}(z)}
${(0,E.unpackFromChannel)()}
void main() {
ivec3 rc = getOutputCoords();
vec4 result = vec4(0.0);
ivec3 outputCoords;
int rows = ${z[2]};
int cols = ${z[1]};
${Z}
${H.output} = result;
}
`;return Object.assign(Object.assign({},F),{output:{dims:z,type:L.type,textureType:M.TextureType.packed},shaderSource:Y,hasMain:!0})})(P,R,G,$)})},c.processDims3D=function(P){if(P.length===0)return[1,1,1];let R=1;for(let $=0;$1?P[P.length-2]:1,P[P.length-1]]},c.isReshapeCheap=function(P,R){let $=!1;return $=P.length===0||R.length===0||(P.length<2||R.length<2?P[P.length-1]===R[R.length-1]:P[P.length-1]===R[R.length-1]&&P[P.length-2]===R[R.length-2]),$}},718:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reshape=void 0;const T=_(2517);c.reshape=(C,M)=>{const E=T.ShapeUtil.calculateReshapedDims(M[0].dims,M[1].integerData);return C.session.pack?[C.reshapePacked(M[0],E)]:[C.reshapeUnpacked(M[0],E)]}},2268:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseResizeAttributesV11=c.parseResizeAttributesV10=c.resize=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P=_(9793),R={name:"Resize",inputNames:["A"],inputTypes:[C.TextureType.packed]};c.resize=(F,V,W)=>((0,P.validateInputs)(V,W),[F.run(Object.assign(Object.assign({},R),{cacheHint:W.cacheKey,get:()=>$(F,V,W)}),V)]),c.parseResizeAttributesV10=F=>(0,P.parseUpsampleAttributes)(F,10),c.parseResizeAttributesV11=F=>(0,P.parseUpsampleAttributes)(F,11);const $=(F,V,W)=>{const z=(0,T.getGlsl)(F.session.backend.glContext.version),[Z,H]=G(V,W);if(Z.every(ae=>ae===1)&&W.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},R),{output:{dims:H,type:V[0].type,textureType:C.TextureType.packed},hasMain:!0,shaderSource:`void main() {
vec4 v = ${z.texture2D}(X, TexCoords);
${z.output} = v;
}`});const Y=H.length;if(Y<2)throw new Error(`output dimension should be at least 2, but got ${Y}`);const U=H[Y-2],j=H[Y-1],X=V[0].dims;if(Y!==X.length)throw new Error(`output dimension should match input ${X.length}, but got ${Y}`);const K=X[Y-2],q=X[Y-1],J=Z[Y-2],Q=Z[Y-1];let ee="";if(W.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${W.mode}'`);switch(W.coordinateTransformMode){case"asymmetric":ee=`
vec4 getSourceFracIndex(ivec4 coords) {
return vec4(coords) / scaleWHWH;
}
`;break;case"half_pixel":ee=`
vec4 getSourceFracIndex(ivec4 coords) {
return (vec4(coords) + 0.5) / scaleWHWH - 0.5;
}
`;break;case"pytorch_half_pixel":ee=`
vec4 getSourceFracIndex(ivec4 coords) {
vec4 fcoords = vec4(coords);
return vec4(
${j}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,
${U}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,
${j}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,
${U}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0
);
}
`;break;case"align_corners":ee=`
vec4 getSourceFracIndex(ivec4 coords) {
vec4 resized = vec4(${j}.0 - 1.0, ${U}.0 - 1.0, ${j}.0 - 1.0,
${U}.0 - 1.0);
vec4 original = vec4(${q}.0 - 1.0, ${K}.0 - 1.0, ${q}.0 - 1.0,
${K}.0 - 1.0);
vec4 new_scale = original / resized;
return vec4(coords) * new_scale;
}
`;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${W.coordinateTransformMode}'`)}const re=(0,M.getCoordsDataType)(Y),ie=`
const vec2 inputWH = vec2(${K}.0, ${q}.0);
const vec4 scaleWHWH = vec4(float(${J}), float(${Q}), float(${J}), float(${Q}));
${(0,E.unpackFromChannel)()}
${ee}
float getAValue(int x10, int r, int c, int d) {
return getChannel(getA(x10, r, c, d), vec2(c, d));
}
void main() {
${re} 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 < ${U-1};
bool hasNextCol = rc.z < ${j-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);
${z.output} = vec4(newValue);
}
`;return Object.assign(Object.assign({},R),{output:{dims:H,type:V[0].type,textureType:C.TextureType.packed},hasMain:!0,shaderSource:ie})},G=(F,V)=>{const W=F[0].dims;let z,Z=V.scales;if(Z.length===0){const Y=F[V.scalesInputIdx];if(Y&&Y.size!==0){if(F[V.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");Z=O(Y,V.mode,V.isResize)}else{const U=F[V.sizesInputIdx];if(!U||U.size===0)throw new Error("Either scales or sizes MUST be provided as input.");z=Array.from(U.integerData),Z=L(z,W,V.mode,V.isResize)}}else if(F[V.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const H=z||W.map((Y,U)=>Math.floor(Y*Z[U]));return[Z,H]},O=(F,V,W)=>{const z=Array.from(F.floatData);return(0,P.scalesValidation)(z,V,W),z},L=(F,V,W,z)=>{const Z=V.length,H=new Array(Z);for(let Y=0,U=Z;Y{Object.defineProperty(c,"__esModule",{value:!0}),c.shape=void 0;const T=_(9162);c.shape=(M,E)=>(C(E),[new T.Tensor([E[0].dims.length],"int32",void 0,void 0,new Int32Array(E[0].dims))]);const C=M=>{if(!M||M.length!==1)throw new Error("Shape requires 1 input.")}},2278:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sliceV10=c.parseSliceAttributes=c.slice=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039),P={name:"Slice",inputNames:["A"],inputTypes:[E.TextureType.unpacked]};c.slice=(L,F,V)=>($(F),[L.run(Object.assign(Object.assign({},P),{cacheHint:V.cacheKey,get:()=>R(L,F[0],V)}),F)]),c.parseSliceAttributes=L=>{const F=L.attributes.getInts("starts"),V=L.attributes.getInts("ends"),W=L.attributes.getInts("axes",[]);return(0,T.createAttributeWithCacheKey)({starts:F,ends:V,axes:W})};const R=(L,F,V)=>{const W=V.axes.length===0?F.dims.slice(0).map((X,K)=>K):V.axes,z=M.ShapeUtil.normalizeAxes(W,F.dims.length),Z=V.starts.map((X,K)=>X>F.dims[z[K]]-1?F.dims[z[K]]:M.ShapeUtil.normalizeAxis(X,F.dims[z[K]])),H=V.ends.map((X,K)=>X>F.dims[z[K]]-1?F.dims[z[K]]:M.ShapeUtil.normalizeAxis(X,F.dims[z[K]])),Y=F.dims.slice(),U=[];for(let X=0;X0&&U.push(`outputIdx[${z[X]}] += ${Z[X]};`);const j=`
float process(int outputIdx[${Y.length}]) {
${U.join(`
`)}
return _A(outputIdx);
}`;return Object.assign(Object.assign({},P),{output:{dims:Y,type:F.type,textureType:E.TextureType.unpacked},shaderSource:j})},$=L=>{if(!L||L.length!==1)throw new Error("Slice requires 1 input.");if(C.NUMBER_TYPES.indexOf(L[0].type)===-1)throw new Error("Invalid input type.")};c.sliceV10=(L,F)=>{O(F);const V=G(L,F);return[L.run(Object.assign(Object.assign({},P),{cacheHint:V.cacheKey,get:()=>R(L,F[0],V)}),[F[0]])]};const G=(L,F)=>{if(!L.session.isInitializer(F[1].dataId)||!L.session.isInitializer(F[2].dataId)||F.length>=4&&!L.session.isInitializer(F[3].dataId)||F.length>=5&&!L.session.isInitializer(F[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(F.length>=5&&F[4].integerData.some(Z=>Z!==1))throw new Error("currently non-1 steps is not supported for Slice");const V=Array.from(F[1].integerData),W=Array.from(F[2].integerData),z=F.length>=4?Array.from(F[3].integerData):[];return{starts:V,ends:W,axes:z,cacheKey:`${z};${V};${W}`}},O=L=>{if(!L||L.length<3||L.length>5)throw new Error("Invalid input number.");if(L[1].type!=="int32"||L[1].dims.length!==1)throw new Error("Invalid input type.");if(L[2].type!=="int32"||L[2].dims.length!==1)throw new Error("Invalid input type.");if(L.length>=4&&(L[3].type!=="int32"||L[3].dims.length!==1))throw new Error("Invalid input type.");if(L.length>=5&&(L[4].type!=="int32"||L[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.softmaxV13=c.parseSoftmaxAttributesV13=c.parseSoftmaxAttributes=c.softmax=void 0;const T=_(246),C=_(2517),M=_(5060),E=_(2039),P=_(3738),R={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[E.TextureType.unpacked]},$={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked]},G={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked,E.TextureType.unpacked]};c.softmax=(z,Z,H)=>{W(Z);const Y=Z[0].dims.slice(),U=C.ShapeUtil.normalizeAxis(H.axis,Y.length),j=C.ShapeUtil.sizeToDimension(Y,U),X=C.ShapeUtil.sizeFromDimension(Y,U);return O(z,Z,H,j,X)},c.parseSoftmaxAttributes=z=>(0,T.createAttributeWithCacheKey)({axis:z.attributes.getInt("axis",1)}),c.parseSoftmaxAttributesV13=z=>(0,T.createAttributeWithCacheKey)({axis:z.attributes.getInt("axis",-1)}),c.softmaxV13=(z,Z,H)=>{W(Z);const Y=Z[0].dims.slice(),U=C.ShapeUtil.normalizeAxis(H.axis,Y.length),j=Y.length,X=U!==j-1,K=[];let q,J=[],Q=[];X&&(J=Array.from({length:j}).map((ae,ne)=>ne),J[U]=j-1,J[j-1]=U,J.map(ae=>K.push(Y[ae])),q=(0,T.createAttributeWithCacheKey)({perm:J}),Q=(0,P.transpose)(z,Z,q));const ee=X?C.ShapeUtil.sizeToDimension(K,j-1):C.ShapeUtil.sizeToDimension(Y,j-1),re=X?C.ShapeUtil.sizeFromDimension(K,j-1):C.ShapeUtil.sizeFromDimension(Y,j-1),ie=O(z,X?Q:Z,H,ee,re);return X?(0,P.transpose)(z,ie,q):ie};const O=(z,Z,H,Y,U)=>{const j=L(z,Z[0],Y,U,[Y]),X=z.run(Object.assign(Object.assign({},R),{cacheHint:H.cacheKey,get:()=>j}),Z),K=F(z,Z[0],Y,U,j.output.dims,[Y]),q=z.run(Object.assign(Object.assign({},$),{cacheHint:H.cacheKey,get:()=>K}),[Z[0],X]),J=V(z,Z[0],Y,U,j.output.dims,K.output.dims);return[z.run(Object.assign(Object.assign({},G),{cacheHint:H.cacheKey,get:()=>J}),[Z[0],X,q])]},L=(z,Z,H,Y,U)=>{const[j,X]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),K=U.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(U.length!==1)throw new Error("Dimensionality of the output should be 1");if(U[0]!==H)throw new Error("Shape of the output should be equal to logical row count");const q=(0,M.getGlsl)(z.session.backend.glContext.version),J=`
float process(int[${K}] indices) {
int logical_row_start_offset = indices[0] * ${Y};
float max = getColorAsFloat(${q.texture2D}(A, offsetToCoords(logical_row_start_offset, ${j},
${X} )));
for(int i=1; i<${Y}; ++i)
{
float current = getColorAsFloat(${q.texture2D}(A, offsetToCoords(logical_row_start_offset + i,
${j}, ${X})));
if(current > max)
max = current;
}
return max;
}`;return Object.assign(Object.assign({},R),{output:{dims:U,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},F=(z,Z,H,Y,U,j)=>{const[X,K]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),q=j.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(j.length!==1)throw new Error("Dimensionality of the output should be 1");if(j[0]!==H)throw new Error("Shape of the output should be equal to logical row count");if(U.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(U[0]!==H)throw new Error("Shape of the intermediate results should be equal to logical row count");const J=`
float process(int[${q}] 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,M.getGlsl)(z.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i,
${X}, ${K}))) - max);
}
return norm_factor;
}`;return Object.assign(Object.assign({},$),{output:{dims:j,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},V=(z,Z,H,Y,U,j)=>{const[X,K]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),q=Z.dims.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(U.length!==1||j.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(U[0]!==H||j[0]!==H)throw new Error("Shape of the intermediate results should be equal to logical row count");const J=`
float process(int[${q}] indices) {
// get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)
int offset = coordsToOffset(TexCoords, ${X}, ${K});
//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({},G),{output:{dims:Z.dims,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},W=z=>{if(!z||z.length!==1)throw new Error("Softmax requires 1 input.");if(z[0].type!=="float32"&&z[0].type!=="float64")throw new Error("Invalid input type")}},5975:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSplitAttributes=c.split=void 0;const T=_(246),C=_(2517),M=_(2039),E={name:"Split",inputNames:["A"],inputTypes:[M.TextureType.unpacked]};c.split=(G,O,L)=>{$(O);const F=C.ShapeUtil.normalizeAxis(L.axis,O[0].dims.length),V=P(G,O,F,L),W=[];for(let z=0;zR(G,O[0],L,F,z)}),O));return W},c.parseSplitAttributes=G=>{const O=G.attributes.getInt("axis",0),L=G.attributes.getInts("split",[]),F=G.outputs.length;return(0,T.createAttributeWithCacheKey)({axis:O,split:L,numOutputs:F})};const P=(G,O,L,F)=>{const[,V]=C.SplitUtil.splitShape(O[0].dims,L,F.split,F.numOutputs);return V.length},R=(G,O,L,F,V)=>{const[W,z]=C.SplitUtil.splitShape(O.dims,F,L.split,L.numOutputs),Z=z[V],H=W[V],Y=`
float process(int indices[${H.length}]) {
indices[${F}] += ${Z};
return _A(indices);
}
`;return Object.assign(Object.assign({},E),{cacheHint:`${L.cacheKey}:${V}`,output:{dims:H,type:O.type,textureType:M.TextureType.unpacked},shaderSource:Y})},$=G=>{if(!G||G.length!==1)throw new Error("Split requires one input.");if(G[0].type!=="int8"&&G[0].type!=="uint8"&&G[0].type!=="int16"&&G[0].type!=="uint16"&&G[0].type!=="int32"&&G[0].type!=="uint32"&&G[0].type!=="float32"&&G[0].type!=="float64"&&G[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSqueezeAttributes=c.squeezeV13=c.squeeze=void 0;const T=_(2517);c.squeeze=(E,P,R)=>{C(P);const $=T.ShapeUtil.squeezeShape(P[0].dims,R);return[E.reshapeUnpacked(P[0],$)]},c.squeezeV13=(E,P)=>(M(P),(0,c.squeeze)(E,[P[0]],Array.from(P[1].integerData))),c.parseSqueezeAttributes=E=>E.attributes.getInts("axes");const C=E=>{if(!E||E.length!==1)throw new Error("Squeeze requires 1 input.");if(E[0].type==="string")throw new Error("invalid input tensor types.")},M=E=>{if(!E||E.length!==2)throw new Error("Squeeze requires 2 inputs.");if(E[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sum=void 0;const T=_(5060),C=_(2039);c.sum=(P,R)=>{E(R);const $={name:"Sum",inputNames:R.map((G,O)=>`X${O}`),inputTypes:new Array(R.length).fill(C.TextureType.unpacked)};return[P.run(Object.assign(Object.assign({},$),{get:()=>M(P,R,$)}),R)]};const M=(P,R,$)=>{const G=(0,T.getGlsl)(P.session.backend.glContext.version),O=R[0].dims.slice(),L=`
void main() {
vec4 result = ${R.map((F,V)=>`${G.texture2D}(X${V},TexCoords)`).join(" + ")};
${G.output} = result;
}
`;return Object.assign(Object.assign({},$),{output:{dims:O,type:R[0].type,textureType:C.TextureType.unpacked},hasMain:!0,shaderSource:L})},E=P=>{if(!P||P.length===0)throw new Error("Sum requires inputs.");const R=P[0].dims.length;for(let $=1;${Object.defineProperty(c,"__esModule",{value:!0}),c.tile=void 0;const T=_(782),C=_(2039);c.tile=(P,R)=>{E(R);const $={name:"Tile",inputNames:["A"],inputTypes:[C.TextureType.unpacked]};return[P.run(Object.assign(Object.assign({},$),{get:()=>M(P,R,$)}),R)]};const M=(P,R,$)=>{const G=R[0].dims.slice(),O=new Array(G.length),L=[];for(let W=0;W{if(!P||P.length!==2)throw new Error("Tile requires 2 input.");if(P[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(P[1].dims[0]!==P[0].dims.length)throw new Error("Invalid input shape.");if(T.NUMBER_TYPES.indexOf(P[0].type)===-1)throw new Error("Invalid input type.");if(P[1].type!=="int32"&&P[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseTransposeAttributes=c.transpose=void 0;const T=_(246),C=_(2517),M=_(2039),E={name:"Transpose",inputNames:["A"],inputTypes:[M.TextureType.unpacked]};c.transpose=(L,F,V)=>(O(F),[L.run(Object.assign(Object.assign({},E),{cacheHint:V.cacheKey,get:()=>P(L,F[0],V.perm)}),F)]),c.parseTransposeAttributes=L=>(0,T.createAttributeWithCacheKey)({perm:L.attributes.getInts("perm",[])});const P=(L,F,V)=>{const W=F.dims;V=R(W,V);const z=$(W,V),Z=W.length,H=`
${G("perm",V,Z)}
float process(int indices[${Z}]) {
int a[${Z}];
perm(a, indices);
return _A(a);
}`;return Object.assign(Object.assign({},E),{output:{dims:z,type:F.type,textureType:M.TextureType.unpacked},shaderSource:H})},R=(L,F)=>(F&&F.length!==L.length&&(F=[...L.keys()].reverse()),F),$=(L,F)=>(F=R(L,F),C.ShapeUtil.sortBasedOnPerm(L,F)),G=(L,F,V)=>{const W=[];W.push(`void ${L}(out int a[${V}], int src[${V}]) {`);for(let z=0;z{if(!L||L.length!==1)throw new Error("Transpose requires 1 input.");if(L[0].type!=="float32"&&L[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.encodeAsUint8=void 0;const T=_(5060),C=_(2039);c.encodeAsUint8=(M,E)=>{const P=E.shape,R=(0,T.getGlsl)(M.session.backend.glContext.version),$=`
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 = ${R.texture2D}(X,TexCoords).r;
${R.output} = encodeAsUint8(value);
}`,G={name:"Uint8Encode",inputTypes:[C.TextureType.unpacked],inputNames:["X"],output:{dims:P,type:E.tensor.type,textureType:C.TextureType.downloadUint8AsFloat},shaderSource:$,hasMain:!0};return M.executeProgram(G,[E.tensor])}},4909:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tanh=c.tan=c.sqrt=c.sin=c.sigmoid=c.relu=c.not=c.neg=c.log=c.parseLeakyReluAttributes=c.leakyRelu=c.identity=c.floor=c.exp=c.parseEluAttributes=c.elu=c.cos=c.ceil=c.clipV11=c.parseClipAttributes=c.clip=c.atan=c.asin=c.acos=c.abs=c.glslTanh=c.glslTan=c.glslSqrt=c.glslSigmoid=c.glslRelu=c.glslSin=c.glslNot=c.glslNeg=c.glslLog=c.glslLeakyRelu=c.glslIdentity=c.glslClip=c.glslFloor=c.glslExp=c.glslElu=c.glslCos=c.glslCeil=c.glslAtan=c.glslAsin=c.glslAcos=c.glslAbs=void 0;const T=_(246),C=_(2517),M=_(8520),E=_(5060),P=_(2039);function R(){return ie("abs")}function $(){return ie("acos")}function G(){return ie("asin")}function O(){return ie("atan")}function L(){return ie("ceil")}function F(){return ie("cos")}function V(te){const oe="elu";return{body:`
const float alpha = float(${te});
float ${oe}_(float a) {
return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;
}
vec4 ${oe}_(vec4 v) {
return vec4(${oe}_(v.x), ${oe}_(v.y), ${oe}_(v.z), ${oe}_(v.w));
}
`,name:oe,type:M.FunctionType.ValueBased}}function W(){return ie("exp")}function z(){return ie("floor")}function Z(te,oe){const ue="clip";return{body:`
const float min = float(${te});
const float max = float(${oe});
float ${ue}_(float a) {
return clamp(a, min, max);
}
vec4 ${ue}_(vec4 v) {
return clamp(v, min, max);
}
`,name:ue,type:M.FunctionType.ValueBased}}function H(){const te="indentity";return{body:`
float ${te}_(float a) {
return a;
}
vec4 ${te}_(vec4 v) {
return v;
}
`,name:te,type:M.FunctionType.ValueBased}}function Y(te){const oe="leakyRelu";return{body:`
const float alpha = float(${te});
float ${oe}_(float a) {
return a < 0.0 ? a * alpha : a;
}
vec4 ${oe}_(vec4 v) {
return vec4(${oe}_(v.x), ${oe}_(v.y), ${oe}_(v.z), ${oe}_(v.w));
}
`,name:oe,type:M.FunctionType.ValueBased}}function U(){return ie("log")}function j(){const te="neg";return{body:`
float ${te}_(float a) {
return -a;
}
vec4 ${te}_(vec4 v) {
return -v;
}
`,name:te,type:M.FunctionType.ValueBased}}function X(){const te="not";return{body:`
float ${te}_(float a) {
return float( ! bool(a) );
}
bool ${te}_(bool a) {
return !a;
}
vec4 ${te}_(vec4 v) {
return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));
}
bvec4 ${te}_(bvec4 v) {
return bvec4(!v.x, !v.y, !v.z, !v.w);
}
`,name:te,type:M.FunctionType.ValueBased}}function K(){return ie("sin")}function q(){const te="relu";return{body:`
float ${te}_(float a) {
return max( a, 0.0 );
}
vec4 ${te}_(vec4 v) {
return max( v, 0.0 );
}
`,name:te,type:M.FunctionType.ValueBased}}function J(){const te="sigmoid";return{body:`
float ${te}_(float a) {
return 1.0 / (1.0 + exp(-a));
}
vec4 ${te}_(vec4 v) {
return 1.0 / (1.0 + exp(-v));
}
`,name:te,type:M.FunctionType.ValueBased}}function Q(){return ie("sqrt")}function ee(){return ie("tan")}function re(){const te="tanh";return{body:`
float ${te}_(float a) {
a = clamp(a, -10., 10.);
a = exp(2.*a);
return (a - 1.) / (a + 1.);
}
vec4 ${te}_(vec4 v) {
v = clamp(v, -10., 10.);
v = exp(2.*v);
return (v - 1.) / (v + 1.);
}
`,name:te,type:M.FunctionType.ValueBased}}function ie(te){return{body:`
float ${te}_(float a) {
return ${te}(a);
}
vec4 ${te}_(vec4 v) {
return ${te}(v);
}
`,name:te,type:M.FunctionType.ValueBased}}c.glslAbs=R,c.glslAcos=$,c.glslAsin=G,c.glslAtan=O,c.glslCeil=L,c.glslCos=F,c.glslElu=V,c.glslExp=W,c.glslFloor=z,c.glslClip=Z,c.glslIdentity=H,c.glslLeakyRelu=Y,c.glslLog=U,c.glslNeg=j,c.glslNot=X,c.glslSin=K,c.glslRelu=q,c.glslSigmoid=J,c.glslSqrt=Q,c.glslTan=ee,c.glslTanh=re;const ae=(te,oe,ue,de)=>{const pe=te.session.pack?P.TextureType.packed:P.TextureType.unpacked,he={name:ue.name,inputTypes:[pe],inputNames:["A"],cacheHint:de};return Object.assign(Object.assign({},he),{get:()=>((we,ye,Me,Pe)=>{const Re=we.session.pack?P.TextureType.packed:P.TextureType.unpacked,De=(0,E.getGlsl)(we.session.backend.glContext.version);return Object.assign(Object.assign({},ye),{output:{dims:Me.dims,type:Me.type,textureType:Re},shaderSource:`
${Pe.body}
void main() {
vec4 v = ${De.texture2D}(A, TexCoords);
v = ${Pe.name}_(v);
${De.output} = v;
}
`,hasMain:!0})})(te,he,oe,ue)})};c.abs=(te,oe)=>[te.run(ae(te,oe[0],R()),oe)],c.acos=(te,oe)=>[te.run(ae(te,oe[0],$()),oe)],c.asin=(te,oe)=>[te.run(ae(te,oe[0],G()),oe)],c.atan=(te,oe)=>[te.run(ae(te,oe[0],O()),oe)],c.clip=(te,oe,ue)=>[te.run(ae(te,oe[0],Z(ue.min,ue.max),ue.cacheKey),oe)],c.parseClipAttributes=te=>(0,T.createAttributeWithCacheKey)({min:te.attributes.getFloat("min",C.MIN_CLIP),max:te.attributes.getFloat("max",C.MAX_CLIP)}),c.clipV11=(te,oe)=>{const ue=ne(te,oe);return(0,c.clip)(te,[oe[0]],ue)};const ne=(te,oe)=>{if(oe.length>=3&&(!te.session.isInitializer(oe[1].dataId)||!te.session.isInitializer(oe[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const ue=oe.length>=3?oe[1].numberData[0]:C.MIN_CLIP,de=oe.length>=3?oe[2].numberData[0]:C.MAX_CLIP;return(0,T.createAttributeWithCacheKey)({min:ue,max:de})};c.ceil=(te,oe)=>[te.run(ae(te,oe[0],L()),oe)],c.cos=(te,oe)=>[te.run(ae(te,oe[0],F()),oe)],c.elu=(te,oe,ue)=>[te.run(ae(te,oe[0],V(ue.alpha),ue.cacheKey),oe)],c.parseEluAttributes=te=>(0,T.createAttributeWithCacheKey)({alpha:te.attributes.getFloat("alpha",1)}),c.exp=(te,oe)=>[te.run(ae(te,oe[0],W()),oe)],c.floor=(te,oe)=>[te.run(ae(te,oe[0],z()),oe)],c.identity=(te,oe)=>[te.run(ae(te,oe[0],H()),oe)],c.leakyRelu=(te,oe,ue)=>[te.run(ae(te,oe[0],Y(ue.alpha),ue.cacheKey),oe)],c.parseLeakyReluAttributes=te=>(0,T.createAttributeWithCacheKey)({alpha:te.attributes.getFloat("alpha",.01)}),c.log=(te,oe)=>[te.run(ae(te,oe[0],U()),oe)],c.neg=(te,oe)=>[te.run(ae(te,oe[0],j()),oe)],c.not=(te,oe)=>[te.run(ae(te,oe[0],X()),oe)],c.relu=(te,oe)=>[te.run(ae(te,oe[0],q()),oe)],c.sigmoid=(te,oe)=>[te.run(ae(te,oe[0],J()),oe)],c.sin=(te,oe)=>[te.run(ae(te,oe[0],K()),oe)],c.sqrt=(te,oe)=>[te.run(ae(te,oe[0],Q()),oe)],c.tan=(te,oe)=>[te.run(ae(te,oe[0],ee()),oe)],c.tanh=(te,oe)=>[te.run(ae(te,oe[0],re()),oe)]},5611:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackProgramInfoLoader=c.createUnpackProgramInfo=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P={name:"unpack",inputNames:["A"],inputTypes:[C.TextureType.packed]};c.createUnpackProgramInfo=(R,$)=>{const G=$.dims.length,O=(0,E.getChannels)("rc",G),L=O.slice(-2),F=(0,M.getCoordsDataType)(G),V=(0,E.unpackFromChannel)(),W=$.dims.length===0?"":function(H,Y){if(H===1)return"rc";let U="";for(let j=0;jObject.assign(Object.assign({},P),{get:()=>(0,c.createUnpackProgramInfo)(R,$)})},8428:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseUnsqueezeAttributes=c.unsqueezeV13=c.unsqueeze=void 0;const T=_(2517);c.unsqueeze=(E,P,R)=>{C(P);const $=T.ShapeUtil.unsqueezeShape(P[0].dims,R);return[E.reshapeUnpacked(P[0],$)]},c.unsqueezeV13=(E,P)=>(M(P),(0,c.unsqueeze)(E,[P[0]],Array.from(P[1].integerData))),c.parseUnsqueezeAttributes=E=>E.attributes.getInts("axes");const C=E=>{if(!E||E.length!==1)throw new Error("Unsqueeze requires 1 input.");if(E[0].type==="string")throw new Error("invalid input tensor types.")},M=E=>{if(!E||E.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(E[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.scalesValidation=c.validateInputs=c.parseUpsampleAttributes=c.parseUpsampleAttributesV9=c.parseUpsampleAttributesV7=c.upsample=void 0;const T=_(246),C=_(5060),M=_(2039),E={name:"Upsample",inputNames:["X"],inputTypes:[M.TextureType.unpacked]};c.upsample=(R,$,G)=>((0,c.validateInputs)($,G),[R.run(Object.assign(Object.assign({},E),{cacheHint:G.cacheKey,get:()=>P(R,$,G)}),$)]),c.parseUpsampleAttributesV7=R=>(0,c.parseUpsampleAttributes)(R,7),c.parseUpsampleAttributesV9=R=>(0,c.parseUpsampleAttributes)(R,9),c.parseUpsampleAttributes=(R,$)=>{const G=$>=10,O=R.attributes.getString("mode","nearest");if(O!=="nearest"&&O!=="linear"&&($<11||O!=="cubic"))throw new Error(`unrecognized mode: ${O}`);let L=[];$<9&&(L=R.attributes.getFloats("scales"),(0,c.scalesValidation)(L,O,G));const F=R.attributes.getFloat("extrapolation_value",0),V=$>10?R.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(V)===-1)throw new Error(`coordinate_transform_mode '${V}' is not supported`);const W=V==="tf_crop_and_resize",z=W,Z=O==="nearest"&&$>=11?R.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(Z)===-1)throw new Error(`nearest_mode '${Z}' is not supported`);const H=R.attributes.getFloat("cubic_coeff_a",-.75),Y=R.attributes.getInt("exclude_outside",0)!==0;if(Y&&O!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const U=$<11||O==="nearest"&&V==="asymmetric"&&Z==="floor";let j=0,X=0,K=0;return $>10?R.inputs.length>2?(j=1,X=2,K=3):(X=1,K=2):$===9&&(X=1),(0,T.createAttributeWithCacheKey)({opset:$,isResize:G,mode:O,scales:L,extrapolationValue:F,coordinateTransformMode:V,useExtrapolation:z,needRoiInput:W,nearestMode:Z,cubicCoefficientA:H,excludeOutside:Y,useNearest2xOptimization:U,roiInputIdx:j,scalesInputIdx:X,sizesInputIdx:K})};const P=(R,$,G)=>{const O=(0,C.getGlsl)(R.session.backend.glContext.version),[L,F]=R.calculateTextureWidthAndHeight($[0].dims,M.TextureType.unpacked),V=$[0].dims.map((K,q)=>Math.floor(K*G.scales[q])),[W,z]=R.calculateTextureWidthAndHeight(V,M.TextureType.unpacked),Z=V.length,H=new Array(Z),Y=new Array(Z);let U=`
int output_pitches[${Z}];
int input_pitches[${Z}];
`;for(let K=Z-1;K>=0;K--)H[K]=K===Z-1?1:H[K+1]*V[K+1],Y[K]=K===Z-1?1:Y[K+1]*$[0].dims[K+1],U+=`
output_pitches[${K}] = ${H[K]};
input_pitches[${K}] = ${Y[K]};
`;const j=`
float getInputFloat(int index) {
vec2 coords = offsetToCoords(index, ${L}, ${F});
float value = getColorAsFloat(${O.texture2D}(X, coords));
return value;
}
`,X=G.mode==="nearest"?`
${j}
float process(int indices[${Z}]) {
int input_index = 0;
int output_index = coordsToOffset(TexCoords, ${W}, ${z});
${U}
int d, m;
for (int dim = 0; dim < ${Z}; ++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);
}`:Z===4?`
${j}
float process(int indices[4]) {
int input_index = 0;
int output_index = coordsToOffset(TexCoords, ${W}, ${z});
${U}
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 == (${$[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]);
}`:`
${j}
float process(int indices[2]) {
int input_index = 0;
int output_index = coordsToOffset(TexCoords, ${W}, ${z});
${U}
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 == (${$[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({},E),{output:{dims:V,type:$[0].type,textureType:M.TextureType.unpacked},shaderSource:X,variables:[{name:"scales",type:"int",arrayLength:G.scales.length,data:G.scales.map(K=>Math.ceil(K))}]})};c.validateInputs=(R,$)=>{if(!R||$.opset<9&&R.length!==1||$.opset>=9&&$.opset<11&&R.length!==2||$.opset>=11&&R.length<2)throw new Error("invalid inputs.");if($.scales.length>0&&R[0].dims.length!==$.scales.length)throw new Error("Invalid input shape.");if(R[0].type==="string")throw new Error("Invalid input tensor types.")},c.scalesValidation=(R,$,G)=>{if(G){for(const O of R)if(O<=0)throw new Error("Scale value should be greater than 0.")}else for(const O of R)if(O<1)throw new Error("Scale value should be greater than or equal to 1.");if(!($!=="linear"&&$!=="cubic"||R.length===2||R.length===4&&R[0]===1&&R[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 ${G?"Resize":"Upsample"} opeartor.`)}},1958:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ProgramManager=void 0;const T=_(1670),C=_(6231),M=_(8879),E=_(5060);c.ProgramManager=class{constructor(P,R,$){this.profiler=P,this.glContext=R,this.textureLayoutStrategy=$,this.repo=new Map,this.attributesBound=!1}getArtifact(P){return this.repo.get(P)}setArtifact(P,R){this.repo.set(P,R)}run(P,R,$){var G;this.profiler.event("op",`ProgramManager.run ${(G=P.programInfo.name)!==null&&G!==void 0?G:"unknown kernel"}`,()=>{var O;const L=this.glContext.gl,F=P.program;L.useProgram(F);try{this.bindOutput($),this.attributesBound||this.bindAttributes(P.attribLocations),this.bindUniforms(P.uniformLocations,(O=P.programInfo.variables)!==null&&O!==void 0?O:[],R)}catch(V){throw C.Logger.error("ProgramManager",P.programInfo.shaderSource),V}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(P=>this.glContext.deleteProgram(P.program))}build(P,R,$){return this.profiler.event("backend","ProgramManager.build",()=>{const G=new M.GlslPreprocessor(this.glContext,P,R,$),O=G.preprocess(),L=this.compile(O);return{programInfo:P,program:L,uniformLocations:this.getUniformLocations(L,G.context.programInfo.inputNames,G.context.programInfo.variables),attribLocations:this.getAttribLocations(L)}})}compile(P){if(!this.vertexShader){C.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const G=(0,E.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(G,this.glContext.gl.VERTEX_SHADER)}T.env.debug&&C.Logger.verbose("ProrgramManager",`FragShader:
${P}
`);const R=this.glContext.compileShader(P,this.glContext.gl.FRAGMENT_SHADER),$=this.glContext.createProgram(this.vertexShader,R);return this.glContext.deleteShader(R),$}bindOutput(P){const R=P.width,$=P.height;C.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${R}/${$}, shape=${P.shape}, type=${P.tensor.type}`),this.glContext.attachFramebuffer(P.texture,R,$)}bindAttributes(P){const R=P.position,$=P.textureCoord;this.glContext.setVertexAttributes(R,$),this.attributesBound=!0}bindUniforms(P,R,$){var G;const O=this.glContext.gl;let L=0;for(const{name:F,type:V,location:W,arrayLength:z}of P){const Z=(G=R.find(H=>H.name===F))===null||G===void 0?void 0:G.data;if(V!=="sampler2D"&&!Z)throw new Error(`variable '${F}' does not have data defined in program info`);switch(V){case"sampler2D":this.bindTexture($[L],W,L),L++;break;case"float":z?O.uniform1fv(W,Z):O.uniform1f(W,Z);break;case"int":z?O.uniform1iv(W,Z):O.uniform1i(W,Z);break;default:throw new Error(`Uniform not implemented: ${V}`)}}}bindTexture(P,R,$){this.glContext.bindTextureToUniform(P.texture,$,R)}getAttribLocations(P){return{position:this.getAttribLocation(P,"position"),textureCoord:this.getAttribLocation(P,"textureCoord")}}getUniformLocations(P,R,$){const G=[];if(R)for(const O of R)G.push({name:O,type:"sampler2D",location:this.getUniformLocation(P,O)});if($)for(const O of $)G.push(Object.assign(Object.assign({},O),{location:this.getUniformLocation(P,O.name)}));return G}getUniformLocation(P,R){const $=this.glContext.gl.getUniformLocation(P,R);if($===null)throw new Error(`Uniform ${R} not found.`);return $}getAttribLocation(P,R){return this.glContext.gl.getAttribLocation(P,R)}}},6416:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLSessionHandler=void 0;const T=_(6231),C=_(1047),M=_(8316),E=_(1640),P=_(1958),R=_(7859),$=_(5702);c.WebGLSessionHandler=class{constructor(G,O){this.backend=G,this.context=O,this.layoutStrategy=new R.PreferLogicalStrategy(G.glContext.maxTextureSize),this.programManager=new P.ProgramManager(this.context.profiler,G.glContext,this.layoutStrategy),this.textureManager=new $.TextureManager(G.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:G.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=G.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new M.WebGLInferenceHandler(this)}onGraphInitialized(G){const O=G.getValues().filter(L=>L.from===-1&&L.tensor).map(L=>L.tensor.dataId);this.initializers=new Set(O)}isInitializer(G){return!!this.initializers&&this.initializers.has(G)}addInitializer(G){this.initializers.add(G)}getTextureData(G,O){return O?this.packedTextureDataCache.get(G):this.unpackedTextureDataCache.get(G)}setTextureData(G,O,L=!1){T.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),L?this.packedTextureDataCache.set(G,O):this.unpackedTextureDataCache.set(G,O)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(G=>this.textureManager.releaseTexture(G,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(G=>this.textureManager.releaseTexture(G,!0)),this.unpackedTextureDataCache=new Map}resolve(G,O,L){const F=(0,C.resolveOperator)(G,O,E.WEBGL_OP_RESOLVE_RULES);return{impl:F.opImpl,context:F.opInit?F.opInit(G,L):G}}}},7769:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Uint8DataEncoder=c.RGBAFloatDataEncoder=c.RedFloat32DataEncoder=void 0;const T=_(6231);c.RedFloat32DataEncoder=class{constructor(C,M=1){if(M===1)this.internalFormat=C.R32F,this.format=C.RED,this.textureType=C.FLOAT,this.channelSize=M;else{if(M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA32F,this.format=C.RGBA,this.textureType=C.FLOAT,this.channelSize=M}}encode(C,M){let E,P;return C.constructor!==Float32Array&&(T.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),P=new Float32Array(C)),M*this.channelSize>C.length?(T.Logger.warning("Encoder","Source data too small. Allocating larger array"),P=C,E=this.allocate(M*this.channelSize),P.forEach((R,$)=>E[$]=R)):(P=C,E=P),E}allocate(C){return new Float32Array(4*C)}decode(C,M){return this.channelSize===1?C.filter((E,P)=>P%4==0).subarray(0,M):C.subarray(0,M)}},c.RGBAFloatDataEncoder=class{constructor(C,M=1,E){if(M!==1&&M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA,this.format=C.RGBA,this.channelSize=M,this.textureType=E||C.FLOAT}encode(C,M){let E=C;return this.channelSize===1&&(T.Logger.verbose("Encoder","Exploding into a larger array"),E=this.allocate(M),C.forEach((P,R)=>E[4*R]=P)),E}allocate(C){return new Float32Array(4*C)}decode(C,M){return this.channelSize===1?C.filter((E,P)=>P%4==0).subarray(0,M):C.subarray(0,M)}},c.Uint8DataEncoder=class{constructor(C,M=1){if(this.channelSize=4,M===1)this.internalFormat=C.ALPHA,this.format=C.ALPHA,this.textureType=C.UNSIGNED_BYTE,this.channelSize=M;else{if(M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA,this.format=C.RGBA,this.textureType=C.UNSIGNED_BYTE,this.channelSize=M}}encode(C,M){return new Uint8Array(C.buffer,C.byteOffset,C.byteLength)}allocate(C){return new Uint8Array(C*this.channelSize)}decode(C,M){if(C instanceof Uint8Array)return C.subarray(0,M);throw new Error(`Invalid array type: ${C.constructor}`)}}},7859:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getBatchDim=c.sizeToSquarishShape=c.getRowsCols=c.sizeFromShape=c.isInt=c.parseAxisParam=c.squeezeShape=c.PreferLogicalStrategy=c.AlwaysKeepOriginalSizeStrategy=void 0;const T=_(6231),C=_(2517);function M(G,O){const L=[],F=[],V=O!=null&&Array.isArray(O)&&O.length===0,W=O==null||V?null:E(O,G).sort();let z=0;for(let Z=0;ZZ)&&G[Z]===1&&(L.push(G[Z]),F.push(Z)),W[z]<=Z&&z++}G[Z]!==1&&(L.push(G[Z]),F.push(Z))}return{newShape:L,keptDims:F}}function E(G,O){const L=O.length;return G=G==null?O.map((F,V)=>V):[].concat(G),(0,C.assert)(G.every(F=>F>=-L&&F`All values in axis param must be in range [-${L}, ${L}) but got axis ${G}`),(0,C.assert)(G.every(P),()=>`All values in axis param must be integers but got axis ${G}`),G.map(F=>F<0?L+F:F)}function P(G){return G%1==0}function R(G){if(G.length===0)return 1;let O=G[0];for(let L=1;L=G.length?1:G.slice(O.breakAxis).reduce((Z,H)=>Z*H),z=O.breakAxis<=0?1:G.slice(0,O.breakAxis).reduce((Z,H)=>Z*H);if(!(W>L||z>L))return[W,z];T.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${G}, breakAxis:${O.breakAxis}`)}const F=G.reduce((W,z)=>W*z);let V=Math.floor(Math.sqrt(F));for(;V=L||F%V!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${G}`);return[V,F/V]}},c.PreferLogicalStrategy=class{constructor(G){this.maxTextureSize=G}computeTextureWH(G,O){const L=this.computeTexture(G,O);return O&&O.isPacked&&(L[0]/=2,L[1]/=2),O&&O.reverseWH?[L[1],L[0]]:L}computeTexture(G,O){const L=O&&O.isPacked;if(G.length===0)return L?[2,2]:[1,1];let F=this.maxTextureSize;if(O&&O.breakAxis!==void 0){const z=O.breakAxis>=G.length?1:G.slice(O.breakAxis).reduce((H,Y)=>H*Y),Z=O.breakAxis<=0?1:G.slice(0,O.breakAxis).reduce((H,Y)=>H*Y);if(!(z>F||Z>F))return[z,Z];T.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${G}, breakAxis:${O.breakAxis}`)}let V=G.slice(0);L&&(F*=2,V=V.map((z,Z)=>Z>=V.length-2?V[Z]%2==0?V[Z]:V[Z]+1:V[Z]),V.length===1&&(V=[2,V[0]])),V.length!==2&&(V=M(V).newShape);const W=R(V);return V.length<=1&&W<=F?[1,W]:V.length===2&&V[0]<=F&&V[1]<=F?V:V.length===3&&V[0]*V[1]<=F&&V[2]<=F?[V[0]*V[1],V[2]]:V.length===3&&V[0]<=F&&V[1]*V[2]<=F?[V[0],V[1]*V[2]]:V.length===4&&V[0]*V[1]*V[2]<=F&&V[3]<=F?[V[0]*V[1]*V[2],V[3]]:V.length===4&&V[0]<=F&&V[1]*V[2]*V[3]<=F?[V[0],V[1]*V[2]*V[3]]:L?$(W/4).map(z=>2*z):$(W)}},c.squeezeShape=M,c.parseAxisParam=E,c.isInt=P,c.sizeFromShape=R,c.getRowsCols=function(G){if(G.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[G.length>1?G[G.length-2]:1,G[G.length-1]]},c.sizeToSquarishShape=$,c.getBatchDim=function(G,O=2){return R(G.slice(0,G.length-O))}},4057:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createTextureLayoutFromShape=c.calculateTextureWidthAndHeight=c.createTextureLayoutFromTextureType=void 0;const T=_(2517),C=_(2039);c.createTextureLayoutFromTextureType=(M,E,P)=>{const R=P===C.TextureType.unpacked||P===C.TextureType.unpackedReversed?1:4,$=P===C.TextureType.packed,G=P===C.TextureType.unpackedReversed||P===C.TextureType.packed,O=P===C.TextureType.packedLastDimension?E.length-1:void 0,L=P===C.TextureType.packedLastDimension?E.map((F,V)=>V===E.length-1?4*F:F):void 0;return(0,c.createTextureLayoutFromShape)(M,E,R,L,{isPacked:$,reverseWH:G,breakAxis:O})},c.calculateTextureWidthAndHeight=(M,E,P)=>{const R=(0,c.createTextureLayoutFromTextureType)(M,E,P);return[R.width,R.height]},c.createTextureLayoutFromShape=(M,E,P=1,R,$)=>{const G=!(!$||!$.isPacked),[O,L]=M.computeTextureWH(G&&R||E,$),F=E.length;let V=E.slice(0);if(F===0&&(V=[1]),P===1)R=E;else if(G){if(P!==4)throw new Error("a packed texture must be 4-channel");R=E,F>0&&(V[F-1]=Math.ceil(V[F-1]/2)),F>1&&(V[F-2]=Math.ceil(V[F-2]/2))}else if(!R)throw new Error("Unpacked shape is needed when using channels > 1");return{width:O,height:L,channels:P,isPacked:G,shape:V,strides:T.ShapeUtil.computeStrides(V),unpackedShape:R,reversedWH:$&&$.reverseWH}}},5702:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TextureManager=void 0;const T=_(6231);c.TextureManager=class{constructor(C,M,E,P){this.glContext=C,this.layoutStrategy=M,this.profiler=E,this.config=P,this.pendingRead=new Map,P.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(C,M,E,P){const R=this.toEncoderType(C),$=this.glContext.getEncoder(R,M.channels||1,P);if(M.isPacked&&P===1)throw new Error("not implemented");const G=M.width,O=M.height;let L,F;if(this.config.reuseTextures){L=`${G}x${O}_${$.format}_${$.internalFormat}_${$.textureType}`,F=this.inUseTextures.get(L),F||(F=[],this.inUseTextures.set(L,F));const W=this.idleTextures.get(L);if(W&&W.length>0){const z=W.pop();return F.push(z),P===1&&this.glContext.updateTexture(z,G,O,$,this.toTextureData(C,E)),z}}T.Logger.verbose("TextureManager",`Creating new texture of size ${M.width}x${M.height}`);const V=this.glContext.allocateTexture(G,O,$,this.toTextureData(C,E));return this.config.reuseTextures&&(F.push(V),this.textureLookup.set(V,L)),V}readTexture(C,M,E){return E||(E=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const P=C.shape.reduce(($,G)=>$*G)*E,R=this.glContext.readTexture(C.texture,C.width,C.height,P,this.toEncoderType(M),E);return this.toTensorData(M,R)})}async readTextureAsync(C,M,E){const P=C.tensor.dataId;if(E||(E=1),this.pendingRead.has(P)){const R=this.pendingRead.get(P);return new Promise($=>R==null?void 0:R.push($))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(P,[]);const R=C.shape.reduce((L,F)=>L*F)*E;await this.glContext.createAndWaitForFence();const $=this.glContext.readTexture(C.texture,C.width,C.height,R,this.toEncoderType(M),E),G=this.toTensorData(M,$),O=this.pendingRead.get(P);return this.pendingRead.delete(P),O==null||O.forEach(L=>L(G)),G})}readUint8TextureAsFloat(C){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const M=C.shape.reduce((P,R)=>P*R),E=this.glContext.readTexture(C.texture,C.width,C.height,4*M,"byte",4);return new Float32Array(E.buffer,E.byteOffset,M)})}releaseTexture(C,M){let E;if(this.config.reuseTextures&&(E=this.textureLookup.get(C.texture),E)){M&&this.textureLookup.delete(E);const P=this.inUseTextures.get(E);if(P){const R=P.indexOf(C.texture);if(R!==-1){P.splice(R,1);let $=this.idleTextures.get(E);$||($=[],this.idleTextures.set(E,$)),$.push(C.texture)}}}E&&!M||(T.Logger.verbose("TextureManager",`Deleting texture of size ${C.width}x${C.height}`),this.glContext.deleteTexture(C.texture))}toTensorData(C,M){switch(C){case"int16":return M instanceof Int16Array?M:Int16Array.from(M);case"int32":return M instanceof Int32Array?M:Int32Array.from(M);case"int8":return M instanceof Int8Array?M:Int8Array.from(M);case"uint16":return M instanceof Uint16Array?M:Uint16Array.from(M);case"uint32":return M instanceof Uint32Array?M:Uint32Array.from(M);case"uint8":case"bool":return M instanceof Uint8Array?M:Uint8Array.from(M);case"float32":return M instanceof Float32Array?M:Float32Array.from(M);case"float64":return M instanceof Float64Array?M:Float64Array.from(M);default:throw new Error(`TensorData type ${C} is not supported`)}}toTextureData(C,M){if(M)return M instanceof Float32Array?M:new Float32Array(M)}toEncoderType(C){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(x,c)=>{var _;Object.defineProperty(c,"__esModule",{value:!0}),c.TextureType=void 0,(_=c.TextureType||(c.TextureType={}))[_.unpacked=0]="unpacked",_[_.unpackedReversed=1]="unpackedReversed",_[_.packed=2]="packed",_[_.downloadUint8AsFloat=3]="downloadUint8AsFloat",_[_.packedLastDimension=4]="packedLastDimension"},9390:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getGlChannels=c.getCoordsDataType=c.getSqueezedParams=c.squeezeInputShape=c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=c.generateShaderFuncNameFromInputSamplerName=c.repeatedTry=c.getPackedShape=void 0;const T=_(2517);c.getPackedShape=function(C){const M=C.length;return C.slice(0,M-1).concat(C[M-1]/4)},c.repeatedTry=async function(C,M=P=>0,E){return new Promise((P,R)=>{let $=0;const G=()=>{if(C())return void P();$++;const O=M($);E!=null&&$>=E?R():setTimeout(G,O)};G()})},c.generateShaderFuncNameFromInputSamplerName=function(C){return(0,T.assert)(C!==void 0&&C.length!==0,()=>"empty string found for sampler name"),"get"+C.charAt(0).toUpperCase()+C.slice(1)},c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(C){return(0,T.assert)(C!==void 0&&C.length!==0,()=>"empty string found for sampler name"),"get"+C.charAt(0).toUpperCase()+C.slice(1)+"AtOutCoords"},c.squeezeInputShape=function(C,M){let E=JSON.parse(JSON.stringify(C));return E=M,E},c.getSqueezedParams=function(C,M){return M.map(E=>C[E]).join(", ")},c.getCoordsDataType=function(C){if(C<=1)return"int";if(C===2)return"ivec2";if(C===3)return"ivec3";if(C===4)return"ivec4";if(C===5)return"ivec5";if(C===6)return"ivec6";throw Error(`GPU for rank ${C} is not yet supported`)},c.getGlChannels=function(C=6){return["x","y","z","w","u","v"].slice(0,C)}},7305:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createNewWebGLContext=c.createWebGLContext=void 0;const T=_(6231),C=_(1713),M={};function E(P){const R=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 O=document.createElement("canvas");return O.width=1,O.height=1,O}();let $;const G={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!P||P==="webgl2")&&($=R.getContext("webgl2",G),$))try{return new C.WebGLContext($,2)}catch(O){T.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${O}`)}if((!P||P==="webgl")&&($=R.getContext("webgl",G)||R.getContext("experimental-webgl",G),$))try{return new C.WebGLContext($,1)}catch(O){T.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${O}`)}throw new Error("WebGL is not supported")}c.createWebGLContext=function P(R){let $;R&&R!=="webgl2"||!("webgl2"in M)?R&&R!=="webgl"||!("webgl"in M)||($=M.webgl):$=M.webgl2,$=$||E(R),R=R||$.version===1?"webgl":"webgl2";const G=$.gl;return M[R]=$,G.isContextLost()?(delete M[R],P(R)):(G.disable(G.DEPTH_TEST),G.disable(G.STENCIL_TEST),G.disable(G.BLEND),G.disable(G.DITHER),G.disable(G.POLYGON_OFFSET_FILL),G.disable(G.SAMPLE_COVERAGE),G.enable(G.SCISSOR_TEST),G.enable(G.CULL_FACE),G.cullFace(G.BACK),$)},c.createNewWebGLContext=E},1713:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(G,O,L,F){F===void 0&&(F=L);var V=Object.getOwnPropertyDescriptor(O,L);V&&!("get"in V?!O.__esModule:V.writable||V.configurable)||(V={enumerable:!0,get:function(){return O[L]}}),Object.defineProperty(G,F,V)}:function(G,O,L,F){F===void 0&&(F=L),G[F]=O[L]}),C=this&&this.__setModuleDefault||(Object.create?function(G,O){Object.defineProperty(G,"default",{enumerable:!0,value:O})}:function(G,O){G.default=O}),M=this&&this.__importStar||function(G){if(G&&G.__esModule)return G;var O={};if(G!=null)for(var L in G)L!=="default"&&Object.prototype.hasOwnProperty.call(G,L)&&T(O,G,L);return C(O,G),O};Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLContext=c.linearSearchLastTrue=void 0;const E=_(1670),P=M(_(7769)),R=_(9390);function $(G){let O=0;for(;Othis.isTimerResultAvailable(G)),this.getTimerResult(G)}async createAndWaitForFence(){const G=this.createFence(this.gl);return this.pollFence(G)}createFence(G){let O;const L=G,F=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),O=F===null?()=>!0:()=>{const V=L.clientWaitSync(F,0,0);return V===L.ALREADY_SIGNALED||V===L.CONDITION_SATISFIED},{query:F,isFencePassed:O}}async pollFence(G){return new Promise(O=>{this.addItemToPoll(()=>G.isFencePassed(),()=>O())})}pollItems(){const G=$(this.itemsToPoll.map(O=>O.isDoneFn));for(let O=0;O<=G;++O){const{resolveFn:L}=this.itemsToPoll[O];L()}this.itemsToPoll=this.itemsToPoll.slice(G+1)}async addItemToPoll(G,O){this.itemsToPoll.push({isDoneFn:G,resolveFn:O}),this.itemsToPoll.length>1||await(0,R.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExecutionPlan=void 0;const T=_(6231);class C{constructor(E,P){this.op=E,this.node=P}}c.ExecutionPlan=class{constructor(M,E,P){this.graph=M,this.profiler=P,this.initialize(E)}initialize(M){this.profiler.event("session","ExecutionPlan.initialize",()=>{const E=this.graph.getNodes();if(E.length!==M.length)throw new Error("The size of nodes and OPs do not match.");this._ops=M.map((P,R)=>new C(P,E[R])),this.reset(),this._starter=[],this._ops.forEach((P,R)=>{let $=!0;for(const G of P.node.inputs)if(!this._values[G]&&this.graph.getInputIndices().indexOf(G)===-1){$=!1;break}$&&this._starter.push(R)})})}reset(){this._values=this.graph.getValues().map(M=>M.tensor)}async execute(M,E){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const P=M.createInferenceHandler(),R=this.graph.getInputIndices();if(E.length!==R.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${E.length} expected: ${R.length}`);E.forEach((V,W)=>{const z=R[W];this._values[z]=V});const $=this._starter.slice(0),G=this.graph.getValues(),O=this.graph.getNodes();let L=0;for(;L<$.length;){const V=$[L++],W=this._ops[V],z=W.node.inputs.map(U=>this._values[U]);if(z.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${W.node}`);const Z=z;T.Logger.verbose("ExecPlan",`Runing op:${W.node.name} (${Z.map((U,j)=>`'${W.node.inputs[j]}': ${U.type}[${U.dims.join(",")}]`).join(", ")})`);const H=await this.profiler.event("node",W.node.name,async()=>W.op.impl(P,Z,W.op.context));if(H.length!==W.node.outputs.length)throw new Error("the size of output does not match model definition.");H.forEach((U,j)=>{const X=W.node.outputs[j];if(this._values[X])throw new Error(`output [${X}] already has value: op:${W.node.name}`);this._values[X]=U});const Y=new Set;H.forEach((U,j)=>{const X=W.node.outputs[j];for(const K of G[X].to){const q=O[K];let J=!0;for(const Q of q.inputs)if(!this._values[Q]){J=!1;break}J&&Y.add(K)}}),$.push(...Y)}const F=[];for(let V=0;V{Object.defineProperty(c,"__esModule",{value:!0}),c.Graph=void 0;const T=_(1446),C=_(7778),M=_(9395),E=_(9162),P=_(2517);var R=M.onnxruntime.experimental.fbs;c.Graph={from:(L,F)=>new O(L,F)};class ${constructor(F){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,F&&(this.type=P.ProtoUtil.tensorValueTypeFromProto(F.type.tensorType))}get from(){return this._from}get to(){return this._to}}class G{constructor(F,V){F instanceof T.onnx.NodeProto?(this.name=F.name,this.opType=F.opType,this.attributes=new C.Attribute(F.attribute)):F instanceof R.Node&&(this.name=V??F.name(),this.opType=F.opType(),this.attributes=new C.Attribute(P.ProtoUtil.tensorAttributesFromORTFormat(F))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class O{constructor(F,V){if(!F)throw new TypeError("graph is empty");this.buildGraph(F),this.transformGraph(V),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(F){if(F instanceof T.onnx.GraphProto)this.buildGraphFromOnnxFormat(F);else{if(!(F instanceof R.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(F)}}buildGraphFromOnnxFormat(F){const V=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const W=new Map;if(!F.input)throw new Error("missing information in graph: input");const z=[];for(const Z of F.input){if(V.has(Z.name))throw new Error(`duplicated input name: ${Z.name}`);const H=this._allData.push(new $(Z))-1;V.set(Z.name,H),z.push(Z.name)}if(!F.initializer)throw new Error("missing information in graph: initializer");for(const Z of F.initializer){let H=V.get(Z.name);if(H===void 0){const Y=new $;Y.type={shape:{dims:P.ProtoUtil.tensorDimsFromProto(Z.dims)},tensorType:P.ProtoUtil.tensorDataTypeFromProto(Z.dataType)},H=this._allData.push(Y)-1,V.set(Z.name,H)}this._allData[H]._from=-1,this._allData[H].tensor=E.Tensor.fromProto(Z)}for(let Z=0;Z{this._allData[z]._to.forEach(Z=>{F.add(Z)})});const V=Array.from(F),W=new Array(this._nodes.length).fill("white");for(;V.length>0;){const z=V.pop();W[z]==="gray"?W[z]="black":(V.push(z),W[z]="gray",this._nodes[z].outputs.forEach(Z=>{const H=this._allData[Z];if(H.tensor!==void 0)throw new Error("node outputs should not be initialized");if(H._from!==z)throw new Error("from property of the Value object doesn't match index of Node being processed");H._to.forEach(Y=>{if(W[Y]==="gray")throw new Error("model graph is cyclic");W[Y]==="white"&&V.push(Y)})}))}}transformGraph(F){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),F&&F.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let F=0;for(let V=0;V0&&(this._nodes[V].inputs.forEach(W=>{const z=this._allData[W]._to.indexOf(V+F);z!==-1&&(this._allData[W]._to[z]=V)}),this._nodes[V].outputs.forEach(W=>{this._allData[W]._from&&this._allData[W]._from===V+F&&(this._allData[W]._from=V)})):(F++,this._nodes[V].outputs.forEach(W=>{this._allData[W]._from=-2}),this._nodes.splice(V,1),V--);F=0;for(let V=0;V0){let W=-1;this._allData[V].from!==void 0&&this._allData[V].from!==-1?(W=this._nodes[this._allData[V].from].outputs.indexOf(V+F),W!==-1&&(this._nodes[this._allData[V].from].outputs[W]=V)):(W=this._allInputIndices.indexOf(V+F),W!==-1&&(this._allInputIndices[W]=V)),this._allData[V].to.forEach(z=>{W=this._nodes[z].inputs.indexOf(V+F),W!==-1&&(this._nodes[z].inputs[W]=V)}),this._allData[V].to.length===0&&(W=this._allOutputIndices.indexOf(V+F),W!==-1&&(this._allOutputIndices[W]=V))}}else F++,this._allData.splice(V,1),V--}deleteNode(F){const V=this._nodes[F];if(V.outputs.length>1){for(let U=1;U0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}V.executeNode=!1;const W=V.inputs[0],z=V.outputs[0],Z=this._allData[z].to,H=this._allData[W].to.indexOf(F);if(H===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[W].to.splice(H,1),this._allData[z]._to=[];const Y=this._allOutputIndices.indexOf(z);if(Y!==-1&&(this._allOutputIndices[Y]=W),Z&&Z.length>0)for(const U of Z){const j=this._nodes[U].inputs.indexOf(z);if(j===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[U].inputs[j]=W,this._allData[W].to.push(U)}}removeAllDropoutNodes(){let F=0;for(const V of this._nodes){if(V.opType==="Dropout"){if(V.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(V.outputs.length!==1&&V.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(V.outputs.length===2&&this._allData[V.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(F)}F++}}removeAllIdentityNodes(){let F=0;for(const V of this._nodes)V.opType==="Identity"&&this.deleteNode(F),F++}isActivation(F){switch(F.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const F of this._nodes)if(F.opType==="Conv"){const V=this._allData[F.outputs[0]]._to;if(V.length===1&&this.isActivation(this._nodes[V[0]])){const W=this._nodes[V[0]];if(W.opType==="Clip")if(W.inputs.length===1)try{F.attributes.set("activation_params","floats",[W.attributes.getFloat("min"),W.attributes.getFloat("max")])}catch{F.attributes.set("activation_params","floats",[P.MIN_CLIP,P.MAX_CLIP])}else{if(!(W.inputs.length>=3&&this._allData[W.inputs[1]].tensor!==void 0&&this._allData[W.inputs[2]].tensor!==void 0))continue;F.attributes.set("activation_params","floats",[this._allData[W.inputs[1]].tensor.floatData[0],this._allData[W.inputs[2]].tensor.floatData[0]])}F.attributes.set("activation","string",W.opType),this.deleteNode(V[0])}}}}},6231:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.now=c.Profiler=c.Logger=void 0;const _={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},T={none:new class{log(G,O,L){}},console:new class{log(G,O,L){console.log(`${this.color(G)} ${L?"\x1B[35m"+L+"\x1B[0m ":""}${O}`)}color(G){switch(G){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: ${G}`)}}}},C={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let M={"":C};function E(G,O,L,F){if(O===void 0)return V=G,{verbose:E.verbose.bind(null,V),info:E.info.bind(null,V),warning:E.warning.bind(null,V),error:E.error.bind(null,V),fatal:E.fatal.bind(null,V)};if(L===void 0)P(G,O);else if(typeof L=="number"&&F===void 0)P(G,O);else if(typeof L=="string"&&F===void 0)P(G,L,0,O);else{if(typeof L!="string"||typeof F!="number")throw new TypeError("input is valid");P(G,L,0,O)}var V}function P(G,O,L,F){const V=M[F||""]||M[""];_[G]<_[V.minimalSeverity]||(V.logDateTime&&(O=`${new Date().toISOString()}|${O}`),V.logSourceLocation,T[V.provider].log(G,O,F))}(function(G){function O(F){M={},L("",F||{})}function L(F,V){if(F==="*")O(V);else{const W=M[F]||C;M[F]={provider:V.provider||W.provider,minimalSeverity:V.minimalSeverity||W.minimalSeverity,logDateTime:V.logDateTime===void 0?W.logDateTime:V.logDateTime,logSourceLocation:V.logSourceLocation===void 0?W.logSourceLocation:V.logSourceLocation}}}G.verbose=function(F,V){G("verbose",F,V)},G.info=function(F,V){G("info",F,V)},G.warning=function(F,V){G("warning",F,V)},G.error=function(F,V){G("error",F,V)},G.fatal=function(F,V){G("fatal",F,V)},G.reset=O,G.set=L,G.setWithEnv=function(F){const V={};F.logLevel&&(V.minimalSeverity=F.logLevel),L("",V)}})(E||(E={})),c.Logger=E;class R{constructor(O,L,F,V,W,z){this.category=O,this.name=L,this.startTime=F,this.endCallback=V,this.timer=W,this.ctx=z}end(){return this.endCallback(this)}async checkTimer(){if(this.ctx===void 0||this.timer===void 0)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}}class ${constructor(O,L,F,V){this.category=O,this.name=L,this.startTime=F,this.endTime=V}}c.Profiler=class{static create(G){return G===void 0?new this:new this(G.maxNumberEvents,G.flushBatchSize,G.flushIntervalInMilliseconds)}constructor(G,O,L){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=G===void 0?1e4:G,this._flushBatchSize=O===void 0?10:O,this._flushIntervalInMilliseconds=L===void 0?5e3:L}start(){this._started=!0,this._timingEvents=[],this._flushTime=(0,c.now)(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer{z.then(async Y=>{V&&await V.end(),Z(Y)},async Y=>{V&&await V.end(),H(Y)})});if(!W&&V){const Z=V.end();if(Z&&typeof Z.then=="function")return new Promise((H,Y)=>{Z.then(()=>{H(z)},U=>{Y(U)})})}return z}begin(G,O,L){if(!this._started)throw new Error("profiler is not started yet");if(L===void 0){const F=(0,c.now)();return this.flush(F),new R(G,O,F,V=>this.endSync(V))}{const F=L.beginTimer();return new R(G,O,0,async V=>this.end(V),F,L)}}async end(G){const O=await G.checkTimer();this._timingEvents.length=this._flushBatchSize||G-this._flushTime>=this._flushIntervalInMilliseconds){for(const O=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Model=void 0;const T=_(5686),C=_(1446),M=_(7070),E=_(9395),P=_(2517);var R=E.onnxruntime.experimental.fbs;c.Model=class{constructor(){}load($,G,O){if(!O)try{return void this.loadFromOnnxFormat($,G)}catch(L){if(O!==void 0)throw L}this.loadFromOrtFormat($,G)}loadFromOnnxFormat($,G){const O=C.onnx.ModelProto.decode($);if(P.LongUtil.longToNumber(O.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=O.opsetImport.map(L=>({domain:L.domain,version:P.LongUtil.longToNumber(L.version)})),this._graph=M.Graph.from(O.graph,G)}loadFromOrtFormat($,G){const O=new T.flatbuffers.ByteBuffer($),L=R.InferenceSession.getRootAsInferenceSession(O).model();if(P.LongUtil.longToNumber(L.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let F=0;F{Object.defineProperty(c,"__esModule",{value:!0}),c.FLOAT_TYPES=c.INT_TYPES=c.NUMBER_TYPES=void 0,c.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],c.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],c.FLOAT_TYPES=["float32","float64"]},1047:(x,c)=>{function _(T,C){if(C.endsWith("+")){const M=Number.parseInt(C.substring(0,C.length-1),10);return!isNaN(M)&&M<=T}if(C.split("-").length===2){const M=C.split("-"),E=Number.parseInt(M[0],10),P=Number.parseInt(M[1],10);return!isNaN(E)&&!isNaN(P)&&E<=T&&T<=P}return Number.parseInt(C,10)===T}Object.defineProperty(c,"__esModule",{value:!0}),c.resolveOperator=void 0,c.resolveOperator=function(T,C,M){for(const E of M){const P=E[0],R=E[1],$=E[2],G=E[3],O=E[4];if(T.opType===P){for(const L of C)if((L.domain===R||L.domain==="ai.onnx"&&R==="")&&_(L.version,$))return{opImpl:G,opInit:O}}}throw new TypeError(`cannot resolve operator '${T.opType}' with opsets: ${C.map(E=>`${E.domain||"ai.onnx"} v${E.version}`).join(", ")}`)}},9395:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.onnxruntime=void 0;const T=_(5686);var C,M;C=c.onnxruntime||(c.onnxruntime={}),function(E){(function(P){P[P.UNDEFINED=0]="UNDEFINED",P[P.FLOAT=1]="FLOAT",P[P.INT=2]="INT",P[P.STRING=3]="STRING",P[P.TENSOR=4]="TENSOR",P[P.GRAPH=5]="GRAPH",P[P.FLOATS=6]="FLOATS",P[P.INTS=7]="INTS",P[P.STRINGS=8]="STRINGS",P[P.TENSORS=9]="TENSORS",P[P.GRAPHS=10]="GRAPHS",P[P.SPARSE_TENSOR=11]="SPARSE_TENSOR",P[P.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(E.AttributeType||(E.AttributeType={}))}((M=C.experimental||(C.experimental={})).fbs||(M.fbs={})),function(E){(function(P){(function(R){(function($){$[$.UNKNOWN=0]="UNKNOWN",$[$.VALUE=1]="VALUE",$[$.PARAM=2]="PARAM"})(R.DimensionValueType||(R.DimensionValueType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.UNDEFINED=0]="UNDEFINED",$[$.FLOAT=1]="FLOAT",$[$.UINT8=2]="UINT8",$[$.INT8=3]="INT8",$[$.UINT16=4]="UINT16",$[$.INT16=5]="INT16",$[$.INT32=6]="INT32",$[$.INT64=7]="INT64",$[$.STRING=8]="STRING",$[$.BOOL=9]="BOOL",$[$.FLOAT16=10]="FLOAT16",$[$.DOUBLE=11]="DOUBLE",$[$.UINT32=12]="UINT32",$[$.UINT64=13]="UINT64",$[$.COMPLEX64=14]="COMPLEX64",$[$.COMPLEX128=15]="COMPLEX128",$[$.BFLOAT16=16]="BFLOAT16"})(R.TensorDataType||(R.TensorDataType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.Primitive=0]="Primitive",$[$.Fused=1]="Fused"})(R.NodeType||(R.NodeType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.NONE=0]="NONE",$[$.tensor_type=1]="tensor_type",$[$.sequence_type=2]="sequence_type",$[$.map_type=3]="map_type"})(R.TypeInfoValue||(R.TypeInfoValue={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsShape(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsShape(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}dim(O,L){let F=this.bb.__offset(this.bb_pos,4);return F?(L||new E.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}dimLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}static startShape(O){O.startObject(1)}static addDim(O,L){O.addFieldOffset(0,L,0)}static createDimVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startDimVector(O,L){O.startVector(4,L,4)}static endShape(O){return O.endObject()}static createShape(O,L){return $.startShape(O),$.addDim(O,L),$.endShape(O)}}R.Shape=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsDimension(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsDimension(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}value(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}denotation(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}static startDimension(O){O.startObject(2)}static addValue(O,L){O.addFieldOffset(0,L,0)}static addDenotation(O,L){O.addFieldOffset(1,L,0)}static endDimension(O){return O.endObject()}static createDimension(O,L,F){return $.startDimension(O),$.addValue(O,L),$.addDenotation(O,F),$.endDimension(O)}}R.Dimension=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsDimensionValue(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsDimensionValue(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}dimType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt8(this.bb_pos+O):E.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}dimParam(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}static startDimensionValue(O){O.startObject(3)}static addDimType(O,L){O.addFieldInt8(0,L,E.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(O,L){O.addFieldInt64(1,L,O.createLong(0,0))}static addDimParam(O,L){O.addFieldOffset(2,L,0)}static endDimensionValue(O){return O.endObject()}static createDimensionValue(O,L,F,V){return $.startDimensionValue(O),$.addDimType(O,L),$.addDimValue(O,F),$.addDimParam(O,V),$.endDimensionValue(O)}}R.DimensionValue=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTensorTypeAndShape(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTensorTypeAndShape(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}elemType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}shape(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startTensorTypeAndShape(O){O.startObject(2)}static addElemType(O,L){O.addFieldInt32(0,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(O,L){O.addFieldOffset(1,L,0)}static endTensorTypeAndShape(O){return O.endObject()}static createTensorTypeAndShape(O,L,F){return $.startTensorTypeAndShape(O),$.addElemType(O,L),$.addShape(O,F),$.endTensorTypeAndShape(O)}}R.TensorTypeAndShape=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsMapType(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsMapType(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}keyType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}valueType(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startMapType(O){O.startObject(2)}static addKeyType(O,L){O.addFieldInt32(0,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(O,L){O.addFieldOffset(1,L,0)}static endMapType(O){return O.endObject()}static createMapType(O,L,F){return $.startMapType(O),$.addKeyType(O,L),$.addValueType(O,F),$.endMapType(O)}}R.MapType=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSequenceType(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSequenceType(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}elemType(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startSequenceType(O){O.startObject(1)}static addElemType(O,L){O.addFieldOffset(0,L,0)}static endSequenceType(O){return O.endObject()}static createSequenceType(O,L){return $.startSequenceType(O),$.addElemType(O,L),$.endSequenceType(O)}}R.SequenceType=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(P.fbs||(P.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(R,$){return this.bb_pos=R,this.bb=$,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(R,$,G,O){return R.prep(4,12),R.writeInt32(O),R.writeInt32(G),R.writeInt32($),R.offset()}}})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsNodeEdge(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsNodeEdge(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}nodeIndex(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readUint32(this.bb_pos+O):0}inputEdges(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+F)+12*O,this.bb):null}inputEdgesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}outputEdges(O,L){let F=this.bb.__offset(this.bb_pos,8);return F?(L||new E.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+F)+12*O,this.bb):null}outputEdgesLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}static startNodeEdge(O){O.startObject(3)}static addNodeIndex(O,L){O.addFieldInt32(0,L,0)}static addInputEdges(O,L){O.addFieldOffset(1,L,0)}static startInputEdgesVector(O,L){O.startVector(12,L,4)}static addOutputEdges(O,L){O.addFieldOffset(2,L,0)}static startOutputEdgesVector(O,L){O.startVector(12,L,4)}static endNodeEdge(O){return O.endObject()}static createNodeEdge(O,L,F,V){return $.startNodeEdge(O),$.addNodeIndex(O,L),$.addInputEdges(O,F),$.addOutputEdges(O,V),$.endNodeEdge(O)}}R.NodeEdge=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsNode(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsNode(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}domain(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}sinceVersion(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readInt32(this.bb_pos+O):0}index(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.readUint32(this.bb_pos+O):0}opType(O){let L=this.bb.__offset(this.bb_pos,14);return L?this.bb.__string(this.bb_pos+L,O):null}type(){let O=this.bb.__offset(this.bb_pos,16);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.NodeType.Primitive}executionProviderType(O){let L=this.bb.__offset(this.bb_pos,18);return L?this.bb.__string(this.bb_pos+L,O):null}inputs(O,L){let F=this.bb.__offset(this.bb_pos,20);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}inputsLength(){let O=this.bb.__offset(this.bb_pos,20);return O?this.bb.__vector_len(this.bb_pos+O):0}outputs(O,L){let F=this.bb.__offset(this.bb_pos,22);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}outputsLength(){let O=this.bb.__offset(this.bb_pos,22);return O?this.bb.__vector_len(this.bb_pos+O):0}attributes(O,L){let F=this.bb.__offset(this.bb_pos,24);return F?(L||new E.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}attributesLength(){let O=this.bb.__offset(this.bb_pos,24);return O?this.bb.__vector_len(this.bb_pos+O):0}inputArgCounts(O){let L=this.bb.__offset(this.bb_pos,26);return L?this.bb.readInt32(this.bb.__vector(this.bb_pos+L)+4*O):0}inputArgCountsLength(){let O=this.bb.__offset(this.bb_pos,26);return O?this.bb.__vector_len(this.bb_pos+O):0}inputArgCountsArray(){let O=this.bb.__offset(this.bb_pos,26);return O?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}implicitInputs(O,L){let F=this.bb.__offset(this.bb_pos,28);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}implicitInputsLength(){let O=this.bb.__offset(this.bb_pos,28);return O?this.bb.__vector_len(this.bb_pos+O):0}static startNode(O){O.startObject(13)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addDomain(O,L){O.addFieldOffset(2,L,0)}static addSinceVersion(O,L){O.addFieldInt32(3,L,0)}static addIndex(O,L){O.addFieldInt32(4,L,0)}static addOpType(O,L){O.addFieldOffset(5,L,0)}static addType(O,L){O.addFieldInt32(6,L,E.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(O,L){O.addFieldOffset(7,L,0)}static addInputs(O,L){O.addFieldOffset(8,L,0)}static createInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInputsVector(O,L){O.startVector(4,L,4)}static addOutputs(O,L){O.addFieldOffset(9,L,0)}static createOutputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOutputsVector(O,L){O.startVector(4,L,4)}static addAttributes(O,L){O.addFieldOffset(10,L,0)}static createAttributesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startAttributesVector(O,L){O.startVector(4,L,4)}static addInputArgCounts(O,L){O.addFieldOffset(11,L,0)}static createInputArgCountsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addInt32(L[F]);return O.endVector()}static startInputArgCountsVector(O,L){O.startVector(4,L,4)}static addImplicitInputs(O,L){O.addFieldOffset(12,L,0)}static createImplicitInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startImplicitInputsVector(O,L){O.startVector(4,L,4)}static endNode(O){return O.endObject()}static createNode(O,L,F,V,W,z,Z,H,Y,U,j,X,K,q){return $.startNode(O),$.addName(O,L),$.addDocString(O,F),$.addDomain(O,V),$.addSinceVersion(O,W),$.addIndex(O,z),$.addOpType(O,Z),$.addType(O,H),$.addExecutionProviderType(O,Y),$.addInputs(O,U),$.addOutputs(O,j),$.addAttributes(O,X),$.addInputArgCounts(O,K),$.addImplicitInputs(O,q),$.endNode(O)}}R.Node=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsValueInfo(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsValueInfo(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}type(O){let L=this.bb.__offset(this.bb_pos,8);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startValueInfo(O){O.startObject(3)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addType(O,L){O.addFieldOffset(2,L,0)}static endValueInfo(O){return O.endObject()}static createValueInfo(O,L,F,V){return $.startValueInfo(O),$.addName(O,L),$.addDocString(O,F),$.addType(O,V),$.endValueInfo(O)}}R.ValueInfo=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTypeInfo(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTypeInfo(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}denotation(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}valueType(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readUint8(this.bb_pos+O):E.experimental.fbs.TypeInfoValue.NONE}value(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__union(O,this.bb_pos+L):null}static startTypeInfo(O){O.startObject(3)}static addDenotation(O,L){O.addFieldOffset(0,L,0)}static addValueType(O,L){O.addFieldInt8(1,L,E.experimental.fbs.TypeInfoValue.NONE)}static addValue(O,L){O.addFieldOffset(2,L,0)}static endTypeInfo(O){return O.endObject()}static createTypeInfo(O,L,F,V){return $.startTypeInfo(O),$.addDenotation(O,L),$.addValueType(O,F),$.addValue(O,V),$.endTypeInfo(O)}}R.TypeInfo=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsOperatorSetId(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsOperatorSetId(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}domain(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}version(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}static startOperatorSetId(O){O.startObject(2)}static addDomain(O,L){O.addFieldOffset(0,L,0)}static addVersion(O,L){O.addFieldInt64(1,L,O.createLong(0,0))}static endOperatorSetId(O){return O.endObject()}static createOperatorSetId(O,L,F){return $.startOperatorSetId(O),$.addDomain(O,L),$.addVersion(O,F),$.endOperatorSetId(O)}}R.OperatorSetId=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTensor(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTensor(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}dims(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}dimsLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}dataType(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}rawData(O){let L=this.bb.__offset(this.bb_pos,12);return L?this.bb.readUint8(this.bb.__vector(this.bb_pos+L)+O):0}rawDataLength(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.__vector_len(this.bb_pos+O):0}rawDataArray(){let O=this.bb.__offset(this.bb_pos,12);return O?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}stringData(O,L){let F=this.bb.__offset(this.bb_pos,14);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}stringDataLength(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.__vector_len(this.bb_pos+O):0}static startTensor(O){O.startObject(6)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addDims(O,L){O.addFieldOffset(2,L,0)}static createDimsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startDimsVector(O,L){O.startVector(8,L,8)}static addDataType(O,L){O.addFieldInt32(3,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(O,L){O.addFieldOffset(4,L,0)}static createRawDataVector(O,L){O.startVector(1,L.length,1);for(let F=L.length-1;F>=0;F--)O.addInt8(L[F]);return O.endVector()}static startRawDataVector(O,L){O.startVector(1,L,1)}static addStringData(O,L){O.addFieldOffset(5,L,0)}static createStringDataVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startStringDataVector(O,L){O.startVector(4,L,4)}static endTensor(O){return O.endObject()}static createTensor(O,L,F,V,W,z,Z){return $.startTensor(O),$.addName(O,L),$.addDocString(O,F),$.addDims(O,V),$.addDataType(O,W),$.addRawData(O,z),$.addStringData(O,Z),$.endTensor(O)}}R.Tensor=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSparseTensor(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSparseTensor(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}values(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}indices(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}dims(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}dimsLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}static startSparseTensor(O){O.startObject(3)}static addValues(O,L){O.addFieldOffset(0,L,0)}static addIndices(O,L){O.addFieldOffset(1,L,0)}static addDims(O,L){O.addFieldOffset(2,L,0)}static createDimsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startDimsVector(O,L){O.startVector(8,L,8)}static endSparseTensor(O){return O.endObject()}static createSparseTensor(O,L,F,V){return $.startSparseTensor(O),$.addValues(O,L),$.addIndices(O,F),$.addDims(O,V),$.endSparseTensor(O)}}R.SparseTensor=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsAttribute(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsAttribute(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}type(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.AttributeType.UNDEFINED}f(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readFloat32(this.bb_pos+O):0}i(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}s(O){let L=this.bb.__offset(this.bb_pos,14);return L?this.bb.__string(this.bb_pos+L,O):null}t(O){let L=this.bb.__offset(this.bb_pos,16);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}g(O){let L=this.bb.__offset(this.bb_pos,18);return L?(O||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}floats(O){let L=this.bb.__offset(this.bb_pos,20);return L?this.bb.readFloat32(this.bb.__vector(this.bb_pos+L)+4*O):0}floatsLength(){let O=this.bb.__offset(this.bb_pos,20);return O?this.bb.__vector_len(this.bb_pos+O):0}floatsArray(){let O=this.bb.__offset(this.bb_pos,20);return O?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}ints(O){let L=this.bb.__offset(this.bb_pos,22);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}intsLength(){let O=this.bb.__offset(this.bb_pos,22);return O?this.bb.__vector_len(this.bb_pos+O):0}strings(O,L){let F=this.bb.__offset(this.bb_pos,24);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}stringsLength(){let O=this.bb.__offset(this.bb_pos,24);return O?this.bb.__vector_len(this.bb_pos+O):0}tensors(O,L){let F=this.bb.__offset(this.bb_pos,26);return F?(L||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}tensorsLength(){let O=this.bb.__offset(this.bb_pos,26);return O?this.bb.__vector_len(this.bb_pos+O):0}graphs(O,L){let F=this.bb.__offset(this.bb_pos,28);return F?(L||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}graphsLength(){let O=this.bb.__offset(this.bb_pos,28);return O?this.bb.__vector_len(this.bb_pos+O):0}static startAttribute(O){O.startObject(13)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addType(O,L){O.addFieldInt32(2,L,E.experimental.fbs.AttributeType.UNDEFINED)}static addF(O,L){O.addFieldFloat32(3,L,0)}static addI(O,L){O.addFieldInt64(4,L,O.createLong(0,0))}static addS(O,L){O.addFieldOffset(5,L,0)}static addT(O,L){O.addFieldOffset(6,L,0)}static addG(O,L){O.addFieldOffset(7,L,0)}static addFloats(O,L){O.addFieldOffset(8,L,0)}static createFloatsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addFloat32(L[F]);return O.endVector()}static startFloatsVector(O,L){O.startVector(4,L,4)}static addInts(O,L){O.addFieldOffset(9,L,0)}static createIntsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startIntsVector(O,L){O.startVector(8,L,8)}static addStrings(O,L){O.addFieldOffset(10,L,0)}static createStringsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startStringsVector(O,L){O.startVector(4,L,4)}static addTensors(O,L){O.addFieldOffset(11,L,0)}static createTensorsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startTensorsVector(O,L){O.startVector(4,L,4)}static addGraphs(O,L){O.addFieldOffset(12,L,0)}static createGraphsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startGraphsVector(O,L){O.startVector(4,L,4)}static endAttribute(O){return O.endObject()}static createAttribute(O,L,F,V,W,z,Z,H,Y,U,j,X,K,q){return $.startAttribute(O),$.addName(O,L),$.addDocString(O,F),$.addType(O,V),$.addF(O,W),$.addI(O,z),$.addS(O,Z),$.addT(O,H),$.addG(O,Y),$.addFloats(O,U),$.addInts(O,j),$.addStrings(O,X),$.addTensors(O,K),$.addGraphs(O,q),$.endAttribute(O)}}R.Attribute=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsGraph(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsGraph(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}initializers(O,L){let F=this.bb.__offset(this.bb_pos,4);return F?(L||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}initializersLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}nodeArgs(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodeArgsLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}nodes(O,L){let F=this.bb.__offset(this.bb_pos,8);return F?(L||new E.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodesLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}maxNodeIndex(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readUint32(this.bb_pos+O):0}nodeEdges(O,L){let F=this.bb.__offset(this.bb_pos,12);return F?(L||new E.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodeEdgesLength(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.__vector_len(this.bb_pos+O):0}inputs(O,L){let F=this.bb.__offset(this.bb_pos,14);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}inputsLength(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.__vector_len(this.bb_pos+O):0}outputs(O,L){let F=this.bb.__offset(this.bb_pos,16);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}outputsLength(){let O=this.bb.__offset(this.bb_pos,16);return O?this.bb.__vector_len(this.bb_pos+O):0}sparseInitializers(O,L){let F=this.bb.__offset(this.bb_pos,18);return F?(L||new E.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}sparseInitializersLength(){let O=this.bb.__offset(this.bb_pos,18);return O?this.bb.__vector_len(this.bb_pos+O):0}static startGraph(O){O.startObject(8)}static addInitializers(O,L){O.addFieldOffset(0,L,0)}static createInitializersVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInitializersVector(O,L){O.startVector(4,L,4)}static addNodeArgs(O,L){O.addFieldOffset(1,L,0)}static createNodeArgsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodeArgsVector(O,L){O.startVector(4,L,4)}static addNodes(O,L){O.addFieldOffset(2,L,0)}static createNodesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodesVector(O,L){O.startVector(4,L,4)}static addMaxNodeIndex(O,L){O.addFieldInt32(3,L,0)}static addNodeEdges(O,L){O.addFieldOffset(4,L,0)}static createNodeEdgesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodeEdgesVector(O,L){O.startVector(4,L,4)}static addInputs(O,L){O.addFieldOffset(5,L,0)}static createInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInputsVector(O,L){O.startVector(4,L,4)}static addOutputs(O,L){O.addFieldOffset(6,L,0)}static createOutputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOutputsVector(O,L){O.startVector(4,L,4)}static addSparseInitializers(O,L){O.addFieldOffset(7,L,0)}static createSparseInitializersVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startSparseInitializersVector(O,L){O.startVector(4,L,4)}static endGraph(O){return O.endObject()}static createGraph(O,L,F,V,W,z,Z,H,Y){return $.startGraph(O),$.addInitializers(O,L),$.addNodeArgs(O,F),$.addNodes(O,V),$.addMaxNodeIndex(O,W),$.addNodeEdges(O,z),$.addInputs(O,Z),$.addOutputs(O,H),$.addSparseInitializers(O,Y),$.endGraph(O)}}R.Graph=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsModel(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsModel(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}irVersion(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}opsetImport(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}opsetImportLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}producerName(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}producerVersion(O){let L=this.bb.__offset(this.bb_pos,10);return L?this.bb.__string(this.bb_pos+L,O):null}domain(O){let L=this.bb.__offset(this.bb_pos,12);return L?this.bb.__string(this.bb_pos+L,O):null}modelVersion(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}docString(O){let L=this.bb.__offset(this.bb_pos,16);return L?this.bb.__string(this.bb_pos+L,O):null}graph(O){let L=this.bb.__offset(this.bb_pos,18);return L?(O||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}graphDocString(O){let L=this.bb.__offset(this.bb_pos,20);return L?this.bb.__string(this.bb_pos+L,O):null}static startModel(O){O.startObject(9)}static addIrVersion(O,L){O.addFieldInt64(0,L,O.createLong(0,0))}static addOpsetImport(O,L){O.addFieldOffset(1,L,0)}static createOpsetImportVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOpsetImportVector(O,L){O.startVector(4,L,4)}static addProducerName(O,L){O.addFieldOffset(2,L,0)}static addProducerVersion(O,L){O.addFieldOffset(3,L,0)}static addDomain(O,L){O.addFieldOffset(4,L,0)}static addModelVersion(O,L){O.addFieldInt64(5,L,O.createLong(0,0))}static addDocString(O,L){O.addFieldOffset(6,L,0)}static addGraph(O,L){O.addFieldOffset(7,L,0)}static addGraphDocString(O,L){O.addFieldOffset(8,L,0)}static endModel(O){return O.endObject()}static createModel(O,L,F,V,W,z,Z,H,Y,U){return $.startModel(O),$.addIrVersion(O,L),$.addOpsetImport(O,F),$.addProducerName(O,V),$.addProducerVersion(O,W),$.addDomain(O,z),$.addModelVersion(O,Z),$.addDocString(O,H),$.addGraph(O,Y),$.addGraphDocString(O,U),$.endModel(O)}}R.Model=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsKernelCreateInfos(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsKernelCreateInfos(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}nodeIndices(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.readUint32(this.bb.__vector(this.bb_pos+L)+4*O):0}nodeIndicesLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}nodeIndicesArray(){let O=this.bb.__offset(this.bb_pos,4);return O?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}kernelDefHashes(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.readUint64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}kernelDefHashesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}static startKernelCreateInfos(O){O.startObject(2)}static addNodeIndices(O,L){O.addFieldOffset(0,L,0)}static createNodeIndicesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addInt32(L[F]);return O.endVector()}static startNodeIndicesVector(O,L){O.startVector(4,L,4)}static addKernelDefHashes(O,L){O.addFieldOffset(1,L,0)}static createKernelDefHashesVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startKernelDefHashesVector(O,L){O.startVector(8,L,8)}static endKernelCreateInfos(O){return O.endObject()}static createKernelCreateInfos(O,L,F){return $.startKernelCreateInfos(O),$.addNodeIndices(O,L),$.addKernelDefHashes(O,F),$.endKernelCreateInfos(O)}}R.KernelCreateInfos=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSubGraphSessionState(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSubGraphSessionState(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}graphId(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}sessionState(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startSubGraphSessionState(O){O.startObject(2)}static addGraphId(O,L){O.addFieldOffset(0,L,0)}static addSessionState(O,L){O.addFieldOffset(1,L,0)}static endSubGraphSessionState(O){let L=O.endObject();return O.requiredField(L,4),L}static createSubGraphSessionState(O,L,F){return $.startSubGraphSessionState(O),$.addGraphId(O,L),$.addSessionState(O,F),$.endSubGraphSessionState(O)}}R.SubGraphSessionState=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSessionState(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSessionState(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}kernels(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}subGraphSessionStates(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}subGraphSessionStatesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}static startSessionState(O){O.startObject(2)}static addKernels(O,L){O.addFieldOffset(0,L,0)}static addSubGraphSessionStates(O,L){O.addFieldOffset(1,L,0)}static createSubGraphSessionStatesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startSubGraphSessionStatesVector(O,L){O.startVector(4,L,4)}static endSessionState(O){return O.endObject()}static createSessionState(O,L,F){return $.startSessionState(O),$.addKernels(O,L),$.addSubGraphSessionStates(O,F),$.endSessionState(O)}}R.SessionState=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsInferenceSession(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsInferenceSession(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static bufferHasIdentifier(O){return O.__has_identifier("ORTM")}ortVersion(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}model(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}sessionState(O){let L=this.bb.__offset(this.bb_pos,8);return L?(O||new E.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startInferenceSession(O){O.startObject(3)}static addOrtVersion(O,L){O.addFieldOffset(0,L,0)}static addModel(O,L){O.addFieldOffset(1,L,0)}static addSessionState(O,L){O.addFieldOffset(2,L,0)}static endInferenceSession(O){return O.endObject()}static finishInferenceSessionBuffer(O,L){O.finish(L,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(O,L){O.finish(L,"ORTM",!0)}static createInferenceSession(O,L,F,V){return $.startInferenceSession(O),$.addOrtVersion(O,L),$.addModel(O,F),$.addSessionState(O,V),$.endInferenceSession(O)}}R.InferenceSession=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={}))},7448:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxjsSessionHandler=void 0;const T=_(1670),C=_(9162);c.OnnxjsSessionHandler=class{constructor(M){this.session=M,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(M,E,P){const R=new Map;for(const O in M)if(Object.hasOwnProperty.call(M,O)){const L=M[O];R.set(O,new C.Tensor(L.dims,L.type,void 0,void 0,L.data))}const $=await this.session.run(R),G={};return $.forEach((O,L)=>{G[L]=new T.Tensor(O.type,O.data,O.dims)}),G}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Session=void 0;const T=_(7067),C=_(1296),M=_(7091),E=_(1036),P=_(6231),R=_(2644);c.Session=class{constructor($={}){this._initialized=!1,this.backendHint=$.backendHint,this.profiler=P.Profiler.create($.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($,G,O){await this.profiler.event("session","Session.loadModel",async()=>{const L=await(0,M.resolveBackend)(this.backendHint);if(this.sessionHandler=L.createSessionHandler(this.context),this._model=new R.Model,typeof $=="string"){const F=$.endsWith(".ort");if(typeof fetch>"u"){const V=await(0,C.promisify)(T.readFile)($);this.initialize(V,F)}else{const V=await fetch($),W=await V.arrayBuffer();this.initialize(new Uint8Array(W),F)}}else if(ArrayBuffer.isView($))this.initialize($);else{const F=new Uint8Array($,G||0,O||$.byteLength);this.initialize(F)}})}initialize($,G){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const O=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load($,O,G),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new E.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run($){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const G=this.normalizeAndValidateInputs($),O=await this._executionPlan.execute(this.sessionHandler,G);return this.createOutput(O)})}normalizeAndValidateInputs($){const G=this._model.graph.getInputNames();if(Array.isArray($)){if($.length!==G.length)throw new Error(`incorrect input array length: expected ${G.length} but got ${$.length}`)}else{if($.size!==G.length)throw new Error(`incorrect input map size: expected ${G.length} but got ${$.size}`);const O=new Array($.size);let L=0;for(let F=0;Ftypeof q=="string")))throw new TypeError("cache should be a string array");K&&(this.cache=new Array(X))}else{if(U!==void 0){const q=L(Z);if(!(U instanceof q))throw new TypeError(`cache should be type ${q.name}`)}if(K){const q=new ArrayBuffer(X*function(J){switch(J){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 ${J}`)}}(Z));this.cache=function(J,Q){return new(L(Q))(J)}(q,Z)}}}static fromProto(z){if(!z)throw new Error("cannot construct Value from an empty tensor");const Z=R.ProtoUtil.tensorDataTypeFromProto(z.dataType),H=R.ProtoUtil.tensorDimsFromProto(z.dims),Y=new G(H,Z);if(Z==="string")z.stringData.forEach((U,j)=>{Y.data[j]=(0,R.decodeUtf8String)(U)});else if(z.rawData&&typeof z.rawData.byteLength=="number"&&z.rawData.byteLength>0){const U=Y.data,j=new DataView(z.rawData.buffer,z.rawData.byteOffset,z.rawData.byteLength),X=O(z.dataType),K=z.rawData.byteLength/X;if(z.rawData.byteLength%X!=0)throw new Error("invalid buffer length");if(U.length!==K)throw new Error("buffer length mismatch");for(let q=0;q0){const U=Y.data,j=new DataView(z.rawDataArray().buffer,z.rawDataArray().byteOffset,z.rawDataLength()),X=O(z.dataType()),K=z.rawDataLength()/X;if(z.rawDataLength()%X!=0)throw new Error("invalid buffer length");if(U.length!==K)throw new Error("buffer length mismatch");for(let q=0;q1&&Q>1)return;K[X-q]=Math.max(J,Q)}return K}static index(Z,H){const Y=new Array(H.length);return $.fillIndex(Z,H,Y),Y}static fillIndex(Z,H,Y){const U=Z.length-H.length;for(let j=0;j=0;ue--)J[ue]=re%X[ue],re=Math.floor(re/X[ue]);ne||($.fillIndex(J,Z.dims,Q),ie=Z.get(Q)),te||($.fillIndex(J,H.dims,ee),ae=H.get(ee)),q.set(J,Y(ie,ae))}}return q}}static isValidBroadcast(Z,H){const Y=Z.length,U=H.length;if(Y>U)return!1;for(let j=1;j<=Y;j++)if(Z[Y-j]!==1&&Z[Y-j]!==H[U-j])return!1;return!0}static getBroadcastDims(Z,H){const Y=Z.length,U=[];for(let j=0;j1&&K===1&&U.unshift(X)}return U}}c.BroadcastUtil=$,c.arrayCopyHelper=function(z,Z,H,Y,U){if(Y<0||Y>=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;jM.default.isLong(H)?H.toNumber():H)}static tensorValueTypeFromProto(Z){return{tensorType:G.tensorDataTypeFromProto(Z.elemType),shape:{dims:G.tensorDimsFromProto(Z.shape.dim.map(H=>H.dimValue))}}}static tensorDimsFromORTFormat(Z){const H=[];for(let Y=0;YZ.length)throw new Error(`invalid dimension of ${H} for sizeFromDimension as Tensor has ${Z.length} dimensions.`);return L.getSizeFromDimensionRange(Z,H,Z.length)}static sizeToDimension(Z,H){if(H<0||H>Z.length)throw new Error(`invalid dimension of ${H} for sizeToDimension as Tensor has ${Z.length} dimensions.`);return L.getSizeFromDimensionRange(Z,0,H)}static getSizeFromDimensionRange(Z,H,Y){let U=1;for(let j=H;j=0;--U)Y[U]=Y[U+1]*Z[U+1];return Y}static transpose(Z){return Z.slice().reverse()}static indicesToOffset(Z,H,Y){Y===void 0&&(Y=Z.length);let U=0;for(let j=0;j=H)throw new Error("unsupported axis for this operation.");return Z<0?Z+H:Z}static normalizeAxes(Z,H){return Z.map(Y=>this.normalizeAxis(Y,H))}static incrementIndex(Z,H,Y){if(H.length===0||Z.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(Y===void 0)Y=H.length;else if(Y<=0||Y>H.length)throw new Error("Incorrect axis to increment on");for(let U=Y-1;U>=0&&(Z[U]++,!(Z[U]=Z.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");U[q]=Z[q]}else U[q]=H[q];X*=U[q]}}const K=L.size(Z);if(j!==-1){if(K%X!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${Z}] Output shape: [${H}]`);U[j]=K/X}else if(X!==K)throw new Error("reshapedDims and originalDims don't have matching sizes");return U}static sortBasedOnPerm(Z,H){return H?H.map(Y=>Z[Y]):Z.slice().reverse()}static padShape(Z,H){const Y=Z.length;return Z.map((U,j)=>U+H[j]+H[j+Y])}static areEqual(Z,H){return Z.length===H.length&&Z.every((Y,U)=>Y===H[U])}static validateDimsAndCalcSize(Z){if(Z.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let H=1;for(const Y of Z){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`);H*=Y}return H}static flattenShape(Z,H){H<0&&(H+=Z.length);const Y=Z.reduce((j,X)=>j*X,1),U=Z.slice(H).reduce((j,X)=>j*X,1);return[Y/U,U]}static squeezeShape(Z,H){const Y=new Array;H=L.normalizeAxes(H,Z.length);for(let U=0;U=0;if(j&&Z[U]!==1)throw new Error("squeeze an axis of size different than 1");(H.length===0&&Z[U]>1||H.length>0&&!j)&&Y.push(Z[U])}return Y}static unsqueezeShape(Z,H){const Y=new Array(Z.length+H.length);Y.fill(0);for(let j=0;j=Y.length)throw new Error("'axes' has an out of range axis");if(Y[X]!==0)throw new Error("'axes' has a duplicate axis");Y[X]=1}let U=0;for(let j=0;j=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;j=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let X=0;X=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let X=0;X=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;jH.push(ae));const K=V.calcReduceShape(X,H,!0),q=L.size(K),J=new P.Tensor(K,Z.type),Q=L.computeStrides(K),ee=L.computeStrides(X),re=new Array(X.length);for(let ie=0;ie=H.length)return X(Z[j]);const J=H[U],Q=J>=Y.length?1:L.size(Y.slice(J+1));for(let ee=0;eej!==0)}}c.ReduceUtil=V;class W{static adjustPoolAttributes(Z,H,Y,U,j,X){if(!Z&&Y.length!==H.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(Z)for(let K=0;K=Y.length?Y.push(H[K+2]):Y[K]=H[K+2];for(let K=0;K=Y[K]||X[K+Y.length]>=Y[K])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(Z,H,Y,U,j,X){if(X){if(j.length!==2*(Z.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(H.length!==Z.length-2)throw new Error("length of strides should be the length of data dimensions");if(U.length!==Z.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let K=0;K{Object.defineProperty(c,"__esModule",{value:!0}),c.iterateExtraOptions=void 0,c.iterateExtraOptions=(_,T,C,M)=>{if(typeof _=="object"&&_!==null){if(C.has(_))throw new Error("Circular reference in options");C.add(_)}Object.entries(_).forEach(([E,P])=>{const R=T?T+E:E;if(typeof P=="object")(0,c.iterateExtraOptions)(P,R+".",C,M);else if(typeof P=="string"||typeof P=="number")M(R,P.toString());else{if(typeof P!="boolean")throw new Error("Can't handle extra config type: "+typeof P);M(R,P?"1":"0")}})}},2157:function(x,c,_){var T,C=this&&this.__createBinding||(Object.create?function(Q,ee,re,ie){ie===void 0&&(ie=re);var ae=Object.getOwnPropertyDescriptor(ee,re);ae&&!("get"in ae?!ee.__esModule:ae.writable||ae.configurable)||(ae={enumerable:!0,get:function(){return ee[re]}}),Object.defineProperty(Q,ie,ae)}:function(Q,ee,re,ie){ie===void 0&&(ie=re),Q[ie]=ee[re]}),M=this&&this.__setModuleDefault||(Object.create?function(Q,ee){Object.defineProperty(Q,"default",{enumerable:!0,value:ee})}:function(Q,ee){Q.default=ee}),E=this&&this.__importStar||function(Q){if(Q&&Q.__esModule)return Q;var ee={};if(Q!=null)for(var re in Q)re!=="default"&&Object.prototype.hasOwnProperty.call(Q,re)&&C(ee,Q,re);return M(ee,Q),ee};Object.defineProperty(c,"__esModule",{value:!0}),c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initOrt=c.initWasm=void 0;const P=_(1670),R=E(_(349)),$=_(6361),G=()=>!!P.env.wasm.proxy&&typeof document<"u";let O,L,F,V=!1,W=!1,z=!1;const Z=[],H=[],Y=[],U=[],j=[],X=[],K=()=>{if(V||!W||z||!O)throw new Error("worker not ready")},q=Q=>{switch(Q.data.type){case"init-wasm":V=!1,Q.data.err?(z=!0,L[1](Q.data.err)):(W=!0,L[0]());break;case"init-ort":Q.data.err?F[1](Q.data.err):F[0]();break;case"create_allocate":Q.data.err?Z.shift()[1](Q.data.err):Z.shift()[0](Q.data.out);break;case"create_finalize":Q.data.err?H.shift()[1](Q.data.err):H.shift()[0](Q.data.out);break;case"create":Q.data.err?Y.shift()[1](Q.data.err):Y.shift()[0](Q.data.out);break;case"release":Q.data.err?U.shift()[1](Q.data.err):U.shift()[0]();break;case"run":Q.data.err?j.shift()[1](Q.data.err):j.shift()[0](Q.data.out);break;case"end-profiling":Q.data.err?X.shift()[1](Q.data.err):X.shift()[0]()}},J=typeof document<"u"?(T=document==null?void 0:document.currentScript)===null||T===void 0?void 0:T.src:void 0;c.initWasm=async()=>{if(G()){if(W)return;if(V)throw new Error("multiple calls to 'initWasm()' detected.");if(z)throw new Error("previous call to 'initWasm()' failed.");return V=!0,P.env.wasm.wasmPaths===void 0&&J&&J.indexOf("blob:")!==0&&(P.env.wasm.wasmPaths=J.substr(0,+J.lastIndexOf("/")+1)),new Promise((Q,ee)=>{O==null||O.terminate(),O=_(9710).Z(),O.onmessage=q,L=[Q,ee];const re={type:"init-wasm",in:P.env.wasm};O.postMessage(re)})}return(0,$.initializeWebAssembly)(P.env.wasm)},c.initOrt=async(Q,ee)=>{if(G())return K(),new Promise((re,ie)=>{F=[re,ie];const ae={type:"init-ort",in:{numThreads:Q,loggingLevel:ee}};O.postMessage(ae)});R.initOrt(Q,ee)},c.createSessionAllocate=async Q=>G()?(K(),new Promise((ee,re)=>{Z.push([ee,re]);const ie={type:"create_allocate",in:{model:Q}};O.postMessage(ie,[Q.buffer])})):R.createSessionAllocate(Q),c.createSessionFinalize=async(Q,ee)=>G()?(K(),new Promise((re,ie)=>{H.push([re,ie]);const ae={type:"create_finalize",in:{modeldata:Q,options:ee}};O.postMessage(ae)})):R.createSessionFinalize(Q,ee),c.createSession=async(Q,ee)=>G()?(K(),new Promise((re,ie)=>{Y.push([re,ie]);const ae={type:"create",in:{model:Q,options:ee}};O.postMessage(ae,[Q.buffer])})):R.createSession(Q,ee),c.releaseSession=async Q=>{if(G())return K(),new Promise((ee,re)=>{U.push([ee,re]);const ie={type:"release",in:Q};O.postMessage(ie)});R.releaseSession(Q)},c.run=async(Q,ee,re,ie,ae)=>G()?(K(),new Promise((ne,te)=>{j.push([ne,te]);const oe={type:"run",in:{sessionId:Q,inputIndices:ee,inputs:re,outputIndices:ie,options:ae}};O.postMessage(oe,R.extractTransferableBuffers(re))})):R.run(Q,ee,re,ie,ae),c.endProfiling=async Q=>{if(G())return K(),new Promise((ee,re)=>{X.push([ee,re]);const ie={type:"end-profiling",in:Q};O.postMessage(ie)});R.endProfiling(Q)}},586:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.setRunOptions=void 0;const T=_(7967),C=_(4983),M=_(6361);c.setRunOptions=E=>{const P=(0,M.getInstance)();let R=0;const $=[],G=E||{};try{if((E==null?void 0:E.logSeverityLevel)===void 0)G.logSeverityLevel=2;else if(typeof E.logSeverityLevel!="number"||!Number.isInteger(E.logSeverityLevel)||E.logSeverityLevel<0||E.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${E.logSeverityLevel}`);if((E==null?void 0:E.logVerbosityLevel)===void 0)G.logVerbosityLevel=0;else if(typeof E.logVerbosityLevel!="number"||!Number.isInteger(E.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${E.logVerbosityLevel}`);(E==null?void 0:E.terminate)===void 0&&(G.terminate=!1);let O=0;if((E==null?void 0:E.tag)!==void 0&&(O=(0,C.allocWasmString)(E.tag,$)),R=P._OrtCreateRunOptions(G.logSeverityLevel,G.logVerbosityLevel,!!G.terminate,O),R===0)throw new Error("Can't create run options");return(E==null?void 0:E.extra)!==void 0&&(0,T.iterateExtraOptions)(E.extra,"",new WeakSet,(L,F)=>{const V=(0,C.allocWasmString)(L,$),W=(0,C.allocWasmString)(F,$);if(P._OrtAddRunConfigEntry(R,V,W)!==0)throw new Error(`Can't set a run config entry: ${L} - ${F}`)}),[R,$]}catch(O){throw R!==0&&P._OrtReleaseRunOptions(R),$.forEach(P._free),O}}},2306:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxruntimeWebAssemblySessionHandler=void 0;const T=_(2806),C=_(1670),M=_(2850),E=_(2157);let P;c.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(R){const $=await fetch(R),G=await $.arrayBuffer();return(0,E.createSessionAllocate)(new Uint8Array(G))}async loadModel(R,$){if(P||(await(0,E.initOrt)(C.env.wasm.numThreads,(G=>{switch(G){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: ${G}`)}})(C.env.logLevel)),P=!0),typeof R=="string")if(typeof fetch>"u"){const G=await(0,M.promisify)(T.readFile)(R);[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSession)(G,$)}else{const G=await this.createSessionAllocate(R);[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSessionFinalize)(G,$)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSession)(R,$)}async dispose(){return(0,E.releaseSession)(this.sessionId)}async run(R,$,G){const O=[],L=[];Object.entries(R).forEach(z=>{const Z=z[0],H=z[1],Y=this.inputNames.indexOf(Z);if(Y===-1)throw new Error(`invalid input '${Z}'`);O.push(H),L.push(Y)});const F=[];Object.entries($).forEach(z=>{const Z=z[0],H=this.outputNames.indexOf(Z);if(H===-1)throw new Error(`invalid output '${Z}'`);F.push(H)});const V=await(0,E.run)(this.sessionId,L,O.map(z=>[z.type,z.dims,z.data]),F,G),W={};for(let z=0;z{Object.defineProperty(c,"__esModule",{value:!0}),c.setSessionOptions=void 0;const T=_(7967),C=_(4983),M=_(6361);c.setSessionOptions=E=>{const P=(0,M.getInstance)();let R=0;const $=[],G=E||{};(O=>{O.extra||(O.extra={}),O.extra.session||(O.extra.session={});const L=O.extra.session;L.use_ort_model_bytes_directly||(L.use_ort_model_bytes_directly="1")})(G);try{(E==null?void 0:E.graphOptimizationLevel)===void 0&&(G.graphOptimizationLevel="all");const O=(V=>{switch(V){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${V}`)}})(G.graphOptimizationLevel);(E==null?void 0:E.enableCpuMemArena)===void 0&&(G.enableCpuMemArena=!0),(E==null?void 0:E.enableMemPattern)===void 0&&(G.enableMemPattern=!0),(E==null?void 0:E.executionMode)===void 0&&(G.executionMode="sequential");const L=(V=>{switch(V){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${V}`)}})(G.executionMode);let F=0;if((E==null?void 0:E.logId)!==void 0&&(F=(0,C.allocWasmString)(E.logId,$)),(E==null?void 0:E.logSeverityLevel)===void 0)G.logSeverityLevel=2;else if(typeof E.logSeverityLevel!="number"||!Number.isInteger(E.logSeverityLevel)||E.logSeverityLevel<0||E.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${E.logSeverityLevel}`);if((E==null?void 0:E.logVerbosityLevel)===void 0)G.logVerbosityLevel=0;else if(typeof E.logVerbosityLevel!="number"||!Number.isInteger(E.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${E.logVerbosityLevel}`);if((E==null?void 0:E.enableProfiling)===void 0&&(G.enableProfiling=!1),R=P._OrtCreateSessionOptions(O,!!G.enableCpuMemArena,!!G.enableMemPattern,L,!!G.enableProfiling,0,F,G.logSeverityLevel,G.logVerbosityLevel),R===0)throw new Error("Can't create session options");return E!=null&&E.executionProviders&&((V,W,z)=>{for(const Z of W){let H=typeof Z=="string"?Z:Z.name;switch(H){case"xnnpack":H="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${H}`)}const Y=(0,C.allocWasmString)(H,z);if((0,M.getInstance)()._OrtAppendExecutionProvider(V,Y)!==0)throw new Error(`Can't append execution provider: ${H}`)}})(R,E.executionProviders,$),(E==null?void 0:E.extra)!==void 0&&(0,T.iterateExtraOptions)(E.extra,"",new WeakSet,(V,W)=>{const z=(0,C.allocWasmString)(V,$),Z=(0,C.allocWasmString)(W,$);if(P._OrtAddSessionConfigEntry(R,z,Z)!==0)throw new Error(`Can't set a session config entry: ${V} - ${W}`)}),[R,$]}catch(O){throw R!==0&&P._OrtReleaseSessionOptions(R),$.forEach(P._free),O}}},4983:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.allocWasmString=void 0;const T=_(6361);c.allocWasmString=(C,M)=>{const E=(0,T.getInstance)(),P=E.lengthBytesUTF8(C)+1,R=E._malloc(P);return E.stringToUTF8(C,R,P),M.push(R),R}},349:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.extractTransferableBuffers=c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initOrt=void 0;const T=_(586),C=_(4919),M=_(4983),E=_(6361);c.initOrt=(O,L)=>{const F=(0,E.getInstance)()._OrtInit(O,L);if(F!==0)throw new Error(`Can't initialize onnxruntime. error code = ${F}`)};const P=new Map;c.createSessionAllocate=O=>{const L=(0,E.getInstance)(),F=L._malloc(O.byteLength);return L.HEAPU8.set(O,F),[F,O.byteLength]},c.createSessionFinalize=(O,L)=>{const F=(0,E.getInstance)();let V=0,W=0,z=[];try{if([W,z]=(0,C.setSessionOptions)(L),V=F._OrtCreateSession(O[0],O[1],W),V===0)throw new Error("Can't create a session")}finally{F._free(O[0]),F._OrtReleaseSessionOptions(W),z.forEach(F._free)}const Z=F._OrtGetInputCount(V),H=F._OrtGetOutputCount(V),Y=[],U=[],j=[],X=[];for(let K=0;K{const F=(0,c.createSessionAllocate)(O);return(0,c.createSessionFinalize)(F,L)},c.releaseSession=O=>{const L=(0,E.getInstance)(),F=P.get(O);if(!F)throw new Error("invalid session id");const V=F[0],W=F[1],z=F[2];W.forEach(L._OrtFree),z.forEach(L._OrtFree),L._OrtReleaseSession(V),P.delete(O)};const R=O=>{switch(O){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: ${O}`)}},$=O=>{switch(O){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: ${O}`)}},G=O=>{switch(O){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: ${O}`)}};c.run=(O,L,F,V,W)=>{const z=(0,E.getInstance)(),Z=P.get(O);if(!Z)throw new Error("invalid session id");const H=Z[0],Y=Z[1],U=Z[2],j=L.length,X=V.length;let K=0,q=[];const J=[],Q=[];try{[K,q]=(0,T.setRunOptions)(W);for(let te=0;tez.HEAP32[Me++]=Re);const Pe=z._OrtCreateTensor(R(oe),pe,he,ye,ue.length);if(Pe===0)throw new Error("Can't create a tensor");J.push(Pe)}finally{z.stackRestore(we)}}const ee=z.stackSave(),re=z.stackAlloc(4*j),ie=z.stackAlloc(4*j),ae=z.stackAlloc(4*X),ne=z.stackAlloc(4*X);try{let te=re/4,oe=ie/4,ue=ae/4,de=ne/4;for(let we=0;weWe*Ke);if(Re=$($e),Re==="string"){const We=[];let Ke=De/4;for(let Je=0;Je{const L=(0,E.getInstance)(),F=P.get(O);if(!F)throw new Error("invalid session id");const V=F[0],W=L._OrtEndProfiling(V);if(W===0)throw new Error("Can't get an profile file name");L._OrtFree(W)},c.extractTransferableBuffers=O=>{const L=[];for(const F of O){const V=F[2];!Array.isArray(V)&&V.buffer&&L.push(V.buffer)}return L}},6361:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(W,z,Z,H){H===void 0&&(H=Z);var Y=Object.getOwnPropertyDescriptor(z,Z);Y&&!("get"in Y?!z.__esModule:Y.writable||Y.configurable)||(Y={enumerable:!0,get:function(){return z[Z]}}),Object.defineProperty(W,H,Y)}:function(W,z,Z,H){H===void 0&&(H=Z),W[H]=z[Z]}),C=this&&this.__setModuleDefault||(Object.create?function(W,z){Object.defineProperty(W,"default",{enumerable:!0,value:z})}:function(W,z){W.default=z}),M=this&&this.__importStar||function(W){if(W&&W.__esModule)return W;var z={};if(W!=null)for(var Z in W)Z!=="default"&&Object.prototype.hasOwnProperty.call(W,Z)&&T(z,W,Z);return C(z,W),z},E=this&&this.__importDefault||function(W){return W&&W.__esModule?W:{default:W}};Object.defineProperty(c,"__esModule",{value:!0}),c.dispose=c.getInstance=c.initializeWebAssembly=void 0;const P=M(_(6449)),R=E(_(932)),$=_(3474);let G,O=!1,L=!1,F=!1;const V=(W,z)=>z?W?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":W?"ort-wasm-simd.wasm":"ort-wasm.wasm";c.initializeWebAssembly=async W=>{if(O)return Promise.resolve();if(L)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(F)throw new Error("previous call to 'initializeWebAssembly()' failed.");L=!0;const z=W.initTimeout,Z=W.numThreads,H=W.simd,Y=Z>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}})(),U=H&&(()=>{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}})(),j=typeof W.wasmPaths=="string"?W.wasmPaths:void 0,X=V(!1,Y),K=V(U,Y),q=typeof W.wasmPaths=="object"?W.wasmPaths[K]:void 0;let J=!1;const Q=[];if(z>0&&Q.push(new Promise(ee=>{setTimeout(()=>{J=!0,ee()},z)})),Q.push(new Promise((ee,re)=>{const ie=Y?$:R.default,ae={locateFile:(ne,te)=>Y&&ne.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([_(4154)],{type:"text/javascript"})):ne===X?q??(j??te)+K:te+ne};if(Y)if(typeof Blob>"u")ae.mainScriptUrlOrBlob=P.join("/","ort-wasm-threaded.js");else{const ne=`var ortWasmThreaded=(function(){var _scriptDir;return ${ie.toString()}})();`;ae.mainScriptUrlOrBlob=new Blob([ne],{type:"text/javascript"})}ie(ae).then(ne=>{L=!1,O=!0,G=ne,ee()},ne=>{L=!1,F=!0,re(ne)})})),await Promise.race(Q),J)throw new Error(`WebAssembly backend initializing failed due to timeout: ${z}ms`)},c.getInstance=()=>{if(O&&G)return G;throw new Error("WebAssembly is not initialized yet.")},c.dispose=()=>{var W;!O||L||F||(L=!0,(W=G.PThread)===null||W===void 0||W.terminateAllThreads(),G=void 0,L=!1,O=!1,F=!0)}},9710:(x,c,_)=>{_.d(c,{Z:()=>M});var T=_(477),C=_.n(T);function M(){return C()('/*!\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:x=>{x.exports=function(c,_,T,C){var M=self||window;try{try{var E;try{E=new M.Blob([c])}catch{(E=new(M.BlobBuilder||M.WebKitBlobBuilder||M.MozBlobBuilder||M.MSBlobBuilder)).append(c),E=E.getBlob()}var P=M.URL||M.webkitURL,R=P.createObjectURL(E),$=new M[_](R,T);return P.revokeObjectURL(R),$}catch{return new M[_]("data:application/javascript,".concat(encodeURIComponent(c)),T)}}catch{if(!C)throw Error("Inline worker is not supported");return new M[_](C,T)}}},4154:x=>{x.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:x=>{x.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(x,c,_)=>{_.r(c),_.d(c,{flatbuffers:()=>T});var T={};T.Offset,T.Table,T.SIZEOF_SHORT=2,T.SIZEOF_INT=4,T.FILE_IDENTIFIER_LENGTH=4,T.SIZE_PREFIX_LENGTH=4,T.Encoding={UTF8_BYTES:1,UTF16_STRING:2},T.int32=new Int32Array(2),T.float32=new Float32Array(T.int32.buffer),T.float64=new Float64Array(T.int32.buffer),T.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,T.Long=function(C,M){this.low=0|C,this.high=0|M},T.Long.create=function(C,M){return C==0&&M==0?T.Long.ZERO:new T.Long(C,M)},T.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},T.Long.prototype.equals=function(C){return this.low==C.low&&this.high==C.high},T.Long.ZERO=new T.Long(0,0),T.Builder=function(C){if(C)M=C;else var M=1024;this.bb=T.ByteBuffer.allocate(M),this.space=M,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},T.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},T.Builder.prototype.forceDefaults=function(C){this.force_defaults=C},T.Builder.prototype.dataBuffer=function(){return this.bb},T.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},T.Builder.prototype.prep=function(C,M){C>this.minalign&&(this.minalign=C);for(var E=1+~(this.bb.capacity()-this.space+M)&C-1;this.space=0&&this.vtable[M]==0;M--);for(var E=M+1;M>=0;M--)this.addInt16(this.vtable[M]!=0?C-this.vtable[M]:0);this.addInt16(C-this.object_start);var P=(E+2)*T.SIZEOF_SHORT;this.addInt16(P);var R=0,$=this.space;e:for(M=0;M=0;$--)this.writeInt8(R.charCodeAt($))}this.prep(this.minalign,T.SIZEOF_INT+P),this.addOffset(C),P&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},T.Builder.prototype.finishSizePrefixed=function(C,M){this.finish(C,M,!0)},T.Builder.prototype.requiredField=function(C,M){var E=this.bb.capacity()-C,P=E-this.bb.readInt32(E);if(this.bb.readInt16(P+M)==0)throw new Error("FlatBuffers: field "+M+" must be set")},T.Builder.prototype.startVector=function(C,M,E){this.notNested(),this.vector_num_elems=M,this.prep(T.SIZEOF_INT,C*M),this.prep(E,C*M)},T.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},T.Builder.prototype.createString=function(C){if(C instanceof Uint8Array)var M=C;else{M=[];for(var E=0;E=56320?R:(R<<10)+C.charCodeAt(E++)+-56613888)<128?M.push(P):(P<2048?M.push(P>>6&31|192):(P<65536?M.push(P>>12&15|224):M.push(P>>18&7|240,P>>12&63|128),M.push(P>>6&63|128)),M.push(63&P|128))}}this.addInt8(0),this.startVector(1,M.length,1),this.bb.setPosition(this.space-=M.length),E=0;for(var $=this.space,G=this.bb.bytes();E>24},T.ByteBuffer.prototype.readUint8=function(C){return this.bytes_[C]},T.ByteBuffer.prototype.readInt16=function(C){return this.readUint16(C)<<16>>16},T.ByteBuffer.prototype.readUint16=function(C){return this.bytes_[C]|this.bytes_[C+1]<<8},T.ByteBuffer.prototype.readInt32=function(C){return this.bytes_[C]|this.bytes_[C+1]<<8|this.bytes_[C+2]<<16|this.bytes_[C+3]<<24},T.ByteBuffer.prototype.readUint32=function(C){return this.readInt32(C)>>>0},T.ByteBuffer.prototype.readInt64=function(C){return new T.Long(this.readInt32(C),this.readInt32(C+4))},T.ByteBuffer.prototype.readUint64=function(C){return new T.Long(this.readUint32(C),this.readUint32(C+4))},T.ByteBuffer.prototype.readFloat32=function(C){return T.int32[0]=this.readInt32(C),T.float32[0]},T.ByteBuffer.prototype.readFloat64=function(C){return T.int32[T.isLittleEndian?0:1]=this.readInt32(C),T.int32[T.isLittleEndian?1:0]=this.readInt32(C+4),T.float64[0]},T.ByteBuffer.prototype.writeInt8=function(C,M){this.bytes_[C]=M},T.ByteBuffer.prototype.writeUint8=function(C,M){this.bytes_[C]=M},T.ByteBuffer.prototype.writeInt16=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8},T.ByteBuffer.prototype.writeUint16=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8},T.ByteBuffer.prototype.writeInt32=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8,this.bytes_[C+2]=M>>16,this.bytes_[C+3]=M>>24},T.ByteBuffer.prototype.writeUint32=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8,this.bytes_[C+2]=M>>16,this.bytes_[C+3]=M>>24},T.ByteBuffer.prototype.writeInt64=function(C,M){this.writeInt32(C,M.low),this.writeInt32(C+4,M.high)},T.ByteBuffer.prototype.writeUint64=function(C,M){this.writeUint32(C,M.low),this.writeUint32(C+4,M.high)},T.ByteBuffer.prototype.writeFloat32=function(C,M){T.float32[0]=M,this.writeInt32(C,T.int32[0])},T.ByteBuffer.prototype.writeFloat64=function(C,M){T.float64[0]=M,this.writeInt32(C,T.int32[T.isLittleEndian?0:1]),this.writeInt32(C+4,T.int32[T.isLittleEndian?1:0])},T.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&$)))}return P},T.ByteBuffer.prototype.__indirect=function(C){return C+this.readInt32(C)},T.ByteBuffer.prototype.__vector=function(C){return C+this.readInt32(C)+T.SIZEOF_INT},T.ByteBuffer.prototype.__vector_len=function(C){return this.readInt32(C+this.readInt32(C))},T.ByteBuffer.prototype.__has_identifier=function(C){if(C.length!=T.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+T.FILE_IDENTIFIER_LENGTH);for(var M=0;M{var c=x&&x.__esModule?()=>x.default:()=>x;return __webpack_require__.d(c,{a:c}),c},__webpack_require__.d=(x,c)=>{for(var _ in c)__webpack_require__.o(c,_)&&!__webpack_require__.o(x,_)&&Object.defineProperty(x,_,{enumerable:!0,get:c[_]})},__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=(x,c)=>Object.prototype.hasOwnProperty.call(x,c),__webpack_require__.r=x=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(x,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min$1);const ortWeb_min=getDefaultExportFromCjs(ortWeb_minExports),ONNX_WEB=_mergeNamespaces({__proto__:null,default:ortWeb_min},[ortWeb_minExports]);let ONNX;const executionProviders=["wasm"];var Gr;typeof process<"u"&&((Gr=process==null?void 0:process.release)==null?void 0:Gr.name)==="node"?(ONNX=sharp??ONNX_NODE,executionProviders.unshift("cpu")):(ONNX=ortWeb_min??ONNX_WEB,typeof navigator<"u"&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(ONNX.env.wasm.simd=!1));const{env:onnx_env}=ONNX,VERSION="2.17.2",WEB_CACHE_AVAILABLE=typeof self<"u"&&"caches"in self,FS_AVAILABLE=!isEmpty(sharp),PATH_AVAILABLE=!isEmpty(sharp),RUNNING_LOCALLY=FS_AVAILABLE&&PATH_AVAILABLE,__dirname=RUNNING_LOCALLY?sharp.dirname(sharp.dirname(sharp.fileURLToPath(import.meta.url))):"./",DEFAULT_CACHE_DIR=RUNNING_LOCALLY?sharp.join(__dirname,"/.cache/"):null,DEFAULT_LOCAL_MODEL_PATH="/models/",localModelPath=RUNNING_LOCALLY?sharp.join(__dirname,DEFAULT_LOCAL_MODEL_PATH):DEFAULT_LOCAL_MODEL_PATH;onnx_env!=null&&onnx_env.wasm&&(onnx_env.wasm.wasmPaths=RUNNING_LOCALLY?sharp.join(__dirname,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${VERSION}/dist/`);const env$1={backends:{onnx:onnx_env,tfjs:{}},__dirname,version:VERSION,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,useCustomCache:!1,customCache:null};function isEmpty(x){return Object.keys(x).length===0}class FileResponse{constructor(c){ke(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=c,this.headers=new Headers,this.exists=sharp.existsSync(c),this.exists){this.status=200,this.statusText="OK";let _=sharp.statSync(c);this.headers.set("content-length",_.size.toString()),this.updateContentType();let T=this;this.body=new ReadableStream({start(C){T.arrayBuffer().then(M=>{C.enqueue(new Uint8Array(M)),C.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const c=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[c]??"application/octet-stream")}clone(){let c=new FileResponse(this.filePath);return c.exists=this.exists,c.status=this.status,c.statusText=this.statusText,c.headers=new Headers(this.headers),c}async arrayBuffer(){return(await sharp.promises.readFile(this.filePath)).buffer}async blob(){const c=await sharp.promises.readFile(this.filePath);return new Blob([c],{type:this.headers.get("content-type")})}async text(){return await sharp.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function isValidUrl(x,c=null,_=null){let T;try{T=new URL(x)}catch{return!1}return!(c&&!c.includes(T.protocol)||_&&!_.includes(T.hostname))}async function getFile(x){var c,_,T,C;if(env$1.useFS&&!isValidUrl(x,["http:","https:","blob:"]))return new FileResponse(x);if(typeof process<"u"&&((c=process==null?void 0:process.release)==null?void 0:c.name)==="node"){const M=!!((_=process.env)!=null&&_.TESTING_REMOTELY),E=env$1.version,P=new Headers;if(P.set("User-Agent",`transformers.js/${E}; is_ci/${M};`),isValidUrl(x,["http:","https:"],["huggingface.co","hf.co"])){const $=((T=process.env)==null?void 0:T.HF_TOKEN)??((C=process.env)==null?void 0:C.HF_ACCESS_TOKEN);$&&P.set("Authorization",`Bearer ${$}`)}return fetch(x,{headers:P})}else return fetch(x)}const ERROR_MAPPING={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function handleError(x,c,_){if(!_)return null;const T=ERROR_MAPPING[x]??`Error (${x}) occurred while trying to load file`;throw Error(`${T}: "${c}".`)}class FileCache{constructor(c){this.path=c}async match(c){let _=sharp.join(this.path,c),T=new FileResponse(_);if(T.exists)return T}async put(c,_){const T=Buffer.from(await _.arrayBuffer());let C=sharp.join(this.path,c);try{await sharp.promises.mkdir(sharp.dirname(C),{recursive:!0}),await sharp.promises.writeFile(C,T)}catch(M){console.warn("An error occurred while writing the file to cache:",M)}}}async function tryCache(x,...c){for(let _ of c)try{let T=await x.match(_);if(T)return T}catch{continue}}async function getModelFile(x,c,_=!0,T={}){if(!env$1.allowLocalModels&&T.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");dispatchCallback(T.progress_callback,{status:"initiate",name:x,file:c});let C;if(!C&&env$1.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{C=await caches.open("transformers-cache")}catch(Z){console.warn("An error occurred while opening the browser cache:",Z)}}if(!C&&env$1.useFSCache&&(C=new FileCache(T.cache_dir??env$1.cacheDir)),!C&&env$1.useCustomCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");const M=T.revision??"main";let E=pathJoin(x,c),P=pathJoin(env$1.localModelPath,E),R=pathJoin(env$1.remoteHost,env$1.remotePathTemplate.replaceAll("{model}",x).replaceAll("{revision}",encodeURIComponent(M)),c),$=M==="main"?E:pathJoin(x,M,c),G,O=C instanceof FileCache?$:R,L=!1,F;C&&(F=await tryCache(C,P,O));const V=F!==void 0;if(F===void 0){if(env$1.allowLocalModels)if(isValidUrl(E,["http:","https:"])){if(T.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${E}.`)}else try{F=await getFile(P),G=P}catch(H){console.warn(`Unable to load from local path "${P}": "${H}"`)}if(F===void 0||F.status===404){if(T.local_files_only||!env$1.allowRemoteModels){if(_)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${P}".`);return null}if(F=await getFile(R),F.status!==200)return handleError(F.status,R,_);G=O}L=C&&typeof Response<"u"&&F instanceof Response&&F.status===200}dispatchCallback(T.progress_callback,{status:"download",name:x,file:c});const W={status:"progress",name:x,file:c};let z;return T.progress_callback?V&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(z=new Uint8Array(await F.arrayBuffer()),dispatchCallback(T.progress_callback,{...W,progress:100,loaded:z.length,total:z.length})):z=await readResponse(F,Z=>{dispatchCallback(T.progress_callback,{...W,...Z})}):z=new Uint8Array(await F.arrayBuffer()),L&&G&&await C.match(G)===void 0&&await C.put(G,new Response(z,{headers:F.headers})).catch(Z=>{console.warn(`Unable to add response to browser cache: ${Z}.`)}),dispatchCallback(T.progress_callback,{status:"done",name:x,file:c}),z}async function getModelJSON(x,c,_=!0,T={}){let C=await getModelFile(x,c,_,T);if(C===null)return{};let E=new TextDecoder("utf-8").decode(C);return JSON.parse(E)}async function readResponse(x,c){const _=x.headers.get("Content-Length");_===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let T=parseInt(_??"0"),C=new Uint8Array(T),M=0;const E=x.body.getReader();async function P(){const{done:R,value:$}=await E.read();if(R)return;let G=M+$.length;if(G>T){T=G;let L=new Uint8Array(T);L.set(C),C=L}C.set($,M),M=G;const O=M/T*100;return c({progress:O,loaded:M,total:T}),P()}return await P(),C}function pathJoin(...x){return x=x.map((c,_)=>(_&&(c=c.replace(new RegExp("^/"),"")),_!==x.length-1&&(c=c.replace(new RegExp("/$"),"")),c)),x.join("/")}function interpolate_data(x,[c,_,T],[C,M],E="bilinear",P=!1){const R=M/T,$=C/_,G=new x.constructor(C*M*c),O=_*T,L=C*M;for(let F=0;F